|
From: <men...@us...> - 2011-09-09 10:50:39
|
Revision: 3
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=3&view=rev
Author: mennodekker
Date: 2011-09-09 10:50:32 +0000 (Fri, 09 Sep 2011)
Log Message:
-----------
Moved contents of RespondentController to RespondentAction so the controller is a stub like all others for easier extension
Modified Paths:
--------------
trunk/library/classes/Gems/Default/RespondentAction.php
trunk/library/controllers/RespondentController.php
Modified: trunk/library/classes/Gems/Default/RespondentAction.php
===================================================================
--- trunk/library/classes/Gems/Default/RespondentAction.php 2011-09-08 13:43:14 UTC (rev 2)
+++ trunk/library/classes/Gems/Default/RespondentAction.php 2011-09-09 10:50:32 UTC (rev 3)
@@ -46,7 +46,12 @@
*/
abstract class Gems_Default_RespondentAction extends Gems_Controller_BrowseEditAction implements Gems_Menu_ParameterSourceInterface
{
- public $showSnippets;
+ public $showSnippets = array(
+ 'RespondentDetailsSnippet',
+ 'AddTracksSnippet',
+ 'RespondentTokenTabsSnippet',
+ 'RespondentTokenSnippet',
+ );
public $filterStandard = array('grc_success' => 1);
@@ -80,6 +85,86 @@
}
}
+ /**
+ * Adds elements from the model to the bridge that creates the form.
+ *
+ * Overrule this function to add different elements to the browse table, without
+ * having to recode the core table building code.
+ *
+ * @param MUtil_Model_FormBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @param array $data The data that will later be loaded into the form
+ * @param optional boolean $new Form should be for a new element
+ * @return void|array When an array of new values is return, these are used to update the $data array in the calling function
+ */
+ protected function addFormElements(MUtil_Model_FormBridge $bridge, MUtil_Model_ModelAbstract $model, array $data, $new = false)
+ {
+ if (APPLICATION_ENV !== 'production') {
+ $bsn = new MUtil_Validate_Dutch_Burgerservicenummer();
+ $num = mt_rand(100000000, 999999999);
+
+ while (! $bsn->isValid($num)) {
+ $num++;
+ }
+
+ $model->set('grs_bsn', 'description', 'Willekeurig voorbeeld BSN: ' . $num);
+
+ } else {
+ $model->set('grs_bsn', 'description', $this->_('Enter a 9-digit BSN number.'));
+ }
+
+ $ucfirst = new Zend_Filter_Callback('ucfirst');
+
+ $bridge->addHidden( 'grs_id_user');
+ $bridge->addHidden( 'gr2o_id_organization');
+ $bridge->addHidden( $model->getKeyCopyName('gr2o_patient_nr'));
+
+ $bridge->addTab( 'caption1')->h4($this->_('Identification'));
+ $bridge->addText( 'grs_bsn', 'label', $this->_('BSN'), 'size', 10, 'maxlength', 12)
+ ->addValidator( new MUtil_Validate_Dutch_Burgerservicenummer())
+ ->addValidator( $model->createUniqueValidator('grs_bsn'))
+ ->addFilter( 'Digits');
+ $bridge->addText( 'gr2o_patient_nr', 'label', $this->_('Patient number'), 'size', 15, 'minlength', 4)
+ ->addValidator( $model->createUniqueValidator(array('gr2o_patient_nr', 'gr2o_id_organization'), array('gr2o_id_user' => 'grs_id_user', 'gr2o_id_organization')));
+
+ $bridge->addText( 'grs_first_name')
+ ->addFilter( $ucfirst);
+ $bridge->addText( 'grs_surname_prefix', 'description', 'de, van der, \'t, etc...');
+ $bridge->addText( 'grs_last_name', 'required', true)
+ ->addFilter( $ucfirst);
+
+ $bridge->addTab( 'caption2')->h4($this->_('Medical data'));
+ $bridge->addRadio( 'grs_gender', 'separator', '', 'multiOptions', $this->util->getTranslated()->getGenders());
+ $year = intval(date('Y')); // Als jQuery 1.4 gebruikt wordt: yearRange = c-130:c0
+ $bridge->addDate( 'grs_birthday', 'jQueryParams', array('defaultDate' => '-30y', 'maxDate' => 0, 'yearRange' => ($year - 130) . ':' . $year))
+ ->addValidator(new MUtil_Validate_Date_DateBefore());
+
+ $bridge->addSelect( 'gr2o_id_physician');
+ $bridge->addText( 'gr2o_treatment', 'size', 30, 'description', $this->_('DBC\'s, etc...'));
+ $bridge->addTextarea('gr2o_comments', 'rows', 4, 'cols', 60);
+
+ $bridge->addTab( 'caption3')->h4($this->_('Contact information'));
+ // Setting e-mail to required is niet mogelijk, grijpt te diep in
+ // misschien later proberen met ->addGroup('required', 'true'); ???
+ $bridge->addText( 'grs_email', 'size', 30) // , 'required', true, 'AutoInsertNotEmptyValidator', false)
+ ->addValidator( 'SimpleEmail');
+ $bridge->addCheckBox('calc_email', 'label', $this->_('Respondent has no e-mail'));
+ $bridge->addText( 'grs_address_1', 'size', 40, 'description', $this->_('With housenumber'))
+ ->addFilter( $ucfirst);
+ $bridge->addText( 'grs_address_2', 'size', 40);
+ $bridge->addText( 'grs_zipcode', 'size', 7, 'description', '0000 AA');
+ $bridge->addFilter( 'grs_zipcode', new Gems_Filter_DutchZipcode());
+ $bridge->addText( 'grs_city')
+ ->addFilter( $ucfirst);
+ $bridge->addSelect( 'grs_iso_country', 'label', $this->_('Country'), 'multiOptions', $this->util->getLocalized()->getCountries());
+ $bridge->addText( 'grs_phone_1', 'size', 15)
+ ->addValidator( 'Phone');
+
+ $bridge->addTab( 'caption4')->h4($this->_('Settings'));
+ $bridge->addSelect( 'grs_iso_lang', 'label', $this->_('Language'), 'multiOptions', $this->util->getLocalized()->getLanguages());
+ $bridge->addRadio( 'gr2o_consent', 'separator', '', 'description', $this->_('Has the respondent signed the informed consent letter?'));
+ }
+
public function afterSave(array $data, $isNew)
{
$this->openedRespondent($data['gr2o_patient_nr'], $data['gr2o_id_organization'], $data['grs_id_user']);
@@ -99,7 +184,19 @@
*/
public function createModel($detailed, $action)
{
- return $this->loader->getModels()->getRespondentModel($detailed, $action);
+ $model = $this->loader->getModels()->getRespondentModel($detailed, $action);
+
+ if ($detailed) {
+ $model->set('gr2o_comments', 'label', $this->_('Comments'));
+ $model->set('gr2o_id_physician', 'label', $this->_('Physician'), 'multiOptions', MUtil_Lazy::call(array($this, 'getPhysicians')));
+ $model->set('gr2o_treatment', 'label', $this->_('Treatment'));
+
+ $model->addColumn('CASE WHEN grs_email IS NULL OR LENGTH(TRIM(grs_email)) = 0 THEN 1 ELSE 0 END', 'calc_email');
+ }
+
+ $model->set('gr2o_id_organization', 'default', $model->getCurrentOrganization());
+
+ return $model;
}
public function deleteAction()
@@ -210,6 +307,26 @@
$this->html[] = $form;
}
+ public function getPhysicians()
+ {
+ $session = new Zend_Session_Namespace('Pulse_' . __FILE__);
+
+ if (! isset($session->physicians)) {
+ $organizationId = $this->escort->getCurrentOrganization();
+
+ $values = $this->db->fetchPairs("
+ SELECT gsf_id_user,
+ CONCAT(gsf_last_name, ', ', COALESCE(CONCAT(gsf_first_name, ' '), ''), COALESCE(gsf_surname_prefix, '')) AS name
+ FROM gems__staff INNER JOIN gems__groups ON gsf_id_primary_group = ggp_id_group
+ WHERE gsf_active=1 AND gsf_id_organization = ? AND ggp_role = 'physician'
+ ORDER BY 2", $organizationId);
+
+ $session->physicians = $values;
+ }
+
+ return $this->util->getTranslated()->getEmptyDropdownArray() + $session->physicians;
+ }
+
public function getMenuParameter($name, $default)
{
switch ($name) {
Modified: trunk/library/controllers/RespondentController.php
===================================================================
--- trunk/library/controllers/RespondentController.php 2011-09-08 13:43:14 UTC (rev 2)
+++ trunk/library/controllers/RespondentController.php 2011-09-09 10:50:32 UTC (rev 3)
@@ -1,180 +1,33 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-class RespondentController extends Gems_Default_RespondentAction
-{
- public $showSnippets = array(
- 'RespondentDetailsSnippet',
- 'AddTracksSnippet',
- 'RespondentTokenTabsSnippet',
- 'RespondentTokenSnippet',
- );
- /**
- * Adds elements from the model to the bridge that creates the form.
- *
- * Overrule this function to add different elements to the browse table, without
- * having to recode the core table building code.
- *
- * @param MUtil_Model_FormBridge $bridge
- * @param MUtil_Model_ModelAbstract $model
- * @param array $data The data that will later be loaded into the form
- * @param optional boolean $new Form should be for a new element
- * @return void|array When an array of new values is return, these are used to update the $data array in the calling function
- */
- protected function addFormElements(MUtil_Model_FormBridge $bridge, MUtil_Model_ModelAbstract $model, array $data, $new = false)
- {
- if (APPLICATION_ENV !== 'production') {
- $bsn = new MUtil_Validate_Dutch_Burgerservicenummer();
- $num = mt_rand(100000000, 999999999);
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
- while (! $bsn->isValid($num)) {
- $num++;
- }
-
- $model->set('grs_bsn', 'description', 'Willekeurig voorbeeld BSN: ' . $num);
-
- } else {
- $model->set('grs_bsn', 'description', $this->_('Enter a 9-digit BSN number.'));
- }
-
- $ucfirst = new Zend_Filter_Callback('ucfirst');
-
- $bridge->addHidden( 'grs_id_user');
- $bridge->addHidden( 'gr2o_id_organization');
- $bridge->addHidden( $model->getKeyCopyName('gr2o_patient_nr'));
-
- $bridge->addTab( 'caption1')->h4($this->_('Identification'));
- $bridge->addText( 'grs_bsn', 'label', $this->_('BSN'), 'size', 10, 'maxlength', 12)
- ->addValidator( new MUtil_Validate_Dutch_Burgerservicenummer())
- ->addValidator( $model->createUniqueValidator('grs_bsn'))
- ->addFilter( 'Digits');
- $bridge->addText( 'gr2o_patient_nr', 'label', $this->_('Patient number'), 'size', 15, 'minlength', 4)
- ->addValidator( $model->createUniqueValidator(array('gr2o_patient_nr', 'gr2o_id_organization'), array('gr2o_id_user' => 'grs_id_user', 'gr2o_id_organization')));
-
- $bridge->addText( 'grs_first_name')
- ->addFilter( $ucfirst);
- $bridge->addText( 'grs_surname_prefix', 'description', 'de, van der, \'t, etc...');
- $bridge->addText( 'grs_last_name', 'required', true)
- ->addFilter( $ucfirst);
-
- $bridge->addTab( 'caption2')->h4($this->_('Medical data'));
- $bridge->addRadio( 'grs_gender', 'separator', '', 'multiOptions', $this->util->getTranslated()->getGenders());
- $year = intval(date('Y')); // Als jQuery 1.4 gebruikt wordt: yearRange = c-130:c0
- $bridge->addDate( 'grs_birthday', 'jQueryParams', array('defaultDate' => '-30y', 'maxDate' => 0, 'yearRange' => ($year - 130) . ':' . $year))
- ->addValidator(new MUtil_Validate_Date_DateBefore());
-
- $bridge->addSelect( 'gr2o_id_physician');
- $bridge->addText( 'gr2o_treatment', 'size', 30, 'description', $this->_('DBC\'s, etc...'));
- $bridge->addTextarea('gr2o_comments', 'rows', 4, 'cols', 60);
-
- $bridge->addTab( 'caption3')->h4($this->_('Contact information'));
- // Setting e-mail to required is niet mogelijk, grijpt te diep in
- // misschien later proberen met ->addGroup('required', 'true'); ???
- $bridge->addText( 'grs_email', 'size', 30) // , 'required', true, 'AutoInsertNotEmptyValidator', false)
- ->addValidator( 'SimpleEmail');
- $bridge->addCheckBox('calc_email', 'label', $this->_('Respondent has no e-mail'));
- $bridge->addText( 'grs_address_1', 'size', 40, 'description', $this->_('With housenumber'))
- ->addFilter( $ucfirst);
- $bridge->addText( 'grs_address_2', 'size', 40);
- $bridge->addText( 'grs_zipcode', 'size', 7, 'description', '0000 AA');
- $bridge->addFilter( 'grs_zipcode', new Gems_Filter_DutchZipcode());
- $bridge->addText( 'grs_city')
- ->addFilter( $ucfirst);
- $bridge->addSelect( 'grs_iso_country', 'label', $this->_('Country'), 'multiOptions', $this->util->getLocalized()->getCountries());
- $bridge->addText( 'grs_phone_1', 'size', 15)
- ->addValidator( 'Phone');
-
- $bridge->addTab( 'caption4')->h4($this->_('Settings'));
- $bridge->addSelect( 'grs_iso_lang', 'label', $this->_('Language'), 'multiOptions', $this->util->getLocalized()->getLanguages());
- $bridge->addRadio( 'gr2o_consent', 'separator', '', 'description', $this->_('Has the respondent signed the informed consent letter?'));
- }
-
- public function afterSave(array $data, $isNew)
- {
- Gems_AccessLog::getLog($this->db)->logSaveRespondent($data['grs_id_user'], $this->getRequest());
- return true;
- }
-
- /**
- * Creates a model for getModel(). Called only for each new $action.
- *
- * The parameters allow you to easily adapt the model to the current action. The $detailed
- * parameter was added, because the most common use of action is a split between detailed
- * and summarized actions.
- *
- * @param boolean $detailed True when the current action is not in $summarizedActions.
- * @param string $action The current action.
- * @return MUtil_Model_ModelAbstract
- */
- public function createModel($detailed, $action)
- {
- $model = parent::createModel($detailed, $action);
-
- if ($detailed) {
- $model->set('gr2o_comments', 'label', $this->_('Comments'));
- $model->set('gr2o_id_physician', 'label', $this->_('Physician'), 'multiOptions', MUtil_Lazy::call(array($this, 'getPhysicians')));
- $model->set('gr2o_treatment', 'label', $this->_('Treatment'));
-
- $model->addColumn('CASE WHEN grs_email IS NULL OR LENGTH(TRIM(grs_email)) = 0 THEN 1 ELSE 0 END', 'calc_email');
- }
-
- $model->set('gr2o_id_organization', 'default', $model->getCurrentOrganization());
-
- return $model;
- }
-
- public function getPhysicians()
- {
- $session = new Zend_Session_Namespace('Pulse_' . __FILE__);
-
- if (! isset($session->physicians)) {
- $organizationId = $this->escort->getCurrentOrganization();
-
- $values = $this->db->fetchPairs("
- SELECT gsf_id_user,
- CONCAT(gsf_last_name, ', ', COALESCE(CONCAT(gsf_first_name, ' '), ''), COALESCE(gsf_surname_prefix, '')) AS name
- FROM gems__staff INNER JOIN gems__groups ON gsf_id_primary_group = ggp_id_group
- WHERE gsf_active=1 AND gsf_id_organization = ? AND ggp_role = 'physician'
- ORDER BY 2", $organizationId);
-
- $session->physicians = $values;
- }
-
- return $this->util->getTranslated()->getEmptyDropdownArray() + $session->physicians;
- }
-
- protected function openedRespondent($patientId, $orgId = null, $userId = null)
- {
- Gems_AccessLog::getLog($this->db)->logShowRespondent($userId, $this->getRequest());
-
- return parent::openedRespondent($patientId, $orgId, $userId);
- }
-}
+class RespondentController extends Gems_Default_RespondentAction
+{
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <men...@us...> - 2011-09-09 12:43:25
|
Revision: 6
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=6&view=rev
Author: mennodekker
Date: 2011-09-09 12:43:19 +0000 (Fri, 09 Sep 2011)
Log Message:
-----------
Removing the view, had to change the validator too as it is used in change password. This needs to be changed when alternative auth backends are added
Modified Paths:
--------------
trunk/library/classes/Gems/Validate/GemsPasswordUsername.php
Removed Paths:
-------------
trunk/library/configs/db/views/
trunk/library/configs/db_multi_layout/views/
Modified: trunk/library/classes/Gems/Validate/GemsPasswordUsername.php
===================================================================
--- trunk/library/classes/Gems/Validate/GemsPasswordUsername.php 2011-09-09 12:30:13 UTC (rev 5)
+++ trunk/library/classes/Gems/Validate/GemsPasswordUsername.php 2011-09-09 12:43:19 UTC (rev 6)
@@ -1,39 +1,39 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
*
- * @version $Id: GemsPasswordUsername.php 345 2011-07-28 08:39:24Z 175780 $
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @version $Id: GemsPasswordUsername.php 345 2011-07-28 08:39:24Z 175780 $
* @package Gems
* @subpackage Validate
* @copyright Copyright (c) 2011 Erasmus MC
* @license New BSD License
*/
-
-/**
+
+/**
* OBSOLETE, we now use Gems_Auth with a Zend_Auth_Adapter_DbTable
*
* @deprecated
@@ -66,7 +66,7 @@
protected $_passwordField;
protected $_usernameField;
-
+
/**
* Exponent to use when calculating delay
* @var int
@@ -86,11 +86,11 @@
*/
public function __construct($usernameField, $passwordField, Zend_Db_Adapter_Abstract $adapter = null, $delayFactor = null)
{
- parent::__construct('gems__login_info', 'user_login', null, $adapter);
+ parent::__construct('gems__staff', 'gsf_login', null, $adapter);
$this->_usernameField = $usernameField;
$this->_passwordField = $passwordField;
-
+
if (isset($delayFactor)) {
$this->_delayFactor = $delayFactor;
}
@@ -136,8 +136,8 @@
throw new Zend_Validate_Exception('No database adapter present');
}
}
-
- $condition = $this->_adapter->quoteIdentifier('user_password') . ' = ?';
+
+ $condition = $this->_adapter->quoteIdentifier('gsf_password') . ' = ?';
$this->_exclude = $this->_adapter->quoteInto($condition, md5($password));
try {
@@ -145,24 +145,24 @@
* Lookup last failed login and number of failed logins
*/
try {
- $sql = "SELECT user_failed_logins, UNIX_TIMESTAMP(user_last_failed)
- AS user_last_failed FROM {$this->_table} WHERE user_login = ?";
+ $sql = "SELECT gsf_failed_logins, UNIX_TIMESTAMP(gsf_last_failed)
+ AS gsf_last_failed FROM {$this->_table} WHERE gsf_login = ?";
$results = $this->_adapter->fetchRow($sql, array($username));
} catch (Zend_Db_Exception $zde) {
//If we need to apply a db patch, just use a default value
$results = 0;
MUtil_Echo::r(GemsEscort::getInstance()->translate->_('Please update the database'));
}
-
- $delay = pow($results['user_failed_logins'], $this->_delayFactor);
- $remaining = ($results['user_last_failed'] + $delay) - time();
-
- if ($results['user_failed_logins'] > 0 && $remaining > 0) {
+
+ $delay = pow($results['gsf_failed_logins'], $this->_delayFactor);
+ $remaining = ($results['gsf_last_failed'] + $delay) - time();
+
+ if ($results['gsf_failed_logins'] > 0 && $remaining > 0) {
$this->_obscureValue = false;
$this->_error(self::ERROR_PASSWORD_DELAY, ceil($remaining / 60));
return false;
}
-
+
if ($this->_query($username)) {
return true;
} else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-09-13 18:27:35
|
Revision: 12
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=12&view=rev
Author: matijsdejong
Date: 2011-09-13 17:44:45 +0000 (Tue, 13 Sep 2011)
Log Message:
-----------
- SingleTrack projects will now allow the addition of one track to the patient when none exist
- hidden parameters in menu items are now added to parameter source instead of request, in order to allow filtering
- started cleanup of _createTable in TrackActionAbstract
- created new minimal snippet implementation
Modified Paths:
--------------
trunk/library/classes/Gems/Default/TrackAction.php
trunk/library/classes/Gems/Default/TrackActionAbstract.php
trunk/library/classes/Gems/Menu/SubMenuItem.php
trunk/library/classes/Gems/Menu.php
trunk/library/classes/GemsEscort.php
trunk/library/classes/MUtil/Model/ModelAbstract.php
trunk/library/classes/MUtil/Snippets/SnippetInterface.php
Added Paths:
-----------
trunk/library/classes/MUtil/Snippets/EmptySnippetAbstract.php
trunk/library/snippets/Track/
trunk/library/snippets/Track/AvailableTracksSnippets.php
Modified: trunk/library/classes/Gems/Default/TrackAction.php
===================================================================
--- trunk/library/classes/Gems/Default/TrackAction.php 2011-09-13 14:38:14 UTC (rev 11)
+++ trunk/library/classes/Gems/Default/TrackAction.php 2011-09-13 17:44:45 UTC (rev 12)
@@ -466,6 +466,8 @@
$request = $this->getRequest();
$model = $this->getModel();
+ // Gems_Menu::$verbose = true;
+
if ($data = $model->applyRequest($request)->loadFirst()) {
$this->setMenuParameters($data);
@@ -522,6 +524,21 @@
$this->html->buttonDiv($links);
}
+ } elseif ($this->escort instanceof Gems_Project_Tracks_SingleTrackInterface) {
+
+ $data['gr2o_patient_nr'] = $this->_getIdParam();
+ $data['gr2o_id_organization'] = $this->escort->getCurrentOrganization();
+ $data['track_can_be_created'] = 1;
+ $this->setMenuParameters($data);
+
+ $model = $this->createTrackModel(false, 'index');
+
+ // MUtil_Model::$verbose = true;
+
+ $this->html->h3($this->_('Add track'));
+ $this->html->pInfo($this->_('This respondent does not yet have an active track. Add one here.'));
+ $this->addSnippet('Track_AvailableTracksSnippets', 'model', $model, 'trackType', $this->trackType);
+
} else {
$this->addMessage(sprintf($this->_('Unknown %s requested'), $this->getTopic()));
}
Modified: trunk/library/classes/Gems/Default/TrackActionAbstract.php
===================================================================
--- trunk/library/classes/Gems/Default/TrackActionAbstract.php 2011-09-13 14:38:14 UTC (rev 11)
+++ trunk/library/classes/Gems/Default/TrackActionAbstract.php 2011-09-13 17:44:45 UTC (rev 12)
@@ -74,10 +74,13 @@
$model = $this->createTrackModel(false, 'index');
$request = $this->getRequest();
+ $organisation_id = $this->escort->getCurrentOrganization();
+ $searchText = $this->_getParam($model->getTextFilter());
+
$model->applyPostRequest($request);
// $model->trackUsage(); DO NOT USE AS all is label here.
- if ($searchText = $this->_getParam($model->getTextFilter())) {
+ if ($searchText) {
$marker = new MUtil_Html_Marker($model->getTextSearches($searchText), 'strong', 'UTF-8');
foreach ($model->getItemNames() as $name) {
if ($model->get($name, 'label')) {
@@ -86,15 +89,13 @@
}
}
- $organisation_id = $this->escort->getCurrentOrganization();
- $filterText = $this->_getParam(MUtil_Model::TEXT_FILTER);
- $filter = $model->getTextSearchFilter($filterText);
+ $filter = $model->getTextSearchFilter($searchText);
$filter['gtr_track_type'] = $this->trackType;
$filter['gtr_active'] = 1;
$filter[] = '(gtr_date_until IS NULL OR gtr_date_until >= CURRENT_DATE) AND gtr_date_start <= CURRENT_DATE';
$filter[] = "gtr_organisations LIKE '%|$organisation_id|%'";
- $baseurl = array('action' => 'index', 'gr2o_patient_nr' => $id, MUtil_Model::TEXT_FILTER => $filterText);
+ $baseurl = array('action' => 'index', 'gr2o_patient_nr' => $id, MUtil_Model::TEXT_FILTER => $searchText);
$bridge = new MUtil_Model_TableBridge($model, array('class' => 'browser'));
$bridge->setBaseUrl($baseurl);
Modified: trunk/library/classes/Gems/Menu/SubMenuItem.php
===================================================================
--- trunk/library/classes/Gems/Menu/SubMenuItem.php 2011-09-13 14:38:14 UTC (rev 11)
+++ trunk/library/classes/Gems/Menu/SubMenuItem.php 2011-09-13 17:44:45 UTC (rev 12)
@@ -444,6 +444,16 @@
return $this->addActionButton($this->_('Excel export'), $this->get('privilege') . '.excel', 'excel', $options);
}
+ /**
+ * Add parameter values that should not show in the url but that
+ * must be added to the request when this menu item is current.
+ *
+ * @see applyHiddenParameters
+ *
+ * @param string $name Name of parameter
+ * @param mixed $value
+ * @return Gems_Menu_SubMenuItem (continuation pattern
+ */
public function addHiddenParameter($name, $value = null)
{
if (null === $value) {
@@ -531,11 +541,11 @@
return $menu;
}
- public function applyHiddenParameters(Zend_Controller_Request_Abstract $request)
+ public function applyHiddenParameters(Gems_Menu_ParameterSource $source)
{
if ($this->_hiddenParameters) {
foreach ($this->_hiddenParameters as $key => $name) {
- $request->setParam($key, $name);
+ $source[$key] = $name;
}
}
Modified: trunk/library/classes/Gems/Menu.php
===================================================================
--- trunk/library/classes/Gems/Menu.php 2011-09-13 14:38:14 UTC (rev 11)
+++ trunk/library/classes/Gems/Menu.php 2011-09-13 17:44:45 UTC (rev 12)
@@ -340,12 +340,22 @@
if ($this->escort instanceof Gems_Project_Tracks_SingleTrackInterface) {
+ $trType = 'T';
$subPage = $page->addPage($this->_('Track'), 'pr.track', 'track', 'show-track')
->addNamedParameters(MUtil_Model::REQUEST_ID, 'gr2o_patient_nr')
->addHiddenParameter(Gems_Model::TRACK_ID, $this->escort->getTrackId(), 'gtr_track_type', 'T');
- $tkPages['T'] = $subPage->addAction($this->_('Token'), 'pr.token', 'show')
- ->addNamedParameters(MUtil_Model::REQUEST_ID, 'gto_id_token');
+ $tkPages[$trType] = $subPage->addAction($this->_('Token'), 'pr.token', 'show')
+ ->addNamedParameters(MUtil_Model::REQUEST_ID, 'gto_id_token')
+ ->setParameterFilter('gtr_track_type', $trType, Gems_Model::ID_TYPE, 'token');
+ $subPage->addAction($this->_('Add'), 'pr.track.create', 'create')
+ ->addNamedParameters(MUtil_Model::REQUEST_ID, 'gr2o_patient_nr', Gems_Model::TRACK_ID, 'gtr_id_track')
+ ->setParameterFilter('gtr_track_type', $trType, 'track_can_be_created', 1)
+ ->addHiddenParameter('track_can_be_created', 1);
+ $subPage->addAction($this->_('Preview'), 'pr.track', 'view')
+ ->addNamedParameters(MUtil_Model::REQUEST_ID, 'gr2o_patient_nr', Gems_Model::TRACK_ID, 'gtr_id_track')
+ ->setParameterFilter('gtr_track_type', $trType, 'track_can_be_created', 1)
+ ->addHiddenParameter('track_can_be_created', 1);
} else {
@@ -669,9 +679,12 @@
if ($this->_menuParameters) {
// array_unshift($parameterSources, $this->_menuParameters);
+ // MUtil_echo::track($this->_menuParameters);
$parameterSources[] = $this->_menuParameters;
}
+ // self::$verbose = true;
+
$nav = new Zend_Navigation($this->_toNavigationArray($parameterSources));
// MUtil_Echo::r($this->_toNavigationArray($parameterSources));
Modified: trunk/library/classes/GemsEscort.php
===================================================================
--- trunk/library/classes/GemsEscort.php 2011-09-13 14:38:14 UTC (rev 11)
+++ trunk/library/classes/GemsEscort.php 2011-09-13 17:44:45 UTC (rev 12)
@@ -1570,7 +1570,7 @@
}
if (isset($menuItem)) {
- $menuItem->applyHiddenParameters($request);
+ $menuItem->applyHiddenParameters($this->menu->getParameterSource());
$this->menu->setCurrent($menuItem);
}
}
Modified: trunk/library/classes/MUtil/Model/ModelAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Model/ModelAbstract.php 2011-09-13 14:38:14 UTC (rev 11)
+++ trunk/library/classes/MUtil/Model/ModelAbstract.php 2011-09-13 17:44:45 UTC (rev 12)
@@ -198,6 +198,12 @@
return $this;
}
+ /**
+ * Add's one or more sort fields to the standard sort.
+ *
+ * @param mixed $value Array of sortfield => SORT_ASC|SORT_DESC or single sortfield for ascending sort.
+ * @return MUtil_Model_ModelAbstract (continuation pattern)
+ */
public function addSort($value)
{
$value = $this->_checkSortValue($value);
Added: trunk/library/classes/MUtil/Snippets/EmptySnippetAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Snippets/EmptySnippetAbstract.php (rev 0)
+++ trunk/library/classes/MUtil/Snippets/EmptySnippetAbstract.php 2011-09-13 17:44:45 UTC (rev 12)
@@ -0,0 +1,108 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Minimal implementation of Snippet interface.
+ *
+ * @package MUtil
+ * @subpackage Snippets
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ * Minimal implementation of Snippet interface.
+ *
+ * Use this class for a quick implementation when SnippetAbstract feels to heavvy
+ *
+ * @see MUtil_Snippets_SnippetAbstract
+ *
+ * @package MUtil
+ * @subpackage Snippets
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.2
+ */
+abstract class MUtil_Snippets_EmptySnippetAbstract extends MUtil_Registry_TargetAbstract implements MUtil_Snippets_SnippetInterface
+{
+ /**
+ * When hasHtmlOutput() is false a snippet code user should check
+ * for a redirectRoute. Otherwise the redirect calling render() will
+ * execute the redirect.
+ *
+ * This function should never return a value when the snippet does
+ * not redirect.
+ *
+ * Also when hasHtmlOutput() is true this function should not be
+ * called.
+ *
+ * @see Zend_Controller_Action_Helper_Redirector
+ *
+ * @return mixed Nothing or either an array or a string that is acceptable for Redector->gotoRoute()
+ */
+ public function getRedirectRoute()
+ { }
+
+ /**
+ * The place to check if the data set in the snippet is valid
+ * to generate the snippet.
+ *
+ * When invalid data should result in an error, you can throw it
+ * here but you can also perform the check in the
+ * checkRegistryRequestsAnswers() function from the
+ * {@see MUtil_Registry_TargetInterface}.
+ *
+ * @return boolean
+ */
+ public function hasHtmlOutput()
+ {
+ return false;
+ }
+
+ /**
+ * When there is a redirectRoute this function will execute it.
+ *
+ * When hasHtmlOutput() is true this functions should not be called.
+ *
+ * @see Zend_Controller_Action_Helper_Redirector
+ */
+ public function redirectRoute()
+ { }
+
+ /**
+ * Renders the element into a html string
+ *
+ * The $view is used to correctly encode and escape the output
+ *
+ * @param Zend_View_Abstract $view
+ * @return string Correctly encoded and escaped html output
+ */
+ public function render(Zend_View_Abstract $view)
+ { }
+}
Modified: trunk/library/classes/MUtil/Snippets/SnippetInterface.php
===================================================================
--- trunk/library/classes/MUtil/Snippets/SnippetInterface.php 2011-09-13 14:38:14 UTC (rev 11)
+++ trunk/library/classes/MUtil/Snippets/SnippetInterface.php 2011-09-13 17:44:45 UTC (rev 12)
@@ -3,7 +3,7 @@
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@@ -14,7 +14,7 @@
* * Neither the name of Erasmus MC nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -25,7 +25,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* @package MUtil
* @subpackage Snippets
* @author Matijs de Jong <mj...@ma...>
@@ -35,18 +35,18 @@
*/
/**
- * A snippet is a piece of html output that can be reused on multiple places in the code
+ * A snippet is a piece of html output that can be reused on multiple places in the code
* or that isolates the processing needed for that output.
*
- * Variables are intialized using the MUtil_Registry_TargetInterface mechanism.
+ * Variables are intialized using the MUtil_Registry_TargetInterface mechanism.
* The snippet is then rendered using MUtil_Html_HtmlInterface.
- *
- * The only "program flow" that can be initiated by a snippet is that it can reroute
+ *
+ * The only "program flow" that can be initiated by a snippet is that it can reroute
* the browser to another page.
*
* @see MUtil_Registry_TargetInterface
* @see MUtil_Html_HtmlInterface
- *
+ *
* @package MUtil
* @subpackage Snippets
* @copyright Copyright (c) 2011 Erasmus MC
@@ -57,39 +57,39 @@
{
/**
* When hasHtmlOutput() is false a snippet code user should check
- * for a redirectRoute. Otherwise the redirect calling render() will
+ * for a redirectRoute. Otherwise the redirect calling render() will
* execute the redirect.
- *
+ *
* This function should never return a value when the snippet does
* not redirect.
- *
- * Also when hasHtmlOutput() is true this function should not be
+ *
+ * Also when hasHtmlOutput() is true this function should not be
* called.
- *
+ *
* @see Zend_Controller_Action_Helper_Redirector
- *
+ *
* @return mixed Nothing or either an array or a string that is acceptable for Redector->gotoRoute()
*/
public function getRedirectRoute();
-
+
/**
* The place to check if the data set in the snippet is valid
* to generate the snippet.
*
- * When invalid data should result in an error, you can throw it
- * here but you can also perform the check in the
+ * When invalid data should result in an error, you can throw it
+ * here but you can also perform the check in the
* checkRegistryRequestsAnswers() function from the
* {@see MUtil_Registry_TargetInterface}.
*
* @return boolean
*/
public function hasHtmlOutput();
-
+
/**
* When there is a redirectRoute this function will execute it.
- *
+ *
* When hasHtmlOutput() is true this functions should not be called.
- *
+ *
* @see Zend_Controller_Action_Helper_Redirector
*/
public function redirectRoute();
Property changes on: trunk/library/snippets/Track
___________________________________________________________________
Added: bugtraq:number
+ true
Added: trunk/library/snippets/Track/AvailableTracksSnippets.php
===================================================================
--- trunk/library/snippets/Track/AvailableTracksSnippets.php (rev 0)
+++ trunk/library/snippets/Track/AvailableTracksSnippets.php 2011-09-13 17:44:45 UTC (rev 12)
@@ -0,0 +1,137 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Short description of file
+ *
+ * @package Gems
+ * @subpackage Snippets
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ * Short description for class
+ *
+ * Long description for class (if any)...
+ *
+ * @package Gems
+ * @subpackage Snippets
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4
+ */
+class Track_AvailableTracksSnippets extends Gems_Snippets_ModelTableSnippetAbstract
+{
+ /**
+ *
+ * @var MUtil_Model_ModelAbstract
+ */
+ protected $model;
+
+ /**
+ *
+ * @var string 'S' or 'T'
+ */
+ protected $trackType;
+
+ /**
+ * Adds columns from the model to the bridge that creates the browse table.
+ *
+ * Overrule this function to add different columns to the browse table, without
+ * having to recode the core table building code.
+ *
+ * @param MUtil_Model_TableBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @return void
+ */
+ protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model)
+ {
+ $controller = $this->request->getControllerName();
+
+ $menuList = $this->menu->getMenuList();
+
+ $menuList->addByController($controller, 'create')
+ ->addByController($controller, 'view')
+ ->addParameterSources($bridge, $this->request)
+ ->setLowerCase(); //->showDisabled();
+
+ // Add create button
+ if ($menuItem = $menuList->getActionLink($controller, 'create')) {
+ $bridge->addItemLink($menuItem);
+ }
+
+ foreach($model->getItemsOrdered() as $name) {
+ if ($label = $model->get($name, 'label')) {
+ $bridge->addSortable($name, $label);
+ }
+ }
+
+ // Add view button
+ if ($menuItem = $menuList->getActionLink($controller, 'view')) {
+ $bridge->addItemLink($menuItem);
+ }
+
+ }
+
+ /**
+ * Creates the model
+ *
+ * @return MUtil_Model_ModelAbstract
+ */
+ public function createModel()
+ {
+ $this->model->addColumn(new Zend_Db_Expr(1), 'track_can_be_created');
+
+
+ return $this->model;
+ }
+
+ /**
+ * Overrule to implement snippet specific filtering and sorting.
+ *
+ * @param MUtil_Model_ModelAbstract $model
+ */
+ protected function processFilterAndSort(MUtil_Model_ModelAbstract $model)
+ {
+ $filter = array();
+
+ if ($this->trackType) {
+ $filter['gtr_track_type'] = $this->trackType;
+ }
+
+ $sort = array('gtr_track_name' => SORT_ASC);
+
+ // MUtil_Echo::track($filter);
+
+ $model->addFilter($filter);
+ $model->addSort($sort);
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-09-15 10:46:10
|
Revision: 15
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=15&view=rev
Author: matijsdejong
Date: 2011-09-15 10:46:03 +0000 (Thu, 15 Sep 2011)
Log Message:
-----------
- system no longer gives error when token table does not exist
- bug #422, initial patch level of database set to 40
Modified Paths:
--------------
trunk/library/classes/Gems/Default/TrackRoundsAction.php
trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php
trunk/library/classes/Gems/Tracker/Engine/TrackEngineInterface.php
trunk/library/classes/Gems/Tracker/Snippets/EditRoundSnippetAbstract.php
trunk/library/configs/db/tables/gems__patch_levels.10.sql
trunk/library/snippets/EditTrackEngineSnippet.php
Modified: trunk/library/classes/Gems/Default/TrackRoundsAction.php
===================================================================
--- trunk/library/classes/Gems/Default/TrackRoundsAction.php 2011-09-15 09:47:09 UTC (rev 14)
+++ trunk/library/classes/Gems/Default/TrackRoundsAction.php 2011-09-15 10:46:03 UTC (rev 15)
@@ -87,7 +87,7 @@
$trackEngine->applyToMenuSource($menuSource);
$menuSource->setRequestId($trackId); // Tell the menu we're using track id as request id
- $this->addSnippets($trackEngine->getRoundEditSnippetNames(), 'trackEngine', $trackEngine, 'trackId', $trackId);
+ $this->addSnippets($trackEngine->getRoundEditSnippetNames(), 'trackEngine', $trackEngine, 'trackId', $trackId, 'userId', $this->session->user_id);
}
/**
@@ -149,7 +149,7 @@
$trackEngine->applyToMenuSource($menuSource);
$menuSource->setRequestId($trackId); // Tell the menu we're using track id as request id
- $this->addSnippets($trackEngine->getRoundEditSnippetNames(), 'roundId', $this->_getParam(Gems_Model::ROUND_ID), 'trackEngine', $trackEngine, 'trackId', $trackId);
+ $this->addSnippets($trackEngine->getRoundEditSnippetNames(), 'roundId', $this->_getParam(Gems_Model::ROUND_ID), 'trackEngine', $trackEngine, 'trackId', $trackId, 'userId', $this->session->user_id);
}
public function getTopic($count = 1)
Modified: trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2011-09-15 09:47:09 UTC (rev 14)
+++ trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2011-09-15 10:46:03 UTC (rev 15)
@@ -191,6 +191,43 @@
}
/**
+ * Update the track, both in the database and in memory.
+ *
+ * @param array $values The values that this token should be set to
+ * @param int $userId The current user
+ * @return int 1 if data changed, 0 otherwise
+ */
+ private function _update(array $values, $userId)
+ {
+ if ($this->tracker->filterChangesOnly($this->_trackData, $values)) {
+
+ if (Gems_Tracker::$verbose) {
+ $echo = '';
+ foreach ($values as $key => $val) {
+ $echo .= $key . ': ' . $this->_trackData[$key] . ' => ' . $val . "\n";
+ }
+ MUtil_Echo::r($echo, 'Updated values for ' . $this->_trackId);
+ }
+
+ if (! isset($values['gto_changed'])) {
+ $values['gtr_changed'] = new Zend_Db_Expr('CURRENT_TIMESTAMP');
+ }
+ if (! isset($values['gtr_changed_by'])) {
+ $values['gtr_changed_by'] = $userId;
+ }
+
+ // Update values in this object
+ $this->_trackData = $values + $this->_trackData;
+
+ // return 1;
+ return $this->db->update('gems__tracks', $values, array('gtr_id_track = ?' => $this->_trackId));
+
+ } else {
+ return 0;
+ }
+ }
+
+ /**
* Creates all tokens that should exist, but do not exist
*
* NOTE: When overruling this function you should not create tokens because they
@@ -266,6 +303,16 @@
}
/**
+ * Calculate the number of active rounds in this track from the database.
+ *
+ * @return int The number of rounds in this track.
+ */
+ public function calculateRoundCount()
+ {
+ return $this->db->fetchOne("SELECT COUNT(*) FROM gems__rounds WHERE gro_active = 1 AND gro_id_track = ?", $this->_trackId);
+ }
+
+ /**
* Checks all existing tokens and updates any changes to the original rounds (when necessary)
*
* @param Gems_Tracker_RespondentTrack $respTrack The respondent track to check
@@ -715,4 +762,17 @@
return 0;
}
+
+ /**
+ * Updates the number of rounds in this track.
+ *
+ * @param int $userId The current user
+ * @return int 1 if data changed, 0 otherwise
+ */
+ public function updateRoundCount($userId)
+ {
+ $values['gtr_survey_rounds'] = $this->calculateRoundCount();
+
+ return $this->_update($values, $userId);
+ }
}
Modified: trunk/library/classes/Gems/Tracker/Engine/TrackEngineInterface.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Engine/TrackEngineInterface.php 2011-09-15 09:47:09 UTC (rev 14)
+++ trunk/library/classes/Gems/Tracker/Engine/TrackEngineInterface.php 2011-09-15 10:46:03 UTC (rev 15)
@@ -68,6 +68,13 @@
public function calculateFieldsInfo($respTrackId, array $data);
/**
+ * Calculate the number of active rounds in this track from the database.
+ *
+ * @return int The number of rounds in this track.
+ */
+ public function calculateRoundCount();
+
+ /**
* Check for the existence of all tokens and create them otherwise
*
* @param Gems_Tracker_RespondentTrack $respTrack The respondent track to check
@@ -303,4 +310,12 @@
* @return int The number of changed fields
*/
public function setFieldsData($respTrackId, array $data);
+
+ /**
+ * Updates the number of rounds in this track.
+ *
+ * @param int $userId The current user
+ * @return int 1 if data changed, 0 otherwise
+ */
+ public function updateRoundCount($userId);
}
Modified: trunk/library/classes/Gems/Tracker/Snippets/EditRoundSnippetAbstract.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Snippets/EditRoundSnippetAbstract.php 2011-09-15 09:47:09 UTC (rev 14)
+++ trunk/library/classes/Gems/Tracker/Snippets/EditRoundSnippetAbstract.php 2011-09-15 10:46:03 UTC (rev 15)
@@ -77,6 +77,12 @@
protected $trackId;
/**
+ *
+ * @var int $userId The current user
+ */
+ protected $userId = 0;
+
+ /**
* @var Gems_Util
*/
protected $util;
@@ -199,6 +205,7 @@
if ($this->createData && (! $this->roundId)) {
$this->roundId = $this->formData['gro_id_round'];
}
+ $this->trackEngine->updateRoundCount($this->userId);
}
/**
Modified: trunk/library/configs/db/tables/gems__patch_levels.10.sql
===================================================================
--- trunk/library/configs/db/tables/gems__patch_levels.10.sql 2011-09-15 09:47:09 UTC (rev 14)
+++ trunk/library/configs/db/tables/gems__patch_levels.10.sql 2011-09-15 10:46:03 UTC (rev 15)
@@ -3,7 +3,7 @@
gpl_level int unsigned not null unique,
gpl_created timestamp not null default current_timestamp,
-
+
PRIMARY KEY (gpl_level)
)
ENGINE=InnoDB
@@ -11,5 +11,5 @@
INSERT INTO gems__patch_levels (gpl_level, gpl_created)
VALUES
- (26, CURRENT_TIMESTAMP);
+ (40, CURRENT_TIMESTAMP);
Modified: trunk/library/snippets/EditTrackEngineSnippet.php
===================================================================
--- trunk/library/snippets/EditTrackEngineSnippet.php 2011-09-15 09:47:09 UTC (rev 14)
+++ trunk/library/snippets/EditTrackEngineSnippet.php 2011-09-15 10:46:03 UTC (rev 15)
@@ -265,10 +265,10 @@
if (isset($this->formData['gtr_organisations']) && is_array($this->formData['gtr_organisations'])) {
$this->formData['gtr_organisations'] = '|' . implode('|', $this->formData['gtr_organisations']) . '|';
}
- if ($this->createData) {
+ if ($this->trackEngine) {
+ $this->formData['gtr_survey_rounds'] = $this->trackEngine->calculateRoundCount();
+ } else {
$this->formData['gtr_survey_rounds'] = 0;
- } else {
- $this->formData['gtr_survey_rounds'] = $this->db->fetchOne("SELECT COUNT(*) FROM gems__rounds WHERE gro_active = 1 AND gro_id_track = ?", $this->trackId);
}
parent::saveData();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-09-15 14:19:10
|
Revision: 22
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=22&view=rev
Author: matijsdejong
Date: 2011-09-15 14:19:01 +0000 (Thu, 15 Sep 2011)
Log Message:
-----------
- added organization code field without using it
- fixed #413 overzicht weekview
- added extra overview column to patches
Modified Paths:
--------------
trunk/library/classes/Gems/Default/DatabaseAction.php
trunk/library/classes/Gems/Selector/DateSelectorAbstract.php
trunk/library/classes/Gems/Selector/TokenDateSelector.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__organizations.20.sql
trunk/library/configs/db_multi_layout/tables/gems__organizations.20.sql
Modified: trunk/library/classes/Gems/Default/DatabaseAction.php
===================================================================
--- trunk/library/classes/Gems/Default/DatabaseAction.php 2011-09-15 14:18:48 UTC (rev 21)
+++ trunk/library/classes/Gems/Default/DatabaseAction.php 2011-09-15 14:19:01 UTC (rev 22)
@@ -298,10 +298,11 @@
$patcher = new Gems_Util_DatabasePatcher($this->db, 'patches.sql', $this->escort->getDatabasePaths());
$changed = $patcher->uploadPatches($this->loader->getVersions()->getBuild());
$tableSql = sprintf(
- 'SELECT gpa_level AS `%s`, gpa_location AS `%s`, COUNT(*) AS `%s`, SUM(gpa_executed) AS `%s`, SUM(gpa_completed) AS `%s` FROM gems__patches GROUP BY gpa_level, gpa_location ORDER BY gpa_level DESC, gpa_location',
+ 'SELECT gpa_level AS `%s`, gpa_location AS `%s`, COUNT(*) AS `%s`, COUNT(*) - SUM(gpa_executed) AS `%s`, SUM(gpa_executed) AS `%s`, SUM(gpa_completed) AS `%s` FROM gems__patches GROUP BY gpa_level, gpa_location ORDER BY gpa_level DESC, gpa_location',
$this->_('Level'),
$this->_('Subtype'),
$this->_('Patches'),
+ $this->_('To be executed'),
$this->_('Executed'),
$this->_('Finished'));
Modified: trunk/library/classes/Gems/Selector/DateSelectorAbstract.php
===================================================================
--- trunk/library/classes/Gems/Selector/DateSelectorAbstract.php 2011-09-15 14:18:48 UTC (rev 21)
+++ trunk/library/classes/Gems/Selector/DateSelectorAbstract.php 2011-09-15 14:19:01 UTC (rev 22)
@@ -26,24 +26,24 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * File description of DateSelectorAbstract
*
- * @author Matijs de Jong <mj...@ma...>
- * @since 1.1
- * @version 1.1
+ *
+ *
* @package Gems
* @subpackage Selector
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: OverviewPlanAction.php 430 2011-08-18 10:40:21Z 175780 $
*/
/**
- * Class description of DateSelectorAbstract
*
- * @author Matijs de Jong <mj...@ma...>
* @package Gems
* @subpackage Selector
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.2
*/
abstract class Gems_Selector_DateSelectorAbstract extends Gems_Registry_TargetAbstract
{
@@ -190,7 +190,7 @@
switch ($this->dateType) {
case 'D':
$keyCount = 1;
- $groupby['period_1'] = $this->dateFrom;
+ $groupby['period_1'] = new Zend_Db_Expr("CONVERT($this->dateFrom, DATE)");
$date->setTime(0);
$date->addDay($this->dateFactor - $this->dateRange);
@@ -630,7 +630,7 @@
case 'W':
$header = array($repeater->period_1, MUtil_Html::create()->br(),
- sprintf($this->_('week %s'), $repeater->period_2));
+ MUtil_Lazy::call('sprintf', $this->_('week %s'), $repeater->period_2));
break;
case 'M':
Modified: trunk/library/classes/Gems/Selector/TokenDateSelector.php
===================================================================
--- trunk/library/classes/Gems/Selector/TokenDateSelector.php 2011-09-15 14:18:48 UTC (rev 21)
+++ trunk/library/classes/Gems/Selector/TokenDateSelector.php 2011-09-15 14:19:01 UTC (rev 22)
@@ -4,7 +4,7 @@
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@@ -15,7 +15,7 @@
* * Neither the name of Erasmus MC nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -26,24 +26,23 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * File description of TokenDateSelector
*
- * @author Matijs de Jong <mj...@ma...>
- * @since 1.1
- * @version 1.1
+ *
* @package Gems
* @subpackage Selector
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: OverviewPlanAction.php 430 2011-08-18 10:40:21Z 175780 $
*/
/**
- * Class description of TokenDateSelector
*
- * @author Matijs de Jong <mj...@ma...>
* @package Gems
* @subpackage Selector
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.2
*/
class Gems_Selector_TokenDateSelector extends Gems_Selector_DateSelectorAbstract
{
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-09-15 14:18:48 UTC (rev 21)
+++ trunk/library/configs/db/patches.sql 2011-09-15 14:19:01 UTC (rev 22)
@@ -185,3 +185,8 @@
-- PATCH: Mail templates per organization
ALTER TABLE `gems__mail_templates` ADD `gmt_organizations` VARCHAR( 250 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `gmt_body`;
UPDATE gems__mail_templates SET gmt_organizations = (SELECT CONCAT('|', GROUP_CONCAT(gor_id_organization SEPARATOR '|'), '|') FROM gems__organizations);
+
+-- GEMS VERSION: 40
+-- PATCH: Organization codes
+ALTER TABLE `gems__organizations` ADD gor_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' AFTER gor_name;
+
Modified: trunk/library/configs/db/tables/gems__organizations.20.sql
===================================================================
--- trunk/library/configs/db/tables/gems__organizations.20.sql 2011-09-15 14:18:48 UTC (rev 21)
+++ trunk/library/configs/db/tables/gems__organizations.20.sql 2011-09-15 14:19:01 UTC (rev 22)
@@ -3,6 +3,7 @@
gor_id_organization bigint unsigned not null auto_increment,
gor_name varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
+ gor_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
gor_location varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
gor_url varchar(127) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
gor_task varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
Modified: trunk/library/configs/db_multi_layout/tables/gems__organizations.20.sql
===================================================================
--- trunk/library/configs/db_multi_layout/tables/gems__organizations.20.sql 2011-09-15 14:18:48 UTC (rev 21)
+++ trunk/library/configs/db_multi_layout/tables/gems__organizations.20.sql 2011-09-15 14:19:01 UTC (rev 22)
@@ -4,6 +4,7 @@
gor_id_organization bigint unsigned not null auto_increment,
gor_name varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
+ gor_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
gor_location varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
gor_url varchar(127) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
gor_task varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-09-16 06:24:29
|
Revision: 28
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=28&view=rev
Author: mennodekker
Date: 2011-09-16 06:24:15 +0000 (Fri, 16 Sep 2011)
Log Message:
-----------
Setting the keywords again since they seem to be lost in migration
Modified Paths:
--------------
trunk/library/classes/Gems/AccessLog.php
trunk/library/classes/Gems/Auth.php
trunk/library/classes/Gems/Communication/Exception.php
trunk/library/classes/Gems/Communication/RespondentContainer.php
trunk/library/classes/Gems/Communication/RespondentModelWriter.php
trunk/library/classes/Gems/Communication/RespondentReader.php
trunk/library/classes/Gems/Communication/RespondentWriter.php
trunk/library/classes/Gems/Controller/BrowseEditAction.php
trunk/library/classes/Gems/Controller/ModelActionAbstract.php
trunk/library/classes/Gems/Cookies.php
trunk/library/classes/Gems/Default/AskAction.php
trunk/library/classes/Gems/Default/DatabaseAction.php
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/Default/MailAction.php
trunk/library/classes/Gems/Default/MailServerAction.php
trunk/library/classes/Gems/Default/OverviewPlanAction.php
trunk/library/classes/Gems/Default/ProjectInformationAction.php
trunk/library/classes/Gems/Default/ProjectSurveysAction.php
trunk/library/classes/Gems/Default/ProjectTracksAction.php
trunk/library/classes/Gems/Default/RespondentAction.php
trunk/library/classes/Gems/Default/RespondentPlanAction.php
trunk/library/classes/Gems/Default/RoleAction.php
trunk/library/classes/Gems/Default/SourceAction.php
trunk/library/classes/Gems/Default/StaffAction.php
trunk/library/classes/Gems/Default/SurveyAction.php
trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php
trunk/library/classes/Gems/Default/TokenPlanAction.php
trunk/library/classes/Gems/Default/TrackAction.php
trunk/library/classes/Gems/Default/TrackActionAbstract.php
trunk/library/classes/Gems/Default/TrackFieldsAction.php
trunk/library/classes/Gems/Default/TrackMaintenanceAction.php
trunk/library/classes/Gems/Default/TrackRoundAction.php
trunk/library/classes/Gems/Default/TrackRoundsAction.php
trunk/library/classes/Gems/Email/EmailFormAbstract.php
trunk/library/classes/Gems/Email/MailTemplateForm.php
trunk/library/classes/Gems/Email/MultiMailForm.php
trunk/library/classes/Gems/Email/OneMailForm.php
trunk/library/classes/Gems/Email/TemplateMailer.php
trunk/library/classes/Gems/Event/EventCalculations.php
trunk/library/classes/Gems/Event/EventInterface.php
trunk/library/classes/Gems/Event/RoundChangedEventInterface.php
trunk/library/classes/Gems/Event/SurveyBeforeAnsweringEventInterface.php
trunk/library/classes/Gems/Event/SurveyCompletedEventInterface.php
trunk/library/classes/Gems/Events.php
trunk/library/classes/Gems/Filter/DutchZipcode.php
trunk/library/classes/Gems/Form/Decorator/Form.php
trunk/library/classes/Gems/Form/Decorator/TabErrors.php
trunk/library/classes/Gems/Form/Decorator/Tooltip.php
trunk/library/classes/Gems/Form/SubForm.php
trunk/library/classes/Gems/Form/TabGroup.php
trunk/library/classes/Gems/Form/TabSubForm.php
trunk/library/classes/Gems/Form/TableForm.php
trunk/library/classes/Gems/Form.php
trunk/library/classes/Gems/FormattedData.php
trunk/library/classes/Gems/JQuery/Form/Decorator/TabContainer.php
trunk/library/classes/Gems/JQuery/Form/Element/ToggleCheckboxes.php
trunk/library/classes/Gems/JQuery/JQueryExtenderAbstract.php
trunk/library/classes/Gems/JQuery/TableRowKeySelector.php
trunk/library/classes/Gems/JQuery/View/Helper/TabContainer.php
trunk/library/classes/Gems/JQuery/View/Helper/ToggleCheckboxes.php
trunk/library/classes/Gems/Loader/LoaderAbstract.php
trunk/library/classes/Gems/Loader.php
trunk/library/classes/Gems/Log.php
trunk/library/classes/Gems/Menu/MenuAbstract.php
trunk/library/classes/Gems/Menu/MenuList.php
trunk/library/classes/Gems/Menu/ParameterSource.php
trunk/library/classes/Gems/Menu/ParameterSourceInterface.php
trunk/library/classes/Gems/Menu/SubMenuItem.php
trunk/library/classes/Gems/Menu.php
trunk/library/classes/Gems/Model/DbaModel.php
trunk/library/classes/Gems/Model/HiddenOrganizationModel.php
trunk/library/classes/Gems/Model/JoinModel.php
trunk/library/classes/Gems/Model/RespondentModel.php
trunk/library/classes/Gems/Model/ThreeColumnTableBridge.php
trunk/library/classes/Gems/Model.php
trunk/library/classes/Gems/Roles.php
trunk/library/classes/Gems/Selector/DateSelectorAbstract.php
trunk/library/classes/Gems/Selector/TokenDateSelector.php
trunk/library/classes/Gems/Selector.php
trunk/library/classes/Gems/Snippets/MenuSnippetAbstract.php
trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php
trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php
trunk/library/classes/Gems/Snippets/RespondentDetailSnippetAbstract.php
trunk/library/classes/Gems/Snippets/TokenModelSnippetAbstract.php
trunk/library/classes/Gems/TabForm.php
trunk/library/classes/Gems/Tracker/Engine/AnyStepEngine.php
trunk/library/classes/Gems/Tracker/Engine/NextStepEngine.php
trunk/library/classes/Gems/Tracker/Engine/SingleSurveyEngine.php
trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php
trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php
trunk/library/classes/Gems/Tracker/Engine/TrackEngineInterface.php
trunk/library/classes/Gems/Tracker/Model/RespondentTrackModel.php
trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php
trunk/library/classes/Gems/Tracker/Model/TrackModel.php
trunk/library/classes/Gems/Tracker/RespondentTrack.php
trunk/library/classes/Gems/Tracker/Snippets/EditRoundSnippetAbstract.php
trunk/library/classes/Gems/Tracker/Snippets/EditSingleSurveyTokenSnippetAbstract.php
trunk/library/classes/Gems/Tracker/Snippets/EditTokenSnippetAbstract.php
trunk/library/classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php
trunk/library/classes/Gems/Tracker/Snippets/ShowRoundSnippetAbstract.php
trunk/library/classes/Gems/Tracker/Snippets/ShowTokenSnippetAbstract.php
trunk/library/classes/Gems/Tracker/Snippets/ShowTrackUsageAbstract.php
trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m91Database.php
trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php
trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php
trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php
trunk/library/classes/Gems/Tracker/Source/SourceInterface.php
trunk/library/classes/Gems/Tracker/Survey.php
trunk/library/classes/Gems/Tracker/Token/TokenLibrary.php
trunk/library/classes/Gems/Tracker/Token/TokenSelect.php
trunk/library/classes/Gems/Tracker/Token.php
trunk/library/classes/Gems/Tracker/TrackerInterface.php
trunk/library/classes/Gems/Tracker.php
trunk/library/classes/Gems/Util/DatabasePatcher.php
trunk/library/classes/Gems/Util/DbLookup.php
trunk/library/classes/Gems/Util/RequestCache.php
trunk/library/classes/Gems/Util/TrackData.php
trunk/library/classes/Gems/Util/Translated.php
trunk/library/classes/Gems/Util.php
trunk/library/classes/Gems/Validate/GemsPasswordUsername.php
trunk/library/classes/Gems/Versions.php
trunk/library/classes/Gems/View/Helper/Excel.php
trunk/library/classes/GemsEscort.php
trunk/library/classes/MUtil/Acl.php
trunk/library/classes/MUtil/Application/Escort.php
trunk/library/classes/MUtil/Application/EscortControllerHelper.php
trunk/library/classes/MUtil/Application/EscortPlugin.php
trunk/library/classes/MUtil/Controller/ModelActionAbstract.php
trunk/library/classes/MUtil/Form/Element/Exhibitor.php
trunk/library/classes/MUtil/Form/Element/FakeSubmit.php
trunk/library/classes/MUtil/Form/Element/Html.php
trunk/library/classes/MUtil/Form/Element/NoFocusInterface.php
trunk/library/classes/MUtil/Form/Element/SubFocusInterface.php
trunk/library/classes/MUtil/Form/Element/Tab.php
trunk/library/classes/MUtil/Form/Element/Table.php
trunk/library/classes/MUtil/Form.php
trunk/library/classes/MUtil/Html/Marker.php
trunk/library/classes/MUtil/Html/PageRangeRenderer.php
trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php
trunk/library/classes/MUtil/Model/FormBridge.php
trunk/library/classes/MUtil/Model/ModelAbstract.php
trunk/library/classes/MUtil/Model/TableBridge.php
trunk/library/classes/MUtil/Model/TableModel.php
trunk/library/classes/MUtil/Ra/Filter/Contains.php
trunk/library/classes/MUtil/Ra/FilterAbstract.php
trunk/library/classes/MUtil/Ra/FilterInterface.php
trunk/library/classes/MUtil/Ra/Nested.php
trunk/library/classes/MUtil/Snippets/EmptySnippetAbstract.php
trunk/library/classes/MUtil/Snippets/ModelFormSnippetAbstract.php
trunk/library/classes/MUtil/Snippets/ModelSnippetAbstract.php
trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php
trunk/library/classes/MUtil/Snippets/ModelVerticalTableSnippetAbstract.php
trunk/library/classes/MUtil/Snippets/SnippetAbstract.php
trunk/library/classes/MUtil/Snippets/SnippetInterface.php
trunk/library/classes/MUtil/Snippets/SnippetLoader.php
trunk/library/classes/MUtil/Snippets/Standard/ModelFormSnippet.php
trunk/library/classes/MUtil/Snippets/Standard/ModelTableSnippet.php
trunk/library/classes/MUtil/Snippets/Standard/ModelVerticalTableSnippet.php
trunk/library/classes/MUtil/Snippets/Standard/SelectiveTableSnippet.php
trunk/library/classes/MUtil/Snippets/Standard/TableSnippet.php
trunk/library/classes/MUtil/Snippets/TabSnippetAbstract.php
trunk/library/classes/MUtil/Snippets/TableSnippetAbstract.php
trunk/library/classes/ZFDebug/Controller/Plugin/Debug/Plugin/Auth.php
trunk/library/classes/ZFDebug/Controller/Plugin/Debug/Plugin/Cache.php
trunk/library/classes/ZFDebug/Controller/Plugin/Debug/Plugin/Database.php
trunk/library/classes/ZFDebug/Controller/Plugin/Debug/Plugin/Exception.php
trunk/library/classes/ZFDebug/Controller/Plugin/Debug/Plugin/File.php
trunk/library/classes/ZFDebug/Controller/Plugin/Debug/Plugin/Html.php
trunk/library/classes/ZFDebug/Controller/Plugin/Debug/Plugin/Interface.php
trunk/library/classes/ZFDebug/Controller/Plugin/Debug/Plugin/Memory.php
trunk/library/classes/ZFDebug/Controller/Plugin/Debug/Plugin/Registry.php
trunk/library/classes/ZFDebug/Controller/Plugin/Debug/Plugin/Text.php
trunk/library/classes/ZFDebug/Controller/Plugin/Debug/Plugin/Time.php
trunk/library/classes/ZFDebug/Controller/Plugin/Debug/Plugin/Variables.php
trunk/library/classes/ZFDebug/Controller/Plugin/Debug/Plugin.php
trunk/library/classes/ZFDebug/Controller/Plugin/Debug.php
trunk/library/controllers/MailServerController.php
trunk/library/controllers/TrackRoundController.php
trunk/library/docs/Sample.php
trunk/library/snippets/AddTracksSnippet.php
trunk/library/snippets/AnswerModelSnippet.php
trunk/library/snippets/BrowseSingleSurveyTokenSnippet.php
trunk/library/snippets/DeleteInSourceTrackSnippet.php
trunk/library/snippets/DeleteSingleSurveyInSourceTokenSnippet.php
trunk/library/snippets/DeleteSingleSurveyNotUsedTokenSnippet.php
trunk/library/snippets/DeleteTrackTokenSnippet.php
trunk/library/snippets/EditRoundSnippet.php
trunk/library/snippets/EditRoundStepSnippet.php
trunk/library/snippets/EditSingleSurveyTokenSnippet.php
trunk/library/snippets/EditTrackEngineSnippet.php
trunk/library/snippets/EditTrackSnippet.php
trunk/library/snippets/EditTrackTokenSnippet.php
trunk/library/snippets/RespondentDetailsSnippet.php
trunk/library/snippets/RespondentDetailsWithAssignmentsSnippet.php
trunk/library/snippets/RespondentTokenSnippet.php
trunk/library/snippets/RespondentTokenTabsSnippet.php
trunk/library/snippets/SelectedTokensTitleSnippet.php
trunk/library/snippets/ShowRoundSnippet.php
trunk/library/snippets/ShowRoundStepSnippet.php
trunk/library/snippets/ShowSingleSurveyTokenSnippet.php
trunk/library/snippets/ShowTrackTokenSnippet.php
trunk/library/snippets/SurveyQuestionsSnippet.php
trunk/library/snippets/TokenDateSelectorSnippet.php
trunk/library/snippets/TokenNotFoundSnippet.php
trunk/library/snippets/Track/AvailableTracksSnippets.php
trunk/library/snippets/TrackAnswersModelSnippet.php
trunk/library/snippets/TrackSurveyOverviewSnippet.php
trunk/library/snippets/TrackTokenOverviewSnippet.php
trunk/library/snippets/TrackUsageTextDetailsSnippet.php
Property Changed:
----------------
trunk/library/classes/Gems/AccessLog.php
trunk/library/classes/Gems/Auth.php
trunk/library/classes/Gems/Communication/Exception.php
trunk/library/classes/Gems/Communication/RespondentContainer.php
trunk/library/classes/Gems/Communication/RespondentModelWriter.php
trunk/library/classes/Gems/Communication/RespondentReader.php
trunk/library/classes/Gems/Communication/RespondentWriter.php
trunk/library/classes/Gems/Controller/Action.php
trunk/library/classes/Gems/Controller/BrowseEditAction.php
trunk/library/classes/Gems/Controller/ModelActionAbstract.php
trunk/library/classes/Gems/Cookies.php
trunk/library/classes/Gems/Default/AskAction.php
trunk/library/classes/Gems/Default/ConsentAction.php
trunk/library/classes/Gems/Default/ContactAction.php
trunk/library/classes/Gems/Default/CountryAction.php
trunk/library/classes/Gems/Default/DatabaseAction.php
trunk/library/classes/Gems/Default/EmailAction.php
trunk/library/classes/Gems/Default/ErrorAction.php
trunk/library/classes/Gems/Default/GroupAction.php
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/Default/InvitationAction.php
trunk/library/classes/Gems/Default/LanguageAction.php
trunk/library/classes/Gems/Default/LogAction.php
trunk/library/classes/Gems/Default/LogMaintenanceAction.php
trunk/library/classes/Gems/Default/MailAction.php
trunk/library/classes/Gems/Default/MailServerAction.php
trunk/library/classes/Gems/Default/OptionAction.php
trunk/library/classes/Gems/Default/OrganizationAction.php
trunk/library/classes/Gems/Default/OverviewPlanAction.php
trunk/library/classes/Gems/Default/ProjectInformationAction.php
trunk/library/classes/Gems/Default/ProjectSurveysAction.php
trunk/library/classes/Gems/Default/ProjectTracksAction.php
trunk/library/classes/Gems/Default/ReceptionAction.php
trunk/library/classes/Gems/Default/RespondentAction.php
trunk/library/classes/Gems/Default/RespondentPlanAction.php
trunk/library/classes/Gems/Default/RoleAction.php
trunk/library/classes/Gems/Default/SourceAction.php
trunk/library/classes/Gems/Default/StaffAction.php
trunk/library/classes/Gems/Default/SurveyAction.php
trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php
trunk/library/classes/Gems/Default/TokenPlanAction.php
trunk/library/classes/Gems/Default/TrackAction.php
trunk/library/classes/Gems/Default/TrackActionAbstract.php
trunk/library/classes/Gems/Default/TrackFieldsAction.php
trunk/library/classes/Gems/Default/TrackMaintenanceAction.php
trunk/library/classes/Gems/Default/TrackRoundAction.php
trunk/library/classes/Gems/Default/TrackRoundsAction.php
trunk/library/classes/Gems/Email/EmailFormAbstract.php
trunk/library/classes/Gems/Email/MailTemplateForm.php
trunk/library/classes/Gems/Email/MultiMailForm.php
trunk/library/classes/Gems/Email/OneMailForm.php
trunk/library/classes/Gems/Email/TemplateMailer.php
trunk/library/classes/Gems/Event/EventCalculations.php
trunk/library/classes/Gems/Event/EventInterface.php
trunk/library/classes/Gems/Event/RoundChangedEventInterface.php
trunk/library/classes/Gems/Event/SurveyBeforeAnsweringEventInterface.php
trunk/library/classes/Gems/Event/SurveyCompletedEventInterface.php
trunk/library/classes/Gems/Events.php
trunk/library/classes/Gems/Exception/Coding.php
trunk/library/classes/Gems/Exception.php
trunk/library/classes/Gems/Filter/DutchZipcode.php
trunk/library/classes/Gems/Form/Decorator/Form.php
trunk/library/classes/Gems/Form/Decorator/TabErrors.php
trunk/library/classes/Gems/Form/Decorator/Tooltip.php
trunk/library/classes/Gems/Form/SubForm.php
trunk/library/classes/Gems/Form/TabGroup.php
trunk/library/classes/Gems/Form/TabSubForm.php
trunk/library/classes/Gems/Form/TableForm.php
trunk/library/classes/Gems/Form.php
trunk/library/classes/Gems/FormattedData.php
trunk/library/classes/Gems/Html.php
trunk/library/classes/Gems/JQuery/AutoSubmitForm.php
trunk/library/classes/Gems/JQuery/Form/Decorator/TabContainer.php
trunk/library/classes/Gems/JQuery/Form/Element/ToggleCheckboxes.php
trunk/library/classes/Gems/JQuery/JQueryExtenderAbstract.php
trunk/library/classes/Gems/JQuery/TableRowKeySelector.php
trunk/library/classes/Gems/JQuery/View/Helper/TabContainer.php
trunk/library/classes/Gems/JQuery/View/Helper/ToggleCheckboxes.php
trunk/library/classes/Gems/Loader/LoaderAbstract.php
trunk/library/classes/Gems/Loader/TargetLoaderAbstract.php
trunk/library/classes/Gems/Loader.php
trunk/library/classes/Gems/Log.php
trunk/library/classes/Gems/Menu/MenuAbstract.php
trunk/library/classes/Gems/Menu/MenuList.php
trunk/library/classes/Gems/Menu/ParameterSource.php
trunk/library/classes/Gems/Menu/ParameterSourceInterface.php
trunk/library/classes/Gems/Menu/SubMenuItem.php
trunk/library/classes/Gems/Menu.php
trunk/library/classes/Gems/Model/DbaModel.php
trunk/library/classes/Gems/Model/HiddenOrganizationModel.php
trunk/library/classes/Gems/Model/JoinModel.php
trunk/library/classes/Gems/Model/RespondentModel.php
trunk/library/classes/Gems/Model/ThreeColumnTableBridge.php
trunk/library/classes/Gems/Model.php
trunk/library/classes/Gems/Pdf.php
trunk/library/classes/Gems/Project/Layout/MultiLayoutInterface.php
trunk/library/classes/Gems/Project/Layout/SingleLayoutInterface.php
trunk/library/classes/Gems/Project/Log/LogRespondentAccessInterface.php
trunk/library/classes/Gems/Project/Organization/MultiOrganizationInterface.php
trunk/library/classes/Gems/Project/Organization/SingleOrganizationInterface.php
trunk/library/classes/Gems/Project/Tracks/FixedTracksInterface.php
trunk/library/classes/Gems/Project/Tracks/MultiTracksInterface.php
trunk/library/classes/Gems/Project/Tracks/SingleTrackInterface.php
trunk/library/classes/Gems/Project/Tracks/StandAloneSurveysInterface.php
trunk/library/classes/Gems/Project/Tracks/TracksOnlyInterface.php
trunk/library/classes/Gems/Registry/TargetAbstract.php
trunk/library/classes/Gems/Roles.php
trunk/library/classes/Gems/Selector/DateSelectorAbstract.php
trunk/library/classes/Gems/Selector/SelectorField.php
trunk/library/classes/Gems/Selector/TokenByGroupDateSelector.php
trunk/library/classes/Gems/Selector/TokenDateSelector.php
trunk/library/classes/Gems/Selector.php
trunk/library/classes/Gems/Snippets/MenuSnippetAbstract.php
trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php
trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php
trunk/library/classes/Gems/Snippets/RespondentDetailSnippetAbstract.php
trunk/library/classes/Gems/Snippets/TokenModelSnippetAbstract.php
trunk/library/classes/Gems/TabForm.php
trunk/library/classes/Gems/Tracker/ChangeTracker.php
trunk/library/classes/Gems/Tracker/Engine/AnyStepEngine.php
trunk/library/classes/Gems/Tracker/Engine/NextStepEngine.php
trunk/library/classes/Gems/Tracker/Engine/SingleSurveyEngine.php
trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php
trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php
trunk/library/classes/Gems/Tracker/Engine/TrackEngineInterface.php
trunk/library/classes/Gems/Tracker/Model/RespondentTrackModel.php
trunk/library/classes/Gems/Tracker/Model/SingleSurveyTokenModel.php
trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php
trunk/library/classes/Gems/Tracker/Model/TrackModel.php
trunk/library/classes/Gems/Tracker/RespondentTrack.php
trunk/library/classes/Gems/Tracker/Snippets/EditRoundSnippetAbstract.php
trunk/library/classes/Gems/Tracker/Snippets/EditSingleSurveyTokenSnippetAbstract.php
trunk/library/classes/Gems/Tracker/Snippets/EditTokenSnippetAbstract.php
trunk/library/classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php
trunk/library/classes/Gems/Tracker/Snippets/ShowRoundSnippetAbstract.php
trunk/library/classes/Gems/Tracker/Snippets/ShowTokenSnippetAbstract.php
trunk/library/classes/Gems/Tracker/Snippets/ShowTrackUsageAbstract.php
trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m91Database.php
trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php
trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php
trunk/library/classes/Gems/Tracker/Source/SourceAbstract.php
trunk/library/classes/Gems/Tracker/Source/SourceInterface.php
trunk/library/classes/Gems/Tracker/Source/SurveyNotFoundException.php
trunk/library/classes/Gems/Tracker/Survey.php
trunk/library/classes/Gems/Tracker/SurveyModel.php
trunk/library/classes/Gems/Tracker/Token/TokenFilter.php
trunk/library/classes/Gems/Tracker/Token/TokenLibrary.php
trunk/library/classes/Gems/Tracker/Token/TokenSelect.php
trunk/library/classes/Gems/Tracker/Token/TokenValidator.php
trunk/library/classes/Gems/Tracker/Token.php
trunk/library/classes/Gems/Tracker/TrackerInterface.php
trunk/library/classes/Gems/Tracker.php
trunk/library/classes/Gems/Util/BasePath.php
trunk/library/classes/Gems/Util/DatabasePatcher.php
trunk/library/classes/Gems/Util/DbLookup.php
trunk/library/classes/Gems/Util/Localized.php
trunk/library/classes/Gems/Util/RequestCache.php
trunk/library/classes/Gems/Util/TrackData.php
trunk/library/classes/Gems/Util/Translated.php
trunk/library/classes/Gems/Util.php
trunk/library/classes/Gems/Validate/GemsPasswordUsername.php
trunk/library/classes/Gems/Validate/LimeSurveySoapClient.php
trunk/library/classes/Gems/Versions.php
trunk/library/classes/Gems/View/Helper/Excel.php
trunk/library/classes/GemsEscort.php
trunk/library/classes/MUtil/Acl.php
trunk/library/classes/MUtil/Application/Escort.php
trunk/library/classes/MUtil/Application/EscortControllerHelper.php
trunk/library/classes/MUtil/Application/EscortPlugin.php
trunk/library/classes/MUtil/ArrayString.php
trunk/library/classes/MUtil/Config/Php.php
trunk/library/classes/MUtil/Controller/Action.php
trunk/library/classes/MUtil/Controller/ModelActionAbstract.php
trunk/library/classes/MUtil/Controller/html-view.phtml
trunk/library/classes/MUtil/Date.php
trunk/library/classes/MUtil/Dojo.php
trunk/library/classes/MUtil/Echo.php
trunk/library/classes/MUtil/Form/Decorator/AutoFocus.php
trunk/library/classes/MUtil/Form/Decorator/Table.php
trunk/library/classes/MUtil/Form/Element/Exhibitor.php
trunk/library/classes/MUtil/Form/Element/FakeSubmit.php
trunk/library/classes/MUtil/Form/Element/Html.php
trunk/library/classes/MUtil/Form/Element/NoFocusInterface.php
trunk/library/classes/MUtil/Form/Element/SubFocusInterface.php
trunk/library/classes/MUtil/Form/Element/Tab.php
trunk/library/classes/MUtil/Form/Element/Table.php
trunk/library/classes/MUtil/Form.php
trunk/library/classes/MUtil/Html/AElement.php
trunk/library/classes/MUtil/Html/ArrayAttribute.php
trunk/library/classes/MUtil/Html/Attribute.php
trunk/library/classes/MUtil/Html/AttributeAbstract.php
trunk/library/classes/MUtil/Html/AttributeInterface.php
trunk/library/classes/MUtil/Html/ClassArrayAttribute.php
trunk/library/classes/MUtil/Html/ColElement.php
trunk/library/classes/MUtil/Html/ColGroupElement.php
trunk/library/classes/MUtil/Html/ColumnInterface.php
trunk/library/classes/MUtil/Html/Creator.php
trunk/library/classes/MUtil/Html/DdElement.php
trunk/library/classes/MUtil/Html/DlElement.php
trunk/library/classes/MUtil/Html/Dojo/ContentPane.php
trunk/library/classes/MUtil/Html/Dojo/DojoData.php
trunk/library/classes/MUtil/Html/Dojo/DojoElementAbstract.php
trunk/library/classes/MUtil/Html/Dojo/TabContainer.php
trunk/library/classes/MUtil/Html/DtElement.php
trunk/library/classes/MUtil/Html/ElementDecorator.php
trunk/library/classes/MUtil/Html/ElementInterface.php
trunk/library/classes/MUtil/Html/FormLayout.php
trunk/library/classes/MUtil/Html/HrefArrayAttribute.php
trunk/library/classes/MUtil/Html/HtmlElement.php
trunk/library/classes/MUtil/Html/HtmlException.php
trunk/library/classes/MUtil/Html/HtmlInterface.php
trunk/library/classes/MUtil/Html/ImgElement.php
trunk/library/classes/MUtil/Html/InputRenderer.php
trunk/library/classes/MUtil/Html/LabelElement.php
trunk/library/classes/MUtil/Html/ListElement.php
trunk/library/classes/MUtil/Html/Marker.php
trunk/library/classes/MUtil/Html/MultiWrapper.php
trunk/library/classes/MUtil/Html/OnClickArrayAttribute.php
trunk/library/classes/MUtil/Html/PagePanel.php
trunk/library/classes/MUtil/Html/PageRangeRenderer.php
trunk/library/classes/MUtil/Html/Raw.php
trunk/library/classes/MUtil/Html/Renderer.php
trunk/library/classes/MUtil/Html/RepeatRenderer.php
trunk/library/classes/MUtil/Html/Sequence.php
trunk/library/classes/MUtil/Html/StyleArrayAttribute.php
trunk/library/classes/MUtil/Html/TBodyElement.php
trunk/library/classes/MUtil/Html/TableElement.php
trunk/library/classes/MUtil/Html/TrElement.php
trunk/library/classes/MUtil/Html/UrlArrayAttribute.php
trunk/library/classes/MUtil/Html.php
trunk/library/classes/MUtil/Https.php
trunk/library/classes/MUtil/JQuery/Form/Element/DatePicker.php
trunk/library/classes/MUtil/JQuery.php
trunk/library/classes/MUtil/Lazy/Alternate.php
trunk/library/classes/MUtil/Lazy/ArrayAccessor.php
trunk/library/classes/MUtil/Lazy/ArrayWrap.php
trunk/library/classes/MUtil/Lazy/Call.php
trunk/library/classes/MUtil/Lazy/LazyAbstract.php
trunk/library/classes/MUtil/Lazy/LazyException.php
trunk/library/classes/MUtil/Lazy/LazyGet.php
trunk/library/classes/MUtil/Lazy/LazyInterface.php
trunk/library/classes/MUtil/Lazy/ObjectWrap.php
trunk/library/classes/MUtil/Lazy/ParallelRepeater.php
trunk/library/classes/MUtil/Lazy/Procrastinator.php
trunk/library/classes/MUtil/Lazy/Property.php
trunk/library/classes/MUtil/Lazy/Repeatable.php
trunk/library/classes/MUtil/Lazy/RepeatableByKeyValue.php
trunk/library/classes/MUtil/Lazy/RepeatableFormElements.php
trunk/library/classes/MUtil/Lazy/RepeatableInterface.php
trunk/library/classes/MUtil/Lazy/RepeatableObjectProperties.php
trunk/library/classes/MUtil/Lazy/Stack/EmptyStack.php
trunk/library/classes/MUtil/Lazy/StackInterface.php
trunk/library/classes/MUtil/Lazy/StaticCall.php
trunk/library/classes/MUtil/Lazy.php
trunk/library/classes/MUtil/Mail.php
trunk/library/classes/MUtil/Markup/Renderer/Text/Url.php
trunk/library/classes/MUtil/Markup/Renderer/Text.php
trunk/library/classes/MUtil/Markup.php
trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php
trunk/library/classes/MUtil/Model/FormBridge.php
trunk/library/classes/MUtil/Model/JoinModel.php
trunk/library/classes/MUtil/Model/ModelAbstract.php
trunk/library/classes/MUtil/Model/ModelException.php
trunk/library/classes/MUtil/Model/ModelTransformerAbstract.php
trunk/library/classes/MUtil/Model/SelectModel.php
trunk/library/classes/MUtil/Model/TableBridge.php
trunk/library/classes/MUtil/Model/TableBridgeAbstract.php
trunk/library/classes/MUtil/Model/TableModel.php
trunk/library/classes/MUtil/Model/Transform/RequiredRowsTransformer.php
trunk/library/classes/MUtil/Model/VerticalTableBridge.php
trunk/library/classes/MUtil/Model.php
trunk/library/classes/MUtil/MultiWrapper.php
trunk/library/classes/MUtil/Parser/Sql/WordsParser.php
trunk/library/classes/MUtil/Parser/Sql/WordsParserException.php
trunk/library/classes/MUtil/Ra/Filter/Contains.php
trunk/library/classes/MUtil/Ra/FilterAbstract.php
trunk/library/classes/MUtil/Ra/FilterInterface.php
trunk/library/classes/MUtil/Ra/Nested.php
trunk/library/classes/MUtil/Ra.php
trunk/library/classes/MUtil/Registry/Source.php
trunk/library/classes/MUtil/Registry/SourceInterface.php
trunk/library/classes/MUtil/Registry/TargetAbstract.php
trunk/library/classes/MUtil/Registry/TargetInterface.php
trunk/library/classes/MUtil/Snippets/EmptySnippetAbstract.php
trunk/library/classes/MUtil/Snippets/ModelFormSnippetAbstract.php
trunk/library/classes/MUtil/Snippets/ModelSnippetAbstract.php
trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php
trunk/library/classes/MUtil/Snippets/ModelVerticalTableSnippetAbstract.php
trunk/library/classes/MUtil/Snippets/SnippetAbstract.php
trunk/library/classes/MUtil/Snippets/SnippetInterface.php
trunk/library/classes/MUtil/Snippets/SnippetLoader.php
trunk/library/classes/MUtil/Snippets/Standard/ModelFormSnippet.php
trunk/library/classes/MUtil/Snippets/Standard/ModelTableSnippet.php
trunk/library/classes/MUtil/Snippets/Standard/ModelVerticalTableSnippet.php
trunk/library/classes/MUtil/Snippets/Standard/SelectiveTableSnippet.php
trunk/library/classes/MUtil/Snippets/Standard/TableSnippet.php
trunk/library/classes/MUtil/Snippets/TabSnippetAbstract.php
trunk/library/classes/MUtil/Snippets/TableSnippetAbstract.php
trunk/library/classes/MUtil/Translate/Adapter/Potemkin.php
trunk/library/classes/MUti...
[truncated message content] |
|
From: <gem...@li...> - 2011-09-16 08:03:27
|
Revision: 29
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=29&view=rev
Author: mennodekker
Date: 2011-09-16 08:03:15 +0000 (Fri, 16 Sep 2011)
Log Message:
-----------
Fixed #6: Add export options for collected data
Modified Paths:
--------------
trunk/library/classes/Gems/Menu.php
Added Paths:
-----------
trunk/library/classes/Gems/Default/ExportAction.php
trunk/library/classes/Gems/Export/
trunk/library/classes/Gems/Export/Excel.php
trunk/library/classes/Gems/Export/ExportAbstract.php
trunk/library/classes/Gems/Export/ExportInterface.php
trunk/library/classes/Gems/Export/ExportModel.php
trunk/library/classes/Gems/Export/Spss.php
trunk/library/classes/Gems/Export.php
trunk/library/controllers/ExportController.php
Added: trunk/library/classes/Gems/Default/ExportAction.php
===================================================================
--- trunk/library/classes/Gems/Default/ExportAction.php (rev 0)
+++ trunk/library/classes/Gems/Default/ExportAction.php 2011-09-16 08:03:15 UTC (rev 29)
@@ -0,0 +1,270 @@
+<?php
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: DatabaseAction.php 28 2011-09-16 06:24:15Z mennodekker $
+ */
+
+/**
+ * Standard controller for database creation and maintenance.
+ *
+ * @package Gems
+ * @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
+ */
+class Gems_Default_ExportAction extends Gems_Controller_Action
+{
+ /**
+ * @var Gems_Export
+ */
+ public $export;
+
+ /**
+ *
+ * @var Zend_Locale
+ */
+ public $locale;
+
+ public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
+ {
+ parent::__construct($request, $response, $invokeArgs);
+ $this->export = $this->loader->getExport();
+
+ //Add this controller to the export so it can render view when needed
+ $this->export->controller = $this;
+ }
+
+ public function getTopic($count = 1)
+ {
+ return $this->_('Data');
+ }
+
+ public function getTopicTitle()
+ {
+ return $this->_('Export data');
+ }
+
+ public function indexAction()
+ {
+ $this->initHtml();
+ //Hacked around to get a self-refreshing form, quite hardcoded but fine for now
+ if ($form = $this->processForm()) {
+ if (!$this->getRequest()->isPost() || $form->getElement('export')->isChecked()) {
+ if ($form->getElement('export')->isChecked()) {
+ $data = $form->getValues();
+ $this->handleExport($data);
+ }
+ $this->html->h3($this->getTopicTitle());
+ $div = $this->html->div(array('id' => 'mainform'));
+ $div[] = $form;
+ } else {
+ Zend_Layout::resetMvcInstance();
+ $this->view->addHelperPath('Gems/JQuery/View/Helper', 'Gems_JQuery_View_Helper');
+ $this->view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper');
+ $this->html->raw($form->render($this->view));
+
+ //Now add all onload actions to make the form still work
+ $actions = $this->view->jQuery()->getOnLoadActions();
+ $this->html->raw('<script type="text/javascript">');
+ foreach($actions as $action) {
+ $this->html->raw($action);
+ }
+ $this->html->raw('</script>');
+ }
+ }
+ }
+
+ /**
+ * Handle the form
+ *
+ * @param type $saveLabel
+ * @param type $data
+ * @return type
+ */
+ public function processForm($saveLabel = null, $data = null)
+ {
+ $request = $this->getRequest();
+
+ if ($request->isPost()) {
+ $data = $request->getPost() + (array) $data;
+ } else {
+ //Set the defaults for the form here
+ $data = $this->export->getDefaults();
+ }
+
+ $form = $this->getForm($data);
+
+ $form->setAttrib('id', 'autosubmit');
+ $form->setAutoSubmit(MUtil_Html::attrib('href', array('action' => 'index', MUtil_Model::TEXT_FILTER => null, 'RouteReset' => true)), 'mainform');
+ //$this->html[] = new Gems_JQuery_AutoSubmitForm(MUtil_Html::attrib('href', array('action' => 'index', MUtil_Model::TEXT_FILTER => null, 'RouteReset' => true)), 'mainform', $form);
+
+ if ($request->isPost()) {
+ $form->populate($data);
+ }
+
+ if ($data) {
+ $form->populate($data);
+ }
+ return $form;
+ }
+
+ /**
+ * Retrieve the form
+ *
+ * @param array $data
+ * @return Gems_Form
+ */
+ public function getForm(&$data)
+ {
+ //Read some data from tables, initialize defaults...
+ $surveys = $this->db->fetchPairs('SELECT gsu_id_survey, gsu_survey_name FROM gems__surveys WHERE gsu_active = 1 ORDER BY gsu_survey_name');
+ $organizations = $this->escort->getAllowedOrganizations();
+ $types = $this->export->getExportClasses();
+
+ //Create the basic form
+ $form = new Gems_Form_TableForm();
+ $form->loadDefaultDecorators();
+ $form->removeDecorator('TabPane');
+
+ //Start adding elements
+ $element = new Zend_Form_Element_Select('sid');
+ $element->setLabel($this->_('Survey'))
+ ->setMultiOptions($surveys);
+ $elements[] = $element;
+
+ //Add a field to the form showing the record count. If this is too slow for large recordsets
+ //then remove it or make it more efficient
+ unset($data['records']);
+ if (isset($data['sid'])) {
+ $gsu_id = intval($data['sid']);
+ $survey = $this->loader->getTracker()->getSurvey($gsu_id);
+
+ $filter = $this->_getFilter($data);
+ $answers = $survey->getRawTokenAnswerRows($filter);
+ } else {
+ $answers = array();
+ }
+ $element = new MUtil_Form_Element_Exhibitor('records');
+ $element->setValue(sprintf($this->_('%s records found.'), count($answers)));
+ $elements[] = $element;
+
+ $element = new Zend_Form_Element_MultiCheckbox('oid');
+ $element->setLabel($this->_('Organization'))
+ ->setMultiOptions($organizations);
+ $elements[] = $element;
+ $element = new Gems_JQuery_Form_Element_ToggleCheckboxes('toggleOrg', array('selector'=>'input[name^=oid]'));
+ $element->setLabel('Toggle');
+ $elements[] = $element;
+
+ $element = new Zend_Form_Element_Select('type');
+ $element->setLabel($this->_('Export to'))
+ ->setMultiOptions($types);
+ $elements[] = $element;
+
+ //Add all elements to the form
+ $form->addElements($elements);
+ unset($elements);
+
+ //Now make a change for the selected export type
+ if (isset($data['type'])) {
+ $exportClass = $this->export->getExport($data['type']);
+ $formFields = $exportClass->getFormElements($form, $data);
+ $exportName = $exportClass->getName();
+ //Now add a hidden field so we know that when this is present in the $data
+ //we don't need to set the defaults
+ $formFields[] = new Zend_Form_Element_Hidden($exportName);
+ foreach ($formFields as $formField) {
+ $formField->setBelongsTo($exportName);
+ $form->addElement($formField);
+ }
+
+ if (!isset($data[$exportName])) {
+ $data[$exportName] = $exportClass->getDefaults();
+ }
+ }
+
+ //Finally create a submit button and add to the form
+ $element = new Zend_Form_Element_Submit('export');
+ $element->setLabel('Export')
+ ->setAttrib('class', 'button');
+ $form->addElement($element);
+
+ return $form;
+ }
+
+ /**
+ * Take care of exporting the data
+ *
+ * @param array $data
+ */
+ public function handleExport($data)
+ {
+ $language = $this->locale->getLanguage();
+ $emptyMsg = sprintf($this->_('No %s found.'), $this->getTopic(0));
+ $gsu_id = intval($data['sid']);
+ $survey = $this->loader->getTracker()->getSurvey($gsu_id);
+
+ $filter = $this->_getFilter($data);
+ $answers = $survey->getRawTokenAnswerRows($filter);
+ $answerModel = $survey->getAnswerModel($language);
+ //Now add the organization id => name mapping
+ $answerModel->set('organizationid', 'multiOptions', $this->escort->getAllowedOrganizations());
+
+ if (count($answers) === 0) {
+ $answers[0] = array('' => $emptyMsg);
+ }
+
+ if (isset($data['type'])) {
+ //Do the logging
+ $message = join(', ', $data);
+ Gems_AccessLog::getLog()->log('export', $this->getRequest(), $message, null, true);
+
+ //And delegate the export to the right class
+ $exportClass = $this->export->getExport($data['type']);
+ $exportClass->handleExport($data, $survey, $answers, $answerModel, $language);
+ }
+ }
+
+ public function _getFilter($data) {
+ $filter = array();
+ if (isset($data['oid'])) {
+ $filter['organizationid'] = $data['oid'];
+ } else {
+ //Invalid id so when nothing selected... we get nothing
+ //$filter['organizationid'] = '-1';
+ }
+ $filter['consentcode'] = array_diff((array) $this->util->getConsentTypes(), (array) $this->util->getConsentRejected());
+
+ return $filter;
+ }
+}
\ No newline at end of file
Added: trunk/library/classes/Gems/Export/Excel.php
===================================================================
--- trunk/library/classes/Gems/Export/Excel.php (rev 0)
+++ trunk/library/classes/Gems/Export/Excel.php 2011-09-16 08:03:15 UTC (rev 29)
@@ -0,0 +1,138 @@
+<?php
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Short description of file
+ *
+ * @package Gems
+ * @subpackage Export
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Excel.php 140 2011-09-15 14:18:14Z 175780 $
+ */
+
+/**
+ * Short description for Excel
+ *
+ * Long description for class Excel (if any)...
+ *
+ * @package Gems
+ * @subpackage Export
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class Gems_Export_Excel extends Gems_Export_ExportAbstract
+{
+ /**
+ * Return an array of Form Elements for this specific export
+ *
+ * @param type $form
+ * @param type $data
+ * @return array of Zend_Form_Element
+ */
+ public function getFormElements(&$form, &$data)
+ {
+ $element = new Zend_Form_Element_MultiCheckbox('format');
+ $element->setLabel($this->_('Excel options'))
+ ->setMultiOptions(array(
+ 'formatVariable' => $this->_('Export questions instead of variable names'),
+ 'formatAnswer' => $this->_('Format answers')
+ ));
+ $elements[] = $element;
+
+ return $elements;
+ }
+
+ /**
+ * Sets the default form values when this export type is first chosen
+ *
+ * @return array
+ */
+ public function getDefaults()
+ {
+ return array('format'=>array('formatVariable', 'formatAnswer'));
+ }
+
+ /**
+ * Returns the unique name for this class
+ *
+ * It will be used for handling this export's specific options
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ return 'excel';
+ }
+
+ /**
+ * This method handles the export with the given options
+ *
+ * The method takes care of rendering the right script by using $this->export->controller to
+ * access the controller object.
+ *
+ * @param array $data The formdata
+ * @param Gems_Tracker_Survey $survey The survey object we are exporting
+ * @param array $answers The array of answers
+ */
+ public function handleExport($data, $survey, $answers, $answerModel, $language)
+ {
+ $questions = $survey->getQuestionList($language);
+ if (isset($data[$this->getName()])) {
+ $options = $data[$this->getName()];
+ if (isset($options['format'])) {
+ $options = $options['format'];
+ }
+ } else {
+ $options = array();
+ }
+
+ if (in_array('formatVariable', $options)) {
+ //@@TODO This breaks date formatting, think of a way to fix this, check out the spss exports for
+ //a more direct export, also check UTF-8 differences between view / direct output
+ foreach ($answers[0] as $key => $value) {
+ if (isset($questions[$key])) {
+ $headers[0][$key] = $questions[$key];
+ } else {
+ $headers[0][$key] = $key;
+ }
+ }
+ } else {
+ $headers[0] = array_keys($answers[0]);
+ }
+ $answers = array_merge($headers, $answers);
+
+ if (in_array('formatAnswer', $options)) {
+ $answers = new Gems_FormattedData($answers, $answerModel);
+ }
+
+ $this->view->result = $answers;
+ $this->view->filename = $survey->getName() . '.xls';
+ $this->view->setScriptPath(GEMS_LIBRARY_DIR . '/views/scripts');
+ $this->export->controller->render('excel',null,true);
+ }
+}
\ No newline at end of file
Added: trunk/library/classes/Gems/Export/ExportAbstract.php
===================================================================
--- trunk/library/classes/Gems/Export/ExportAbstract.php (rev 0)
+++ trunk/library/classes/Gems/Export/ExportAbstract.php 2011-09-16 08:03:15 UTC (rev 29)
@@ -0,0 +1,84 @@
+<?php
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Short description of file
+ *
+ * @package Gems
+ * @subpackage Export
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: ExportAbstract.php 128 2011-08-12 12:33:14Z 175780 $
+ */
+
+/**
+ * Short description for ExportAbstract
+ *
+ * Long description for class ExportAbstract (if any)...
+ *
+ * @package Gems
+ * @subpackage Export
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+abstract class Gems_Export_ExportAbstract extends Gems_Loader_TargetLoaderAbstract implements Gems_Export_ExportInterface
+{
+ /**
+ * Variable needed to access the controller functions
+ *
+ * $this->export->controller
+ *
+ * @var Gems_Export
+ */
+ public $export;
+
+ /**
+ * @var Zend_Translate
+ */
+ public $translate;
+
+ /**
+ * @var Zend_View
+ */
+ public $view;
+
+ /**
+ * Copy from Zend_Translate_Adapter
+ *
+ * Translates the given string
+ * returns the translation
+ *
+ * @param string $text Translation string
+ * @param string|Zend_Locale $locale (optional) Locale/Language to use, identical with locale
+ * identifier, @see Zend_Locale for more information
+ * @return string
+ */
+ public function _($text, $locale = null)
+ {
+ return $this->translate->_($text, $locale);
+ }
+}
\ No newline at end of file
Added: trunk/library/classes/Gems/Export/ExportInterface.php
===================================================================
--- trunk/library/classes/Gems/Export/ExportInterface.php (rev 0)
+++ trunk/library/classes/Gems/Export/ExportInterface.php 2011-09-16 08:03:15 UTC (rev 29)
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @package Gems
+ * @subpackage Export
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: ExportInterface.php 128 2011-08-12 12:33:14Z 175780 $
+ */
+
+/**
+ * The export interface
+ *
+ * Exporting survey-data can be done for various sorts of output formats, this interface
+ * describes the methods needed to implement an output format
+ *
+ * @package Gems
+ * @subpackage Export
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+interface Gems_Export_ExportInterface
+{
+ /**
+ * Return an array of Form Elements for this specific export
+ *
+ * @param type $form
+ * @param type $data
+ * @return array of Zend_Form_Element
+ */
+ public function getFormElements(&$form, &$data);
+
+ /**
+ * Sets the default form values when this export type is first chosen
+ *
+ * @return array
+ */
+ public function getDefaults();
+
+ /**
+ * Returns the unique name for this class
+ *
+ * It will be used for handling this export's specific options
+ *
+ * @return string
+ */
+ public function getName();
+
+ /**
+ * This method handles the export with the given options
+ *
+ * The method takes care of rendering the right script by using $this->export->controller to
+ * access the controller object.
+ *
+ * @param array $data The formdata
+ * @param Gems_Tracker_Survey $survey The survey object we are exporting
+ * @param array $answers The array of answers
+ * @param MUtil_Model_ModelAbstract $answerModel The modified answermodel that includes info about extra attributes
+ * @param string $language The language used / to use for the export
+ */
+ public function handleExport($data, $survey, $answers, $answerModel, $language);
+}
\ No newline at end of file
Added: trunk/library/classes/Gems/Export/ExportModel.php
===================================================================
--- trunk/library/classes/Gems/Export/ExportModel.php (rev 0)
+++ trunk/library/classes/Gems/Export/ExportModel.php 2011-09-16 08:03:15 UTC (rev 29)
@@ -0,0 +1,80 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Short description of file
+ *
+ * @package Gems
+ * @subpackage Export
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: ExportModel.php 138 2011-09-15 10:44:24Z 175780 $
+ */
+
+/**
+ * Short description for ExportModel
+ *
+ * Long description for class ExportModel (if any)...
+ *
+ * @package Gems
+ * @subpackage Export
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class Gems_Export_ExportModel extends MUtil_Model_ModelAbstract
+{
+
+ public function __construct()
+ {
+ parent::__construct('export');
+ }
+
+ public function delete($filter = true)
+ {
+ return false;
+ }
+
+ public function hasNew()
+ {
+ return false;
+ }
+
+ public function load($filter = true, $sort = true)
+ {
+ $result = array();
+ foreach ($this->getItemsOrdered() as $item) {
+ $result[0][$item] = $item;
+ }
+ return $result;
+ }
+
+ public function save(array $newValues, array $filter = null)
+ {
+ return $newValues;
+ }
+}
\ No newline at end of file
Added: trunk/library/classes/Gems/Export/Spss.php
===================================================================
--- trunk/library/classes/Gems/Export/Spss.php (rev 0)
+++ trunk/library/classes/Gems/Export/Spss.php 2011-09-16 08:03:15 UTC (rev 29)
@@ -0,0 +1,270 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Short description of file
+ *
+ * @package Gems
+ * @subpackage Export
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Spss.php 140 2011-09-15 14:18:14Z 175780 $
+ */
+
+/**
+ * Short description for Spss
+ *
+ * Long description for class Spss (if any)...
+ *
+ * @package Gems
+ * @subpackage Export
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class Gems_Export_Spss extends Gems_Export_ExportAbstract
+{
+
+ public function getDefaults()
+ {
+ return array('file'=>'data');
+ }
+
+ public function getFormElements(&$form, &$data)
+ {
+ $element = new Zend_Form_Element_Radio('file');
+ $eleme...
[truncated message content] |
|
From: <gem...@li...> - 2011-09-16 15:15:03
|
Revision: 32
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=32&view=rev
Author: matijsdejong
Date: 2011-09-16 15:14:56 +0000 (Fri, 16 Sep 2011)
Log Message:
-----------
- sorted function names TemplateMailer.php
- extended existing logging with template id & from address
Modified Paths:
--------------
trunk/library/classes/Gems/Email/EmailFormAbstract.php
trunk/library/classes/Gems/Email/TemplateMailer.php
trunk/library/classes/GemsEscort.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__respondent_communications.60.sql
Modified: trunk/library/classes/Gems/Email/EmailFormAbstract.php
===================================================================
--- trunk/library/classes/Gems/Email/EmailFormAbstract.php 2011-09-16 08:28:47 UTC (rev 31)
+++ trunk/library/classes/Gems/Email/EmailFormAbstract.php 2011-09-16 15:14:56 UTC (rev 32)
@@ -486,6 +486,7 @@
$this->mailer->setMethod($this->getValue('multi_method'));
$this->mailer->setSubject($this->getValue('gmt_subject'));
$this->mailer->setBody($this->getValue('gmt_body'));
+ $this->mailer->setTemplateId($this->getValue('select_subject'));
$result = $this->mailer->process($this->getTokensData());
Modified: trunk/library/classes/Gems/Email/TemplateMailer.php
===================================================================
--- trunk/library/classes/Gems/Email/TemplateMailer.php 2011-09-16 08:28:47 UTC (rev 31)
+++ trunk/library/classes/Gems/Email/TemplateMailer.php 2011-09-16 15:14:56 UTC (rev 32)
@@ -66,6 +66,7 @@
private $_subject = null;
private $_body = null;
private $_method = 'M';
+ private $_templateId = null; // Not used for lookup
private $_tokenData = array();
private $_verbose = false;
@@ -86,11 +87,45 @@
return $this;
}
+ /**
+ * Replaces fields with their values
+ * @param string $value
+ * @return string
+ */
+ public function applyFields($value)
+ {
+ if (! $this->_mailFields) {
+ $this->getTokenMailFields();
+ }
+ if (! $this->_mailKeys) {
+ $this->_mailKeys = array_keys($this->_mailFields);
+ }
+
+ return str_replace($this->_mailKeys, $this->_mailFields, $value);
+ }
+
+ /**
+ * Returns true if the "email.bounce" setting exists in the project
+ * configuration and is true
+ * @return boolean
+ */
+ public function bounceCheck()
+ {
+ return isset($this->escort->project->email['bounce']) && $this->escort->project->email['bounce'];
+ }
+
+ /**
+ * Returns Zend_Mail_Transport_Abstract when something else than the default mail protocol should be used.
+ *
+ * @staticvar array $mailServers
+ * @param email address $from
+ * @return Zend_Mail_Transport_Abstract or null
+ */
public function checkTransport($from)
{
static $mailServers = array();
- if (!array_key_exists($from, $mailServers)) {
+ if (! array_key_exists($from, $mailServers)) {
$sql = 'SELECT * FROM gems__mail_servers WHERE ? LIKE gms_from ORDER BY LENGTH(gms_from) DESC LIMIT 1';
// Always set cache, se we know when not to check for this row.
@@ -138,31 +173,13 @@
return $this->messages;
}
- /**
- * Returns true if the "email.bounce" setting exists in the project
- * configuration and is true
- * @return boolean
- */
- public function bounceCheck()
+ public function getTokenMailFields()
{
- return isset($this->escort->project->email['bounce']) && $this->escort->project->email['bounce'];
- }
-
- /**
- * Replaces fields with their values
- * @param string $value
- * @return string
- */
- public function applyFields($value)
- {
if (! $this->_mailFields) {
- $this->getTokenMailFields();
+ $this->_mailFields = $this->escort->tokenMailFields($this->_tokenData);
}
- if (! $this->_mailKeys) {
- $this->_mailKeys = array_keys($this->_mailFields);
- }
- return str_replace($this->_mailKeys, $this->_mailFields, $value);
+ return $this->_mailFields;
}
/**
@@ -184,68 +201,6 @@
}
/**
- * Sets verbose (noisy) operation
- * @param boolean $verbose
- */
- public function setVerbose($verbose)
- {
- $this->_verbose = $verbose;
- }
-
- /**
- * Sets sender (regular e-mail address) or one of:
- * 'O' - Uses the contact information of the selected organization
- * 'S' - Uses the site-wide contact information
- * 'U' - Uses the contact information of the currently logged in user
- *
- * @param string $from
- */
- public function setFrom($from)
- {
- $this->_from = $from;
- }
-
- /**
- * Sets a list of tokens
- * @param string[] $tokens
- */
- public function setTokens(array $tokens)
- {
- $this->_tokens = $tokens;
- }
-
- /**
- * Sets the sending method to use
- * 'M' - Send multiple mails per respondent, one for each checked token.
- * 'O' - Send one mail per respondent, mark all checked tokens as send.
- * 'A' - Send one mail per respondent, mark only mailed tokens as send.
- *
- * @param string $method
- */
- public function setMethod($method)
- {
- $this->_method = $method;
- }
-
- /**
- * Sets the subject of the mail
- * @param string $subject
- */
- public function setSubject($subject)
- {
- $this->_subject = $subject;
- }
-
- /**
- * Sets the body of the mail
- * @param string $body
- */
- public function setBody($body)
- {
- $this->_body = $body;
- }
-
- /**
* Processes an array of token data and sends e-mails
* @param array $tokensData
* @return boolean
@@ -279,7 +234,10 @@
$ucount = 0;
foreach ($tokensData as $tokenData) {
+ // Should this token be mailed?
if (in_array($tokenData['gto_id_token'], $this->_tokens)) {
+
+ // Should all tokens be mailed or is this the first?
if ($mailAll || (! isset($send[$tokenData['grs_email']]))) {
if ($message = $this->processMail($tokenData)) {
@@ -347,7 +305,7 @@
if ($message = $this->sendMail($to, $to_name, $from, $from_name, $tokenData)) {
return $message;
} else {
- $this->updateToken($tokenData);
+ $this->updateToken($tokenData, $to, $from);
return false;
}
}
@@ -395,59 +353,67 @@
try {
$mail->send($this->checkTransport($from));
- return false;
+ $result = false;
} catch (Exception $e) {
- return $e->getMessage();
+ $result = $e->getMessage();
+
+ // Log to error file
+ $this->escort->logger->logError($e, $this->escort->request);
}
+
+ return $result;
}
/**
- * Updates a token
- * @param array $tokenData
- * @param string $subject
+ * Sets the body of the mail
+ * @param string $body
*/
- protected function updateToken(array $tokenData, $subject = null)
+ public function setBody($body)
{
- if (null === $subject) {
- $subject = $this->_mailSubject;
- } else {
- $this->_mailSubject = $subject;
- }
+ $this->_body = $body;
+ }
- if (null === $this->_changeDate) {
- $this->_changeDate = new Zend_Db_Expr('CURRENT_TIMESTAMP');
- }
+ /**
+ * Sets sender (regular e-mail address) or one of:
+ * 'O' - Uses the contact information of the selected organization
+ * 'S' - Uses the site-wide contact information
+ * 'U' - Uses the contact information of the currently logged in user
+ *
+ * @param string $from
+ */
+ public function setFrom($from)
+ {
+ $this->_from = $from;
+ }
- $db = $this->escort->db;
- $uid = $this->escort->session->user_id;
+ /**
+ * Sets the sending method to use
+ * 'M' - Send multiple mails per respondent, one for each checked token.
+ * 'O' - Send one mail per respondent, mark all checked tokens as send.
+ * 'A' - Send one mail per respondent, mark only mailed tokens as send.
+ *
+ * @param string $method
+ */
+ public function setMethod($method)
+ {
+ $this->_method = $method;
+ }
- $tdata['gto_mail_sent_date'] = $this->_mailDate;
-
- $db->update('gems__tokens', $tdata, $db->quoteInto('gto_id_token = ?', $tokenData['gto_id_token']));
-
- $cdata['grco_id_to'] = $tokenData['grs_id_user'];
- $cdata['grco_id_by'] = $uid;
- $cdata['grco_organization'] = $tokenData['gor_id_organization'];
- $cdata['grco_id_token'] = $tokenData['gto_id_token'];
- $cdata['grco_method'] = 'email';
- $cdata['grco_topic'] = substr($subject, 0, 120);
- $cdata['grco_address'] = substr($tokenData['grs_email'], 0, 120);
- $cdata['grco_changed'] = $this->_changeDate;
- $cdata['grco_changed_by'] = $uid;
- $cdata['grco_created'] = $this->_changeDate;
- $cdata['grco_created_by'] = $uid;
-
- $db->insert('gems__respondent_communications', $cdata);
+ /**
+ * Sets the subject of the mail
+ * @param string $subject
+ */
+ public function setSubject($subject)
+ {
+ $this->_subject = $subject;
}
- public function getTokenMailFields()
+ public function setTemplateId($templatedId)
{
- if (! $this->_mailFields) {
- $this->_mailFields = $this->escort->tokenMailFields($this->_tokenData);
- }
+ $this->_templateId = $templatedId;
- return $this->_mailFields;
+ return $this;
}
public function setTokenData(array $tokenData)
@@ -470,4 +436,65 @@
return $this->_mailFields;
}
+
+ /**
+ * Sets a list of tokens
+ * @param string[] $tokens
+ */
+ public function setTokens(array $tokens)
+ {
+ $this->_tokens = $tokens;
+ }
+
+ /**
+ * Sets verbose (noisy) operation
+ *
+ * @param boolean $verbose
+ */
+ public function setVerbose($verbose)
+ {
+ $this->_verbose = $verbose;
+ }
+
+ /**
+ * Updates a token and log's the communication
+ *
+ * @param array $tokenData
+ * @param string $to Optional, if available the communication is logged.
+ * @param string $from Optional
+ */
+ protected function updateToken(array $tokenData, $to = null, $from = null)
+ {
+ if (null === $this->_changeDate) {
+ $this->_changeDate = new Zend_Db_Expr('CURRENT_TIMESTAMP');
+ }
+
+ $db = $this->escort->db;
+ $uid = $this->escort->getCurrentUserId();
+
+ $tdata['gto_mail_sent_date'] = $this->_mailDate;
+
+ $db->update('gems__tokens', $tdata, $db->quoteInto('gto_id_token = ?', $tokenData['gto_id_token']));
+
+ if ($to) {
+ $cdata['grco_id_to'] = $tokenData['grs_id_user'];
+ $cdata['grco_id_by'] = $uid;
+ $cdata['grco_organization'] = $tokenData['gor_id_organization'];
+ $cdata['grco_id_token'] = $tokenData['gto_id_token'];
+
+ $cdata['grco_method'] = 'email';
+ $cdata['grco_topic'] = substr($this->_mailSubject, 0, 120);
+ $cdata['grco_address'] = substr($to, 0, 120);
+ $cdata['grco_sender'] = substr($from, 0, 120);
+
+ $cdata['grco_id_message'] = $this->_templateId;
+
+ $cdata['grco_changed'] = $this->_changeDate;
+ $cdata['grco_changed_by'] = $uid;
+ $cdata['grco_created'] = $this->_changeDate;
+ $cdata['grco_created_by'] = $uid;
+
+ $db->insert('gems__respondent_communications', $cdata);
+ }
+ }
}
Modified: trunk/library/classes/GemsEscort.php
===================================================================
--- trunk/library/classes/GemsEscort.php 2011-09-16 08:28:47 UTC (rev 31)
+++ trunk/library/classes/GemsEscort.php 2011-09-16 15:14:56 UTC (rev 32)
@@ -1090,6 +1090,10 @@
return $allowedOrganizations;
}
+ /**
+ *
+ * @return int The current active organization id or 0 when not known
+ */
public function getCurrentOrganization()
{
if ($this instanceof Gems_Project_Organization_MultiOrganizationInterface) {
@@ -1100,9 +1104,26 @@
return $this->getRespondentOrganization();
}
- return $this->session->user_organization_id;
+ if (isset($this->session->user_organization_id)) {
+ return $this->session->user_organization_id;
+ } else {
+ return 0;
+ }
}
+ /**
+ *
+ * @return int The current user id or 0 when not known.
+ */
+ public function getCurrentUserId()
+ {
+ if (isset($this->session->user_id)) {
+ return $this->session->user_id;
+ } else {
+ return 0;
+ }
+ }
+
public function getDatabasePaths()
{
$path = APPLICATION_PATH . '/configs/db';
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-09-16 08:28:47 UTC (rev 31)
+++ trunk/library/configs/db/patches.sql 2011-09-16 15:14:56 UTC (rev 32)
@@ -190,3 +190,6 @@
-- PATCH: Organization codes
ALTER TABLE `gems__organizations` ADD gor_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' AFTER gor_name;
+-- PATCH: Extra log
+ALTER TABLE gems__respondent_communications ADD grco_sender varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER grco_address;
+ALTER TABLE gems__respondent_communications ADD grco_id_message bigint unsigned null references gems__mail_templates (gmt_id_message) AFTER grco_comments;
Modified: trunk/library/configs/db/tables/gems__respondent_communications.60.sql
===================================================================
--- trunk/library/configs/db/tables/gems__respondent_communications.60.sql 2011-09-16 08:28:47 UTC (rev 31)
+++ trunk/library/configs/db/tables/gems__respondent_communications.60.sql 2011-09-16 15:14:56 UTC (rev 32)
@@ -11,8 +11,11 @@
grco_method varchar(12) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
grco_topic varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
grco_address varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ grco_sender varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
grco_comments varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ grco_id_message bigint unsigned null references gems__mail_templates (gmt_id_message),
+
grco_changed timestamp not null default current_timestamp,
grco_changed_by bigint unsigned not null,
grco_created timestamp not null,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-09-20 15:42:19
|
Revision: 51
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=51&view=rev
Author: matijsdejong
Date: 2011-09-20 15:42:08 +0000 (Tue, 20 Sep 2011)
Log Message:
-----------
- put the log into respondent_communications table name
- added template save to OneMailForm.php
- made temporary old style controller for mail log
Modified Paths:
--------------
trunk/library/classes/Gems/Default/MailLogAction.php
trunk/library/classes/Gems/Default/RespondentAction.php
trunk/library/classes/Gems/Email/OneMailForm.php
trunk/library/classes/Gems/Email/TemplateMailer.php
trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php
trunk/library/configs/db/patches.sql
trunk/library/controllers/MailLogController.php
trunk/library/languages/default-en.mo
trunk/library/languages/default-en.po
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
Added Paths:
-----------
trunk/library/classes/Gems/Default/MailLogActionOldStyle.php
trunk/library/configs/db/tables/gems__log_respondent_communications.500.sql
trunk/library/configs/db/tables/gems__mail_jobs.300.sql
Removed Paths:
-------------
trunk/library/configs/db/tables/gems__respondent_communications.60.sql
Modified: trunk/library/classes/Gems/Default/MailLogAction.php
===================================================================
--- trunk/library/classes/Gems/Default/MailLogAction.php 2011-09-20 14:55:25 UTC (rev 50)
+++ trunk/library/classes/Gems/Default/MailLogAction.php 2011-09-20 15:42:08 UTC (rev 51)
@@ -62,16 +62,44 @@
*/
public function createModel($detailed, $action)
{
- $model = new MUtil_Model_TableModel('gems__respondent_communications');
+ $model = new Gems_Model_JoinModel('maillog', 'gems__log_respondent_communications');
- // $model->set('grco_id_to', 'label', $this->_(''));
- // $model->set('grco_id_by', 'label', $this->_(''));
- $model->set('grco_address', 'label', $this->_('To'));
- $model->set('grco_sender', 'label', $this->_('From'));
- $model->set('grco_topic', 'label', $this->_('Subject'));
- $model->set('grco_created', 'label', $this->_('Date sent'));
- // $model->set('', 'label', $this->_(''));
+ $model->addLeftTable('gems__respondents', array('grco_id_to' => 'grs_id_user'));
+ $model->addLeftTable('gems__staff', array('grco_id_by' => 'gsf_id_user'));
+ $model->addLeftTable('gems__mail_templates', array('grco_id_message' => 'gmt_id_message'));
+ $model->addColumn(
+ "TRIM(CONCAT(COALESCE(CONCAT(grs_last_name, ', '), '-, '), COALESCE(CONCAT(grs_first_name, ' '), ''), COALESCE(grs_surname_prefix, '')))",
+ 'respondent_name');
+ $model->addColumn(
+ "CASE WHEN gems__staff.gsf_id_user IS NULL
+ THEN '-'
+ ELSE
+ CONCAT(
+ COALESCE(gems__staff.gsf_last_name, ''),
+ ', ',
+ COALESCE(gems__staff.gsf_first_name, ''),
+ COALESCE(CONCAT(' ', gems__staff.gsf_surname_prefix), '')
+ )
+ END",
+ 'assigned_by');
+
+ $model->resetOrder();
+
+ $model->set('grco_created', 'label', $this->_('Date sent'));
+ $model->set('respondent_name', 'label', $this->_('Receiver'));
+ $model->set('grco_address', 'label', $this->_('To address'), 'itemDisplay', 'MUtil_Html_AElement::ifmail');
+ $model->set('assigned_by', 'label', $this->_('Sender'));
+ $model->set('grco_sender', 'label', $this->_('From address'), 'itemDisplay', 'MUtil_Html_AElement::ifmail');
+ $model->set('grco_id_token', 'label', $this->_('Token'));
+ $model->set('grco_topic', 'label', $this->_('Subject'));
+
+ if ($detailed) {
+ $model->set('gmt_subject', 'label', $this->_('Template'));
+ } else {
+ $model->set('grco_created', 'formatFunction', $this->util->getTranslated()->formatDate);
+ }
+
return $model;
}
Added: trunk/library/classes/Gems/Default/MailLogActionOldStyle.php
===================================================================
--- trunk/library/classes/Gems/Default/MailLogActionOldStyle.php (rev 0)
+++ trunk/library/classes/Gems/Default/MailLogActionOldStyle.php 2011-09-20 15:42:08 UTC (rev 51)
@@ -0,0 +1,150 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Short description of file
+ *
+ * @package Gems
+ * @subpackage Default
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ * Temprary class until Gems_Controller_ModelSnippetActionAbstract works
+ *
+ * @package Gems
+ * @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.2
+ */
+class Gems_Default_MailLogActionOldStyle extends Gems_Controller_BrowseEditAction
+{
+ public $sortKey = array('grco_created' => SORT_DESC);
+
+ /**
+ * Adds columns from the model to the bridge that creates the browse table.
+ *
+ * Adds a button column to the model, if such a button exists in the model.
+ *
+ * @param MUtil_Model_TableBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @rturn void
+ */
+ protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model)
+ {
+ if ($menuItem = $this->findAllowedMenuItem('show')) {
+ $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge));
+ }
+
+ // Newline placeholder
+ $br = MUtil_Html::create('br');
+
+ $bridge->addMultiSort('grco_created', $br, 'respondent_name', $br, 'grco_address');
+ $bridge->addMultiSort('grco_id_token', $br, 'assigned_by', $br, 'grco_sender');
+ $bridge->addMultiSort('grco_topic');
+ }
+
+ /**
+ * Creates a model for getModel(). Called only for each new $action.
+ *
+ * The parameters allow you to easily adapt the model to the current action. The $detailed
+ * parameter was added, because the most common use of action is a split between detailed
+ * and summarized actions.
+ *
+ * @param boolean $detailed True when the current action is not in $summarizedActions.
+ * @param string $action The current action.
+ * @return MUtil_Model_ModelAbstract
+ */
+ public function createModel($detailed, $action)
+ {
+ $model = new Gems_Model_JoinModel('maillog', 'gems__log_respondent_communications');
+
+ $model->addLeftTable('gems__respondents', array('grco_id_to' => 'grs_id_user'));
+ $model->addLeftTable('gems__staff', array('grco_id_by' => 'gsf_id_user'));
+ $model->addLeftTable('gems__mail_templates', array('grco_id_message' => 'gmt_id_message'));
+
+ $model->addColumn(
+ "TRIM(CONCAT(COALESCE(CONCAT(grs_last_name, ', '), '-, '), COALESCE(CONCAT(grs_first_name, ' '), ''), COALESCE(grs_surname_prefix, '')))",
+ 'respondent_name');
+ $model->addColumn(
+ "CASE WHEN gems__staff.gsf_id_user IS NULL
+ THEN '-'
+ ELSE
+ CONCAT(
+ COALESCE(gems__staff.gsf_last_name, ''),
+ ', ',
+ COALESCE(gems__staff.gsf_first_name, ''),
+ COALESCE(CONCAT(' ', gems__staff.gsf_surname_prefix), '')
+ )
+ END",
+ 'assigned_by');
+
+ $model->resetOrder();
+
+ $model->set('grco_created', 'label', $this->_('Date sent'));
+ $model->set('respondent_name', 'label', $this->_('Receiver'));
+ $model->set('grco_address', 'label', $this->_('To address'), 'itemDisplay', 'MUtil_Html_AElement::ifmail');
+ $model->set('assigned_by', 'label', $this->_('Sender'));
+ $model->set('grco_sender', 'label', $this->_('From address'), 'itemDisplay', 'MUtil_Html_AElement::ifmail');
+ $model->set('grco_id_token', 'label', $this->_('Token'));
+ $model->set('grco_topic', 'label', $this->_('Subject'));
+
+ if ($detailed) {
+ $model->set('gmt_subject', 'label', $this->_('Template'));
+ } else {
+ $model->set('grco_created', 'formatFunction', $this->util->getTranslated()->formatDate);
+ }
+
+ return $model;
+ }
+
+ /**
+ * Helper function to allow generalized statements about the items in the model.
+ *
+ * @param int $count
+ * @return $string
+ */
+ public function getTopic($count = 1)
+ {
+ return $this->plural('Activity Log', 'Activity Logs', $count);
+ }
+
+
+ /**
+ * Helper function to allow generalized treatment of the header.
+ *
+ * return $string
+ */
+ public function getTopicTitle()
+ {
+ return $this->_('Mail Activity Log');
+ }
+}
Modified: trunk/library/classes/Gems/Default/RespondentAction.php
===================================================================
--- trunk/library/classes/Gems/Default/RespondentAction.php 2011-09-20 14:55:25 UTC (rev 50)
+++ trunk/library/classes/Gems/Default/RespondentAction.php 2011-09-20 15:42:08 UTC (rev 51)
@@ -59,6 +59,15 @@
public $useTabbedForms = true;
+ /**
+ * Adds columns from the model to the bridge that creates the browse table.
+ *
+ * Adds a button column to the model, if such a button exists in the model.
+ *
+ * @param MUtil_Model_TableBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @rturn void
+ */
protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model)
{
$model->setIfExists('gr2o_opened', 'tableDisplay', 'small');
Modified: trunk/library/classes/Gems/Email/OneMailForm.php
===================================================================
--- trunk/library/classes/Gems/Email/OneMailForm.php 2011-09-20 14:55:25 UTC (rev 50)
+++ trunk/library/classes/Gems/Email/OneMailForm.php 2011-09-20 15:42:08 UTC (rev 51)
@@ -134,6 +134,7 @@
$this->mailer->setSubject($this->getValue('gmt_subject'));
$this->mailer->setBody($this->getValue('gmt_body'));
+ $this->mailer->setTemplateId($this->getValue('select_subject'));
if ($message = $this->mailer->processMail($tokenData)) {
$this->addMessage($this->escort->_('Mail failed to send.'));
Modified: trunk/library/classes/Gems/Email/TemplateMailer.php
===================================================================
--- trunk/library/classes/Gems/Email/TemplateMailer.php 2011-09-20 14:55:25 UTC (rev 50)
+++ trunk/library/classes/Gems/Email/TemplateMailer.php 2011-09-20 15:42:08 UTC (rev 51)
@@ -481,7 +481,7 @@
$cdata['grco_id_by'] = $uid;
$cdata['grco_organization'] = $tokenData['gor_id_organization'];
$cdata['grco_id_token'] = $tokenData['gto_id_token'];
-
+
$cdata['grco_method'] = 'email';
$cdata['grco_topic'] = substr($this->_mailSubject, 0, 120);
$cdata['grco_address'] = substr($to, 0, 120);
@@ -494,7 +494,7 @@
$cdata['grco_created'] = $this->_changeDate;
$cdata['grco_created_by'] = $uid;
- $db->insert('gems__respondent_communications', $cdata);
+ $db->insert('gems__log_respondent_communications', $cdata);
}
}
}
Modified: trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php 2011-09-20 14:55:25 UTC (rev 50)
+++ trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php 2011-09-20 15:42:08 UTC (rev 51)
@@ -206,7 +206,7 @@
// Token items
$this->set('gto_id_token', 'label', $this->translate->_('Token'));
$this->set('gto_round_description', 'label', $this->translate->_('Round'));
- $this->set('gto_valid_from', 'label', $this->translate->_('Measure(d) on'), 'formatFunction', $translated->formatDateNever, 'tdClass', 'date');
+ $this->set('gto_valid_from', 'label', $this->translate->_('Measure(d) on'), 'formatFunction', $translated->formatDateNever, 'tdClass', 'date');
$this->set('gto_valid_until', 'label', $this->translate->_('Valid until'), 'formatFunction', $translated->formatDateForever, 'tdClass', 'date');
$this->set('gto_mail_sent_date', 'label', $this->translate->_('Last contact'), 'formatFunction', $translated->formatDateNever, 'tdClass', 'date');
$this->set('gto_completion_time', 'label', $this->translate->_('Completed'), 'formatFunction', $translated->formatDateNa, 'tdClass', 'date');
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-09-20 14:55:25 UTC (rev 50)
+++ trunk/library/configs/db/patches.sql 2011-09-20 15:42:08 UTC (rev 51)
@@ -190,6 +190,9 @@
-- PATCH: Organization codes
ALTER TABLE `gems__organizations` ADD gor_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' AFTER gor_name;
--- PATCH: Extra log
-ALTER TABLE gems__respondent_communications ADD grco_sender varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER grco_address;
-ALTER TABLE gems__respondent_communications ADD grco_id_message bigint unsigned null references gems__mail_templates (gmt_id_message) AFTER grco_comments;
+-- PATCH: Extra mail logging
+RENAME TABLE gems__respondent_communications TO gems__log_respondent_communications;
+
+ALTER TABLE gems__log_respondent_communications ADD grco_sender varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER grco_address;
+ALTER TABLE gems__log_respondent_communications ADD grco_id_message bigint unsigned null references gems__mail_templates (gmt_id_message) AFTER grco_comments;
+
Copied: trunk/library/configs/db/tables/gems__log_respondent_communications.500.sql (from rev 46, trunk/library/configs/db/tables/gems__respondent_communications.60.sql)
===================================================================
--- trunk/library/configs/db/tables/gems__log_respondent_communications.500.sql (rev 0)
+++ trunk/library/configs/db/tables/gems__log_respondent_communications.500.sql 2011-09-20 15:42:08 UTC (rev 51)
@@ -0,0 +1,29 @@
+
+CREATE TABLE if not exists gems__log_respondent_communications (
+ grco_id_action bigint unsigned not null auto_increment,
+
+ grco_id_to bigint unsigned not null references gems__respondents (grs_id_user),
+ grco_id_by bigint unsigned null default 0 references gems__staff (gsf_id_user),
+ grco_organization bigint unsigned not null references gems__organizations (gor_id_organization),
+
+ grco_id_token varchar(9) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null references gems__tokens (gto_id_token),
+
+ grco_method varchar(12) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
+ grco_topic varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
+ grco_address varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ grco_sender varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ grco_comments varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+
+ grco_id_message bigint unsigned null references gems__mail_templates (gmt_id_message),
+
+ grco_changed timestamp not null default current_timestamp,
+ grco_changed_by bigint unsigned not null,
+ grco_created timestamp not null,
+ grco_created_by bigint unsigned not null,
+
+ PRIMARY KEY (grco_id_action)
+ )
+ ENGINE=InnoDB
+ auto_increment = 200000
+ CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
+
Copied: trunk/library/configs/db/tables/gems__mail_jobs.300.sql (from rev 39, trunk/library/configs/db/tables/gems__mail_templates.200.sql)
===================================================================
--- trunk/library/configs/db/tables/gems__mail_jobs.300.sql (rev 0)
+++ trunk/library/configs/db/tables/gems__mail_jobs.300.sql 2011-09-20 15:42:08 UTC (rev 51)
@@ -0,0 +1,36 @@
+
+CREATE TABLE if not exists gems__mail_jobs (
+ gmj_id_message bigint unsigned not null auto_increment,
+
+ gmj_id_organization bigint unsigned not null
+ references gems__organizations (gor_id_organization),
+ gmj_id_message bigint unsigned not null
+ references gems__mail_templates (gmt_id_message),
+
+ gmj_id_user_as bigint unsigned not null
+ references gems__staff (gsf_id_user),
+
+ -- O Use organization from address
+ -- S Use site from address
+ -- U Use gmj_id_user_as from address
+ gmj_from_method varchar(1) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
+
+ -- M => multiple per respondent, one for each token
+ -- O => One per respondent, mark all tokens as send
+ -- U / A? => Send only one token, do not mark
+ gmj_process_method varchar(1) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
+
+ -- N => notmailed
+ -- R => reminder
+ gmj_filter_mode varchar(1) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
+
+ gmj_changed timestamp not null default current_timestamp on update current_timestamp,
+ gmj_changed_by bigint unsigned not null,
+ gmj_created timestamp not null default '0000-00-00 00:00:00',
+ gmj_created_by bigint unsigned not null,
+
+ PRIMARY KEY (gmj_id_message)
+ )
+ ENGINE=InnoDB
+ AUTO_INCREMENT = 800
+ CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
Deleted: trunk/library/configs/db/tables/gems__respondent_communications.60.sql
===================================================================
--- trunk/library/configs/db/tables/gems__respondent_communications.60.sql 2011-09-20 14:55:25 UTC (rev 50)
+++ trunk/library/configs/db/tables/gems__respondent_communications.60.sql 2011-09-20 15:42:08 UTC (rev 51)
@@ -1,29 +0,0 @@
-
-CREATE TABLE if not exists gems__respondent_communications (
- grco_id_action bigint unsigned not null auto_increment,
-
- grco_id_to bigint unsigned not null references gems__respondents (grs_id_user),
- grco_id_by bigint unsigned null default 0 references gems_staff (gsf_id_user),
- grco_organization bigint unsigned not null references gems__organizations (gor_id_organization),
-
- grco_id_token varchar(9) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null references gems__tokens (gto_id_token),
-
- grco_method varchar(12) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
- grco_topic varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
- grco_address varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
- grco_sender varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
- grco_comments varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
-
- grco_id_message bigint unsigned null references gems__mail_templates (gmt_id_message),
-
- grco_changed timestamp not null default current_timestamp,
- grco_changed_by bigint unsigned not null,
- grco_created timestamp not null,
- grco_created_by bigint unsigned not null,
-
- PRIMARY KEY (grco_id_action)
- )
- ENGINE=InnoDB
- auto_increment = 200000
- CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
-
Modified: trunk/library/controllers/MailLogController.php
===================================================================
--- trunk/library/controllers/MailLogController.php 2011-09-20 14:55:25 UTC (rev 50)
+++ trunk/library/controllers/MailLogController.php 2011-09-20 15:42:08 UTC (rev 51)
@@ -42,6 +42,6 @@
* @license New BSD License
* @since Class available since version 1.4.2
*/
-class MailLogController extends Gems_Default_MailLogAction
+class MailLogController extends Gems_Default_MailLogActionOldStyle
{
}
Modified: trunk/library/languages/default-en.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-en.po
===================================================================
--- trunk/library/languages/default-en.po 2011-09-20 14:55:25 UTC (rev 50)
+++ trunk/library/languages/default-en.po 2011-09-20 15:42:08 UTC (rev 51)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse EN\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-09-19 18:18+0100\n"
+"POT-Creation-Date: 2011-09-20 17:39+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -1069,7 +1069,6 @@
msgstr "Username"
#: classes/Gems/Default/IndexAction.php:105
-#: classes/Gems/Default/MailServerAction.php:88
msgid "Password"
msgstr "Password"
@@ -1225,7 +1224,8 @@
msgstr "Log maintenance"
#: classes/Gems/Default/MailAction.php:61
-#: classes/Gems/Default/MailLogAction.php:71
+#: classes/Gems/Default/MailLogAction.php:95
+#: classes/Gems/Default/MailLogActionOldStyle.php:118
msgid "Subject"
msgstr "Subject"
@@ -1243,22 +1243,47 @@
msgid "Email templates"
msgstr "Email templates"
-#: classes/Gems/Default/MailLogAction.php:69
-msgid "To"
-msgstr "To"
-
-#: classes/Gems/Default/MailLogAction.php:70
-msgid "From"
-msgstr "From"
-
-#: classes/Gems/Default/MailLogAction.php:72
+#: classes/Gems/Default/MailLogAction.php:89
+#: classes/Gems/Default/MailLogActionOldStyle.php:112
msgid "Date sent"
msgstr "Date sent"
-#: classes/Gems/Default/MailLogAction.php:80
+#: classes/Gems/Default/MailLogAction.php:90
+#: classes/Gems/Default/MailLogActionOldStyle.php:113
+msgid "Receiver"
+msgstr "Receiver"
+
+#: classes/Gems/Default/MailLogAction.php:91
+#: classes/Gems/Default/MailLogActionOldStyle.php:114
+msgid "To address"
+msgstr "To address"
+
+#: classes/Gems/Default/MailLogAction.php:92
+#: classes/Gems/Default/MailLogActionOldStyle.php:115
+msgid "Sender"
+msgstr "Sender"
+
+#: classes/Gems/Default/MailLogAction.php:93
+#: classes/Gems/Default/MailLogActionOldStyle.php:116
+msgid "From address"
+msgstr "From address"
+
+#: classes/Gems/Default/MailLogAction.php:98
+#: classes/Gems/Default/MailLogActionOldStyle.php:121
+msgid "Template"
+msgstr "Template"
+
+#: classes/Gems/Default/MailLogAction.php:108
+#: classes/Gems/Default/MailLogActionOldStyle.php:148
msgid "Mail Activity Log"
msgstr "Mail Activity Log"
+#: classes/Gems/Default/MailLogActionOldStyle.php:137
+msgid "Activity Log"
+msgid_plural "Activity Logs"
+msgstr[0] "Activity Log"
+msgstr[1] "Activity Logs"
+
#: classes/Gems/Default/MailServerAction.php:68
msgid "From address [part]"
msgstr "From address [part]"
@@ -1300,10 +1325,16 @@
msgstr "User ID"
#: classes/Gems/Default/MailServerAction.php:90
+#: classes/Gems/Default/OptionAction.php:107
+#: classes/Gems/Default/OptionAction.php:112
+#: classes/Gems/Default/SourceAction.php:95
+#: classes/Gems/Default/StaffAction.php:114
msgid "Repeat password"
msgstr "Repeat password"
#: classes/Gems/Default/MailServerAction.php:91
+#: classes/Gems/Default/SourceAction.php:74
+#: classes/Gems/Default/StaffAction.php:99
msgid "Enter only when changing"
msgstr "Enter only when changing the password"
@@ -1319,7 +1350,7 @@
#: classes/Gems/Default/OptionAction.php:73
#: classes/Gems/Default/OrganizationAction.php:128
-#: classes/Gems/Default/RespondentAction.php:164
+#: classes/Gems/Default/RespondentAction.php:173
#: classes/Gems/Default/StaffAction.php:192
msgid "Language"
msgstr "Language"
@@ -1436,7 +1467,7 @@
#: classes/Gems/Default/OverviewPlanAction.php:115
#: classes/Gems/Default/ProjectSurveysAction.php:88
#: classes/Gems/Default/SurveyAction.php:203
-#: classes/Gems/Default/SurveyMaintenanceAction.php:424
+#: classes/Gems/Default/SurveyMaintenanceAction.php:425
msgid "survey"
msgid_plural "surveys"
msgstr[0] "survey"
@@ -1553,10 +1584,15 @@
msgid "By"
msgstr "By"
+#: classes/Gems/Default/ProjectSurveysAction.php:69
+#: classes/Gems/Default/ProjectTracksAction.php:67
+#: classes/Gems/Default/SurveyAction.php:193
+msgid "From"
+msgstr "From"
+
#: classes/Gems/Default/ProjectSurveysAction.php:70
#: classes/Gems/Default/ProjectTracksAction.php:68
#: classes/Gems/Default/SurveyAction.php:195
-#: classes/Gems/Default/TrackAction.php:331
msgid "Until"
msgstr "Until"
@@ -1565,12 +1601,10 @@
msgstr "Active surveys"
#: classes/Gems/Default/ProjectTracksAction.php:65
-#: classes/Gems/Default/TrackAction.php:328
msgid "Survey #"
msgstr "Survey #"
#: classes/Gems/Default/ProjectTracksAction.php:85
-#: classes/Gems/Default/TrackAction.php:451
msgid "track"
msgid_plural "tracks"
msgstr[0] "track"
@@ -1666,114 +1700,106 @@
msgstr[0] "reception code"
msgstr[1] "reception codes"
-#: classes/Gems/Default/RespondentAction.php:113
+#: classes/Gems/Default/RespondentAction.php:122
msgid "Enter a 9-digit BSN number."
msgstr "Enter a 9-digit BSN number."
-#: classes/Gems/Default/RespondentAction.php:122
+#: classes/Gems/Default/RespondentAction.php:131
msgid "Identification"
msgstr "Identification"
-#: classes/Gems/Default/RespondentAction.php:123
+#: classes/Gems/Default/RespondentAction.php:132
msgid "BSN"
msgstr "BSN"
-#: classes/Gems/Default/RespondentAction.php:127
+#: classes/Gems/Default/RespondentAction.php:136
msgid "Patient number"
msgstr "Patient number"
-#: classes/Gems/Default/RespondentAction.php:136
+#: classes/Gems/Default/RespondentAction.php:145
msgid "Medical data"
msgstr "Medical data"
-#: classes/Gems/Default/RespondentAction.php:143
+#: classes/Gems/Default/RespondentAction.php:152
msgid "DBC's, etc..."
msgstr "DBC's, etc..."
-#: classes/Gems/Default/RespondentAction.php:146
+#: classes/Gems/Default/RespondentAction.php:155
msgid "Contact information"
msgstr "Contact information"
-#: classes/Gems/Default/RespondentAction.php:151
+#: classes/Gems/Default/RespondentAction.php:160
msgid "Respondent has no e-mail"
msgstr "Patient has no e-mail"
-#: classes/Gems/Default/RespondentAction.php:152
+#: classes/Gems/Default/RespondentAction.php:161
msgid "With housenumber"
msgstr "With housenumber"
-#: classes/Gems/Default/RespondentAction.php:159
+#: classes/Gems/Default/RespondentAction.php:168
msgid "Country"
msgstr "Country"
-#: classes/Gems/Default/RespondentAction.php:163
+#: classes/Gems/Default/RespondentAction.php:172
msgid "Settings"
msgstr "Settings"
-#: classes/Gems/Default/RespondentAction.php:165
+#: classes/Gems/Default/RespondentAction.php:174
msgid "Has the respondent signed the informed consent letter?"
msgstr "Has the patient signed the informed consent letter?"
-#: classes/Gems/Default/RespondentAction.php:190
+#: classes/Gems/Default/RespondentAction.php:199
msgid "Comments"
msgstr "Comments"
-#: classes/Gems/Default/RespondentAction.php:191
+#: classes/Gems/Default/RespondentAction.php:200
msgid "Physician"
msgstr "Physician"
-#: classes/Gems/Default/RespondentAction.php:192
+#: classes/Gems/Default/RespondentAction.php:201
msgid "Treatment"
msgstr "Treatment"
-#: classes/Gems/Default/RespondentAction.php:221
-#: classes/Gems/Default/TrackAction.php:131
-#: classes/Gems/Default/TrackAction.php:475
+#: classes/Gems/Default/RespondentAction.php:230
msgid "Rejection code"
msgstr "Rejection code"
-#: classes/Gems/Default/RespondentAction.php:228
+#: classes/Gems/Default/RespondentAction.php:237
msgid "Delete respondent"
msgstr "Delete patient"
-#: classes/Gems/Default/RespondentAction.php:279
+#: classes/Gems/Default/RespondentAction.php:288
msgid "Respondent deleted."
msgstr "Patient deleted"
-#: classes/Gems/Default/RespondentAction.php:282
-#: classes/Gems/Default/TrackAction.php:404
+#: classes/Gems/Default/RespondentAction.php:291
msgid "Choose a reception code to delete."
msgstr "Choose a reception code to delete."
-#: classes/Gems/Default/RespondentAction.php:346
...
[truncated message content] |
|
From: <gem...@li...> - 2011-09-27 13:00:46
|
Revision: 80
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=80&view=rev
Author: matijsdejong
Date: 2011-09-27 13:00:35 +0000 (Tue, 27 Sep 2011)
Log Message:
-----------
- fix for #14, misspelled gtr_organisations name
Modified Paths:
--------------
trunk/library/changelog.txt
trunk/library/classes/Gems/Default/ProjectSurveysAction.php
trunk/library/classes/Gems/Default/ProjectTracksAction.php
trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php
trunk/library/classes/Gems/Default/TokenPlanAction.php
trunk/library/classes/Gems/Default/TrackActionAbstract.php
trunk/library/classes/Gems/Default/TrackMaintenanceAction.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__tracks.30.sql
trunk/library/snippets/AddTracksSnippet.php
trunk/library/snippets/EditTrackEngineSnippet.php
Modified: trunk/library/changelog.txt
===================================================================
--- trunk/library/changelog.txt 2011-09-27 12:43:37 UTC (rev 79)
+++ trunk/library/changelog.txt 2011-09-27 13:00:35 UTC (rev 80)
@@ -1,3 +1,7 @@
+Important changes from 1.4.2 => 1.4.3
+============================================================
+ * gtr_organisations renamed to gtr_organizations
+
Important changes from 1.4.1 => 1.4.2
============================================================
* To have an autosubmit form it is enough now to just use $form->setAutoSubmit($href, $targetId)
Modified: trunk/library/classes/Gems/Default/ProjectSurveysAction.php
===================================================================
--- trunk/library/classes/Gems/Default/ProjectSurveysAction.php 2011-09-27 12:43:37 UTC (rev 79)
+++ trunk/library/classes/Gems/Default/ProjectSurveysAction.php 2011-09-27 13:00:35 UTC (rev 80)
@@ -78,7 +78,7 @@
$filter = parent::getDataFilter($data);
$organization_id = $this->escort->getCurrentOrganization();
- $filter[] = "gtr_organisations LIKE '%|$organization_id|%'";
+ $filter[] = "gtr_organizations LIKE '%|$organization_id|%'";
return $filter;
}
Modified: trunk/library/classes/Gems/Default/ProjectTracksAction.php
===================================================================
--- trunk/library/classes/Gems/Default/ProjectTracksAction.php 2011-09-27 12:43:37 UTC (rev 79)
+++ trunk/library/classes/Gems/Default/ProjectTracksAction.php 2011-09-27 13:00:35 UTC (rev 80)
@@ -75,7 +75,7 @@
$filter = parent::getDataFilter($data);
$organization_id = $this->escort->getCurrentOrganization();
- $filter[] = "gtr_organisations LIKE '%|$organization_id|%'";
+ $filter[] = "gtr_organizations LIKE '%|$organization_id|%'";
return $filter;
}
Modified: trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php
===================================================================
--- trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2011-09-27 12:43:37 UTC (rev 79)
+++ trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2011-09-27 13:00:35 UTC (rev 80)
@@ -203,7 +203,7 @@
$bridge->addDate( 'gtr_date_start', 'label', $this->_('Assignable since'));
$bridge->addDate( 'gtr_date_until', 'label', $this->_('Assignable until'));
// feature request #200
- $bridge->addMultiCheckbox('gtr_organisations', 'label', $this->_('Organizations'), 'multiOptions', $this->util->getDbLookup()->getOrganizations(), 'required', true);
+ $bridge->addMultiCheckbox('gtr_organizations', 'label', $this->_('Organizations'), 'multiOptions', $this->util->getDbLookup()->getOrganizations(), 'required', true);
} else {
$standAloneButton = new MUtil_Form_Element_FakeSubmit('create_stand_alone');
@@ -228,8 +228,8 @@
public function afterFormLoad(array &$data, $isNew)
{
// feature request #200
- if (isset($data['gtr_organisations']) && (! is_array($data['gtr_organisations']))) {
- $data['gtr_organisations'] = explode('|', trim($data['gtr_organisations'], '|'));
+ if (isset($data['gtr_organizations']) && (! is_array($data['gtr_organizations']))) {
+ $data['gtr_organizations'] = explode('|', trim($data['gtr_organizations'], '|'));
}
}
@@ -259,8 +259,8 @@
$data['gtr_track_class'] = 'SingleSurveyEngine';
// feature request #200
- if (isset($data['gtr_organisations']) && is_array($data['gtr_organisations'])) {
- $data['gtr_organisations'] = '|' . implode('|', $data['gtr_organisations']) . '|';
+ if (isset($data['gtr_organizations']) && is_array($data['gtr_organizations'])) {
+ $data['gtr_organizations'] = '|' . implode('|', $data['gtr_organizations']) . '|';
}
if ($data['gsu_active']==1 && empty($data['gsu_id_primary_group'])) {
Modified: trunk/library/classes/Gems/Default/TokenPlanAction.php
===================================================================
--- trunk/library/classes/Gems/Default/TokenPlanAction.php 2011-09-27 12:43:37 UTC (rev 79)
+++ trunk/library/classes/Gems/Default/TokenPlanAction.php 2011-09-27 13:00:35 UTC (rev 80)
@@ -289,7 +289,7 @@
// Add track selection
if ($this->escort instanceof Gems_Project_Tracks_MultiTracksInterface) {
- $sql = "SELECT gtr_id_track, gtr_track_name FROM gems__tracks WHERE gtr_active=1 AND gtr_track_type='T' AND INSTR(gtr_organisations, '|$orgId|') > 0";
+ $sql = "SELECT gtr_id_track, gtr_track_name FROM gems__tracks WHERE gtr_active=1 AND gtr_track_type='T' AND INSTR(gtr_organizations, '|$orgId|') > 0";
$elements[] = $this->_createSelectElement('gto_id_track', $sql, $this->_('(all tracks)'));
}
@@ -299,7 +299,7 @@
LENGTH(gro_round_description) > 0 AND
gtr_active=1 AND
gtr_track_type='T' AND
- INSTR(gtr_organisations, '|$orgId|') > 0";
+ INSTR(gtr_organizations, '|$orgId|') > 0";
$elements[] = $this->_createSelectElement('gto_round_description', $sql, $this->_('(all rounds)'));
$sql = "SELECT gsu_id_survey, gsu_survey_name
@@ -309,7 +309,7 @@
gro_active=1 AND
gtr_active=1 AND
gtr_track_type='T' AND
- INSTR(gtr_organisations, '|$orgId|') > 0";
+ INSTR(gtr_organizations, '|$orgId|') > 0";
/* TODO: use this when we can update this list using ajax
if (isset($data['gsu_id_primary_group'])) {
$sql .= $this->db->quoteInto(" AND gsu_id_primary_group = ?", $data['gsu_id_primary_group']);
@@ -335,7 +335,7 @@
gro_active=1 AND
gtr_active=1 AND
gtr_track_type='T' AND
- INSTR(gtr_organisations, '|$orgId|') > 0";
+ INSTR(gtr_organizations, '|$orgId|') > 0";
$elements[] = $this->_createSelectElement('gsu_id_primary_group', $sql, $this->_('(all fillers)'));
if (($this->escort instanceof Gems_Project_Organization_MultiOrganizationInterface) &&
Modified: trunk/library/classes/Gems/Default/TrackActionAbstract.php
===================================================================
--- trunk/library/classes/Gems/Default/TrackActionAbstract.php 2011-09-27 12:43:37 UTC (rev 79)
+++ trunk/library/classes/Gems/Default/TrackActionAbstract.php 2011-09-27 13:00:35 UTC (rev 80)
@@ -93,7 +93,7 @@
$filter['gtr_track_type'] = $this->trackType;
$filter['gtr_active'] = 1;
$filter[] = '(gtr_date_until IS NULL OR gtr_date_until >= CURRENT_DATE) AND gtr_date_start <= CURRENT_DATE';
- $filter[] = "gtr_organisations LIKE '%|$organisation_id|%'";
+ $filter[] = "gtr_organizations LIKE '%|$organisation_id|%'";
$baseurl = array('action' => 'index', 'gr2o_patient_nr' => $id, MUtil_Model::TEXT_FILTER => $searchText);
Modified: trunk/library/classes/Gems/Default/TrackMaintenanceAction.php
===================================================================
--- trunk/library/classes/Gems/Default/TrackMaintenanceAction.php 2011-09-27 12:43:37 UTC (rev 79)
+++ trunk/library/classes/Gems/Default/TrackMaintenanceAction.php 2011-09-27 13:00:35 UTC (rev 80)
@@ -98,7 +98,7 @@
$bridge->addDate( 'gtr_date_until');
// $bridge->addList( 'gtr_start_date_field', 'label', $this->_('Date used for track'));
$bridge->addCheckbox('gtr_active');
- $bridge->addMultiCheckbox('gtr_organisations', 'label', $this->_('Organizations'), 'multiOptions', $this->util->getDbLookup()->getOrganizations(), 'required', true);
+ $bridge->addMultiCheckbox('gtr_organizations', 'label', $this->_('Organizations'), 'multiOptions', $this->util->getDbLookup()->getOrganizations(), 'required', true);
}
/**
@@ -109,8 +109,8 @@
public function afterFormLoad(array &$data, $isNew)
{
// feature request #200
- if (isset($data['gtr_organisations']) && (! is_array($data['gtr_organisations']))) {
- $data['gtr_organisations'] = explode('|', trim($data['gtr_organisations'], '|'));
+ if (isset($data['gtr_organizations']) && (! is_array($data['gtr_organizations']))) {
+ $data['gtr_organizations'] = explode('|', trim($data['gtr_organizations'], '|'));
}
}
@@ -124,8 +124,8 @@
public function beforeSave(array &$data, $isNew, Zend_Form $form = null)
{
// feature request #200
- if (isset($data['gtr_organisations']) && is_array($data['gtr_organisations'])) {
- $data['gtr_organisations'] = '|' . implode('|', $data['gtr_organisations']) . '|';
+ if (isset($data['gtr_organizations']) && is_array($data['gtr_organizations'])) {
+ $data['gtr_organizations'] = '|' . implode('|', $data['gtr_organizations']) . '|';
}
if (isset($data['gtr_id_track'])) {
$data['gtr_survey_rounds'] = $this->db->fetchOne("SELECT COUNT(*) FROM gems__rounds WHERE gro_active = 1 AND gro_id_track = ?", $data['gtr_id_track']);
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-09-27 12:43:37 UTC (rev 79)
+++ trunk/library/configs/db/patches.sql 2011-09-27 13:00:35 UTC (rev 80)
@@ -84,10 +84,10 @@
ALTER TABLE `gems__staff` ADD `gsf_reset_key` varchar(64) NULL AFTER `gsf_phone_1`;
ALTER TABLE `gems__staff` ADD `gsf_reset_req`timestamp NULL AFTER `gsf_reset_key`;
--- PATCH: Add gtr_organisations to tracks
-ALTER TABLE `gems__tracks` ADD `gtr_organisations` VARCHAR(250) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `gtr_track_type` ;
+-- PATCH: Add gtr_organizations to tracks
+ALTER TABLE `gems__tracks` ADD `gtr_organizations` VARCHAR(250) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `gtr_track_type` ;
UPDATE gems__tracks
- SET `gtr_organisations` = (SELECT CONCAT('|', CONVERT(GROUP_CONCAT(gor_id_organization SEPARATOR '|'), CHAR), '|') as orgs FROM gems__organizations WHERE gor_active=1)
+ SET `gtr_organizations` = (SELECT CONCAT('|', CONVERT(GROUP_CONCAT(gor_id_organization SEPARATOR '|'), CHAR), '|') as orgs FROM gems__organizations WHERE gor_active=1)
WHERE gtr_active = 1;
-- PATCH: Gewijzigd track model
@@ -196,3 +196,6 @@
ALTER TABLE gems__log_respondent_communications ADD grco_sender varchar(120) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER grco_address;
ALTER TABLE gems__log_respondent_communications ADD grco_id_message bigint unsigned null references gems__mail_templates (gmt_id_message) AFTER grco_comments;
+-- GEMS VERSION: 41
+-- PATCH: Corrected misspelling of gtr_organisations
+ALTER TABLE gems__tracks CHANGE gtr_organisations gtr_organizations varchar(250) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
Modified: trunk/library/configs/db/tables/gems__tracks.30.sql
===================================================================
--- trunk/library/configs/db/tables/gems__tracks.30.sql 2011-09-27 12:43:37 UTC (rev 79)
+++ trunk/library/configs/db/tables/gems__tracks.30.sql 2011-09-27 13:00:35 UTC (rev 80)
@@ -20,7 +20,7 @@
gtr_track_class varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
-- Yes, quick and dirty, will correct later (probably)
- gtr_organisations varchar(250) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
+ gtr_organizations varchar(250) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
gtr_changed timestamp not null default current_timestamp on update current_timestamp,
gtr_changed_by bigint unsigned not null,
Modified: trunk/library/snippets/AddTracksSnippet.php
===================================================================
--- trunk/library/snippets/AddTracksSnippet.php 2011-09-27 12:43:37 UTC (rev 79)
+++ trunk/library/snippets/AddTracksSnippet.php 2011-09-27 13:00:35 UTC (rev 80)
@@ -117,7 +117,7 @@
(gtr_date_until IS NULL OR gtr_date_until > CURRENT_TIMESTAMP) AND
gtr_active = 1 AND
gtr_track_type = 'T' AND
- gtr_organisations LIKE '%|$organization_id|%'
+ gtr_organizations LIKE '%|$organization_id|%'
ORDER BY gtr_track_name";
break;
case 'S':
@@ -131,7 +131,7 @@
gtr_active = 1 AND
gtr_track_type = 'S' AND
ggp_respondent_members = 1 AND
- gtr_organisations LIKE '%|$organization_id|%'
+ gtr_organizations LIKE '%|$organization_id|%'
ORDER BY gtr_track_name";
break;
case 'M':
@@ -145,7 +145,7 @@
gtr_active = 1 AND
gtr_track_type = 'S' AND
ggp_respondent_members = 0 AND
- gtr_organisations LIKE '%|$organization_id|%'
+ gtr_organizations LIKE '%|$organization_id|%'
ORDER BY gtr_track_name";
break;
// default:
Modified: trunk/library/snippets/EditTrackEngineSnippet.php
===================================================================
--- trunk/library/snippets/EditTrackEngineSnippet.php 2011-09-27 12:43:37 UTC (rev 79)
+++ trunk/library/snippets/EditTrackEngineSnippet.php 2011-09-27 13:00:35 UTC (rev 80)
@@ -134,7 +134,7 @@
if (! $this->createData) {
$bridge->addCheckbox('gtr_active');
}
- $bridge->addMultiCheckbox('gtr_organisations', 'label', $this->_('Organizations'), 'multiOptions', $this->util->getDbLookup()->getOrganizations(), 'required', true);
+ $bridge->addMultiCheckbox('gtr_organizations', 'label', $this->_('Organizations'), 'multiOptions', $this->util->getDbLookup()->getOrganizations(), 'required', true);
}
/**
@@ -247,8 +247,8 @@
parent::loadFormData();
// feature request #200
- if (isset($this->formData['gtr_organisations']) && (! is_array($this->formData['gtr_organisations']))) {
- $this->formData['gtr_organisations'] = explode('|', trim($this->formData['gtr_organisations'], '|'));
+ if (isset($this->formData['gtr_organizations']) && (! is_array($this->formData['gtr_organizations']))) {
+ $this->formData['gtr_organizations'] = explode('|', trim($this->formData['gtr_organizations'], '|'));
}
}
@@ -262,8 +262,8 @@
protected function saveData()
{
// feature request #200
- if (isset($this->formData['gtr_organisations']) && is_array($this->formData['gtr_organisations'])) {
- $this->formData['gtr_organisations'] = '|' . implode('|', $this->formData['gtr_organisations']) . '|';
+ if (isset($this->formData['gtr_organizations']) && is_array($this->formData['gtr_organizations'])) {
+ $this->formData['gtr_organizations'] = '|' . implode('|', $this->formData['gtr_organizations']) . '|';
}
if ($this->trackEngine) {
$this->formData['gtr_survey_rounds'] = $this->trackEngine->calculateRoundCount();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-09-27 17:28:54
|
Revision: 82
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=82&view=rev
Author: matijsdejong
Date: 2011-09-27 17:28:46 +0000 (Tue, 27 Sep 2011)
Log Message:
-----------
- added constructor with arguments to RequestCache.php
- extra documentation for BrowseEditAction.php, TargetAbstract.php, TargetInterface.php
- continued on #10 new BrowseEditAction.php
todo: make possible to add filters to excel, look Excel export, maybe export using snippet
Modified Paths:
--------------
trunk/library/classes/Gems/Controller/BrowseEditAction.php
trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php
trunk/library/classes/Gems/Default/MailLogAction.php
trunk/library/classes/Gems/Registry/TargetAbstract.php
trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php
trunk/library/classes/Gems/Util/RequestCache.php
trunk/library/classes/Gems/Util.php
trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php
trunk/library/classes/MUtil/Registry/TargetAbstract.php
trunk/library/classes/MUtil/Registry/TargetInterface.php
trunk/library/snippets/Generic/AutosearchForm.php
trunk/library/snippets/Generic/ModelItemTableSnippet.php
trunk/library/snippets/Generic/ModelTableSnippet.php
Added Paths:
-----------
trunk/library/snippets/Generic/CurrentButtonRow.php
Modified: trunk/library/classes/Gems/Controller/BrowseEditAction.php
===================================================================
--- trunk/library/classes/Gems/Controller/BrowseEditAction.php 2011-09-27 14:43:57 UTC (rev 81)
+++ trunk/library/classes/Gems/Controller/BrowseEditAction.php 2011-09-27 17:28:46 UTC (rev 82)
@@ -583,16 +583,13 @@
*
* @param boolean $includeDefaults Include the default values (yes for filtering, no for urls
* @param string $sourceAction The action to get the cache from if not the current one.
+ * @param boolean $readonly Optional, tell the cache not to store any new values
* @return array
*/
public function getCachedRequestData($includeDefaults = true, $sourceAction = null, $readonly = false)
{
if (! $this->requestCache) {
- $this->requestCache = $this->util->getRequestCache();
- if ($sourceAction) {
- $this->requestCache->setSourceAction($sourceAction);
- }
- $this->requestCache->setReadonly($readonly);
+ $this->requestCache = $this->util->getRequestCache($sourceAction, $readonly);
$this->requestCache->setMenu($this->menu);
$this->requestCache->setRequest($this->request);
Modified: trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php
===================================================================
--- trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php 2011-09-27 14:43:57 UTC (rev 81)
+++ trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php 2011-09-27 17:28:46 UTC (rev 82)
@@ -74,13 +74,20 @@
protected $autofilterSnippets = 'Generic_ModelTableSnippet';
/**
- * The snippets used for the index action, minus those in autofilter
+ * The snippets used for the index action, before those in autofilter
*
* @var mixed String or array of snippets name
*/
- protected $indexSnippets = 'Generic_AutosearchForm';
+ protected $indexStartSnippets = 'Generic_AutosearchForm';
/**
+ * The snippets used for the index action, after those in autofilter
+ *
+ * @var mixed String or array of snippets name
+ */
+ protected $indexStopSnippets = 'Generic_CurrentButtonRow';
+
+ /**
* The snippets used for the show action
*
* @var mixed String or array of snippets name
@@ -88,6 +95,42 @@
protected $showSnippets = 'Generic_ModelItemTableSnippet';
/**
+ *
+ * @var Gems_Util
+ */
+ public $util;
+
+ /**
+ * Outputs the model to excel, applying all filters and searches needed
+ *
+ * When you want to change the output, there are two places to check:
+ *
+ * 1. $this->addExcelColumns($model), where the model can be changed to have labels for columns you
+ * need exported
+ *
+ * 2. $this->getExcelData($data, $model) where the supplied data and model are merged to get output
+ * (by default all fields from the model that have a label)
+ */
+ public function excelAction()
+ {
+ // Set the request cache to use the search params from the index action
+ $requestCache = $this->util->getRequestCache('index', true);
+ $filter = $requestCache->getProgramParams();
+
+ $model = $this->getModel();
+
+ $model->applyParameters($filter);
+
+ // $this->addExcelColumns($model); // Hook to modify the model
+
+ $this->view->result = $this->getExcelData($model->load(), $model);
+ $this->view->filename = $this->getRequest()->getControllerName() . '.xls';
+ $this->view->setScriptPath(GEMS_LIBRARY_DIR . '/views/scripts' );
+
+ $this->render('excel', null, true);
+ }
+
+ /**
* Finds the first item with one of the actions specified as parameter and using the current controller
*
* @param string $action
@@ -109,6 +152,45 @@
}
/**
+ * Returns an array with all columns from the model that have a label
+ *
+ * @param array $data
+ * @param MUtil_Model_ModelAbstract $model
+ * @return array
+ */
+ protected function getExcelData($data, MUtil_Model_ModelAbstract $model)
+ {
+ $headings = array();
+ $emptyMsg = $this->_('No data found.');
+ foreach ($model->getItemsOrdered() as $name) {
+ if ($label = $model->get($name, 'label')) {
+ $headings[$name] = (string) $label;
+ }
+ }
+ $results = array();
+ $results[] = $headings;
+ if ($headings) {
+ if ($data) {
+ foreach ($data as $row) {
+ foreach ($headings as $key => $value) {
+ $result[$key] = isset($row[$key]) ? $row[$key] : null;
+ }
+ $results[] = $result;
+ }
+ return $results;
+ } else {
+ foreach ($headings as $key => $value) {
+ $result[$key] = $emptyMsg;
+ }
+ $results[] = $result;
+ return $results;
+ }
+ } else {
+ return array($emptyMsg);
+ }
+ }
+
+ /**
* Intializes the html component.
*
* @param boolean $reset Throws away any existing html output when true
Modified: trunk/library/classes/Gems/Default/MailLogAction.php
===================================================================
--- trunk/library/classes/Gems/Default/MailLogAction.php 2011-09-27 14:43:57 UTC (rev 81)
+++ trunk/library/classes/Gems/Default/MailLogAction.php 2011-09-27 17:28:46 UTC (rev 82)
@@ -140,6 +140,9 @@
return $model;
}
+ /**
+ * Action for showing a browse page
+ */
public function indexAction()
{
$this->html->h3($this->_('Mail Activity Log'));
@@ -147,4 +150,16 @@
// MUtil_Echo::track($this->indexParameters);
parent::indexAction();
}
+
+
+ /**
+ * Action for showing an item page
+ */
+ public function showAction()
+ {
+ $this->html->h3($this->_('Show Mail Activity Log item'));
+
+ // MUtil_Echo::track($this->indexParameters);
+ parent::showAction();
+ }
}
Modified: trunk/library/classes/Gems/Registry/TargetAbstract.php
===================================================================
--- trunk/library/classes/Gems/Registry/TargetAbstract.php 2011-09-27 14:43:57 UTC (rev 81)
+++ trunk/library/classes/Gems/Registry/TargetAbstract.php 2011-09-27 17:28:46 UTC (rev 82)
@@ -4,7 +4,7 @@
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@@ -15,7 +15,7 @@
* * Neither the name of Erasmus MC nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -26,23 +26,25 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @author Matijs de Jong
- * @since 1.0
- * @version 1.1
- * @package Gems
+ *
+ *
+ * @package Gems
* @subpackage Registry
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
*/
/**
- * Extends MUtil_Registry_TargetAbstract with the ability to create
+ * Extends MUtil_Registry_TargetAbstract with the ability to create PHP
* callables by request an existing method using $this->methodName.
- *
- * @author Matijs de Jong
- * @package Gems
+ *
+ * @package Gems
* @subpackage Registry
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.1
*/
class Gems_Registry_TargetAbstract extends MUtil_Registry_TargetAbstract
{
Modified: trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php 2011-09-27 14:43:57 UTC (rev 81)
+++ trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php 2011-09-27 17:28:46 UTC (rev 82)
@@ -82,6 +82,7 @@
public $menu;
/**
+ * Optional, used for base url
*
* @var Gems_Util_RequestCache
*/
@@ -122,11 +123,16 @@
*/
public function checkRegistryRequestsAnswers()
{
- if ($this->requestCache && (! $this->baseUrl)) {
- $this->baseUrl = $this->requestCache->getProgramParams();
+ if ($this->requestCache) {
+ // Items that should not be stored.
+ $this->requestCache->removeParams('page', 'items', 'action');
- if (MUtil_Registry_Source::$verbose) {
- MUtil_Echo::track($this->baseUrl);
+ if ((! $this->baseUrl)) {
+ $this->baseUrl = $this->requestCache->getProgramParams();
+
+ if (MUtil_Registry_Source::$verbose) {
+ MUtil_Echo::track($this->baseUrl);
+ }
}
}
@@ -186,4 +192,21 @@
return $table;
}
}
+
+ /**
+ * Overrule to implement snippet specific filtering and sorting.
+ *
+ * @param MUtil_Model_ModelAbstract $model
+ */
+ protected function processFilterAndSort(MUtil_Model_ModelAbstract $model)
+ {
+ if ($this->requestCache) {
+ $data = $this->requestCache->getProgramParams();
+
+ $model->applyParameters($data);
+
+ } else {
+ parent::processFilterAndSort($model);
+ }
+ }
}
Modified: trunk/library/classes/Gems/Util/RequestCache.php
===================================================================
--- trunk/library/classes/Gems/Util/RequestCache.php 2011-09-27 14:43:57 UTC (rev 81)
+++ trunk/library/classes/Gems/Util/RequestCache.php 2011-09-27 17:28:46 UTC (rev 82)
@@ -109,6 +109,19 @@
protected $sourceAction;
/**
+ *
+ * @param string $sourceAction The action to get the cache from if not the current one.
+ * @param boolean $readonly Optional, tell the cache not to store any new values
+ */
+ public function __construct($sourceAction = null, $readonly = false)
+ {
+ if ($sourceAction) {
+ $this->setSourceAction($sourceAction);
+ }
+ $this->setReadonly($readonly);
+ }
+
+ /**
* Should be called after answering the request to allow the Target
* to check if all required registry values have been set correctly.
*
Modified: trunk/library/classes/Gems/Util.php
===================================================================
--- trunk/library/classes/Gems/Util.php 2011-09-27 14:43:57 UTC (rev 81)
+++ trunk/library/classes/Gems/Util.php 2011-09-27 17:28:46 UTC (rev 82)
@@ -170,11 +170,13 @@
/**
*
+ * @param string $sourceAction The action to get the cache from if not the current one.
+ * @param boolean $readonly Optional, tell the cache not to store any new values
* @return Gems_Util_RequestCache
*/
- public function getRequestCache()
+ public function getRequestCache($sourceAction = null, $readonly = false)
{
- return $this->_getClass('requestCache');
+ return $this->_getClass('requestCache', null, array($sourceAction, $readonly));
}
/**
Modified: trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php 2011-09-27 14:43:57 UTC (rev 81)
+++ trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php 2011-09-27 17:28:46 UTC (rev 82)
@@ -70,13 +70,20 @@
protected $indexParameters = array();
/**
- * The snippets used for the index action, minus those in autofilter
+ * The snippets used for the index action, before those in autofilter
*
* @var mixed String or array of snippets name
*/
- protected $indexSnippets = null;
+ protected $indexStartSnippets = null;
/**
+ * The snippets used for the index action, after those in autofilter
+ *
+ * @var mixed String or array of snippets name
+ */
+ protected $indexStopSnippets = null;
+
+ /**
* The parameters used for the show action
*
* @var array Mixed key => value array for snippet initialization
@@ -139,16 +146,22 @@
*/
public function indexAction()
{
- if ($this->indexSnippets) {
+ if ($this->indexStartSnippets || $this->indexStopSnippets) {
$this->indexParameters = $this->indexParameters + $this->autofilterParameters;
$this->indexParameters['model'] = $this->getModel();
$this->indexParameters['request'] = $this->getRequest();
- $this->addSnippets($this->indexSnippets, $this->indexParameters);
+ if ($this->indexStartSnippets) {
+ $this->addSnippets($this->indexStartSnippets, $this->indexParameters);
+ }
}
$this->autofilterAction(false);
+
+ if ($this->indexStopSnippets) {
+ $this->addSnippets($this->indexStopSnippets, $this->indexParameters);
+ }
}
@@ -158,8 +171,6 @@
public function showAction()
{
if ($this->showSnippets) {
- $this->showParameters = $this->indexParameters + $this->autofilterParameters;
-
$this->showParameters['model'] = $this->getModel();
$this->showParameters['request'] = $this->getRequest();
Modified: trunk/library/classes/MUtil/Registry/TargetAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Registry/TargetAbstract.php 2011-09-27 14:43:57 UTC (rev 81)
+++ trunk/library/classes/MUtil/Registry/TargetAbstract.php 2011-09-27 17:28:46 UTC (rev 82)
@@ -1,48 +1,54 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
+
/**
- * @author Matijs de Jong
- * @since 1.1
- * @version 1.1
- * @package MUtil
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
* @subpackage Registry
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
*/
/**
- * MUtil_Registry_TargetAbstract is a default target object.
- *
- * Also usable to copy the code to implement your own version of this class.
+ * MUtil_Registry_TargetAbstract is a default target object, that requests values
+ * for all defined instance variables with names not starting with '_'.
*
- * @author Matijs de Jong
- * @package MUtil
+ * I.e. variables in a class inheriting from MUtil_Registry_TargetAbstract can be
+ * initialized by a source even when they are protected or private.
+ *
+ * Also usafull to copy the code to implement your own version of this class.
+ *
+ * @package MUtil
* @subpackage Registry
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.1
*/
abstract class MUtil_Registry_TargetAbstract implements MUtil_Registry_TargetInterface
{
@@ -90,12 +96,12 @@
}
/**
- * Allows the loader to know the resources to set.
- *
- * Returns those object variables defined by the subclass but not at the level of this definition.
- *
- * Can be overruled.
- *
+ * Allows the loader to know the resources to set.
+ *
+ * Returns those object variables defined by the subclass but not at the level of this definition.
+ *
+ * Can be overruled.
+ *
* @return array of string names
*/
public function getRegistryRequests()
Modified: trunk/library/classes/MUtil/Registry/TargetInterface.php
===================================================================
--- trunk/library/classes/MUtil/Registry/TargetInterface.php 2011-09-27 14:43:57 UTC (rev 81)
+++ trunk/library/classes/MUtil/Registry/TargetInterface.php 2011-09-27 17:28:46 UTC (rev 82)
@@ -4,7 +4,7 @@
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@@ -15,7 +15,7 @@
* * Neither the name of Erasmus MC nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -26,14 +26,14 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @author Matijs de Jong
- * @since 1.1
- * @version 1.1
- * @package MUtil
+ *
+ *
+ * @package MUtil
* @subpackage Registry
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
*/
/**
@@ -44,11 +44,13 @@
*
* @see MUtil_Registry_Source
*
- * @author Matijs de Jong
- * @package MUtil
+ * @package MUtil
* @subpackage Registry
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.1
*/
-interface MUtil_Registry_TargetInterface
+interface MUtil_Registry_TargetInterface
{
/**
* Allows the source to set request.
@@ -69,7 +71,7 @@
/**
* Allows the loader to know the resources to set.
- *
+ *
* @return array of string names
*/
public function getRegistryRequests();
Modified: trunk/library/snippets/Generic/AutosearchForm.php
===================================================================
--- trunk/library/snippets/Generic/AutosearchForm.php 2011-09-27 14:43:57 UTC (rev 81)
+++ trunk/library/snippets/Generic/AutosearchForm.php 2011-09-27 17:28:46 UTC (rev 82)
@@ -68,13 +68,45 @@
protected $request;
/**
+ * Optional, otherwise created from $util
*
+ * @var Gems_Util_RequestCache
+ */
+ public $requestCache;
+
+ /**
+ *
+ * @var Gems_Util
+ */
+ protected $util;
+
+ /**
+ *
* @var string Id for auto search button
*/
protected $searchButtonId = 'AUTO_SEARCH_TEXT_BUTTON';
/**
+ * Should be called after answering the request to allow the Target
+ * to check if all required registry values have been set correctly.
+ *
+ * @return boolean False if required are missing.
+ */
+ public function checkRegistryRequestsAnswers()
+ {
+ if ($this->util && (! $this->requestCache)) {
+ $this->requestCache = $this->util->getRequestCache();
+ }
+ if ($this->requestCache) {
+ // Do not store searchButtonId
+ $this->requestCache->removeParams($this->searchButtonId);
+ }
+
+ return parent::checkRegistryRequestsAnswers();
+ }
+
+ /**
* Creates the form itself
*
* @param array $options
@@ -196,6 +228,10 @@
*/
protected function getSearchData()
{
- return $this->request->getParams();
+ if ($this->requestCache) {
+ return $this->requestCache->getProgramParams();
+ } else {
+ return $this->request->getParams();
+ }
}
}
Added: trunk/library/snippets/Generic/CurrentButtonRow.php
===================================================================
--- trunk/library/snippets/Generic/CurrentButtonRow.php (rev 0)
+++ trunk/library/snippets/Generic/CurrentButtonRow.php 2011-09-27 17:28:46 UTC (rev 82)
@@ -0,0 +1,85 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Short description of file
+ *
+ * @package Gems
+ * @subpackage Snippets
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ * Short description for class
+ *
+ * Long description for class (if any)...
+ *
+ * @package Gems
+ * @subpackage Snippets
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.2
+ */
+class Generic_CurrentButtonRow extends MUtil_Snippets_SnippetAbstract
+{
+ /**
+ * Required
+ *
+ * @var Gems_Menu
+ */
+ protected $menu;
+
+ /**
+ * Required
+ *
+ * @var Zend_Controller_Request_Abstract
+ */
+ protected $request;
+
+ /**
+ * Create the snippets content
+ *
+ * This is a stub function either override getHtmlOutput() or override render()
+ *
+ * @param Zend_View_Abstract $view Just in case it is needed here
+ * @return MUtil_Html_HtmlInterface Something that can be rendered
+ */
+ public function getHtmlOutput(Zend_View_Abstract $view)
+ {
+ $menuList = $this->menu->getMenuList();
+
+ $menuList->addParameterSources($this->request)
+ ->addCurrentParent($this->_('Cancel'))
+ ->addCurrentChildren();
+
+ return $menuList;
+ }
+
+}
Modified: trunk/library/snippets/Generic/ModelItemTableSnippet.php
===================================================================
--- trunk/library/snippets/Generic/ModelItemTableSnippet.php 2011-09-27 14:43:57 UTC (rev 81)
+++ trunk/library/snippets/Generic/ModelItemTableSnippet.php 2011-09-27 17:28:46 UTC (rev 82)
@@ -1,6 +1,5 @@
<?php
-
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
@@ -92,6 +91,31 @@
protected $request;
/**
+ * Adds rows from the model to the bridge that creates the browse table.
+ *
+ * Overrule this function to add different columns to the browse table, without
+ * having to recode the core table building code.
+ *
+ * @param MUtil_Model_TableBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @return void
+ */
+ protected function addShowTableRows(MUtil_Model_VerticalTableBridge $bridge, MUtil_Model_ModelAbstract $model)
+ {
+ parent::addShowTableRows($bridge, $model);
+
+ $controller = $this->request->getControllerName();
+
+ $menuList = $this->menu->getMenuList();
+ $menuList->addParameterSources($bridge)
+ ->addByController($controller)
+ ->addByController($controller, 'edit')
+ ->addByController($controller, 'delete');
+
+ $bridge->tfrow($menuList, array('class' => 'centerAlign'));
+ }
+
+ /**
* Creates the model
*
* @return MUtil_Model_ModelAbstract
Modified: trunk/library/snippets/Generic/ModelTableSnippet.php
===================================================================
--- trunk/library/snippets/Generic/ModelTableSnippet.php 2011-09-27 14:43:57 UTC (rev 81)
+++ trunk/library/snippets/Generic/ModelTableSnippet.php 2011-09-27 17:28:46 UTC (rev 82)
@@ -54,6 +54,29 @@
protected $model;
/**
+ *
+ * @var Gems_Util
+ */
+ protected $util;
+
+ /**
+ * Automatically add request cacge
+ *
+ * Should be called after answering the req...
[truncated message content] |
|
From: <gem...@li...> - 2011-10-11 12:59:48
|
Revision: 88
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=88&view=rev
Author: matijsdejong
Date: 2011-10-11 12:59:41 +0000 (Tue, 11 Oct 2011)
Log Message:
-----------
Whoops, forget the current use of the LanguageController
Added Paths:
-----------
trunk/library/classes/Gems/Default/LanguageAction.php
trunk/library/controllers/LanguageController.php
Copied: trunk/library/classes/Gems/Default/LanguageAction.php (from rev 85, trunk/library/classes/Gems/Default/LanguageAction.php)
===================================================================
--- trunk/library/classes/Gems/Default/LanguageAction.php (rev 0)
+++ trunk/library/classes/Gems/Default/LanguageAction.php 2011-10-11 12:59:41 UTC (rev 88)
@@ -0,0 +1,68 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @package Gems
+ * @subpackage Default
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Allows the user to switch interface language.
+ *
+ * @package Gems
+ * @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
+ */
+class Gems_Default_LanguageAction extends Gems_Controller_Action
+{
+ public function changeUiAction()
+ {
+ $request = $this->getRequest();
+
+ $lang = strtolower($request->getParam('language'));
+ $url = base64_decode($request->getParam('current_uri'));
+
+ if (in_array($lang, $this->view->project->locales)) {
+
+ $this->session->user_locale = $lang;
+ if (Gems_Cookies::setLocale($lang, $this->basepath->getBasePath())) {
+ $this->getResponse()->setRedirect($url);
+ return;
+ }
+
+ throw new Exception($this->_('Cookies must be enabled for setting the language.'));
+ }
+
+ throw new Exception($this->_('Invalid language setting.'));
+ }
+}
Copied: trunk/library/controllers/LanguageController.php (from rev 85, trunk/library/controllers/LanguageController.php)
===================================================================
--- trunk/library/controllers/LanguageController.php (rev 0)
+++ trunk/library/controllers/LanguageController.php 2011-10-11 12:59:41 UTC (rev 88)
@@ -0,0 +1,33 @@
+<?php
+
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+class LanguageController extends Gems_Default_LanguageAction
+{
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-10-17 13:51:12
|
Revision: 112
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=112&view=rev
Author: mennodekker
Date: 2011-10-17 13:51:03 +0000 (Mon, 17 Oct 2011)
Log Message:
-----------
Version -> 1.5, patchlevel -> 42
Modified Paths:
--------------
trunk/library/classes/Gems/Versions.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__patch_levels.10.sql
Modified: trunk/library/classes/Gems/Versions.php
===================================================================
--- trunk/library/classes/Gems/Versions.php 2011-10-17 13:41:18 UTC (rev 111)
+++ trunk/library/classes/Gems/Versions.php 2011-10-17 13:51:03 UTC (rev 112)
@@ -43,12 +43,12 @@
{
public final function getBuild()
{
- return 41;
+ return 42;
}
public final function getGemsVersion()
{
- return '1.4.3';
+ return '1.5';
}
public function getProjectVersion()
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-10-17 13:41:18 UTC (rev 111)
+++ trunk/library/configs/db/patches.sql 2011-10-17 13:51:03 UTC (rev 112)
@@ -201,4 +201,6 @@
ALTER TABLE gems__tracks CHANGE gtr_organisations gtr_organizations varchar(250) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
-- PATCH: Assign maintenance mode toggle to super role
-UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges,',pr.maintenance') WHERE grl_name = 'super' AND grl_privileges NOT LIKE '%pr.maintenance%';
\ No newline at end of file
+UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges,',pr.maintenance') WHERE grl_name = 'super' AND grl_privileges NOT LIKE '%pr.maintenance%';
+
+-- GEMS VERSION: 42
\ No newline at end of file
Modified: trunk/library/configs/db/tables/gems__patch_levels.10.sql
===================================================================
--- trunk/library/configs/db/tables/gems__patch_levels.10.sql 2011-10-17 13:41:18 UTC (rev 111)
+++ trunk/library/configs/db/tables/gems__patch_levels.10.sql 2011-10-17 13:51:03 UTC (rev 112)
@@ -11,5 +11,5 @@
INSERT INTO gems__patch_levels (gpl_level, gpl_created)
VALUES
- (41, CURRENT_TIMESTAMP);
+ (42, CURRENT_TIMESTAMP);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-10-20 11:10:41
|
Revision: 115
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=115&view=rev
Author: matijsdejong
Date: 2011-10-20 11:10:35 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
Surveys give information based on the group they are assigned on as per #24. Also found database field no longer in use in code.
Modified Paths:
--------------
trunk/library/classes/Gems/Tracker/Survey.php
trunk/library/configs/db/tables/gems__surveys.30.sql
Modified: trunk/library/classes/Gems/Tracker/Survey.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Survey.php 2011-10-19 18:01:56 UTC (rev 114)
+++ trunk/library/classes/Gems/Tracker/Survey.php 2011-10-20 11:10:35 UTC (rev 115)
@@ -104,6 +104,26 @@
}
/**
+ * Makes sure the receptioncode data is part of the $this->_gemsData
+ *
+ * @param boolean $reload Optional parameter to force reload.
+ */
+ private function _ensureGroupData($reload = false)
+ {
+ if ($reload || (! isset($this->_gemsSurvey['ggp_id_group']))) {
+ $sql = "SELECT * FROM gems__groups WHERE ggp_id_group = ?";
+ $code = $this->_gemsSurvey['gsu_id_primary_group'];
+
+ if ($row = $this->db->fetchRow($sql, $code)) {
+ $this->_gemsSurvey = $row + $this->_gemsSurvey;
+ } else {
+ $name = $this->getName();
+ throw new Gems_Exception("Group code $code is missing for survey '$name'.");
+ }
+ }
+ }
+
+ /**
* Update the survey, both in the database and in memory.
*
* @param array $values The values that this token should be set to
@@ -466,6 +486,20 @@
}
/**
+ * Should this survey be filled in by staff members.
+ *
+ * @return boolean
+ */
+ public function isTakenByStaff()
+ {
+ if (! isset($this->_gemsSurvey['ggp_staff_members'])) {
+ $this->_ensureGroupData();
+ }
+
+ return (boolean) $this->_gemsSurvey['ggp_staff_members'];
+ }
+
+ /**
* Update the survey, both in the database and in memory.
*
* @param array $values The values that this token should be set to
Modified: trunk/library/configs/db/tables/gems__surveys.30.sql
===================================================================
--- trunk/library/configs/db/tables/gems__surveys.30.sql 2011-10-19 18:01:56 UTC (rev 114)
+++ trunk/library/configs/db/tables/gems__surveys.30.sql 2011-10-20 11:10:35 UTC (rev 115)
@@ -20,7 +20,10 @@
references gems__sources (gso_id_source),
gsu_active boolean not null default 0,
gsu_status varchar(127) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
+
+ -- depreciated
gsu_staff boolean not null default 0,
+ -- end depreciated
gsu_id_primary_group bigint unsigned null
references gems__groups (ggp_id_group),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-10-20 12:56:52
|
Revision: 118
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=118&view=rev
Author: matijsdejong
Date: 2011-10-20 12:56:42 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
Translation fixes for #21 and #22.
Modified Paths:
--------------
trunk/library/classes/Gems/Default/SourceAction.php
trunk/library/languages/default-en.mo
trunk/library/languages/default-en.po
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
Modified: trunk/library/classes/Gems/Default/SourceAction.php
===================================================================
--- trunk/library/classes/Gems/Default/SourceAction.php 2011-10-20 12:44:50 UTC (rev 117)
+++ trunk/library/classes/Gems/Default/SourceAction.php 2011-10-20 12:56:42 UTC (rev 118)
@@ -83,7 +83,7 @@
$bridge->addValidator('gso_ls_url', new MUtil_Validate_Url());
$bridge->addSelect('gso_ls_class');
- $bridge->addSelect('gso_ls_adapter', 'description', $this->_('Choose the database used by this source.'));
+ $bridge->addSelect('gso_ls_adapter', 'description', $this->_('The database server used by the source.'));
$bridge->addText('gso_ls_table_prefix', array('size' => 15, 'description' => $this->_('Do not forget the underscores.')));
$bridge->addText('gso_ls_dbhost', array('size' => 15, 'description' => $in_gems));
Modified: trunk/library/languages/default-en.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-en.po
===================================================================
--- trunk/library/languages/default-en.po 2011-10-20 12:44:50 UTC (rev 117)
+++ trunk/library/languages/default-en.po 2011-10-20 12:56:42 UTC (rev 118)
@@ -2,9 +2,9 @@
msgstr ""
"Project-Id-Version: Pulse EN\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-10-17 15:19+0100\n"
+"POT-Creation-Date: 2011-10-20 14:51+0100\n"
"PO-Revision-Date: \n"
-"Last-Translator: Menno Dekker <men...@er...>\n"
+"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -381,7 +381,7 @@
msgid "Birthday"
msgstr "Birthday"
-#: classes/Gems/Tracker.php:726
+#: classes/Gems/Tracker.php:732
msgid "Checks performed"
msgstr "Checks performed"
@@ -1346,7 +1346,6 @@
msgstr "Invalid organization."
#: classes/Gems/Default/OrganizationAction.php:117
-#: classes/Gems/Default/SourceAction.php:143
msgid "Url"
msgstr "Url"
@@ -1791,6 +1790,18 @@
msgid "Leave empty for the Gems database."
msgstr "Leave empty for the Gems database."
+#: classes/Gems/Default/SourceAction.php:79
+msgid "E.g. the name of the project - for single source projects."
+msgstr "E.g. the name of the project - for single source projects."
+
+#: classes/Gems/Default/SourceAction.php:81
+msgid "For creating token-survey url."
+msgstr "For creating token-survey url."
+
+#: classes/Gems/Default/SourceAction.php:86
+msgid "The database server used by the source."
+msgstr "The database server used by the source."
+
#: classes/Gems/Default/SourceAction.php:88
msgid "Do not forget the underscores."
msgstr "Do not forget the underscores."
@@ -1808,63 +1819,67 @@
msgid "Checking survey results for %s source."
msgstr "Checking survey results for %s source."
+#: classes/Gems/Default/SourceAction.php:143
+msgid "Source Url"
+msgstr "Source Url"
+
#: classes/Gems/Default/SourceAction.php:145
msgid "Adaptor class"
msgstr "Adaptor class"
#: classes/Gems/Default/SourceAction.php:147
-msgid "DB Adaptor"
-msgstr "DB Adaptor"
+msgid "Database Server"
+msgstr "Database Server"
#: classes/Gems/Default/SourceAction.php:149
msgid "Database host"
msgstr "Database host"
-#: classes/Gems/Default/SourceAction.php:152
+#: classes/Gems/Default/SourceAction.php:153
msgid "Table prefix"
msgstr "Table prefix"
-#: classes/Gems/Default/SourceAction.php:156
+#: classes/Gems/Default/SourceAction.php:157
msgid "Last check"
msgstr "Last check"
-#: classes/Gems/Default/SourceAction.php:189
+#: classes/Gems/Default/SourceAction.php:190
msgid "source"
msgid_plural "sources"
msgstr[0] "source"
msgstr[1] "sources"
-#: classes/Gems/Default/SourceAction.php:194
+#: classes/Gems/Default/SourceAction.php:195
msgid "Survey Sources"
msgstr "Survey Sources"
-#: classes/Gems/Default/SourceAction.php:202
+#: classes/Gems/Default/SourceAction.php:203
msgid "This installation is active."
msgstr "This installation is active."
-#: classes/Gems/Default/SourceAction.php:204
+#: classes/Gems/Default/SourceAction.php:205
msgid "Inactive installation."
msgstr "Inactive installation."
-#: classes/Gems/Default/SourceAction.php:217
-#: classes/Gems/Default/SourceAction.php:236
+#: classes/Gems/Default/SourceAction.php:218
+#: classes/Gems/Default/SourceAction.php:237
msgid "No changes."
msgstr "No changes."
-#: classes/Gems/Default/SourceAction.php:232
+#: classes/Gems/Default/SourceAction.php:233
#, php-format
msgid "Synchronization of source %s:"
msgstr "Synchronization of source %s:"
-#: classes/Gems/Default/SourceAction.php:243
+#: classes/Gems/Default/SourceAction.php:244
msgid "Synchronize all sources of surveys"
msgstr "Synchronize all sources of surveys"
-#: classes/Gems/Default/SourceAction.php:244
+#: classes/Gems/Default/SourceAction.php:245
msgid "Synchronization will update the status of all surveys imported into this project to the status at the sources."
msgstr "Synchronization will update the status of all surveys imported into this project to the status at the sources."
-#: classes/Gems/Default/SourceAction.php:251
+#: classes/Gems/Default/SourceAction.php:252
msgid "Are you sure you want to synchronize all survey sources?"
msgstr "Are you sure you want to synchronize all survey sources?"
@@ -3541,10 +3556,12 @@
msgid "This track can be assigned since %s."
msgstr "This track can be assigned since %s."
-#: views/scripts/index/login.phtml:12
-msgid "The Pulse software was made possible thanks to support from "
-msgstr "The Pulse software was made possible thanks to support from "
+#~ msgid "DB Adaptor"
+#~ msgstr "DB Adaptor"
+#~ msgid "The Pulse software was made possible thanks to support from "
+#~ msgstr "The Pulse software was made possible thanks to support from "
+
#~ msgid "ACL"
#~ msgstr "ACL"
Modified: trunk/library/languages/default-nl.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-nl.po
===================================================================
--- trunk/library/languages/default-nl.po 2011-10-20 12:44:50 UTC (rev 117)
+++ trunk/library/languages/default-nl.po 2011-10-20 12:56:42 UTC (rev 118)
@@ -2,9 +2,9 @@
msgstr ""
"Project-Id-Version: Pulse NL\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-10-17 15:19+0100\n"
+"POT-Creation-Date: 2011-10-20 14:51+0100\n"
"PO-Revision-Date: \n"
-"Last-Translator: Menno Dekker <men...@er...>\n"
+"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -381,7 +381,7 @@
msgid "Birthday"
msgstr "Geboren op"
-#: classes/Gems/Tracker.php:726
+#: classes/Gems/Tracker.php:732
msgid "Checks performed"
msgstr "Controle uitgevoerd"
@@ -1346,7 +1346,6 @@
msgstr "Ongeldige organisatie."
#: classes/Gems/Default/OrganizationAction.php:117
-#: classes/Gems/Default/SourceAction.php:143
msgid "Url"
msgstr "Url"
@@ -1791,6 +1790,18 @@
msgid "Leave empty for the Gems database."
msgstr "Leeglaten bij gebruik van de Gems database."
+#: classes/Gems/Default/SourceAction.php:79
+msgid "E.g. the name of the project - for single source projects."
+msgstr "Bijvoorbeeld de project naam - bij projecten met maar één bron."
+
+#: classes/Gems/Default/SourceAction.php:81
+msgid "For creating token-survey url."
+msgstr "Voor kenmerk-vragenlijst url."
+
+#: classes/Gems/Default/SourceAction.php:86
+msgid "The database server used by the source."
+msgstr "Het merk database server gebruikt door deze bron."
+
#: classes/Gems/Default/SourceAction.php:88
msgid "Do not forget the underscores."
msgstr "Vergeet de underscores niet."
@@ -1808,63 +1819,67 @@
msgid "Checking survey results for %s source."
msgstr "Controle vragenlijstresultaten voor %s bron."
+#: classes/Gems/Default/SourceAction.php:143
+msgid "Source Url"
+msgstr "Bron Url"
+
#: classes/Gems/Default/SourceAction.php:145
msgid "Adaptor class"
msgstr "Adaptor klasse"
#: classes/Gems/Default/SourceAction.php:147
-msgid "DB Adaptor"
-msgstr "DB Adaptor"
+msgid "Database Server"
+msgstr "Database Server"
#: classes/Gems/Default/SourceAction.php:149
msgid "Database host"
msgstr "Database machine"
-#: classes/Gems/Default/SourceAction.php:152
+#: classes/Gems/Default/SourceAction.php:153
msgid "Table prefix"
msgstr "Voorvoegsel tabel"
-#: classes/Gems/Default/SourceAction.php:156
+#: classes/Gems/Default/SourceAction.php:157
msgid "Last check"
msgstr "Laatste controle"
-#: classes/Gems/Default/SourceAction.php:189
+#: classes/Gems/Default/SourceAction.php:190
msgid "source"
msgid_plural "sources"
msgstr[0] "bron"
msgstr[1] "bronnen"
-#: classes/Gems/Default/SourceAction.php:194
+#: classes/Gems/Default/SourceAction.php:195
msgid "Survey Sources"
msgstr "Bronnen"
-#: classes/Gems/Default/SourceAction.php:202
+#: classes/Gems/Default/SourceAction.php:203
msgid "This installation is active."
msgstr "Deze installatie is actief"
-#: classes/Gems/Default/SourceAction.php:204
+#: classes/Gems/Default/SourceAction.php:205
msgid "Inactive installation."
msgstr "Deze installatie is inactief"
-#: classes/Gems/Default/SourceAction.php:217
-#: classes/Gems/Default/SourceAction.php:236
+#: classes/Gems/Default/SourceAction.php:218
+#: classes/Gems/Default/SourceAction.php:237
msgid "No changes."
msgstr "Geen veranderingen"
-#: classes/Gems/Default/SourceAction.php:232
+#: classes/Gems/Default/SourceAction.php:233
#, php-format
msgid "Synchronization of source %s:"
msgstr "Synchronisatie van %s bron:"
-#: classes/Gems/Default/SourceAction.php:243
+#: classes/Gems/Default/SourceAction.php:244
msgid "Synchronize all sources of surveys"
msgstr "Synchronizeer alle vragenlijsten bronnen"
-#: classes/Gems/Default/SourceAction.php:244
+#: classes/Gems/Default/SourceAction.php:245
msgid "Synchronization will update the status of all surveys imported into this project to the status at the sources."
msgstr "Synchronisatie zal de status van alle vragenlijsten in dit project aanpassen aan de status van de bron."
-#: classes/Gems/Default/SourceAction.php:251
+#: classes/Gems/Default/SourceAction.php:252
msgid "Are you sure you want to synchronize all survey sources?"
msgstr "Weet je zeker dat je alle bronnen wil synchroniseren?"
@@ -3541,10 +3556,12 @@
msgid "This track can be assigned since %s."
msgstr "Dit traject kan sinds %s aan een patiënt toegewezen worden."
-#: views/scripts/index/login.phtml:12
-msgid "The Pulse software was made possible thanks to support from "
-msgstr "De PULSE software is mede mogelijk gemaakt met steun van "
+#~ msgid "DB Adaptor"
+#~ msgstr "DB Adaptor"
+#~ msgid "The Pulse software was made possible thanks to support from "
+#~ msgstr "De PULSE software is mede mogelijk gemaakt met steun van "
+
#~ msgid "ACL"
#~ msgstr "ACL"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-10-20 13:30:25
|
Revision: 119
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=119&view=rev
Author: matijsdejong
Date: 2011-10-20 13:30:18 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
Maintenance mode is now a button and works a little bit nicer as per #20.
Modified Paths:
--------------
trunk/library/classes/Gems/Default/ProjectInformationAction.php
trunk/library/classes/Gems/Menu/MenuAbstract.php
trunk/library/classes/GemsEscort.php
trunk/library/languages/default-en.mo
trunk/library/languages/default-en.po
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
Modified: trunk/library/classes/Gems/Default/ProjectInformationAction.php
===================================================================
--- trunk/library/classes/Gems/Default/ProjectInformationAction.php 2011-10-20 12:56:42 UTC (rev 118)
+++ trunk/library/classes/Gems/Default/ProjectInformationAction.php 2011-10-20 13:30:18 UTC (rev 119)
@@ -45,6 +45,18 @@
*/
class Gems_Default_ProjectInformationAction extends Gems_Controller_Action
{
+ /**
+ *
+ * @var GemsEscort
+ */
+ public $escort;
+
+ /**
+ *
+ * @var Gems_Menu
+ */
+ public $menu;
+
public $useHtmlView = true;
protected function _showTable($caption, $data, $nested = false)
@@ -132,18 +144,40 @@
$data[$this->_('Server OS')] = php_uname('s');
$data[$this->_('Time on server')] = date('r');
+ if (file_exists($this->escort->getMaintenanceLockFilename())) {
+ $label = $this->_('Turn Maintenance Mode OFF');
+ } else {
+ $label = $this->_('Turn Maintenance Mode ON');
+ }
+ $request = $this->getRequest();
+ $buttonList = $this->menu->getMenuList();
+ $buttonList->addParameterSources($request)
+ ->addByController($request->getControllerName(), 'maintenance', $label);
+
+ // $this->html->buttonDiv($buttonList);
+
$this->_showTable($this->_('Version information'), $data);
+
+ $this->html->buttonDiv($buttonList);
}
public function maintenanceAction()
{
- $lockFile = GEMS_ROOT_DIR . '/var/settings/lock.txt';
- if(file_exists($lockFile)) {
+ $lockFile = $this->escort->getMaintenanceLockFilename();
+ if (file_exists($lockFile)) {
unlink($lockFile);
} else {
touch($lockFile);
}
- $this->_forward('index');
+
+ // Dump the existing maintenance mode messages.
+ $this->escort->getMessenger()->clearCurrentMessages();
+ $this->escort->getMessenger()->clearMessages();
+ MUtil_Echo::out();
+
+ // Redirect
+ $request = $this->getRequest();
+ $this->_reroute(array($request->getActionKey() => 'index'));
}
public function phpAction()
Modified: trunk/library/classes/Gems/Menu/MenuAbstract.php
===================================================================
--- trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-10-20 12:56:42 UTC (rev 118)
+++ trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-10-20 13:30:18 UTC (rev 119)
@@ -300,7 +300,7 @@
$page->addAction($this->_('PHP'), null, 'php');
$page->addAction($this->_('Project'), null, 'project');
$page->addAction($this->_('Session'), null, 'session');
- $page->addAction($this->_('Maintenance mode'), 'pr.maintenance', 'maintenance');
+ $page->addButtonOnly($this->_('Maintenance mode'), 'pr.maintenance', 'project-information', 'maintenance');
return $page;
}
Modified: trunk/library/classes/GemsEscort.php
===================================================================
--- trunk/library/classes/GemsEscort.php 2011-10-20 12:56:42 UTC (rev 118)
+++ trunk/library/classes/GemsEscort.php 2011-10-20 13:30:18 UTC (rev 119)
@@ -1133,6 +1133,15 @@
}
/**
+ *
+ * @return string Name of the file that performs the maintenance lock
+ */
+ public function getMaintenanceLockFilename()
+ {
+ return GEMS_ROOT_DIR . '/var/settings/lock.txt';
+ }
+
+ /**
* Retrieve the GemsEscort object
*
* @return GemsEscort
@@ -1523,7 +1532,7 @@
* Check if we are in maintenance mode or not. This is triggeren by a file in the var/settings
* directory with the name lock.txt
*/
- if(file_exists(GEMS_ROOT_DIR . '/var/settings/lock.txt')) {
+ if (file_exists($this->getMaintenanceLockFilename())) {
if ($this->session->user_id && $this->session->user_role !== 'super') {
//Still allow logoff so we can relogin as super
if (!('index' == $request->getControllerName() && 'logoff' == $request->getActionName())) {
@@ -1533,7 +1542,7 @@
$this->_('System is in maintenance mode'));
}
} else {
- $this->getMessenger()->addMessage($this->_('System is in maintenance mode'));
+ $this->addMessage($this->_('System is in maintenance mode'));
MUtil_Echo::r($this->_('System is in maintenance mode'));
}
}
Modified: trunk/library/languages/default-en.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-en.po
===================================================================
--- trunk/library/languages/default-en.po 2011-10-20 12:56:42 UTC (rev 118)
+++ trunk/library/languages/default-en.po 2011-10-20 13:30:18 UTC (rev 119)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse EN\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-10-20 14:51+0100\n"
+"POT-Creation-Date: 2011-10-20 15:30+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -32,44 +32,44 @@
msgid "version"
msgstr "version"
-#: classes/GemsEscort.php:1410
+#: classes/GemsEscort.php:1419
msgid "Take note: your session has expired, your inputs where not saved. Please check the input data and try again"
msgstr "Take note: your session has expired, your inputs where not saved. Please check the input data and try again"
-#: classes/GemsEscort.php:1531
+#: classes/GemsEscort.php:1540
msgid "Please check back later."
msgstr "Please check back later."
-#: classes/GemsEscort.php:1533
-#: classes/GemsEscort.php:1536
-#: classes/GemsEscort.php:1537
+#: classes/GemsEscort.php:1542
+#: classes/GemsEscort.php:1545
+#: classes/GemsEscort.php:1546
msgid "System is in maintenance mode"
msgstr "System is in maintenance mode"
-#: classes/GemsEscort.php:1551
+#: classes/GemsEscort.php:1560
msgid "No access to site."
msgstr "No access to site."
-#: classes/GemsEscort.php:1553
-#: classes/GemsEscort.php:1589
+#: classes/GemsEscort.php:1562
+#: classes/GemsEscort.php:1598
msgid "You have no access to this site."
msgstr "You have no access to this site."
-#: classes/GemsEscort.php:1569
+#: classes/GemsEscort.php:1578
msgid "No access to page"
msgstr "No access to page"
-#: classes/GemsEscort.php:1571
+#: classes/GemsEscort.php:1580
#, php-format
msgid "Access to this page is not allowed for current role: %s."
msgstr "Access to this page is not allowed for current role: %s."
-#: classes/GemsEscort.php:1576
-#: classes/GemsEscort.php:1587
+#: classes/GemsEscort.php:1585
+#: classes/GemsEscort.php:1596
msgid "You are no longer logged in."
msgstr "You are no longer logged in."
-#: classes/GemsEscort.php:1577
+#: classes/GemsEscort.php:1586
msgid "You must login to access this page."
msgstr "You must login to access this page."
@@ -1401,107 +1401,115 @@
msgid "Planning overview"
msgstr "Planning overview"
-#: classes/Gems/Default/ProjectInformationAction.php:71
+#: classes/Gems/Default/ProjectInformationAction.php:83
msgid "empty file"
msgstr "empty file"
-#: classes/Gems/Default/ProjectInformationAction.php:75
+#: classes/Gems/Default/ProjectInformationAction.php:87
msgid "file not found"
msgstr "file not found"
-#: classes/Gems/Default/ProjectInformationAction.php:108
+#: classes/Gems/Default/ProjectInformationAction.php:120
msgid "Logged errors"
msgstr "Logged errors"
-#: classes/Gems/Default/ProjectInformationAction.php:108
+#: classes/Gems/Default/ProjectInformationAction.php:120
msgid "Empty logfile"
msgstr "Empty logfile"
-#: classes/Gems/Default/ProjectInformationAction.php:113
+#: classes/Gems/Default/ProjectInformationAction.php:125
msgid "Project information"
msgstr "Project information"
-#: classes/Gems/Default/ProjectInformationAction.php:117
+#: classes/Gems/Default/ProjectInformationAction.php:129
msgid "Project name"
msgstr "Project name"
-#: classes/Gems/Default/ProjectInformationAction.php:118
+#: classes/Gems/Default/ProjectInformationAction.php:130
msgid "Project version"
msgstr "Project version"
-#: classes/Gems/Default/ProjectInformationAction.php:119
+#: classes/Gems/Default/ProjectInformationAction.php:131
msgid "Gems version"
msgstr "Gems version"
-#: classes/Gems/Default/ProjectInformationAction.php:121
+#: classes/Gems/Default/ProjectInformationAction.php:133
msgid "Gems project"
msgstr "Gems project"
-#: classes/Gems/Default/ProjectInformationAction.php:122
+#: classes/Gems/Default/ProjectInformationAction.php:134
msgid "Gems web directory"
msgstr "Gems web directory"
-#: classes/Gems/Default/ProjectInformationAction.php:123
+#: classes/Gems/Default/ProjectInformationAction.php:135
msgid "Gems code directory"
msgstr "Gems code directory"
-#: classes/Gems/Default/ProjectInformationAction.php:124
+#: classes/Gems/Default/ProjectInformationAction.php:136
msgid "Gems project path"
msgstr "Gems project path"
-#: classes/Gems/Default/ProjectInformationAction.php:125
+#: classes/Gems/Default/ProjectInformationAction.php:137
msgid "MUtil version"
msgstr "MUtil version"
-#: classes/Gems/Default/ProjectInformationAction.php:126
+#: classes/Gems/Default/ProjectInformationAction.php:138
msgid "Zend version"
msgstr "Zend version"
-#: classes/Gems/Default/ProjectInformationAction.php:127
+#: classes/Gems/Default/ProjectInformationAction.php:139
msgid "Application environment"
msgstr "Application environment"
-#: classes/Gems/Default/ProjectInformationAction.php:128
+#: classes/Gems/Default/ProjectInformationAction.php:140
msgid "Application baseuri"
msgstr "Application baseuri"
-#: classes/Gems/Default/ProjectInformationAction.php:129
+#: classes/Gems/Default/ProjectInformationAction.php:141
msgid "Application directory"
msgstr "Application directory"
-#: classes/Gems/Default/ProjectInformationAction.php:130
+#: classes/Gems/Default/ProjectInformationAction.php:142
msgid "PHP version"
msgstr "PHP version"
-#: classes/Gems/Default/ProjectInformationAction.php:131
+#: classes/Gems/Default/ProjectInformationAction.php:143
msgid "Server Hostname"
msgstr "Server Hostname"
-#: classes/Gems/Default/ProjectInformationAction.php:132
+#: classes/Gems/Default/ProjectInformationAction.php:144
msgid "Server OS"
msgstr "Server OS"
-#: classes/Gems/Default/ProjectInformationAction.php:133
+#: classes/Gems/Default/ProjectInformationAction.php:145
msgid "Time on server"
msgstr "Time on server"
-#: classes/Gems/Default/ProjectInformationAction.php:135
+#: classes/Gems/Default/ProjectInformationAction.php:148
+msgid "Turn Maintenance Mode OFF"
+msgstr "Turn Maintenance Mode OFF"
+
+#: classes/Gems/Default/ProjectInformationAction.php:150
+msgid "Turn Maintenance Mode ON"
+msgstr "Turn Maintenance Mode ON"
+
+#: classes/Gems/Default/ProjectInformationAction.php:159
msgid "Version information"
msgstr "Version information"
-#: classes/Gems/Default/ProjectInformationAction.php:151
+#: classes/Gems/Default/ProjectInformationAction.php:185
msgid "Server PHP Info"
msgstr "Server PHP Info"
-#: classes/Gems/Default/ProjectInformationAction.php:164
+#: classes/Gems/Default/ProjectInformationAction.php:198
msgid "Project settings"
msgstr "Project settings"
-#: classes/Gems/Default/ProjectInformationAction.php:171
+#: classes/Gems/Default/ProjectInformationAction.php:205
msgid "Session content"
msgstr "Session content"
-#: classes/Gems/Default/ProjectInformationAction.php:172
+#: classes/Gems/Default/ProjectInformationAction.php:206
msgid "Session"
msgstr "Session"
Modified: trunk/library/languages/default-nl.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-nl.po
===================================================================
--- trunk/library/languages/default-nl.po 2011-10-20 12:56:42 UTC (rev 118)
+++ trunk/library/languages/default-nl.po 2011-10-20 13:30:18 UTC (rev 119)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse NL\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-10-20 14:51+0100\n"
+"POT-Creation-Date: 2011-10-20 15:30+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -32,44 +32,44 @@
msgid "version"
msgstr "versie"
-#: classes/GemsEscort.php:1410
+#: classes/GemsEscort.php:1419
msgid "Take note: your session has expired, your inputs where not saved. Please check the input data and try again"
msgstr "Let op: uw sessie is verlopen, uw invoer is niet opgeslagen. Controleer de gegevens en probeer a.u.b. opnieuw."
-#: classes/GemsEscort.php:1531
+#: classes/GemsEscort.php:1540
msgid "Please check back later."
msgstr "Probeer het later opnieuw."
-#: classes/GemsEscort.php:1533
-#: classes/GemsEscort.php:1536
-#: classes/GemsEscort.php:1537
+#: classes/GemsEscort.php:1542
+#: classes/GemsEscort.php:1545
+#: classes/GemsEscort.php:1546
msgid "System is in maintenance mode"
msgstr "Systeem is in onderhoudsmodus"
-#: classes/GemsEscort.php:1551
+#: classes/GemsEscort.php:1560
msgid "No access to site."
msgstr "Geen toegang tot website."
-#: classes/GemsEscort.php:1553
-#: classes/GemsEscort.php:1589
+#: classes/GemsEscort.php:1562
+#: classes/GemsEscort.php:1598
msgid "You have no access to this site."
msgstr "U heeft geen toegang tot deze website."
-#: classes/GemsEscort.php:1569
+#: classes/GemsEscort.php:1578
msgid "No access to page"
msgstr "Geen toegang tot pagina"
-#: classes/GemsEscort.php:1571
+#: classes/GemsEscort.php:1580
#, php-format
msgid "Access to this page is not allowed for current role: %s."
msgstr "U heeft geen toegang tot deze pagina. Uw huidige rol is: %s."
-#: classes/GemsEscort.php:1576
-#: classes/GemsEscort.php:1587
+#: classes/GemsEscort.php:1585
+#: classes/GemsEscort.php:1596
msgid "You are no longer logged in."
msgstr "U bent niet meer ingelogd."
-#: classes/GemsEscort.php:1577
+#: classes/GemsEscort.php:1586
msgid "You must login to access this page."
msgstr "U moet ingelogd zijn voor toegang tot deze pagina."
@@ -1401,107 +1401,115 @@
msgid "Planning overview"
msgstr "Planning overzicht"
-#: classes/Gems/Default/ProjectInformationAction.php:71
+#: classes/Gems/Default/ProjectInformationAction.php:83
msgid "empty file"
msgstr "leeg bestand"
-#: classes/Gems/Default/ProjectInformationAction.php:75
+#: classes/Gems/Default/ProjectInformationAction.php:87
msgid "file not found"
msgstr "bestand niet gevonden"
-#: classes/Gems/Default/ProjectInformationAction.php:108
+#: classes/Gems/Default/ProjectInformationAction.php:120
msgid "Logged errors"
msgstr "Opgeslagen foutmeldingen"
-#: classes/Gems/Default/ProjectInformationAction.php:108
+#: classes/Gems/Default/ProjectInformationAction.php:120
msgid "Empty logfile"
msgstr "Verwijder alle foutmeldingen"
-#: classes/Gems/Default/ProjectInformationAction.php:113
+#: classes/Gems/Default/ProjectInformationAction.php:125
msgid "Project information"
msgstr "Project informatie"
-#: classes/Gems/Default/ProjectInformationAction.php:117
+#: classes/Gems/Default/ProjectInformationAction.php:129
msgid "Project name"
msgstr "Project naam"
-#: classes/Gems/Default/ProjectInformationAction.php:118
+#: classes/Gems/Default/ProjectInformationAction.php:130
msgid "Project version"
msgstr "Project versie"
-#: classes/Gems/Default/ProjectInformationAction.php:119
+#: classes/Gems/Default/ProjectInformationAction.php:131
msgid "Gems version"
msgstr "Gems versie"
-#: classes/Gems/Default/ProjectInformationAction.php:121
+#: classes/Gems/Default/ProjectInformationAction.php:133
msgid "Gems project"
msgstr "Gems project"
-#: classes/Gems/Default/ProjectInformationAction.php:122
+#: classes/Gems/Default/ProjectInformationAction.php:134
msgid "Gems web directory"
msgstr "Gems web folder"
-#: classes/Gems/Default/ProjectInformationAction.php:123
+#: classes/Gems/Default/ProjectInformationAction.php:135
msgid "Gems code directory"
msgstr "Gems code folder"
-#: classes/Gems/Default/ProjectInformationAction.php:124
+#: classes/Gems/Default/ProjectInformationAction.php:136
msgid "Gems project path"
msgstr "Gems project folder"
-#: classes/Gems/Default/ProjectInformationAction.php:125
+#: classes/Gems/Default/ProjectInformationAction.php:137
msgid "MUtil version"
msgstr "MUtil versie"
-#: classes/Gems/Default/ProjectInformationAction.php:126
+#: classes/Gems/Default/ProjectInformationAction.php:138
msgid "Zend version"
msgstr "Zend versie"
-#: classes/Gems/Default/ProjectInformationAction.php:127
+#: classes/Gems/Default/ProjectInformationAction.php:139
msgid "Application environment"
msgstr "Applicatie omgeving"
-#: classes/Gems/Default/ProjectInformationAction.php:128
+#: classes/Gems/Default/ProjectInformationAction.php:140
msgid "Application baseuri"
msgstr "Applicatie baseuri"
-#: classes/Gems/Default/ProjectInformationAction.php:129
+#: classes/Gems/Default/ProjectInformationAction.php:141
msgid "Application directory"
msgstr "Applicatie folder"
-#: classes/Gems/Default/ProjectInformationAction.php:130
+#: classes/Gems/Default/ProjectInformationAction.php:142
msgid "PHP version"
msgstr "PHP versie"
-#: classes/Gems/Default/ProjectInformationAction.php:131
+#: classes/Gems/Default/ProjectInformationAction.php:143
msgid "Server Hostname"
msgstr "Webserver naam"
-#: classes/Gems/Default/ProjectInformationAction.php:132
+#: classes/Gems/Default/ProjectInformationAction.php:144
msgid "Server OS"
msgstr "Server besturingssysteem"
-#: classes/Gems/Default/ProjectInformationAction.php:133
+#: classes/Gems/Default/ProjectInformationAction.php:145
msgid "Time on server"
msgstr "De tijd op de server"
-#: classes/Gems/Default/ProjectInformationAction.php:135
+#: classes/Gems/Default/ProjectInformationAction.php:148
+msgid "Turn Maintenance Mode OFF"
+msgstr "Onderhoudsmodus UITzetten"
+
+#: classes/Gems/Default/ProjectInformationAction.php:150
+msgid "Turn Maintenance Mode ON"
+msgstr "Onderhoudsmodus AANzetten"
+
+#: classes/Gems/Default/ProjectInformationAction.php:159
msgid "Version information"
msgstr "Versie informatie"
-#: classes/Gems/Default/ProjectInformationAction.php:151
+#: classes/Gems/Default/ProjectInformationAction.php:185
msgid "Server PHP Info"
msgstr "Server PHP Info"
-#: classes/Gems/Default/ProjectInformationAction.php:164
+#: classes/Gems/Default/ProjectInformationAction.php:198
msgid "Project settings"
msgstr "Project instellingen"
-#: classes/Gems/Default/ProjectInformationAction.php:171
+#: classes/Gems/Default/ProjectInformationAction.php:205
msgid "Session content"
msgstr "Sessie inhoud"
-#: classes/Gems/Default/ProjectInformationAction.php:172
+#: classes/Gems/Default/ProjectInformationAction.php:206
msgid "Session"
msgstr "Sessie"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-10-20 16:03:41
|
Revision: 122
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=122&view=rev
Author: matijsdejong
Date: 2011-10-20 16:03:30 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
Continued on ModelSnippetAction (#10): removed functional extension, added the text marker interface and fixed the Echo output.
Fixed several roles that I forgot to add for mail activities.
Modified Paths:
--------------
trunk/library/classes/Gems/Default/MailLogAction.php
trunk/library/classes/Gems/Menu/MenuAbstract.php
trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php
trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php
trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__roles.20.sql
trunk/library/controllers/MailLogController.php
trunk/library/languages/default-en.mo
trunk/library/languages/default-en.po
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
trunk/library/snippets/Generic/ModelItemTableSnippet.php
trunk/library/snippets/Generic/ModelTableSnippet.php
Added Paths:
-----------
trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php
trunk/library/snippets/Mail/
trunk/library/snippets/Mail/Log/
trunk/library/snippets/Mail/Log/MailLogBrowseSnippet.php
Removed Paths:
-------------
trunk/library/classes/Gems/Default/MailLogActionOldStyle.php
Modified: trunk/library/classes/Gems/Default/MailLogAction.php
===================================================================
--- trunk/library/classes/Gems/Default/MailLogAction.php 2011-10-20 14:12:29 UTC (rev 121)
+++ trunk/library/classes/Gems/Default/MailLogAction.php 2011-10-20 16:03:30 UTC (rev 122)
@@ -37,10 +37,8 @@
*/
/**
- * Short description for class
+ * Controller for looking at mail activity
*
- * Long description for class (if any)...
- *
* @package Gems
* @subpackage Default
* @copyright Copyright (c) 2011 Erasmus MC
@@ -50,28 +48,12 @@
class Gems_Default_MailLogAction extends Gems_Controller_ModelSnippetActionAbstract
{
/**
- * Adds columns from the model to the bridge that creates the browse table.
+ * The snippets used for the autofilter action.
*
- * Adds a button column to the model, if such a button exists in the model.
- *
- * @param MUtil_Model_TableBridge $bridge
- * @param MUtil_Model_ModelAbstract $model
- * @rturn void
+ * @var mixed String or array of snippets name
*/
- public function addTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model)
- {
- if ($menuItem = $this->firstAllowedMenuItem('show')) {
- $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge));
- }
+ protected $autofilterSnippets = 'Mail_Log_MailLogBrowseSnippet';
- // Newline placeholder
- $br = MUtil_Html::create('br');
-
- $bridge->addMultiSort('grco_created', $br, 'respondent_name', $br, 'grco_address');
- $bridge->addMultiSort('grco_id_token', $br, 'assigned_by', $br, 'grco_sender');
- $bridge->addMultiSort('grco_topic');
- }
-
/**
* The automatically filtered result
*/
@@ -79,7 +61,6 @@
{
$filter = array('grco_organization' => $this->escort->getCurrentOrganization());
- $this->autofilterParameters['addTableColumns'] = array($this, 'addTableColumns');
$this->autofilterParameters['extraFilter'] = $filter;
$this->autofilterParameters['extraSort'] = array('grco_created' => SORT_DESC);
@@ -147,7 +128,6 @@
{
$this->html->h3($this->_('Mail Activity Log'));
- // MUtil_Echo::track($this->indexParameters);
parent::indexAction();
}
Deleted: trunk/library/classes/Gems/Default/MailLogActionOldStyle.php
===================================================================
--- trunk/library/classes/Gems/Default/MailLogActionOldStyle.php 2011-10-20 14:12:29 UTC (rev 121)
+++ trunk/library/classes/Gems/Default/MailLogActionOldStyle.php 2011-10-20 16:03:30 UTC (rev 122)
@@ -1,150 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Short description of file
- *
- * @package Gems
- * @subpackage Default
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
- */
-
-/**
- * Temprary class until Gems_Controller_ModelSnippetActionAbstract works
- *
- * @package Gems
- * @subpackage Default
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @since Class available since version 1.4.2
- */
-class Gems_Default_MailLogActionOldStyle extends Gems_Controller_BrowseEditAction
-{
- public $sortKey = array('grco_created' => SORT_DESC);
-
- /**
- * Adds columns from the model to the bridge that creates the browse table.
- *
- * Adds a button column to the model, if such a button exists in the model.
- *
- * @param MUtil_Model_TableBridge $bridge
- * @param MUtil_Model_ModelAbstract $model
- * @rturn void
- */
- protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model)
- {
- if ($menuItem = $this->findAllowedMenuItem('show')) {
- $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge));
- }
-
- // Newline placeholder
- $br = MUtil_Html::create('br');
-
- $bridge->addMultiSort('grco_created', $br, 'respondent_name', $br, 'grco_address');
- $bridge->addMultiSort('grco_id_token', $br, 'assigned_by', $br, 'grco_sender');
- $bridge->addMultiSort('grco_topic');
- }
-
- /**
- * Creates a model for getModel(). Called only for each new $action.
- *
- * The parameters allow you to easily adapt the model to the current action. The $detailed
- * parameter was added, because the most common use of action is a split between detailed
- * and summarized actions.
- *
- * @param boolean $detailed True when the current action is not in $summarizedActions.
- * @param string $action The current action.
- * @return MUtil_Model_ModelAbstract
- */
- public function createModel($detailed, $action)
- {
- $model = new Gems_Model_JoinModel('maillog', 'gems__log_respondent_communications');
-
- $model->addLeftTable('gems__respondents', array('grco_id_to' => 'grs_id_user'));
- $model->addLeftTable('gems__staff', array('grco_id_by' => 'gsf_id_user'));
- $model->addLeftTable('gems__mail_templates', array('grco_id_message' => 'gmt_id_message'));
-
- $model->addColumn(
- "TRIM(CONCAT(COALESCE(CONCAT(grs_last_name, ', '), '-, '), COALESCE(CONCAT(grs_first_name, ' '), ''), COALESCE(grs_surname_prefix, '')))",
- 'respondent_name');
- $model->addColumn(
- "CASE WHEN gems__staff.gsf_id_user IS NULL
- THEN '-'
- ELSE
- CONCAT(
- COALESCE(gems__staff.gsf_last_name, ''),
- ', ',
- COALESCE(gems__staff.gsf_first_name, ''),
- COALESCE(CONCAT(' ', gems__staff.gsf_surname_prefix), '')
- )
- END",
- 'assigned_by');
-
- $model->resetOrder();
-
- $model->set('grco_created', 'label', $this->_('Date sent'));
- $model->set('respondent_name', 'label', $this->_('Receiver'));
- $model->set('grco_address', 'label', $this->_('To address'), 'itemDisplay', 'MUtil_Html_AElement::ifmail');
- $model->set('assigned_by', 'label', $this->_('Sender'));
- $model->set('grco_sender', 'label', $this->_('From address'), 'itemDisplay', 'MUtil_Html_AElement::ifmail');
- $model->set('grco_id_token', 'label', $this->_('Token'));
- $model->set('grco_topic', 'label', $this->_('Subject'));
-
- if ($detailed) {
- $model->set('gmt_subject', 'label', $this->_('Template'));
- } else {
- $model->set('grco_created', 'formatFunction', $this->util->getTranslated()->formatDate);
- }
-
- return $model;
- }
-
- /**
- * Helper function to allow generalized statements about the items in the model.
- *
- * @param int $count
- * @return $string
- */
- public function getTopic($count = 1)
- {
- return $this->plural('Activity Log', 'Activity Logs', $count);
- }
-
-
- /**
- * Helper function to allow generalized treatment of the header.
- *
- * return $string
- */
- public function getTopicTitle()
- {
- return $this->_('Mail Activity Log');
- }
-}
Modified: trunk/library/classes/Gems/Menu/MenuAbstract.php
===================================================================
--- trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-10-20 14:12:29 UTC (rev 121)
+++ trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-10-20 16:03:30 UTC (rev 122)
@@ -230,7 +230,7 @@
// MAIL ACTIVITY CONTROLLER
//$setup->addBrowsePage();
- $page = $setup->addPage($this->_('Activity'), 'pr.mail.log', 'mail-log');
+ $page = $setup->addPage($this->_('Activity log'), 'pr.mail.log', 'mail-log');
$page->addAutofilterAction();
$page->addExcelAction();
$page->addShowAction();
Modified: trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php 2011-10-20 14:12:29 UTC (rev 121)
+++ trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php 2011-10-20 16:03:30 UTC (rev 122)
@@ -103,6 +103,24 @@
protected $sortParamDesc = 'dsrt';
/**
+ * Adds columns from the model to the bridge that creates the browse table.
+ *
+ * Overrule this function to add different columns to the browse table, without
+ * having to recode the core table building code.
+ *
+ * @param MUtil_Model_TableBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @return void
+ */
+ protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model)
+ {
+ // make sure search results are highlighted
+ $this->applyTextMarker();
+
+ return parent::addBrowseTableColumns($bridge, $model);
+ }
+
+ /**
* Add the paginator panel to the table.
*
* Only called when $this->browse is true. Overrule this function
@@ -116,6 +134,30 @@
}
/**
+ * Make sure generic search text results are marked
+ *
+ * @return void
+ */
+ protected function applyTextMarker()
+ {
+ $model = $this->getModel();
+
+ $textKey = $model->getTextFilter();
+ $filter = $model->getFilter();
+
+ if (isset($filter[$textKey])) {
+ $searchText = $filter[$textKey];
+ // MUtil_Echo::r('[' . $searchText . ']');
+ $marker = new MUtil_Html_Marker($model->getTextSearches($searchText), 'strong', 'UTF-8');
+ foreach ($model->getItemNames() as $name) {
+ if ($model->get($name, 'label')) {
+ $model->set($name, 'markCallback', array($marker, 'mark'));
+ }
+ }
+ }
+ }
+
+ /**
* Should be called after answering the request to allow the Target
* to check if all required registry values have been set correctly.
*
@@ -204,7 +246,7 @@
$data = $this->requestCache->getProgramParams();
$model->applyParameters($data);
-
+
} else {
parent::processFilterAndSort($model);
}
Copied: trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php (from rev 114, trunk/library/snippets/Generic/ModelTableSnippet.php)
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php (rev 0)
+++ trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php 2011-10-20 16:03:30 UTC (rev 122)
@@ -0,0 +1,94 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Snippets
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Displays multiple items from a model in a tabel by row using
+ * the model set through the $model snippet parameter.
+ *
+ * If you want to use this class "as is" use the 'Generic_ModelTableSnippet' snippet.
+ *
+ * This class is not in the standard snippet loading directories and does not follow
+ * their naming conventions, but exists only to make it simple to extend this class
+ * for a specific implementation.
+ *
+ * @package MUtil
+ * @subpackage Snippets
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.4
+ */
+class Gems_Snippets_ModelTableSnippetGeneric extends Gems_Snippets_ModelTableSnippetAbstract
+{
+ /**
+ *
+ * @var MUtil_Model_ModelAbstract
+ */
+ protected $model;
+
+ /**
+ *
+ * @var Gems_Util
+ */
+ protected $util;
+
+ /**
+ * Automatically add request cacge
+ *
+ * Should be called after answering the request to allow the Target
+ * to check if all required registry values have been set correctly.
+ *
+ * @return boolean False if required are missing.
+ */
+ public function checkRegistryRequestsAnswers()
+ {
+ if ($this->util && (! $this->requestCache)) {
+ $this->requestCache = $this->util->getRequestCache();
+ }
+
+ return parent::checkRegistryRequestsAnswers();
+ }
+
+ /**
+ * Creates the model
+ *
+ * @return MUtil_Model_ModelAbstract
+ */
+ protected function createModel()
+ {
+ return $this->model;
+ }
+}
Modified: trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php 2011-10-20 14:12:29 UTC (rev 121)
+++ trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php 2011-10-20 16:03:30 UTC (rev 122)
@@ -98,6 +98,19 @@
protected $showSnippets = 'ModelVerticalTableSnippet';
/**
+ * Array of the actions that use a summarized version of the model.
+ *
+ * This determines the value of $detailed in createAction(). As it is usually
+ * less of a problem to use a $detailed model with an action that should use
+ * a summarized model and I guess there will usually be more detailed actions
+ * than summarized ones it seems less work to specify these.
+ *
+ * @var array $summarizedActions Array of the actions that use a
+ * summarized version of the model.
+ */
+ public $summarizedActions = array('index', 'autofilter');
+
+ /**
* Set the action key in request
*
* Use this when an action is a Ajax action for retrieving
@@ -137,7 +150,9 @@
}
if ($resetMvc && MUtil_Echo::hasOutput()) {
- $this->html->raw(MUtil_Echo::out());
+ // Lazy call here, because any echo calls in the snippets have not yet been
+ // performed. so they will appear only in the next call when not lazy.
+ $this->html->raw(MUtil_Lazy::call(array('MUtil_Echo', 'out')));
}
}
Modified: trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php 2011-10-20 14:12:29 UTC (rev 121)
+++ trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php 2011-10-20 16:03:30 UTC (rev 122)
@@ -57,13 +57,6 @@
protected $_marker;
/**
- * Functional extension: optionally use this function to add the browse columns
- *
- * @var callable With signature: function(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model, MUtil_Snippets_ModelTableSnippetAbstract $snippet)
- */
- public $addTableColumns;
-
- /**
* Url parts added to each link in the resulting table
*
* @var array
@@ -171,11 +164,7 @@
$bridge->setBaseUrl($this->baseUrl);
}
- if (is_callable($this->addTableColumns)) {
- call_user_func($this->addTableColumns, $bridge, $model, $this);
- } else {
- $this->addBrowseTableColumns($bridge, $model);
- }
+ $this->addBrowseTableColumns($bridge, $model);
return $bridge->getTable();
}
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-10-20 14:12:29 UTC (rev 121)
+++ trunk/library/configs/db/patches.sql 2011-10-20 16:03:30 UTC (rev 122)
@@ -208,3 +208,6 @@
UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges,',pr.maintenance') WHERE grl_name = 'super' AND grl_privileges NOT LIKE '%pr.maintenance%';
-- GEMS VERSION: 42
+-- PATCH: Add mail actions to admin role
+UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges, ',pr.mail.log') WHERE grl_name = 'admin' AND grl_privileges NOT LIKE '%pr.mail.log%';
+UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges, ',pr.mail.server,pr.mail.server.create,pr.mail.server.delete,pr.mail.server.edit') WHERE grl_name = 'super' AND grl_privileges NOT LIKE '%pr.mail.server%';
Modified: trunk/library/configs/db/tables/gems__roles.20.sql
===================================================================
--- trunk/library/configs/db/tables/gems__roles.20.sql 2011-10-20 14:12:29 UTC (rev 121)
+++ trunk/library/configs/db/tables/gems__roles.20.sql 2011-10-20 16:03:30 UTC (rev 122)
@@ -32,5 +32,5 @@
('staff','staff','pr.option.edit,pr.option.password,pr.plan,pr.plan.overview,pr.plan.token,pr.project,pr.project.questions,pr.respondent.create,pr.respondent.edit,pr.respondent.who,pr.setup,pr.staff,pr.survey,pr.survey.create,pr.token,pr.token.answers,pr.token.delete,pr.token.edit,pr.token.mail,pr.token.print,pr.track,pr.track.create,pr.track.delete,pr.track.edit,pr.respondent.reportdeath','guest', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
('physician','physician','','staff', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
('researcher','researcher','pr.invitation,pr.result,pr.islogin','', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('admin','admin','pr.consent,pr.consent.create,pr.consent.edit,pr.group,pr.role,pr.mail,pr.mail.create,pr.mail.delete,pr.mail.edit,pr.organization,pr.organization-switch,pr.plan.overview.excel,pr.plan.respondent,pr.plan.respondent.excel,pr.plan.token.excel,pr.project-information,pr.reception,pr.reception.create,pr.reception.edit,pr.respondent.choose-org,pr.respondent.delete,pr.respondent.result,pr.source,pr.staff.create,pr.staff.delete,pr.staff.edit,pr.staff.see.all,pr.survey-maintenance,pr.track-maintenance,pr.token.mail.freetext','staff,researcher,security', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('super','super','pr.consent.delete,pr.country,pr.country.create,pr.country.delete,pr.country.edit,pr.database,pr.database.create,pr.database.delete,pr.database.edit,pr.database.execute,pr.database.patches,pr.group.create,pr.group.edit,pr.role.create,pr.role.edit,pr.language,pr.organization.create,pr.organization.edit,pr.plan.choose-org,pr.plan.mail-as-application,pr.reception.delete,pr.source.create,pr.source.edit,pr.source.synchronize,pr.source.synchronize-all,pr.staff.edit.all,pr.survey-maintenance.edit,pr.track-maintenance.create,pr.track-maintenance.edit,pr.maintenance','admin', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1);
+ ('admin','admin','pr.consent,pr.consent.create,pr.consent.edit,pr.group,pr.role,pr.mail,pr.mail.create,pr.mail.delete,pr.mail.edit,pr.mail.log,pr.organization,pr.organization-switch,pr.plan.overview.excel,pr.plan.respondent,pr.plan.respondent.excel,pr.plan.token.excel,pr.project-information,pr.reception,pr.reception.create,pr.reception.edit,pr.respondent.choose-org,pr.respondent.delete,pr.respondent.result,pr.source,pr.staff.create,pr.staff.delete,pr.staff.edit,pr.staff.see.all,pr.survey-maintenance,pr.track-maintenance,pr.token.mail.freetext','staff,researcher,security', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
+ ('super','super','pr.consent.delete,pr.country,pr.country.create,pr.country.delete,pr.country.edit,pr.database,pr.database.create,pr.database.delete,pr.database.edit,pr.database.execute,pr.database.patches,pr.group.create,pr.group.edit,pr.language,pr.mail.server,pr.mail.server.create,pr.mail.server.delete,pr.mail.server.edit,pr.organization.create,pr.organization.edit,pr.plan.choose-org,pr.plan.mail-as-application,pr.reception.delete,pr.role.create,pr.role.edit,pr.source.create,pr.source.edit,pr.source.synchronize,pr.source.synchronize-all,pr.staff.edit.all,pr.survey-maintenance.edit,pr.track-maintenance.create,pr.track-maintenance.edit,pr.maintenance','admin', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1);
Modified: trunk/library/controllers/MailLogController.php
===================================================================
--- trunk/library/controllers/MailLogController.php 2011-10-20 14:12:29 UTC (rev 121)
+++ trunk/library/controllers/MailLogController.php 2011-10-20 16:03:30 UTC (rev 122)
@@ -42,6 +42,5 @@
* @license New BSD License
* @since Class available since version 1.4.2
*/
-class MailLogController extends Gems_Default_MailLogActionOldStyle
-{
-}
+class MailLogController extends Gems_Default_MailLogAction
+{ }
Modified: trunk/library/languages/default-en.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-en.po
===================================================================
--- trunk/library/languages/default-en.po 2011-10-20 14:12:29 UTC (rev 121)
+++ trunk/library/languages/default-en.po 2011-10-20 16:03:30 UTC (rev 122)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse EN\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-10-20 15:30+0100\n"
+"POT-Creation-Date: 2011-10-20 17:52+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -1151,8 +1151,7 @@
msgstr "Log maintenance"
#: classes/Gems/Default/MailAction.php:61
-#: classes/Gems/Default/MailLogAction.php:132
-#: classes/Gems/Default/MailLogActionOldStyle.php:118
+#: classes/Gems/Default/MailLogAction.php:113
msgid "Subject"
msgstr "Subject"
@@ -1170,51 +1169,38 @@
msgid "Email templates"
msgstr "Email templates"
-#: classes/Gems/Default/MailLogAction.php:126
-#: classes/Gems/Default/MailLogActionOldStyle.php:112
+#: classes/Gems/Default/MailLogAction.php:107
msgid "Date sent"
msgstr "Date sent"
-#: classes/Gems/Default/MailLogAction.php:127
-#: classes/Gems/Default/MailLogActionOldStyle.php:113
+#: classes/Gems/Default/MailLogAction.php:108
msgid "Receiver"
msgstr "Receiver"
-#: classes/Gems/Default/MailLogAction.php:128
-#: classes/Gems/Default/MailLogActionOldStyle.php:114
+#: classes/Gems/Default/MailLogAction.php:109
msgid "To address"
msgstr "To address"
-#: classes/Gems/Default/MailLogAction.php:129
-#: classes/Gems/Default/MailLogActionOldStyle.php:115
+#: classes/Gems/Default/MailLogAction.php:110
msgid "Sender"
msgstr "Sender"
-#: classes/Gems/Default/MailLogAction.php:130
-#: classes/Gems/Default/MailLogActionOldStyle.php:116
+#: classes/Gems/Default/MailLogAction.php:111
msgid "From address"
msgstr "From address"
-#: classes/Gems/Default/MailLogAction.php:135
-#: classes/Gems/Default/MailLogActionOldStyle.php:121
+#: classes/Gems/Default/MailLogAction.php:116
msgid "Template"
msgstr "Template"
-#: classes/Gems/Default/MailLogAction.php:148
-#: classes/Gems/Default/MailLogActionOldStyle.php:148
+#: classes/Gems/Default/MailLogAction.php:129
msgid "Mail Activity Log"
msgstr "Mail Activity Log"
-#: classes/Gems/Default/MailLogAction.php:160
+#: classes/Gems/Default/MailLogAction.php:140
msgid "Show Mail Activity Log item"
msgstr "Show Mail Activity Log item"
-#: classes/Gems/Default/MailLogActionOldStyle.php:137
-msgid "Activity Log"
-msgid_plural "Activity Logs"
-msgstr[0] "Activity Log"
-msgstr[1] "Activity Logs"
-
#: classes/Gems/Default/MailServerAction.php:68
msgid "From address [part]"
msgstr "From address [part]"
@@ -1256,6 +1242,8 @@
msgstr "User ID"
#: classes/Gems/Default/MailServerAction.php:90
+#: classes/Gems/Default/OptionAction.php:107
+#: classes/Gems/Default/OptionAction.php:112
msgid "Repeat password"
msgstr "Repeat password"
@@ -1274,14 +1262,10 @@
msgstr "Email servers"
#: classes/Gems/Default/OptionAction.php:73
-#: classes/Gems/Default/OrganizationAction.php:128
-#: classes/Gems/Default/RespondentAction.php:173
-#: classes/Gems/Default/StaffAction.php:188
msgid "Language"
msgstr "Language"
#: classes/Gems/Default/OptionAction.php:74
-#: classes/Gems/Default/StaffAction.php:189
msgid "Logout on survey"
msgstr "Logout on survey"
@@ -1568,6 +1552,7 @@
msgstr "Survey not specified."
#: classes/Gems/Default/ProjectTracksAction.php:120
+#: classes/Gems/Default/TrackActionAbstract.php:479
#, php-format
msgid "Track %s does not exist."
msgstr "Track %s does not exist."
@@ -2515,8 +2500,8 @@
msgstr "Some help for this export"
#: classes/Gems/Menu/MenuAbstract.php:233
-msgid "Activity"
-msgstr "Activity"
+msgid "Activity log"
+msgstr "Activity Log"
#: classes/Gems/Menu/MenuAbstract.php:239
msgid "Servers"
@@ -3564,6 +3549,9 @@
msgid "This track can be assigned since %s."
msgstr "This track can be assigned since %s."
+#~ msgid "Activity"
+#~ msgstr "Activity"
+
#~ msgid "DB Adaptor"
#~ msgstr "DB Adaptor"
Modified: trunk/library/languages/default-nl.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-nl.po
===================================================================
--- trunk/library/languages/default-nl.po 2011-10-20 14:12:29 UTC (rev 121)
+++ trunk/library/languages/default-nl.po 2011-10-20 16:03:30 UTC (rev 122)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse NL\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-10-20 15:30+0100\n"
+"POT-Creation-Date: 2011-10-20 17:53+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -1151,8 +1151,7 @@
msgstr "Logboek onderhoud"
#: classes/Gems/Default/MailAction.php:61
-#: classes/Gems/Default/MailLogAction.php:132
-#: classes/Gems/Default/MailLogActionOldStyl...
[truncated message content] |
|
From: <gem...@li...> - 2011-10-24 10:20:34
|
Revision: 127
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=127&view=rev
Author: matijsdejong
Date: 2011-10-24 10:20:26 +0000 (Mon, 24 Oct 2011)
Log Message:
-----------
Renamed MailController to MailTemplateController
Snippet based browse edit replacement #10 and mails configurable from interface #29 are done, except for removing items and the mail jobs are not yet used.
Bug #18 is corrected.
Modified Paths:
--------------
trunk/library/changelog.txt
trunk/library/classes/Gems/Menu/MenuAbstract.php
trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php
trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php
trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php
trunk/library/classes/MUtil/Snippets/ModelFormSnippetAbstract.php
trunk/library/configs/db/tables/gems__mail_jobs.300.sql
trunk/library/snippets/Generic/ModelItemTableSnippet.php
trunk/library/snippets/Mail/Log/MailLogBrowseSnippet.php
Added Paths:
-----------
trunk/library/classes/Gems/Default/MailJobAction.php
trunk/library/classes/Gems/Default/MailTemplateAction.php
trunk/library/controllers/MailJobController.php
trunk/library/controllers/MailTemplateController.php
Removed Paths:
-------------
trunk/library/classes/Gems/Default/MailAction.php
trunk/library/controllers/MailController.php
Modified: trunk/library/changelog.txt
===================================================================
--- trunk/library/changelog.txt 2011-10-21 15:43:06 UTC (rev 126)
+++ trunk/library/changelog.txt 2011-10-24 10:20:26 UTC (rev 127)
@@ -1,3 +1,7 @@
+Important changes from 1.4.3 => 1.5
+============================================================
+MailController is now claaed MailTemplateController
+
Important changes from 1.4.2 => 1.4.3
============================================================
* gtr_organisations renamed to gtr_organizations
Deleted: trunk/library/classes/Gems/Default/MailAction.php
===================================================================
--- trunk/library/classes/Gems/Default/MailAction.php 2011-10-21 15:43:06 UTC (rev 126)
+++ trunk/library/classes/Gems/Default/MailAction.php 2011-10-24 10:20:26 UTC (rev 127)
@@ -1,130 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @package Gems
- * @subpackage Default
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id$
- */
-
-/**
- *
- * @package Gems
- * @subpackage Default
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @since Class available since version 1.1
- */
-class Gems_Default_MailAction extends Gems_Controller_BrowseEditAction
-{
- /**
- * Creates a model for getModel(). Called only for each new $action.
- *
- * The parameters allow you to easily adapt the model to the current action. The $detailed
- * parameter was added, because the most common use of action is a split between detailed
- * and summarized actions.
- *
- * @param boolean $detailed True when the current action is not in $summarizedActions.
- * @param string $action The current action.
- * $return MUtil_Model_ModelAbstract
- */
- public function createModel($detailed, $action)
- {
- $model = new MUtil_Model_TableModel('gems__mail_templates');
- $model->set('gmt_subject', 'label', $this->_('Subject'));
-
- if ($detailed) {
- $model->set('gmt_body',
- 'label', $this->_('Message'),
- 'itemDisplay', array('Gems_Email_EmailFormAbstract', 'displayMailText'));
- }
-
- return $model;
- }
-
- public function getAutoSearchElements(MUtil_Model_ModelAbstract $model, array $data)
- {
- $elements = parent::getAutoSearchElements($model, $data);
- $options = array('' => $this->_('(all organizations)')) + $this->util->getDbLookup()->getOrganizations();
-
- $elements[] = new Zend_Form_Element_Select('org_id', array('multiOptions' => $options));
-
- return $elements;
- }
-
- protected function getDataFilter(array $data)
- {
- if (isset($data['org_id']) && $data['org_id']) {
- $organizationId = intval($data['org_id']);
- return array("LOCATE('|$organizationId|', gmt_organizations) > 0");
- }
-
- return parent::getDataFilter($data);
- }
-
- public function getTopic($count = 1)
- {
- return $this->plural('email template', 'email templates', $count);
- }
-
- public function getTopicTitle()
- {
- return $this->_('Email templates');
- }
-
- protected function processForm($saveLabel = null, $data = null)
- {
- $model = $this->getModel();
- $isNew = ! $model->applyRequest($this->getRequest())->hasFilter();
- $form = new Gems_Email_MailTemplateForm($this->escort);
-
- $wasSaved = $form->processRequest($this->_request);
-
- if ($form->hasMessages()) {
- $this->addMessage($form->getMessages());
- }
-
- if ($wasSaved) {
- $this->addMessage(sprintf($this->_('%2$u %1$s saved'), $this->getTopic($wasSaved), $wasSaved));
- $this->afterSaveRoute($form->getValues());
-
- } else {
- $table = new MUtil_Html_TableElement(array('class' => 'formTable'));
- $table->setAsFormLayout($form, true, true);
- $table['tbody'][0][0]->class = 'label'; // Is only one row with formLayout, so all in output fields get class.
- if ($links = $this->createMenuLinks(10)) {
- $table->tf(); // Add empty cell, no label
- $linksCell = $table->tf($links);
- }
-
- return $form;
- }
- }
-}
Added: trunk/library/classes/Gems/Default/MailJobAction.php
===================================================================
--- trunk/library/classes/Gems/Default/MailJobAction.php (rev 0)
+++ trunk/library/classes/Gems/Default/MailJobAction.php 2011-10-24 10:20:26 UTC (rev 127)
@@ -0,0 +1,180 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Default
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ *
+ *
+ * @package Gems
+ * @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.4
+ */
+class Gems_Default_MailJobAction extends Gems_Controller_ModelSnippetActionAbstract
+{
+ /**
+ *
+ * @var ArrayObject
+ */
+ public $project;
+
+
+ /**
+ * The automatically filtered result
+ *
+ * @param $resetMvc When true only the filtered resulsts
+ */
+ public function autofilterAction($resetMvc = true)
+ {
+ $this->autofilterParameters['onEmpty'] = $this->_('No automatic mail jobs found...');
+
+ parent::autofilterAction($resetMvc);
+ }
+
+ /**
+ * Action for showing a create new item page
+ */
+ public function createAction()
+ {
+ $this->createEditParameters['formTitle'] = $this->_('New automatic mail job...');
+
+ parent::createAction();
+ }
+
+ /**
+ * Creates a model for getModel(). Called only for each new $action.
+ *
+ * The parameters allow you to easily adapt the model to the current action. The $detailed
+ * parameter was added, because the most common use of action is a split between detailed
+ * and summarized actions.
+ *
+ * @param boolean $detailed True when the current action is not in $summarizedActions.
+ * @param string $action The current action.
+ * @return MUtil_Model_ModelAbstract
+ */
+ protected function createModel($detailed, $action)
+ {
+ $dbLookup = $this->util->getDbLookup();
+ $dbTracks = $this->util->getTrackData();
+ $translated = $this->util->getTranslated();
+ $empty = $translated->getEmptyDropdownArray();
+ $unselected = array('' => '');
+
+ $model = new MUtil_Model_TableModel('gems__mail_jobs');
+
+ Gems_Model::setChangeFieldsByPrefix($model, 'gmj');
+
+ $model->set('gmj_id_message', 'label', $this->_('Template'), 'multiOptions', $unselected + $dbLookup->getMailTemplates());
+ $model->set('gmj_id_user_as', 'label', $this->_('By staff member'),
+ 'multiOptions', $unselected + $dbLookup->getStaff(), 'default', $this->escort->getCurrentUserId(),
+ 'description', $this->_('Used for logging and possibly from address.'));
+ $model->set('gmj_active', 'label', $this->_('Active'),
+ 'multiOptions', $translated->getYesNo(), 'elementClass', 'Checkbox', 'required', true,
+ 'description', $this->_('Job is only run when active.'));
+
+ $fromMethods = $unselected + $this->getBulkMailFromOptions();
+ $model->set('gmj_from_method', 'label', $this->_('From address used'), 'multiOptions', $fromMethods);
+ if ($detailed) {
+ $model->set('gmj_from_fixed', 'label', $this->_('From other'),
+ 'description', sprintf($this->_("Only when '%s' is '%s'."), $model->get('gmj_from_method', 'label'), end($fromMethods)));
+ }
+ $model->set('gmj_process_method', 'label', $this->_('Processing Method'), 'multiOptions', $unselected + $translated->getBulkMailProcessOptions());
+ $model->set('gmj_filter_mode', 'label', $this->_('Filter for'), 'multiOptions', $unselected + $this->getBulkMailFilterOptions());
+
+ if ($detailed) {
+ $model->set('gmj_id_organization', 'label', $this->_('Organization'), 'multiOptions', $empty + $dbLookup->getOrganizations());
+ $model->set('gmj_id_track', 'label', $this->_('Track'), 'multiOptions', $empty + $dbTracks->getAllTracks());
+ $model->set('gsu_id_survey', 'label', $this->_('Survey'), 'multiOptions', $empty + $dbTracks->getAllSurveys());
+ }
+
+ return $model;
+ }
+
+ /**
+ * Action for showing a edit item page
+ */
+ public function editAction()
+ {
+ $this->createEditParameters['formTitle'] = $this->_('Edit automatic mail job');
+
+ parent::editAction();
+ }
+
+ /**
+ * The types of mail filters
+ *
+ * @return array
+ */
+ protected function getBulkMailFilterOptions()
+ {
+ return array(
+ 'N' => $this->_('First mail'),
+ 'R' => $this->_('Reminder'),
+ );
+ }
+
+ /**
+ * Options for from address use.
+ *
+ * @return array
+ */
+ protected function getBulkMailFromOptions()
+ {
+ $results['O'] = $this->_('Use organizational from address');
+
+ if (isset($project->email['site']) && $project->email['site']) {
+ $results['S'] = sprintf($this->_('Use site %s address'), $project->email['site']);
+ }
+
+ $results['U'] = $this->_("Use the 'By staff member' address");
+ $results['F'] = $this->_('Other');
+
+ return $results;
+ }
+
+ /**
+ * Action for showing a browse page
+ */
+ public function indexAction()
+ {
+ $this->html->h3($this->_('Automatic mail jobs'));
+
+ parent::indexAction();
+
+ $this->html->pInfo($this->_('With automatic mail jobs and a cron job on the server, mails can be sent without manual user action.'));
+ }
+}
Copied: trunk/library/classes/Gems/Default/MailTemplateAction.php (from rev 126, trunk/library/classes/Gems/Default/MailAction.php)
===================================================================
--- trunk/library/classes/Gems/Default/MailTemplateAction.php (rev 0)
+++ trunk/library/classes/Gems/Default/MailTemplateAction.php 2011-10-24 10:20:26 UTC (rev 127)
@@ -0,0 +1,130 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @package Gems
+ * @subpackage Default
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ *
+ * @package Gems
+ * @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.1
+ */
+class Gems_Default_MailTemplateAction extends Gems_Controller_BrowseEditAction
+{
+ /**
+ * Creates a model for getModel(). Called only for each new $action.
+ *
+ * The parameters allow you to easily adapt the model to the current action. The $detailed
+ * parameter was added, because the most common use of action is a split between detailed
+ * and summarized actions.
+ *
+ * @param boolean $detailed True when the current action is not in $summarizedActions.
+ * @param string $action The current action.
+ * $return MUtil_Model_ModelAbstract
+ */
+ public function createModel($detailed, $action)
+ {
+ $model = new MUtil_Model_TableModel('gems__mail_templates');
+ $model->set('gmt_subject', 'label', $this->_('Subject'));
+
+ if ($detailed) {
+ $model->set('gmt_body',
+ 'label', $this->_('Message'),
+ 'itemDisplay', array('Gems_Email_EmailFormAbstract', 'displayMailText'));
+ }
+
+ return $model;
+ }
+
+ public function getAutoSearchElements(MUtil_Model_ModelAbstract $model, array $data)
+ {
+ $elements = parent::getAutoSearchElements($model, $data);
+ $options = array('' => $this->_('(all organizations)')) + $this->util->getDbLookup()->getOrganizations();
+
+ $elements[] = new Zend_Form_Element_Select('org_id', array('multiOptions' => $options));
+
+ return $elements;
+ }
+
+ protected function getDataFilter(array $data)
+ {
+ if (isset($data['org_id']) && $data['org_id']) {
+ $organizationId = intval($data['org_id']);
+ return array("LOCATE('|$organizationId|', gmt_organizations) > 0");
+ }
+
+ return parent::getDataFilter($data);
+ }
+
+ public function getTopic($count = 1)
+ {
+ return $this->plural('email template', 'email templates', $count);
+ }
+
+ public function getTopicTitle()
+ {
+ return $this->_('Email templates');
+ }
+
+ protected function processForm($saveLabel = null, $data = null)
+ {
+ $model = $this->getModel();
+ $isNew = ! $model->applyRequest($this->getRequest())->hasFilter();
+ $form = new Gems_Email_MailTemplateForm($this->escort);
+
+ $wasSaved = $form->processRequest($this->_request);
+
+ if ($form->hasMessages()) {
+ $this->addMessage($form->getMessages());
+ }
+
+ if ($wasSaved) {
+ $this->addMessage(sprintf($this->_('%2$u %1$s saved'), $this->getTopic($wasSaved), $wasSaved));
+ $this->afterSaveRoute($form->getValues());
+
+ } else {
+ $table = new MUtil_Html_TableElement(array('class' => 'formTable'));
+ $table->setAsFormLayout($form, true, true);
+ $table['tbody'][0][0]->class = 'label'; // Is only one row with formLayout, so all in output fields get class.
+ if ($links = $this->createMenuLinks(10)) {
+ $table->tf(); // Add empty cell, no label
+ $linksCell = $table->tf($links);
+ }
+
+ return $form;
+ }
+ }
+}
Modified: trunk/library/classes/Gems/Menu/MenuAbstract.php
===================================================================
--- trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-10-21 15:43:06 UTC (rev 126)
+++ trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-10-24 10:20:26 UTC (rev 127)
@@ -235,12 +235,15 @@
$page->addExcelAction();
$page->addShowAction();
- // MAIL Server CONTROLLER
+ // MAIL JOB CONTROLLER
+ $page = $setup->addBrowsePage($this->_('Automatic mail'), 'pr.mail.job', 'mail-job');
+
+ // MAIL SERVER CONTROLLER
$page = $setup->addBrowsePage($this->_('Servers'), 'pr.mail.server', 'mail-server');
// $page->addAction($this->_('Test'), 'pr.mail.server.test', 'test')->addParameters(MUtil_Model::REQUEST_ID);
// MAIL CONTROLLER
- $setup->addBrowsePage($this->_('Templates'), 'pr.mail', 'mail');
+ $setup->addBrowsePage($this->_('Templates'), 'pr.mail', 'mail-template');
return $setup;
}
Modified: trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php 2011-10-21 15:43:06 UTC (rev 126)
+++ trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php 2011-10-24 10:20:26 UTC (rev 127)
@@ -3,7 +3,7 @@
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@@ -14,7 +14,7 @@
* * Neither the name of Erasmus MC nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -25,8 +25,8 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
+ *
+ *
* @package Gems
* @subpackage Snippets
* @author Matijs de Jong <mj...@ma...>
@@ -37,13 +37,13 @@
/**
* Adds Gems specific display details and helper functions:
- *
+ *
* Items set are:
* = Default route: 'show'
* - Display class: 'formTable'
* - Gems_Form use: createForm()
* - Table display: beforeDispay()
- *
+ *
* Extra helpers are:
* - Form title: getTitle()
* - Menu helpers: $this->menu, beforeDispay() & getMenuList()
@@ -62,21 +62,28 @@
* @var string
*/
protected $class = 'formTable';
-
+
/**
+ * An optional title for the form. replacing the current generic form title.
+ *
+ * @var string Optional
+ */
+ protected $formTitle;
+
+ /**
* Required
- *
+ *
* @var Gems_Menu
*/
protected $menu;
-
+
/**
* The name of the action to forward to after form completion
- *
+ *
* @var string
*/
protected $routeAction = 'show';
-
+
/**
* Perform some actions on the form, right before it is displayed but already populated
*
@@ -90,7 +97,7 @@
$table->setAsFormLayout($this->_form, true, true);
// There is only one row with formLayout, so all in output fields get class.
- $table['tbody'][0][0]->appendAttrib('class', $this->labelClass);
+ $table['tbody'][0][0]->appendAttrib('class', $this->labelClass);
if ($links = $this->getMenuList()) {
$table->tf(); // Add empty cell, no label
@@ -108,7 +115,7 @@
{
return $this->menu && parent::checkRegistryRequestsAnswers();
}
-
+
/**
* Creates an empty form. Allows overruling in sub-classes.
*
@@ -119,10 +126,10 @@
{
// $form = new Zend_Form($options);
$form = new Gems_Form($options);
-
+
return $form;
}
-
+
/**
* Create the snippets content
*
@@ -140,13 +147,13 @@
$form = parent::getHtmlOutput($view);
$htmlDiv[] = $form;
-
+
return $htmlDiv;
}
/**
* overrule to add your own buttons.
- *
+ *
* @return Gems_Menu_MenuList
*/
protected function getMenuList()
@@ -158,14 +165,16 @@
return $links;
}
-
+
/**
- *
+ *
* @return string The header title to display
*/
protected function getTitle()
{
- if ($this->createData) {
+ if ($this->formTitle) {
+ return $this->formTitle;
+ } elseif ($this->createData) {
return sprintf($this->_('New %s...'), $this->getTopic());
} else {
return sprintf($this->_('Edit %s'), $this->getTopic());
Modified: trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php 2011-10-21 15:43:06 UTC (rev 126)
+++ trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php 2011-10-24 10:20:26 UTC (rev 127)
@@ -114,10 +114,19 @@
*/
protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model)
{
+ if ($showMenuItem = $this->getShowMenuItem()) {
+ $bridge->addItemLink($showMenuItem->toActionLinkLower($this->request, $bridge));
+ }
+
// make sure search results are highlighted
$this->applyTextMarker();
- return parent::addBrowseTableColumns($bridge, $model);
+ parent::addBrowseTableColumns($bridge, $model);
+
+ if ($editMenuItem = $this->getEditMenuItem()) {
+ $bridge->addItemLink($editMenuItem->toActionLinkLower($this->request, $bridge));
+ }
+
}
/**
@@ -197,17 +206,28 @@
}
/**
+ * Finds a specific active menu item
*
* @param string $controller
* @param string $action
* @return Gems_Menu_SubMenuItem
*/
- public function findMenuItem($controller, $action = 'index')
+ protected function findMenuItem($controller, $action = 'index')
{
return $this->menu->find(array('controller' => $controller, 'action' => $action, 'allowed' => true));
}
/**
+ * Returns an edit menu item, if access is allowed by privileges
+ *
+ * @return Gems_Menu_SubMenuItem
+ */
+ protected function getEditMenuItem()
+ {
+ return $this->findMenuItem($this->request->getControllerName(), 'edit');
+ }
+
+ /**
* Create the snippets content
*
* This is a stub function either override getHtmlOutput() or override render()
@@ -236,6 +256,16 @@
}
/**
+ * Returns a show menu item, if access is allowed by privileges
+ *
+ * @return Gems_Menu_SubMenuItem
+ */
+ protected function getShowMenuItem()
+ {
+ return $this->findMenuItem($this->request->getControllerName(), 'show');
+ }
+
+ /**
* Overrule to implement snippet specific filtering and sorting.
*
* @param MUtil_Model_ModelAbstract $model
Modified: trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php 2011-10-21 15:43:06 UTC (rev 126)
+++ trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php 2011-10-24 10:20:26 UTC (rev 127)
@@ -197,7 +197,7 @@
}
/**
- * Action for showing a create new page
+ * Action for showing a create new item page
*/
public function createAction()
{
Modified: trunk/library/classes/MUtil/Snippets/ModelFormSnippetAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Snippets/ModelFormSnippetAbstract.php 2011-10-21 15:43:06 UTC (rev 126)
+++ trunk/library/classes/MUtil/Snippets/ModelFormSnippetAbstract.php 2011-10-24 10:20:26 UTC (rev 127)
@@ -36,15 +36,15 @@
*/
/**
- * Abstract class for creating & processing a form based on a model. To use this
+ * Abstract class for creating & processing a form based on a model. To use this
* class either subclass or use the existing default ModelFormSnippet.
- *
+ *
* The processForm() method executes e sequence of methods that
- * depending on the input display the form or save the form and
+ * depending on the input display the form or save the form and
* redirects the output to another controller/action.
*
* @see ModelFormSnippet
- *
+ *
* @package MUtil
* @subpackage Snippets
* @copyright Copyright (c) 2011 Erasmus MC
@@ -466,6 +466,27 @@
// Default is just go to the index
if ($this->routeAction && ($this->request->getActionName() !== $this->routeAction)) {
$this->afterSaveRouteUrl = array($this->request->getActionKey() => $this->routeAction);
+
+ // Set the key identifiers for the route.
+ //
+ // Mind you the values may have changed, either because of an edit or
+ // because a new item was created.
+ $model = $this->getModel();
+ $keys = $model->getKeys();
+ if (count($keys) == 1) {
+ $key = reset($keys);
+ if (isset($this->formData[$key])) {
+ $this->afterSaveRouteUrl[MUtil_Model::REQUEST_ID] = $this->formData[$key];
+ }
+ } else {
+ $i = 1;
+ foreach ($model->getKeys()...
[truncated message content] |
|
From: <gem...@li...> - 2011-11-01 13:52:27
|
Revision: 159
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=159&view=rev
Author: matijsdejong
Date: 2011-11-01 13:52:15 +0000 (Tue, 01 Nov 2011)
Log Message:
-----------
Ticket #33: date types for tracks fields, including use in track rounds.
AnswerModelSnippetGeneric now shows a 'Fill in' button when possible and has extra usage options.
Undo of change 157, but corrected the bug.
Fixed bug in Lazy::first
FormBridge::applyFixedOptions is now a static public function for use elsewhere.
Modified Paths:
--------------
trunk/library/classes/Gems/Default/TrackFieldsAction.php
trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php
trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php
trunk/library/classes/Gems/Tracker/RespondentTrack.php
trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php
trunk/library/classes/Gems/Tracker/SurveyModel.php
trunk/library/classes/MUtil/Lazy.php
trunk/library/classes/MUtil/Model/FormBridge.php
trunk/library/classes/MUtil/Model/TableModel.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__track_fields.20.sql
trunk/library/snippets/EditTrackSnippet.php
Modified: trunk/library/classes/Gems/Default/TrackFieldsAction.php
===================================================================
--- trunk/library/classes/Gems/Default/TrackFieldsAction.php 2011-11-01 13:30:39 UTC (rev 158)
+++ trunk/library/classes/Gems/Default/TrackFieldsAction.php 2011-11-01 13:52:15 UTC (rev 159)
@@ -67,9 +67,12 @@
$bridge->addExhibitor('gtf_id_track');
$bridge->addText('gtf_id_order');
$bridge->addText('gtf_field_name', 'size', '30', 'minlength', 4, 'required', true, 'validator', $model->createUniqueValidator(array('gtf_field_name','gtf_id_track')));
+ $bridge->addText('gtf_field_code', 'minlength', 4, 'description', $this->_('Optional extra name to link the field to program code.'));
+ $bridge->addText('gtf_field_description', 'size', 30, 'description', $this->_('Optional extra description to show the user.'));
$bridge->addTextarea('gtf_field_values', 'minlength', 4, 'rows', 4, 'description', $this->_('Separate multiple values with a vertical bar (|)'), 'required', false);
$bridge->addSelect('gtf_field_type');
$bridge->addCheckBox('gtf_required');
+ $bridge->addCheckBox('gtf_readonly', 'description', $this->_('Check this box if this field is always set by code instead of the user.'));
}
/**
@@ -104,16 +107,23 @@
public function createModel($detailed, $action)
{
$trackId = $this->_getIdParam();
- $types = array('select' => $this->_('Select one'), 'multiselect' => $this->_('Select multiple'), 'text' => $this->_('Free text'));
+ $types = array('select' => $this->_('Select one'), 'multiselect' => $this->_('Select multiple'), 'date' => $this->_('Date'), 'text' => $this->_('Free text'));
$model = new MUtil_Model_TableModel('gems__track_fields');
$model->setKeys(array('fid' => 'gtf_id_field', MUtil_Model::REQUEST_ID => 'gtf_id_track'));
$model->set('gtf_id_track', 'label', $this->_('Track'), 'multiOptions', $this->util->getTrackData()->getAllTracks());
$model->set('gtf_id_order', 'label', $this->_('Order'));
$model->set('gtf_field_name', 'label', $this->_('Name'));
+ if ($detailed) {
+ $model->set('gtf_field_code', 'label', $this->_('Code Name'));
+ $model->set('gtf_field_description', 'label', $this->_('Description'));
+ }
$model->set('gtf_field_values', 'label', $this->_('Values'));
$model->set('gtf_field_type', 'label', $this->_('Type'), 'multiOptions', $types);
$model->set('gtf_required', 'label', $this->_('Required'), 'multiOptions', $this->util->getTranslated()->getYesNo());
+ if ($detailed) {
+ $model->set('gtf_readonly', 'label', $this->_('Readonly'), 'multiOptions', $this->util->getTranslated()->getYesNo());
+ }
Gems_Model::setChangeFieldsByPrefix($model, 'gtf');
Modified: trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php 2011-11-01 13:30:39 UTC (rev 158)
+++ trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php 2011-11-01 13:52:15 UTC (rev 159)
@@ -359,12 +359,22 @@
return $survey->getDatesList($language);
case self::RESPONDENT_TRACK_TABLE:
- return array(
+ $this->_ensureTrackFields();
+
+ $results = array(
'gr2t_start_date' => $this->_('Track start'),
'gr2t_end_date' => $this->_('Track end'),
// 'gr2t_created' => $this->_('Track created'),
);
+ foreach ($this->_trackFields as $field) {
+ if ('date' == $field['gtf_field_type']) {
+ $results[$field['gtf_id_field']] = $field['gtf_field_name'];
+ }
+ }
+
+ return $results;
+
case self::TOKEN_TABLE:
return array(
'gto_valid_from' => $this->_('Valid from'),
Modified: trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2011-11-01 13:30:39 UTC (rev 158)
+++ trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2011-11-01 13:52:15 UTC (rev 159)
@@ -173,7 +173,7 @@
protected function _ensureTrackFields()
{
if (! is_array($this->_trackFields)) {
- $sql = "SELECT gtf_id_field, gtf_field_name, gtf_field_values, gtf_field_type, gtf_required
+ $sql = "SELECT *
FROM gems__track_fields
WHERE gtf_id_track = ?
ORDER BY gtf_id_order";
@@ -493,24 +493,38 @@
$name = (string) $field['gtf_id_field'];
- switch ($field['gtf_field_type']) {
- case "multiselect":
- $element = new Zend_Form_Element_MultiCheckbox($name);
- $element->setMultiOptions($multi);
- break;
+ if ($field['gtf_readonly']) {
+ $element = new MUtil_Form_Element_Exhibitor($name);
- case "select":
- $element = new Zend_Form_Element_Select($name);
- $element->setMultiOptions($empty + $multi);
- break;
+ } else {
+ switch ($field['gtf_field_type']) {
+ case "multiselect":
+ $element = new Zend_Form_Element_MultiCheckbox($name);
+ $element->setMultiOptions($multi);
+ break;
- default:
- $element = new Zend_Form_Element_Text($name);
- $element->setAttrib('size', 40);
- break;
+ case "select":
+ $element = new Zend_Form_Element_Select($name);
+ $element->setMultiOptions($empty + $multi);
+ break;
+
+ case "date":
+ $options = array();
+ MUtil_Model_FormBridge::applyFixedOptions('date', $options);
+
+ $element = new MUtil_JQuery_Form_Element_DatePicker($name, $options);
+ $element->setStorageFormat('yyyy-MM-dd');
+ break;
+
+ default:
+ $element = new Zend_Form_Element_Text($name);
+ $element->setAttrib('size', 40);
+ break;
+ }
}
$element->setLabel($field['gtf_field_name'])
- ->setRequired($field['gtf_required']);
+ ->setRequired($field['gtf_required'])
+ ->setDescription($field['gtf_field_description']);
$elements[$name] = $element;
}
@@ -734,15 +748,33 @@
*/
public function setFieldsData($respTrackId, array $data)
{
+ $elements = null;
$newValues = array();
// MUtil_Echo::track($data);
+ $this->_ensureTrackFields();
+
foreach ($data as $id => $value) {
if (is_array($value)) {
$value = implode(self::FIELD_SEP, $value);
}
+ // Do the hard work for storing dates
+ if (isset($this->_trackFields[$id]['gtf_field_type']) && ('date' == $this->_trackFields[$id]['gtf_field_type'])) {
+ if (! $elements) {
+ $elements = $this->getFieldsElements();
+ }
+ if (isset($elements[$id])) {
+ $elem = $elements[$id];
+ if ($elem instanceof MUtil_JQuery_Form_Element_DatePicker) {
+ // I do not like regenerating elements either, but this
+ // is the only place where we KNOW this information for sure.
+ $value = MUtil_Date::format($value, $elem->getStorageFormat(), $elem->getDateFormat());
+ }
+ }
+ }
+
$newValues[]= array(
'gr2t2f_id_respondent_track' => $respTrackId,
'gr2t2f_id_field' => $id,
@@ -765,7 +797,7 @@
/**
* Updates the number of rounds in this track.
- *
+ *
* @param int $userId The current user
* @return int 1 if data changed, 0 otherwise
*/
Modified: trunk/library/classes/Gems/Tracker/RespondentTrack.php
===================================================================
--- trunk/library/classes/Gems/Tracker/RespondentTrack.php 2011-11-01 13:30:39 UTC (rev 158)
+++ trunk/library/classes/Gems/Tracker/RespondentTrack.php 2011-11-01 13:52:15 UTC (rev 159)
@@ -58,6 +58,12 @@
/**
*
+ * @var array Field data
+ */
+ protected $_fieldData = null;
+
+ /**
+ *
* @var Gems_Tracker_Token
*/
protected $_firstToken;
@@ -107,6 +113,18 @@
}
/**
+ * Makes sure the fieldData is in $this->_fieldData
+ *
+ * @param boolean $reload Optional parameter to force reload.
+ */
+ private function _ensureFieldData($reload = false)
+ {
+ if ((null === $this->_fieldData) || $reload) {
+ $this->_fieldData = $this->getTrackEngine()->getFieldsData($this->_respTrackId);
+ }
+ }
+
+ /**
* Makes sure the receptioncode data is part of the $this->_respTrackData
*
* @param boolean $reload Optional parameter to force reload.
@@ -344,14 +362,26 @@
public function getDate($fieldName)
{
if (isset($this->_respTrackData[$fieldName])) {
- if (Zend_Date::isDate($this->_respTrackData[$fieldName], Gems_Tracker::DB_DATETIME_FORMAT)) {
- return new MUtil_Date($this->_respTrackData[$fieldName], Gems_Tracker::DB_DATETIME_FORMAT);
+ $date = $this->_respTrackData[$fieldName];
+ } else {
+ $this->_ensureFieldData();
+
+ if (isset($this->_fieldData[$fieldName])) {
+ $date = $this->_fieldData[$fieldName];
+ } else {
+ $date = false;
}
- if (Zend_Date::isDate($this->_respTrackData[$fieldName], Gems_Tracker::DB_DATE_FORMAT)) {
- return new MUtil_Date($this->_respTrackData[$fieldName], Gems_Tracker::DB_DATE_FORMAT);
+ }
+
+ if ($date) {
+ if (Zend_Date::isDate($date, Gems_Tracker::DB_DATETIME_FORMAT)) {
+ return new MUtil_Date($date, Gems_Tracker::DB_DATETIME_FORMAT);
}
+ if (Zend_Date::isDate($date, Gems_Tracker::DB_DATE_FORMAT)) {
+ return new MUtil_Date($date, Gems_Tracker::DB_DATE_FORMAT);
+ }
if (Gems_Tracker::$verbose) {
- MUtil_Echo::r($this->_respTrackData[$fieldName], 'Missed track date value:');
+ MUtil_Echo::r($date, 'Missed track date value:');
}
}
}
@@ -375,6 +405,18 @@
}
/**
+ * Returns the field data for this respondent track id.
+ *
+ * @return array of the existing field values for this respondent track
+ */
+ public function getFieldData()
+ {
+ $this->_ensureFieldData();
+
+ return $this->_fieldData;
+ }
+
+ /**
* Returns the first token in this track
*
* @return Gems_Tracker_Token
Modified: trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php 2011-11-01 13:30:39 UTC (rev 158)
+++ trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php 2011-11-01 13:52:15 UTC (rev 159)
@@ -83,6 +83,13 @@
protected $locale;
/**
+ * Switch to put the display of the cancel and pritn buttons.
+ *
+ * @var boolean
+ */
+ protected $showButtons = true;
+
+ /**
* Switch to put the display of the current token as select to true or false.
*
* @var boolean
@@ -149,7 +156,20 @@
}
$bridge->th($this->_('Token'));
- $td = $bridge->tdh($bridge->gto_id_token->strtoupper());
+
+ $tokenUpper = $bridge->gto_id_token->strtoupper();
+ if ($menuItem = $this->menu->find(array('controller' => 'ask', 'action' => 'take', 'allowed' => true))) {
+ $source = new Gems_Menu_ParameterSource();
+ $source->setTokenId($bridge->gto_id_token);
+ $source->offsetSet('can_be_taken', $bridge->can_be_taken);
+
+ $link = $menuItem->toActionLink($source);
+ $link->title = array($this->_('Token'), $tokenUpper);
+
+ $td = $bridge->tdh($bridge->can_be_taken->if($link, $tokenUpper));
+ } else {
+ $td = $bridge->tdh($tokenUpper);
+ }
$td->appendAttrib('class', $selectedClass);
$td->appendAttrib('class', $bridge->row_class);
}
@@ -207,9 +227,11 @@
$htmlDiv->ul($this->_('No token specified.'), array('class' => 'errors'));
}
- $buttonDiv = $htmlDiv->buttonDiv();
- $buttonDiv->actionLink(array(), $this->_('Close'), array('onclick' => 'window.close();'));
- $buttonDiv->actionLink(array(), $this->_('Print'), array('onclick' => 'window.print();'));
+ if ($this->showButtons) {
+ $buttonDiv = $htmlDiv->buttonDiv();
+ $buttonDiv->actionLink(array(), $this->_('Close'), array('onclick' => 'window.close();'));
+ $buttonDiv->actionLink(array(), $this->_('Print'), array('onclick' => 'window.print();'));
+ }
return $htmlDiv;
}
Modified: trunk/library/classes/Gems/Tracker/SurveyModel.php
===================================================================
--- trunk/library/classes/Gems/Tracker/SurveyModel.php 2011-11-01 13:30:39 UTC (rev 158)
+++ trunk/library/classes/Gems/Tracker/SurveyModel.php 2011-11-01 13:52:15 UTC (rev 159)
@@ -1,6 +1,5 @@
<?php
-
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
@@ -26,22 +25,24 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @author Matijs de Jong
- * @since 1.4
- * @version 1.4
- * @package Gems
+ *
+ *
+ * @package Gems
* @subpackage Tracker
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
*/
/**
- * Description of SurveyModel
+ * More correctly a Survey ANSWERS Model as it adds answers to token information/
*
- * @author Matijs de Jong
- * @package Gems
+ * @package Gems
* @subpackage Tracker
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4
*/
class Gems_Tracker_SurveyModel extends Gems_Model_JoinModel
{
@@ -63,6 +64,9 @@
$this->addTable('gems__reception_codes', array('gto_reception_code' => 'grc_id_reception_code'));
$this->addColumn(
+ 'CASE WHEN grc_success = 1 AND gto_valid_from <= CURRENT_TIMESTAMP AND gto_completion_time IS NULL AND (gto_valid_until IS NULL OR gto_valid_until >= CURRENT_TIMESTAMP) THEN 1 ELSE 0 END',
+ 'can_be_taken');
+ $this->addColumn(
"CASE WHEN grc_success = 1 THEN '' ELSE 'deleted' END",
'row_class');
Modified: trunk/library/classes/MUtil/Lazy.php
===================================================================
--- trunk/library/classes/MUtil/Lazy.php 2011-11-01 13:30:39 UTC (rev 158)
+++ trunk/library/classes/MUtil/Lazy.php 2011-11-01 13:52:15 UTC (rev 159)
@@ -1,39 +1,38 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
/**
- * @author Matijs de Jong
- * @since 1.0
- * @version 1.1
- * @package MUtil
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
* @subpackage Lazy
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
*/
/**
@@ -48,9 +47,11 @@
* 3 - an object propery
* 4 - an array object
*
- * @author Matijs de Jong
- * @package MUtil
+ * @package MUtil
* @subpackage Lazy
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
*/
class MUtil_Lazy
{
@@ -77,10 +78,10 @@
$args = func_get_args();
// Last value first
- $result = array_pop($args);
+ $result = array_shift($args);
- foreach (array_reverse($args) as $arg) {
- $result = new MUtil_Lazy_Call(array($arg, 'if'), array($arg, $result));
+ foreach ($args as $arg) {
+ $result = new MUtil_Lazy_Call(array($result, 'if'), array($result, $arg));
}
return $result;
}
@@ -130,16 +131,16 @@
return new MUtil_Lazy_Property($object, $property);
}
- /**
- * Raises a MUtil_Lazy_LazyInterface one level, but may still
+ /**
+ * Raises a MUtil_Lazy_LazyInterface one level, but may still
* return a MUtil_Lazy_LazyInterface.
- *
- * This function is usually used to perform a e.g. filter function on object that may e.g.
+ *
+ * This function is usually used to perform a e.g. filter function on object that may e.g.
* contain Repeater objects.
- *
+ *
* @param mixed $object Usually an object of type MUtil_Lazy_LazyInterface
* @param mixed $stack Optional variable stack for evaluation
- * @return mixed
+ * @return mixed
*/
public static function raise($object, $stack = null)
{
@@ -153,7 +154,7 @@
/**
*
* @param mixed $repeatable
- * @return MUtil_Lazy_RepeatableInterface
+ * @return MUtil_Lazy_RepeatableInterface
*/
public static function repeat($repeatable)
{
@@ -164,18 +165,18 @@
return new MUtil_Lazy_Repeatable($repeatable);
}
- /**
- * Raises a MUtil_Lazy_LazyInterface until the return object is not a
+ /**
+ * Raises a MUtil_Lazy_LazyInterface until the return object is not a
* MUtil_Lazy_LazyInterface object.
- *
- * @param mixed $object Usually an object of type MUtil_Lazy_LazyInterface
+ *
+ * @param mixed $object Usually an object of type MUtil_Lazy_LazyInterface
* @param mixed $stack Optional variable stack for evaluation
* @return mixed Something not lazy
*/
public static function rise($object, $stack = null)
{
$stack = self::toStack($stack, __FUNCTION__);
-
+
// Resolving when MUtil_Lazy_LazyInterface.
while ($object instanceof MUtil_Lazy_LazyInterface) {
$object = $object->__toValue($stack);
@@ -192,11 +193,11 @@
return $object;
}
- /**
+ /**
* Turns any input into a MUtil_Lazy_StackInterface object.
- *
- * @param mixed $stack Value to be turned into stack for evaluation
- * @param string A string describing where the stack was created.
+ *
+ * @param mixed $stack Value to be turned into stack for evaluation
+ * @param string A string describing where the stack was created.
* @return MUtil_Lazy_StackInterface A usable stack
*/
private static function toStack($stack, $source)
Modified: trunk/library/classes/MUtil/Model/FormBridge.php
===================================================================
--- trunk/library/classes/MUtil/Model/FormBridge.php 2011-11-01 13:30:39 UTC (rev 158)
+++ trunk/library/classes/MUtil/Model/FormBridge.php 2011-11-01 13:52:15 UTC (rev 159)
@@ -112,7 +112,7 @@
return $element;
}
- protected function _applyFixedOptions($type, array &$options)
+ public static function applyFixedOptions($type, array &$options)
{
static $typeOptions;
@@ -268,7 +268,7 @@
$options = $this->_mergeOptions($name, $options,
self::DISPLAY_OPTIONS, self::CHECK_OPTIONS);
- $this->_applyFixedOptions(__FUNCTION__, $options);
+ self::applyFixedOptions(__FUNCTION__, $options);
$element = new Zend_Form_Element_Checkbox($name, $options);
@@ -286,7 +286,7 @@
$elementName = $name;
// Allow centrally set options
- $this->_applyFixedOptions(__FUNCTION__, $options);
+ self::applyFixedOptions(__FUNCTION__, $options);
if (isset($options['dateFormat'])) {
// Make sure the model knows the dateFormat (can be important for storage).
Modified: trunk/library/classes/MUtil/Model/TableModel.php
===================================================================
--- trunk/library/classes/MUtil/Model/TableModel.php 2011-11-01 13:30:39 UTC (rev 158)
+++ trunk/library/classes/MUtil/Model/TableModel.php 2011-11-01 13:52:15 UTC (rev 159)
@@ -77,7 +77,8 @@
{
return $this->_deleteTableData(
$this->_table,
- $this->_checkFilterUsed($filter));
+ $this->_checkFilterUsed($filter),
+ $this->_deleteValues);
}
/**
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-11-01 13:30:39 UTC (rev 158)
+++ trunk/library/configs/db/patches.sql 2011-11-01 13:52:15 UTC (rev 159)
@@ -233,3 +233,8 @@
ALTER TABLE `gems__staff` CHANGE `gsf_login` `gsf_login` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
CHANGE `gsf_password` `gsf_password` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
CHANGE `gsf_id_organization` `gsf_id_organization` BIGINT( 20 ) NULL DEFAULT NULL;
+
+-- PATCH: Extra information for track fields
+ALTER TABLE gems__track_fields ADD gtf_field_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER gtf_field_name,
+ ADD gtf_field_description varchar(200) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER gtf_field_code,
+ ADD gtf_readonly boolean not null default false AFTER gtf_required;
\ No newline at end of file
Modified: trunk/library/configs/db/tables/gems__track_fields.20.sql
===================================================================
--- trunk/library/configs/db/tables/gems__track_fields.20.sql 2011-11-01 13:30:39 UTC (rev 158)
+++ trunk/library/configs/db/tables/gems__track_fields.20.sql 2011-11-01 13:52:15 UTC (rev 159)
@@ -6,12 +6,15 @@
gtf_id_order int not null default 10,
gtf_field_name varchar(200) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
+ gtf_field_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gtf_field_description varchar(200) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
gtf_field_values text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
gtf_field_type varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
gtf_required boolean not null default false,
+ gtf_readonly boolean not null default false,
gtf_changed timestamp not null default current_timestamp on update current_timestamp,
gtf_changed_by bigint unsigned not null,
Modified: trunk/library/snippets/EditTrackSnippet.php
===================================================================
--- trunk/library/snippets/EditTrackSnippet.php 2011-11-01 13:30:39 UTC (rev 158)
+++ trunk/library/snippets/EditTrackSnippet.php 2011-11-01 13:52:15 UTC (rev 159)
@@ -130,6 +130,7 @@
$model = $this->getModel();
$this->formData = $model->save($this->formData);
$changed = $model->getChanged();
+ $refresh = false;
// Retrieve the key if just created
if ($this->createData) {
@@ -140,18 +141,25 @@
$this->trackEngine->checkRoundsFor($this->respondentTrack, $this->userId);
} elseif (! (isset($this->formData['gr2t_completed']) && $this->formData['gr2t_completed'])) {
- // Check if sartdate has changed
+ // Check if startdate has changed
if (! $this->respondentTrack->getStartDate()->equals(new MUtil_Date($this->formData['gr2t_start_date']))) {
- // Perform a refresh from the database, to avoid date trouble
- $this->respondentTrack->refresh();
- $this->respondentTrack->checkTrackTokens($this->userId);
+ $refresh = true;
}
}
if ($this->trackEngine && isset($this->formData[self::TRACKFIELDS_ID])) {
$changed = $this->trackEngine->setFieldsData($this->respondentTrackId, $this->formData[self::TRACKFIELDS_ID]) ? 1 : $changed;
+ $refresh = $refresh || $changed;
}
+ if ($refresh) {
+ Gems_Tracker::$verbose;
+ // Perform a refresh from the database, to avoid date trouble
+ $this->respondentTrack->refresh();
+ $this->respondentTrack->checkTrackTokens($this->userId);
+ }
+
+
// Communicate with the user
$this->afterSave($changed);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-11-16 18:18:19
|
Revision: 224
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=224&view=rev
Author: matijsdejong
Date: 2011-11-16 18:18:12 +0000 (Wed, 16 Nov 2011)
Log Message:
-----------
Obfuscated difference between non-existing user and existing user logon attempts.
Modified Paths:
--------------
trunk/library/classes/Gems/Auth/Adapter/Callback.php
trunk/library/classes/Gems/Auth.php
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/User/NoLoginDefinition.php
trunk/library/classes/Gems/User/ProjectUserDefinition.php
trunk/library/languages/default-en.mo
trunk/library/languages/default-en.po
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
Modified: trunk/library/classes/Gems/Auth/Adapter/Callback.php
===================================================================
--- trunk/library/classes/Gems/Auth/Adapter/Callback.php 2011-11-16 17:52:38 UTC (rev 223)
+++ trunk/library/classes/Gems/Auth/Adapter/Callback.php 2011-11-16 18:18:12 UTC (rev 224)
@@ -2,7 +2,7 @@
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@@ -13,7 +13,7 @@
* * Neither the name of Erasmus MC nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -24,7 +24,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* Short description of file
*
* @package Gems
@@ -82,7 +82,7 @@
if ($result === true) {
$result = new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $this->_identity);
} else {
- $result = new Zend_Auth_Result(Zend_Auth_Result::FAILURE, $this->_identity);
+ $result = new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $this->_identity);
}
}
return $result;
Modified: trunk/library/classes/Gems/Auth.php
===================================================================
--- trunk/library/classes/Gems/Auth.php 2011-11-16 17:52:38 UTC (rev 223)
+++ trunk/library/classes/Gems/Auth.php 2011-11-16 18:18:12 UTC (rev 224)
@@ -48,9 +48,12 @@
{
/**
* Error constants
+ *
+ * These must be numeric constants smaller than zero for
+ * Zend_Auth_Result to work.
*/
- const ERROR_DATABASE_NOT_INSTALLED = 'notInstalled';
- const ERROR_PASSWORD_DELAY = 'blockedDelay';
+ const ERROR_DATABASE_NOT_INSTALLED = -11;
+ const ERROR_PASSWORD_DELAY = -12;
/**
* @var array Message templates
@@ -71,7 +74,8 @@
*/
public $db;
- public function __construct($db = null) {
+ public function __construct($db = null)
+ {
/**
* Check for an adapter being defined. if not, fetch the default adapter.
*/
@@ -86,13 +90,22 @@
}
}
- private function _error($code, $value1 = null, $value2 = null) {
+ private function _error($code, $value1 = null, $value2 = null)
+ {
$messages = func_get_args();
array_splice($messages, 0, 1, $this->_messageTemplates[$code]);
return new Zend_Auth_Result($code, null, (array) $messages);
}
- public function authenticate(Zend_Auth_Adapter_Interface $adapter, $formValues) {
+ /**
+ * Authenticates against the supplied adapter
+ *
+ * @param Zend_Auth_Adapter_Interface $adapter
+ * @param array $formValues We need information not in the adapter.
+ * @return Zend_Auth_Result
+ */
+ public function authenticate(Zend_Auth_Adapter_Interface $adapter, array $formValues = null)
+ {
try {
$login_name = $formValues['userlogin'];
$organization = $formValues['organization'];
@@ -105,22 +118,23 @@
$values['gula_id_organization'] = $organization;
$values['gula_failed_logins'] = 0;
$values['gula_last_failed'] = null;
+
} elseif ($values['gula_failed_logins'] > 0) {
- // Get the datetime
- $last = new MUtil_Date($values['gula_last_failed'], Zend_Date::ISO_8601);
+ // Get the datetime
+ $last = new MUtil_Date($values['gula_last_failed'], Zend_Date::ISO_8601);
- // How long to wait until we can ignore the previous failed attempt
- $delay = pow($values['gula_failed_logins'], GemsEscort::getInstance()->project->getAccountDelayFactor());
+ // How long to wait until we can ignore the previous failed attempt
+ $delay = pow($values['gula_failed_logins'], GemsEscort::getInstance()->project->getAccountDelayFactor());
- if (abs($last->diffSeconds()) <= $delay) {
- // Response gets slowly slower
- $sleepTime = min($values['gula_failed_logins'], 10);
- sleep($sleepTime);
- $remaining = $delay - abs($last->diffSeconds()) - $sleepTime;
- if ($remaining>0) {
- $result = $this->_error(self::ERROR_PASSWORD_DELAY, $remaining);
- }
+ if (abs($last->diffSeconds()) <= $delay) {
+ // Response gets slowly slower
+ $sleepTime = min($values['gula_failed_logins'], 10);
+ sleep($sleepTime);
+ $remaining = $delay - abs($last->diffSeconds()) - $sleepTime;
+ if ($remaining>0) {
+ $result = $this->_error(self::ERROR_PASSWORD_DELAY, $remaining);
}
+ }
}
} catch (Zend_Db_Exception $e) {
// Fall through as this does not work if the database upgrade did not run
@@ -137,11 +151,12 @@
$values['gula_last_failed'] = null;
} else {
if ($values['gula_failed_logins']) {
+ // MUtil_Echo::track($result->getCode(), self::ERROR_PASSWORD_DELAY);
// Only increment when we have no password delay
- if ($result->getCode() <> self::ERROR_PASSWORD_DELAY) {
+ // if ($result->getCode() <> self::ERROR_PASSWORD_DELAY) {
$values['gula_failed_logins'] += 1;
$values['gula_last_failed'] = new Zend_Db_Expr('CURRENT_TIMESTAMP');
- }
+ // }
} else {
$values['gula_failed_logins'] = 1;
$values['gula_last_failed'] = new Zend_Db_Expr('CURRENT_TIMESTAMP');
@@ -195,7 +210,8 @@
* @param Zend_Auth_Result $result
* @return Zend_Auth_Result
*/
- public function localize($result) {
+ public function localize($result)
+ {
$translate = GemsEscort::getInstance()->translate;
$code = $result->getCode();
$identity = $result->getIdentity();
@@ -210,18 +226,23 @@
*/
switch ($code) {
case Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID:
- $message = $translate->_('Wrong password.');
- break;
+ // $message = $translate->_('Wrong password.');
+ // break;
case Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND:
- $message = $translate->_('Combination of username password not found.');
+ $message = $translate->_('Combination of organization, username and password not found.');
break;
}
- //Now recombine with the others, they will be treated as params
- $messages = array_merge((array) $message, (array) $messages);
- //Now do a sprintf if we have 1 or more params
- if (count($messages)>1) $messages = call_user_func_array('sprintf', $messages);
+ // Recombine with the others if any, they will be treated as params
+ if (count($messages)) {
+ $messages = array_merge((array) $message, (array) $messages);
+ //Now do a sprintf if we have 1 or more params
+ $messages = call_user_func_array('sprintf', $messages);
+ } else {
+ $messages = array($message);
+ }
+
return new Zend_Auth_Result($code, $identity, (array) $messages);
}
}
\ No newline at end of file
Modified: trunk/library/classes/Gems/Default/IndexAction.php
===================================================================
--- trunk/library/classes/Gems/Default/IndexAction.php 2011-11-16 17:52:38 UTC (rev 223)
+++ trunk/library/classes/Gems/Default/IndexAction.php 2011-11-16 18:18:12 UTC (rev 224)
@@ -282,46 +282,44 @@
$user = $this->loader->getUser($request->getParam('userlogin'), $request->getParam('organization'));
- if ($user->isActive()) {
- $formValues = $form->getValues();
- $authResult = $user->authenticate($formValues);
+ // NO!!! DO not test! Otherwise it is easy to test which users exist.
+ // if ($user->isActive()) {
+ $formValues = $form->getValues();
+ $authResult = $user->authenticate($formValues);
- if ($authResult->isValid()) {
+ if ($authResult->isValid()) {
- $user->setAsCurrentUser();
+ $user->setAsCurrentUser();
- $user->afterLogin($form->getValues());
+ $user->afterLogin($form->getValues());
- /**
- * Fix current locale / organization in cookies
- */
- Gems_Cookies::setLocale($user->getLocale(), $this->basepath->getBasePath());
- Gems_Cookies::setOrganization($user->getOrganizationId(), $this->basepath->getBasePath());
+ /**
+ * Fix current locale / organization in cookies
+ */
+ Gems_Cookies::setLocale($user->getLocale(), $this->basepath->getBasePath());
+ Gems_Cookies::setOrganization($user->getOrganizationId(), $this->basepath->getBasePath());
- /**
- * Ready
- */
- $this->addMessage(sprintf($this->_('Login successful, welcome %s.'), $user->getFullName()));
+ /**
+ * Ready
+ */
+ $this->addMessage(sprintf($this->_('Login successful, welcome %s.'), $user->getFullName()));
- /**
- * Log the login
- */
- Gems_AccessLog::getLog($this->db)->log("index.login", $this->getRequest(), null, $user->getUserId(), true);
+ /**
+ * Log the login
+ */
+ Gems_AccessLog::getLog($this->db)->log("index.login", $this->getRequest(), null, $user->getUserId(), true);
- if ($previousRequestParameters = $this->session->previousRequestParameters) {
- $this->_reroute(array('controller' => $previousRequestParameters['controller'], 'action' => $previousRequestParameters['action']), false);
- } else {
- // This reroutes to the first available menu page after login
- $this->_reroute(array('controller' => null, 'action' => null), true);
- }
- return;
+ if ($previousRequestParameters = $this->session->previousRequestParameters) {
+ $this->_reroute(array('controller' => $previousRequestParameters['controller'], 'action' => $previousRequestParameters['action']), false);
} else {
- $errors = $authResult->getMessages();
- $this->addMessage($errors);
+ // This reroutes to the first available menu page after login
+ $this->_reroute(array('controller' => null, 'action' => null), true);
}
+ return;
+ } else {
+ $errors = $authResult->getMessages();
+ $this->addMessage($errors);
}
- } else {
- $errors = $form->getErrors();
}
}
$this->view->form = $form;
Modified: trunk/library/classes/Gems/User/NoLoginDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/NoLoginDefinition.php 2011-11-16 17:52:38 UTC (rev 223)
+++ trunk/library/classes/Gems/User/NoLoginDefinition.php 2011-11-16 18:18:12 UTC (rev 224)
@@ -46,14 +46,14 @@
*/
class Gems_User_NoLoginDefinition extends Gems_User_UserDefinitionAbstract
{
- private function alwaysFalse($params) {
- $result = new Zend_Auth_Result(Zend_Auth_Result::FAILURE, $params['userlogin']);
+ public function alwaysFalse($params)
+ {
return false;
}
-
+
public function getAuthAdapter($formValues)
{
- $adapter = new Gems_Auth_Adapter_Callback(array(get_class(),'alwaysFalse'), $formValues['userlogin'], $formValues);
+ $adapter = new Gems_Auth_Adapter_Callback(array($this,'alwaysFalse'), $formValues['userlogin'], $formValues);
return $adapter;
}
Modified: trunk/library/classes/Gems/User/ProjectUserDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/ProjectUserDefinition.php 2011-11-16 17:52:38 UTC (rev 223)
+++ trunk/library/classes/Gems/User/ProjectUserDefinition.php 2011-11-16 18:18:12 UTC (rev 224)
@@ -54,7 +54,7 @@
public function getAuthAdapter($formValues)
{
- $adapter = new Gems_Auth_Adapter_Callback(array($this->project,'checkSuperAdminPassword'), $formValues['userlogin'], $formValues['password']);
+ $adapter = new Gems_Auth_Adapter_Callback(array($this->project,'checkSuperAdminPassword'), $formValues['userlogin'], array($formValues['password']));
return $adapter;
}
Modified: trunk/library/languages/default-en.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-en.po
===================================================================
--- trunk/library/languages/default-en.po 2011-11-16 17:52:38 UTC (rev 223)
+++ trunk/library/languages/default-en.po 2011-11-16 18:18:12 UTC (rev 224)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse EN\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-11-16 18:30+0100\n"
+"POT-Creation-Date: 2011-11-16 19:09+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -77,13 +77,9 @@
msgid "Database needs to be updated!"
msgstr "Database needs to be updated!"
-#: classes/Gems/Auth.php:225
-msgid "Wrong password."
-msgstr "Wrong password."
-
#: classes/Gems/Auth.php:228
-msgid "Combination of username password not found."
-msgstr "Combination of username password not found."
+msgid "Combination of organization, username and password not found."
+msgstr "Combination of organization, username and password not found."
#: classes/Gems/Html.php:154
msgid "<< First"
@@ -3784,6 +3780,9 @@
msgid "This track can be assigned since %s."
msgstr "This track can be assigned since %s."
+#~ msgid "Wrong password."
+#~ msgstr "Wrong password."
+
#~ msgid "Please update the database"
#~ msgstr "Please update the database"
Modified: trunk/library/languages/default-nl.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-nl.po
===================================================================
--- trunk/library/languages/default-nl.po 2011-11-16 17:52:38 UTC (rev 223)
+++ trunk/library/languages/default-nl.po 2011-11-16 18:18:12 UTC (rev 224)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse NL\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-11-16 18:33+0100\n"
+"POT-Creation-Date: 2011-11-16 19:10+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -77,13 +77,9 @@
msgid "Database needs to be updated!"
msgstr "Database dient ververst te worden!"
-#: classes/Gems/Auth.php:225
-msgid "Wrong password."
-msgstr "Verkeerd wachtwoord."
-
#: classes/Gems/Auth.php:228
-msgid "Combination of username password not found."
-msgstr "Combinatie gebruikersnaam en wachtwoord niet gevonden."
+msgid "Combination of organization, username and password not found."
+msgstr "Combinatie van organisatie, gebruikersnaam en wachtwoord niet gevonden."
#: classes/Gems/Html.php:154
msgid "<< First"
@@ -3784,6 +3780,9 @@
msgid "This track can be assigned since %s."
msgstr "Dit traject kan sinds %s aan een patiënt toegewezen worden."
+#~ msgid "Wrong password."
+#~ msgstr "Verkeerd wachtwoord."
+
#~ msgid "Please update the database"
#~ msgstr "Database moet bijgewerkt worden"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-11-16 17:52:48
|
Revision: 223
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=223&view=rev
Author: matijsdejong
Date: 2011-11-16 17:52:38 +0000 (Wed, 16 Nov 2011)
Log Message:
-----------
Start on #40: organizations can defer to each other. Input possible.
Array values can be saved in a model and read by multi elements.
Modified Paths:
--------------
trunk/library/classes/Gems/Default/OrganizationAction.php
trunk/library/classes/MUtil/Model/FormBridge.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__organizations.20.sql
trunk/library/languages/default-en.mo
trunk/library/languages/default-en.po
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
Added Paths:
-----------
trunk/library/classes/MUtil/Form/Element/MultiCheckbox.php
trunk/library/classes/MUtil/Form/Element/MultiSelect.php
trunk/library/classes/MUtil/Model/Save/
trunk/library/classes/MUtil/Model/Save/ArraySaver.php
Modified: trunk/library/classes/Gems/Default/OrganizationAction.php
===================================================================
--- trunk/library/classes/Gems/Default/OrganizationAction.php 2011-11-16 13:19:44 UTC (rev 222)
+++ trunk/library/classes/Gems/Default/OrganizationAction.php 2011-11-16 17:52:38 UTC (rev 223)
@@ -140,15 +140,20 @@
'gor_iso_lang', 'label', $this->_('Language'),
'multiOptions', $this->util->getLocalized()->getLanguages(), 'default', 'nl'
);
- $model->set(
- 'gor_active', 'label', $this->_('Active'), 'elementClass', 'Checkbox',
- 'multiOptions', $this->util->getTranslated()->getYesNo()
- );
+ $yesNo = $this->util->getTranslated()->getYesNo();
+ $model->set('gor_active', 'label', $this->_('Active'), 'elementClass', 'Checkbox', 'multiOptions', $yesNo);
+ $model->set('gor_add_patients', 'label', $this->_('Allow new respondents'), 'elementClass', 'CheckBox', 'multiOptions', $yesNo);
+
if ($detailed) {
$model->set('gor_name', 'validator', $model->createUniqueValidator('gor_name'));
$model->set('gor_welcome', 'label', $this->_('Greeting'), 'description', $this->_('For emails and token forward screen.'), 'elementClass', 'Textarea', 'rows', 5);
$model->set('gor_signature', 'label', $this->_('Signature'), 'description', $this->_('For emails and token forward screen.'), 'elementClass', 'Textarea', 'rows', 5);
+
+ $model->set('gor_accessible_by', 'label', $this->_('Accessible by'), 'description', $this->_('Checked organizations see this organizations respondents.'), 'elementClass', 'MultiCheckbox',
+ 'multiOptions', $this->util->getDbLookup()->getOrganizations());
+ MUtil_Model_Save_ArraySaver::create($model, 'gor_accessible_by', ':');
+
}
if ($this->project->multiLocale) {
Added: trunk/library/classes/MUtil/Form/Element/MultiCheckbox.php
===================================================================
--- trunk/library/classes/MUtil/Form/Element/MultiCheckbox.php (rev 0)
+++ trunk/library/classes/MUtil/Form/Element/MultiCheckbox.php 2011-11-16 17:52:38 UTC (rev 223)
@@ -0,0 +1,143 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Form
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ * This object allows you to supply a string value when the object expects an
+ * array value, splitting the string along the valueSeperatorChar.
+ *
+ * Return this value as a string is not practical as that breaks the workings
+ * of all Filters, Validators and Decorators.
+ *
+ * @package MUtil
+ * @subpackage Form
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class MUtil_Form_Element_MultiCheckbox extends Zend_Form_Element_MultiCheckbox
+{
+ /**
+ * En/disables padding the value in separators. The default is true as this
+ * simplifies search commands (and usually costs only 2 characters).
+ *
+ * @var boolean
+ */
+ protected $_valuePad = true;
+
+ /**
+ * The value seperator enables this control to accept a single string as value
+ * and split it into an array.
+ *
+ * A null seperator means this class behaves as it's parent class and returns an
+ * array value.
+ *
+ * @var string
+ */
+ protected $_valueSeperatorChar = null;
+
+ /**
+ * En/disables padding the value in separators. The default is true as this
+ * simplifies search commands (and usually costs only 2 characters).
+ *
+ * @return boolean
+ */
+ public function getValuePad()
+ {
+ return $this->_valuePad;
+ }
+
+ /**
+ * The value seperator enables this control to accept a single string as value
+ * and split it into an array.
+ *
+ * A null seperator means this class behaves as it's parent class and returns an
+ * array value.
+ *
+ * @return string
+ */
+ public function getValueSeperatorChar()
+ {
+ return $this->_valueSeperatorChar;
+ }
+
+ /**
+ * Set element value
+ *
+ * @param mixed $value
+ * @return MUtil_Form_Element_MultiCheckbox (continuation pattern)
+ */
+ public function setValue($value)
+ {
+ if ((null !== $this->_valueSeperatorChar) && (! is_array($value))) {
+ if ($this->_valuePad) {
+ $value = trim($value, $this->_valueSeperatorChar);
+ }
+ $value = explode($this->_valueSeperatorChar, $value);
+ }
+
+ return parent::setValue($value);
+ }
+
+ /**
+ * En/disables padding the value in separators. The default is true as this
+ * simplifies search commands (and usually costs only 2 characters).
+ *
+ * @param boolean $value
+ * @return MUtil_Form_Element_MultiCheckbox (continuation pattern)
+ */
+ public function setValuePad($value = true)
+ {
+ $this->_valuePad = $value;
+ return $this;
+ }
+
+ /**
+ * The value seperator enables this control to accept a single string as value
+ * and split it into an array.
+ *
+ * A null seperator means this class behaves as it's parent class and returns an
+ * array value.
+ *
+ * @param string $seperator
+ * @return MUtil_Form_Element_MultiCheckbox (continuation pattern)
+ */
+ public function setValueSeperatorChar($seperator = ' ')
+ {
+ $this->_valueSeperatorChar = substr($seperator . ' ', 0, 1);
+ return $this;
+ }
+}
Added: trunk/library/classes/MUtil/Form/Element/MultiSelect.php
===================================================================
--- trunk/library/classes/MUtil/Form/Element/MultiSelect.php (rev 0)
+++ trunk/library/classes/MUtil/Form/Element/MultiSelect.php 2011-11-16 17:52:38 UTC (rev 223)
@@ -0,0 +1,143 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Form
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ * This object allows you to supply a string value when the object expects an
+ * array value, splitting the string along the valueSeperatorChar.
+ *
+ * Return this value as a string is not practical as that breaks the workings
+ * of all Filters, Validators and Decorators.
+ *
+ * @package MUtil
+ * @subpackage Form
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class MUtil_Form_Element_MultiSelect extends Zend_Form_Element_MultiSelect
+{
+ /**
+ * En/disables padding the value in separators. The default is true as this
+ * simplifies search commands (and usually costs only 2 characters).
+ *
+ * @var boolean
+ */
+ protected $_valuePad = true;
+
+ /**
+ * The value seperator enables this control to accept a single string as value
+ * and split it into an array.
+ *
+ * A null seperator means this class behaves as it's parent class and returns an
+ * array value.
+ *
+ * @var string
+ */
+ protected $_valueSeperatorChar = null;
+
+ /**
+ * En/disables padding the value in separators. The default is true as this
+ * simplifies search commands (and usually costs only 2 characters).
+ *
+ * @return boolean
+ */
+ public function getValuePad()
+ {
+ return $this->_valuePad;
+ }
+
+ /**
+ * The value seperator enables this control to accept a single string as value
+ * and split it into an array.
+ *
+ * A null seperator means this class behaves as it's parent class and returns an
+ * array value.
+ *
+ * @return string
+ */
+ public function getValueSeperatorChar()
+ {
+ return $this->_valueSeperatorChar;
+ }
+
+ /**
+ * Set element value
+ *
+ * @param mixed $value
+ * @return MUtil_Form_Element_MultiCheckbox (continuation pattern)
+ */
+ public function setValue($value)
+ {
+ if ((null !== $this->_valueSeperatorChar) && (! is_array($value))) {
+ if ($this->_valuePad) {
+ $value = trim($value, $this->_valueSeperatorChar);
+ }
+ $value = explode($this->_valueSeperatorChar, $value);
+ }
+
+ return parent::setValue($value);
+ }
+
+ /**
+ * En/disables padding the value in separators. The default is true as this
+ * simplifies search commands (and usually costs only 2 characters).
+ *
+ * @param boolean $value
+ * @return MUtil_Form_Element_MultiCheckbox (continuation pattern)
+ */
+ public function setValuePad($value = true)
+ {
+ $this->_valuePad = $value;
+ return $this;
+ }
+
+ /**
+ * The value seperator enables this control to accept a single string as value
+ * and split it into an array.
+ *
+ * A null seperator means this class behaves as it's parent class and returns an
+ * array value.
+ *
+ * @param string $seperator
+ * @return MUtil_Form_Element_MultiCheckbox (continuation pattern)
+ */
+ public function setValueSeperatorChar($seperator = ' ')
+ {
+ $this->_valueSeperatorChar = substr($seperator . ' ', 0, 1);
+ return $this;
+ }
+}
Modified: trunk/library/classes/MUtil/Model/FormBridge.php
===================================================================
--- trunk/library/classes/MUtil/Model/FormBridge.php 2011-11-16 13:19:44 UTC (rev 222)
+++ trunk/library/classes/MUtil/Model/FormBridge.php 2011-11-16 17:52:38 UTC (rev 223)
@@ -85,7 +85,7 @@
self::FILE_OPTIONS => array('accept', 'count', 'destination', 'valueDisabled'),
self::GROUP_OPTIONS => array('elements', 'legend', 'separator'),
self::JQUERY_OPTIONS => array('jQueryParams'),
- self::MULTI_OPTIONS => array('disable', 'multiOptions', 'onchange', 'separator', 'size'),
+ self::MULTI_OPTIONS => array('disable', 'multiOptions', 'onchange', 'separator', 'size', 'valuePad', 'valueSeperatorChar'),
self::PASSWORD_OPTIONS => array('repeatLabel'),
self::TAB_OPTIONS => array('value'),
self::TEXT_OPTIONS => array('maxlength', 'minlength', 'onchange', 'onfocus', 'onselect', 'size'),
@@ -538,7 +538,7 @@
$options = $this->_mergeOptions($name, $options,
self::DISPLAY_OPTIONS, self::MULTI_OPTIONS);
- $element = new Zend_Form_Element_MultiCheckbox($name, $options);
+ $element = new MUtil_Form_Element_MultiCheckbox($name, $options);
return $this->_addToForm($name, $element);
}
@@ -562,7 +562,7 @@
$options = $this->_mergeOptions($name, $options,
self::DISPLAY_OPTIONS, self::MULTI_OPTIONS);
- $element = new Zend_Form_Element_Multiselect($name, $options);
+ $element = new MUtil_Form_Element_Multiselect($name, $options);
return $this->_addToForm($name, $element);
}
Property changes on: trunk/library/classes/MUtil/Model/Save
___________________________________________________________________
Added: bugtraq:url
+ http://survey.erasmusmc.nl/support/mantis/view.php?id=%BUGID%
Added: bugtraq:logregex
+ #(\d+)
Added: trunk/library/classes/MUtil/Model/Save/ArraySaver.php
===================================================================
--- trunk/library/classes/MUtil/Model/Save/ArraySaver.php (rev 0)
+++ trunk/library/classes/MUtil/Model/Save/ArraySaver.php 2011-11-16 17:52:38 UTC (rev 223)
@@ -0,0 +1,89 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Model
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ *
+ *
+ * @package MUtil
+ * @subpackage Model
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class MUtil_Model_Save_ArraySaver
+{
+ protected $seperatorChar = ' ';
+
+ protected $valuePad = true;
+
+ public function __construct($seperatorChar = ' ', $valuePad = true)
+ {
+ $this->seperatorChar = substr($seperatorChar . ' ', 0, 1);
+ $this->valuePad = $valuePad;
+ }
+
+ /**
+ * If this field is saved as an array value, use
+ *
+ * @param MUtil_Model_ModelAbstract $model
+ * @param string $name The field to set the seperator character
+ * @param string $char
+ * @param boolean $pad
+ * @return MUtil_Model_ModelAbstract (continuation pattern)
+ */
+ public static function create(MUtil_Model_ModelAbstract $model, $name, $char = ' ', $pad = true)
+ {
+ $class = new self($char, $pad);
+
+ $model->set($name, 'valueSeperatorChar', substr($char . ' ', 0, 1), 'valuePad', $pad);
+ $model->setOnSave($name, array($class, 'saveValue'));
+
+ return $class;
+ }
+
+ public function saveValue($name, $value, $isNew)
+ {
+ if (is_array($value)) {
+ $value = implode($this->seperatorChar, $value);
+
+ if ($this->valuePad) {
+ $value = $this->seperatorChar . $value . $this->seperatorChar;
+ }
+ }
+ return $value;
+ }
+}
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-11-16 13:19:44 UTC (rev 222)
+++ trunk/library/configs/db/patches.sql 2011-11-16 17:52:38 UTC (rev 223)
@@ -311,3 +311,11 @@
-- PATCH: Change Burger Service Nummer to Social Security Number
ALTER TABLE `gems__respondents` CHANGE `grs_bsn` `grs_ssn` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
+
+-- PATCH: Extending organizations
+
+ALTER TABLE `gems__organizations` ADD UNIQUE INDEX (`gor_code`);
+
+ALTER TABLE `gems__organizations` ADD gor_accessible_by text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER gor_task,
+ ADD gor_has_patients boolean not null default 1 AFTER gor_iso_lang,
+ ADD gor_add_patients boolean not null default 1 AFTER gor_has_patients;
Modified: trunk/library/configs/db/tables/gems__organizations.20.sql
===================================================================
--- trunk/library/configs/db/tables/gems__organizations.20.sql 2011-11-16 13:19:44 UTC (rev 222)
+++ trunk/library/configs/db/tables/gems__organizations.20.sql 2011-11-16 17:52:38 UTC (rev 223)
@@ -3,20 +3,25 @@
gor_id_organization bigint unsigned not null auto_increment,
gor_name varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
- gor_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
- gor_location varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
- gor_url varchar(127) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
- gor_task varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
+ gor_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gor_location varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gor_url varchar(127) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gor_task varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
- gor_contact_name varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
- gor_contact_email varchar(127) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
- gor_welcome text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
- gor_signature text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
+ -- A commy separated list of organization numbers that can look at respondents in this organization
+ gor_accessible_by text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gor_contact_name varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gor_contact_email varchar(127) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gor_welcome text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gor_signature text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+
gor_style varchar(15) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'gems',
gor_iso_lang char(2) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'
not null default 'en' references gems__languages (gml_iso_lang),
+ gor_has_patients boolean not null default 1,
+ gor_add_patients boolean not null default 1,
gor_active boolean not null default 1,
gor_changed timestamp not null default current_timestamp on update current_timestamp,
@@ -24,15 +29,9 @@
gor_created timestamp not null,
gor_created_by bigint unsigned not null,
- PRIMARY KEY(gor_id_organization)
+ PRIMARY KEY(gor_id_organization),
+ UNIQUE (gor_code)
)
ENGINE=InnoDB
AUTO_INCREMENT = 70
CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
-
--- Default group
-INSERT ignore INTO gems__organizations
- (gor_id_organization, gor_name, gor_location, gor_active, gor_iso_lang, gor_changed, gor_changed_by, gor_created, gor_created_by)
- VALUES
- (70, 'Erasmus MGZ', 'Rotterdam', 1, 'nl', current_timestamp, 0, current_timestamp, 0);
-
Modified: trunk/library/languages/default-en.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-en.po
===================================================================
--- trunk/library/languages/default-en.po 2011-11-16 13:19:44 UTC (rev 222)
+++ trunk/library/languages/default-en.po 2011-11-16 17:52:38 UTC (rev 223)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse EN\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-11-03 12:50+0100\n"
+"POT-Creation-Date: 2011-11-16 18:30+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -18,58 +18,58 @@
"X-Poedit-KeywordsList: plural:1,2\n"
"X-Poedit-SearchPath-0: .\n"
-#: classes/GemsEscort.php:186
+#: classes/GemsEscort.php:201
#, php-format
msgid "Path %s not writable"
msgstr "Path %s not writable"
-#: classes/GemsEscort.php:860
+#: classes/GemsEscort.php:876
#, php-format
msgid "User: %s"
msgstr "User: %s"
-#: classes/GemsEscort.php:884
+#: classes/GemsEscort.php:900
msgid "version"
msgstr "version"
-#: classes/GemsEscort.php:1405
+#: classes/GemsEscort.php:1330
msgid "Take note: your session has expired, your inputs where not saved. Please check the input data and try again"
msgstr "Take note: your session has expired, your inputs where not saved. Please check the input data and try again"
-#: classes/GemsEscort.php:1526
+#: classes/GemsEscort.php:1454
msgid "Please check back later."
msgstr "Please check back later."
-#: classes/GemsEscort.php:1528
-#: classes/GemsEscort.php:1531
-#: classes/GemsEscort.php:1532
+#: classes/GemsEscort.php:1456
+#: classes/GemsEscort.php:1460
+#: classes/GemsEscort.php:1461
msgid "System is in maintenance mode"
msgstr "System is in maintenance mode"
-#: classes/GemsEscort.php:1546
+#: classes/GemsEscort.php:1470
msgid "No access to site."
msgstr "No access to site."
-#: classes/GemsEscort.php:1548
-#: classes/GemsEscort.php:1584
+#: classes/GemsEscort.php:1472
+#: classes/GemsEscort.php:1508
msgid "You have no access to this site."
msgstr "You have no access to this site."
-#: classes/GemsEscort.php:1564
+#: classes/GemsEscort.php:1488
msgid "No access to page"
msgstr "No access to page"
-#: classes/GemsEscort.php:1566
+#: classes/GemsEscort.php:1490
#, php-format
msgid "Access to this page is not allowed for current role: %s."
msgstr "Access to this page is not allowed for current role: %s."
-#: classes/GemsEscort.php:1571
-#: classes/GemsEscort.php:1582
+#: classes/GemsEscort.php:1495
+#: classes/GemsEscort.php:1506
msgid "You are no longer logged in."
msgstr "You are no longer logged in."
-#: classes/GemsEscort.php:1572
+#: classes/GemsEscort.php:1496
msgid "You must login to access this page."
msgstr "You must login to access this page."
@@ -77,15 +77,11 @@
msgid "Database needs to be updated!"
msgstr "Database needs to be updated!"
-#: classes/Gems/Auth.php:107
-msgid "Please update the database"
-msgstr "Please update the database"
-
-#: classes/Gems/Auth.php:174
+#: classes/Gems/Auth.php:225
msgid "Wrong password."
msgstr "Wrong password."
-#: classes/Gems/Auth.php:177
+#: classes/Gems/Auth.php:228
msgid "Combination of username password not found."
msgstr "Combination of username password not found."
@@ -175,7 +171,7 @@
msgstr "Roles"
#: classes/Gems/Menu.php:196
-#: classes/Gems/Menu.php:337
+#: classes/Gems/Menu.php:345
msgid "Assigned"
msgstr "Assigned"
@@ -203,181 +199,202 @@
msgid "Maintenance"
msgstr "Maintenance"
-#: classes/Gems/Menu.php:227
+#: classes/Gems/Menu.php:218
+msgid "Upgrade"
+msgstr "Upgrade"
+
+#: classes/Gems/Menu.php:219
+#: classes/Gems/Menu.php:318
+msgid "Show"
+msgstr "Show"
+
+#: classes/Gems/Menu.php:220
+msgid "Execute all"
+msgstr "Execute all"
+
+#: classes/Gems/Menu.php:221
+msgid "Execute this"
+msgstr "Execute this"
+
+#: classes/Gems/Menu.php:222
+msgid "Execute from here"
+msgstr "Execute from here"
+
+#: classes/Gems/Menu.php:223
+msgid "Execute to here"
+msgstr "Execute to here"
+
+#: classes/Gems/Menu.php:235
#, php-format
msgid "Stand-alone privilige: %s"
msgstr "Stand-alone privilige: %s"
-#: classes/Gems/Menu.php:234
+#: classes/Gems/Menu.php:242
msgid "Logon"
msgstr "Logon"
-#: classes/Gems/Menu.php:235
+#: classes/Gems/Menu.php:243
msgid "Lost password"
msgstr "Lost password"
-#: classes/Gems/Menu.php:236
+#: classes/Gems/Menu.php:244
msgid "Your account"
msgstr "Your account"
-#: classes/Gems/Menu.php:237
+#: classes/Gems/Menu.php:245
msgid "Activity overview"
msgstr "Activity overview"
-#: classes/Gems/Menu.php:238
+#: classes/Gems/Menu.php:246
msgid "Change password"
msgstr "Change password"
-#: classes/Gems/Menu.php:239
-#: classes/Gems/Menu.php:279
-#: classes/Gems/Menu.php:314
+#: classes/Gems/Menu.php:247
+#: classes/Gems/Menu.php:287
+#: classes/Gems/Menu.php:322
msgid "Token"
msgstr "Token"
-#: classes/Gems/Menu.php:240
+#: classes/Gems/Menu.php:248
msgid "Logoff"
msgstr "Logoff"
-#: classes/Gems/Menu.php:275
+#: classes/Gems/Menu.php:283
msgid "Track"
msgstr "Track"
-#: classes/Gems/Menu.php:282
-#: classes/Gems/Menu.php:302
-#: classes/Gems/Menu.php:333
+#: classes/Gems/Menu.php:290
+#: classes/Gems/Menu.php:310
+#: classes/Gems/Menu.php:341
msgid "Add"
msgstr "Add"
-#: classes/Gems/Menu.php:286
-#: classes/Gems/Menu.php:369
+#: classes/Gems/Menu.php:294
+#: classes/Gems/Menu.php:377
msgid "Preview"
msgstr "Preview"
-#: classes/Gems/Menu.php:293
+#: classes/Gems/Menu.php:301
msgid "Tracks"
msgstr "Tracks"
-#: classes/Gems/Menu.php:306
+#: classes/Gems/Menu.php:314
msgid "Assignments"
msgstr "Assignments"
-#: classes/Gems/Menu.php:310
-msgid "Show"
-msgstr "Show"
-
-#: classes/Gems/Menu.php:318
+#: classes/Gems/Menu.php:326
msgid "Edit"
msgstr "Edit"
-#: classes/Gems/Menu.php:322
+#: classes/Gems/Menu.php:330
msgid "Delete"
msgstr "Delete"
-#: classes/Gems/Menu.php:327
+#: classes/Gems/Menu.php:335
msgid "Surveys"
msgstr "Surveys"
-#: classes/Gems/Menu.php:359
+#: classes/Gems/Menu.php:367
msgid "Fill in"
msgstr "Fill in"
-#: classes/Gems/Menu.php:363
+#: classes/Gems/Menu.php:371
msgid "Print PDF"
msgstr "Print PDF"
-#: classes/Gems/Menu.php:366
+#: classes/Gems/Menu.php:374
msgid "E-Mail now!"
msgstr "E-Mail now!"
-#: classes/Gems/Menu.php:372
+#: classes/Gems/Menu.php:380
msgid "Answers"
msgstr "Answers"
-#: classes/Gems/Menu.php:510
+#: classes/Gems/Menu.php:518
msgid "Respondent...
[truncated message content] |
|
From: <gem...@li...> - 2011-11-17 10:59:37
|
Revision: 227
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=227&view=rev
Author: matijsdejong
Date: 2011-11-17 10:59:27 +0000 (Thu, 17 Nov 2011)
Log Message:
-----------
Preparation for #41 onLoad & getFormatted functionality:
- onSave() function enters the value first, isNew next, then name and context,
- SelectModelPaginator allows (future) interception of onLoad calls.
Modified Paths:
--------------
trunk/library/classes/Gems/Default/StaffAction.php
trunk/library/classes/Gems/Model/RespondentModel.php
trunk/library/classes/Gems/Model.php
trunk/library/classes/Gems/Project/ProjectSettings.php
trunk/library/classes/GemsEscort.php
trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php
trunk/library/classes/MUtil/Model/ModelAbstract.php
trunk/library/classes/MUtil/Model/Save/ArraySaver.php
trunk/library/snippets/EditTrackTokenSnippet.php
Added Paths:
-----------
trunk/library/classes/MUtil/Model/SelectModelPaginator.php
Modified: trunk/library/classes/Gems/Default/StaffAction.php
===================================================================
--- trunk/library/classes/Gems/Default/StaffAction.php 2011-11-17 08:45:52 UTC (rev 226)
+++ trunk/library/classes/Gems/Default/StaffAction.php 2011-11-17 10:59:27 UTC (rev 227)
@@ -98,7 +98,7 @@
case Gems_User_UserLoader::USER_STAFF:
Gems_Model::addUserPassword($model);
$passwordField = 'gup_password';
- $model->setOnSave($passwordField, array($this->project, 'getValueHashForModel'));
+ $model->setOnSave($passwordField, array($this->project, 'getValueHash'));
break;
case Gems_User_UserLoader::USER_OLD_STAFF:
@@ -268,12 +268,13 @@
/**
* Return an old style (< 1.5) hashed version of the input value.
*
- * @param string $name Optional name, is here for ModelAbstract setOnSave compatibility
* @param string $value The value to hash.
* @param boolean $new Optional is new, is here for ModelAbstract setOnSave compatibility
+ * @param string $name Optional name, is here for ModelAbstract setOnSave compatibility
+ * @param array $context Optional, the other values being saved
* @return string The salted hash as a 32-character hexadecimal number.
*/
- public function getOldPasswordHash($name, $value, $new)
+ public function getOldPasswordHash($value, $isNew = false, $name = null, array $context = array())
{
return md5($value);
}
Modified: trunk/library/classes/Gems/Model/RespondentModel.php
===================================================================
--- trunk/library/classes/Gems/Model/RespondentModel.php 2011-11-17 08:45:52 UTC (rev 226)
+++ trunk/library/classes/Gems/Model/RespondentModel.php 2011-11-17 10:59:27 UTC (rev 227)
@@ -133,12 +133,13 @@
/**
* Return a hashed version of the input value.
*
- * @param string $name Optional name, is here for ModelAbstract setOnSave compatibility
- * @param string $value The value to hash.
- * @param boolean $new Optional is new, is here for ModelAbstract setOnSave compatibility
+ * @param mixed $value The value being saved
+ * @param boolean $isNew True when a new item is being saved
+ * @param string $name The name of the current field
+ * @param array $context Optional, the other values being saved
* @return string The salted hash as a 32-character hexadecimal number.
*/
- public function formatSSN($name, $value, $new = false)
+ public function formatSSN($value, $isNew = false, $name = null, array $context = array())
{
if ($value) {
return $this->project->getValueHash($value);
Modified: trunk/library/classes/Gems/Model.php
===================================================================
--- trunk/library/classes/Gems/Model.php 2011-11-17 08:45:52 UTC (rev 226)
+++ trunk/library/classes/Gems/Model.php 2011-11-17 10:59:27 UTC (rev 227)
@@ -120,12 +120,15 @@
/**
* Create a Gems project wide unique user id
*
- * @param string $name
- * @param mixed $value
- * @param boolean $isNew
+ * @see Gems_Model_ModelAbstract
+ *
+ * @param mixed $value The value being saved
+ * @param boolean $isNew True when a new item is being saved
+ * @param string $name The name of the current field
+ * @param array $context Optional, the other values being saved
* @return int
*/
- public function createGemsUserId($name, $value, $isNew)
+ public function createGemsUserId($value, $isNew = false, $name = null, array $context = array())
{
if ($isNew || (null === $value)) {
$creationTime = new Zend_Db_Expr('CURRENT_TIMESTAMP');
Modified: trunk/library/classes/Gems/Project/ProjectSettings.php
===================================================================
--- trunk/library/classes/Gems/Project/ProjectSettings.php 2011-11-17 08:45:52 UTC (rev 226)
+++ trunk/library/classes/Gems/Project/ProjectSettings.php 2011-11-17 10:59:27 UTC (rev 227)
@@ -224,17 +224,4 @@
return md5($salted, false);
}
-
- /**
- * Returns a salted hash on the
- *
- * @param string $name Fieldname
- * @param string $value The value to hash
- * @param string $isNew True when new
- * @return string The salted hash as a 32-character hexadecimal number.
- */
- public function getValueHashForModel($name, $value, $isNew = false)
- {
- return $this->getValueHash($value);
- }
}
Modified: trunk/library/classes/GemsEscort.php
===================================================================
--- trunk/library/classes/GemsEscort.php 2011-11-17 08:45:52 UTC (rev 226)
+++ trunk/library/classes/GemsEscort.php 2011-11-17 10:59:27 UTC (rev 227)
@@ -1207,12 +1207,13 @@
*
* @deprecated Since 1.5
*
- * @param string $name Optional name, is here for ModelAbstract setOnSave compatibility
* @param string $value The value to hash.
* @param boolean $new Optional is new, is here for ModelAbstract setOnSave compatibility
+ * @param string $name Optional name, is here for ModelAbstract setOnSave compatibility
+ * @param array $context Optional, the other values being saved
* @return string The salted hash as a 32-character hexadecimal number.
*/
- public function passwordHash($name, $value, $new)
+ public function passwordHash($value, $isNew = false, $name = null, array $context = array())
{
return $this->project->getValueHash($value);
}
Modified: trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2011-11-17 08:45:52 UTC (rev 226)
+++ trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2011-11-17 10:59:27 UTC (rev 227)
@@ -596,14 +596,26 @@
throw new MUtil_Model_ModelException("Cannot create UniqueValue validator as no table was defined for field $name.");
}
- public function formatSaveDate($name, $value, $new = false)
+ /**
+ * A ModelAbstract->setOnSave() function that returns the input
+ * date as a valid date.
+ *
+ * @see Gems_Model_ModelAbstract
+ *
+ * @param mixed $value The value being saved
+ * @param boolean $isNew True when a new item is being saved
+ * @param string $name The name of the current field
+ * @param array $context Optional, the other values being saved
+ * @return Zend_Date
+ */
+ public function formatSaveDate($value, $isNew = false, $name = null)
{
if ($name && (! ((null === $value) || ($value instanceof Zend_Db_Expr)))) {
if ($saveFormat = $this->get($name, 'storageFormat')) {
if ($value instanceof Zend_Date) {
return $value->toString($saveFormat);
-
+
} else {
$displayFormat = $this->get($name, 'dateFormat');
@@ -737,9 +749,10 @@
*/
public function loadPaginator($filter = true, $sort = true)
{
- $select = $this->_createSelect($filter, $sort);
+ $select = $this->_createSelect($filter, $sort);
+ $adapter = new MUtil_Model_SelectModelPaginator($select, $this);
- return Zend_Paginator::factory($select);
+ return new Zend_Paginator($adapter);
}
// abstract public function save(array $newValues);
Modified: trunk/library/classes/MUtil/Model/ModelAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Model/ModelAbstract.php 2011-11-17 08:45:52 UTC (rev 226)
+++ trunk/library/classes/MUtil/Model/ModelAbstract.php 2011-11-17 10:59:27 UTC (rev 227)
@@ -143,7 +143,7 @@
}
if ($this->isSaveable($name, $value, $new)) {
- $filteredData[$name] = $this->getOnSave($name, $value, $new);
+ $filteredData[$name] = $this->getOnSave($value, $new, $name, $data);
}
}
@@ -579,12 +579,22 @@
return $this->_model_name;
}
- public function getOnSave($name, $value, $new = false)
+ /**
+ * Checks for and executes any actions to perform on a value before
+ * saving the value
+ *
+ * @param mixed $value The value being saved
+ * @param boolean $isNew True when a new item is being saved
+ * @param string $name The name of the current field
+ * @param array $context Optional, the other values being saved
+ * @return mixed The value to save
+ */
+ public function getOnSave($value, $new, $name, array $context = array())
{
if ($call = $this->get($name, self::SAVE_TRANSFORMER)) {
if (is_callable($call)) {
- $value = call_user_func($call, $name, $value, $new);
+ $value = call_user_func($call, $value, $new, $name, $context);
} else {
$value = $call;
}
@@ -1107,6 +1117,13 @@
return $this;
}
+ /**
+ * Sets a name to automatically determined/changed of value during save.
+ *
+ * @param string $name
+ * @param mixed $callableOrConstant A constant or a function of this type: callable($value, $isNew = false, $name = null, array $context = array())
+ * @return MUtil_Model_ModelAbstract (continuation pattern)
+ */
public function setOnSave($name, $callableOrConstant)
{
$this->set($name, self::SAVE_TRANSFORMER, $callableOrConstant);
Modified: trunk/library/classes/MUtil/Model/Save/ArraySaver.php
===================================================================
--- trunk/library/classes/MUtil/Model/Save/ArraySaver.php 2011-11-17 08:45:52 UTC (rev 226)
+++ trunk/library/classes/MUtil/Model/Save/ArraySaver.php 2011-11-17 10:59:27 UTC (rev 227)
@@ -75,7 +75,19 @@
return $class;
}
- public function saveValue($name, $value, $isNew)
+ /**
+ * A ModelAbstract->setOnSave() function that concatenates the
+ * value if it is an array.
+ *
+ * @see Gems_Model_ModelAbstract
+ *
+ * @param mixed $value The value being saved
+ * @param boolean $isNew True when a new item is being saved
+ * @param string $name The name of the current field
+ * @param array $context Optional, the other values being saved
+ * @return Zend_Date
+ */
+ public function saveValue($value, $isNew = false, $name = null, array $context = array())
{
if (is_array($value)) {
$value = implode($this->seperatorChar, $value);
Added: trunk/library/classes/MUtil/Model/SelectModelPaginator.php
===================================================================
--- trunk/library/classes/MUtil/Model/SelectModelPaginator.php (rev 0)
+++ trunk/library/classes/MUtil/Model/SelectModelPaginator.php 2011-11-17 10:59:27 UTC (rev 227)
@@ -0,0 +1,98 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Model
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * This class wraps around a select as a paginator, while allowing model->onload
+ * functions to apply.
+ *
+ * @see MUtil_Model_DatabaseModelAbstract
+ *
+ * @package MUtil
+ * @subpackage Model
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class MUtil_Model_SelectModelPaginator implements Zend_Paginator_Adapter_Interface
+{
+ /**
+ *
+ * @var MUtil_Model_DatabaseModelAbstract
+ */
+ protected $_model;
+
+ /**
+ *
+ * @var Zend_Paginator_Adapter_DbSelect
+ */
+ protected $_selectAdapter;
+
+ /**
+ *
+ * @param Zend_Db_Select $select
+ * @param MUtil_Model_ModelAbstract $model
+ */
+ public function __construct(Zend_Db_Select $select, MUtil_Model_DatabaseModelAbstract $model)
+ {
+ $this->_selectAdapter = new Zend_Paginator_Adapter_DbSelect($select);
+ $this->_model = $model;
+ }
+
+ /**
+ * Returns the total number of rows in the result set.
+ *
+ * @return integer
+ */
+ public function count()
+ {
+ return $this->_selectAdapter->count();
+ }
+
+ /**
+ * Returns an array of items for a page.
+ *
+ * @param integer $offset Page offset
+ * @param integer $itemCountPerPage Number of items per page
+ * @return array
+ */
+ public function getItems($offset, $itemCountPerPage)
+ {
+ $items = $this->_selectAdapter->getItems($offset, $itemCountPerPage);
+
+ return $items;
+ }
+}
Modified: trunk/library/snippets/EditTrackTokenSnippet.php
===================================================================
--- trunk/library/snippets/EditTrackTokenSnippet.php 2011-11-17 08:45:52 UTC (rev 226)
+++ trunk/library/snippets/EditTrackTokenSnippet.php 2011-11-17 10:59:27 UTC (rev 227)
@@ -160,8 +160,8 @@
if ($this->formData[self::RECALCULATE_FIELD]) {
$model = $this->getModel();
// Refresh token with current form data
- $updateData['gto_valid_from'] = $model->getOnSave('gto_valid_from', $this->formData['gto_valid_from'], true);
- $updateData['gto_valid_until'] = $model->getOnSave('gto_valid_until', $this->formData['gto_valid_until'], true);
+ $updateData['gto_valid_from'] = $model->getOnSave($this->formData['gto_valid_from'], true, 'gto_valid_from');
+ $updateData['gto_valid_until'] = $model->getOnSave($this->formData['gto_valid_until'], true, 'gto_valid_until');
$updateData['gto_comment'] = $this->formData['gto_comment'];
$this->token->refresh($updateData);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-11-17 16:19:34
|
Revision: 230
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=230&view=rev
Author: matijsdejong
Date: 2011-11-17 16:19:26 +0000 (Thu, 17 Nov 2011)
Log Message:
-----------
Continued with #41 onLoad & getFormatted functionality:
- onLoad() functions work
- started on Model_Types, made first that works, but not yet generalized
Modified Paths:
--------------
trunk/library/changelog.txt
trunk/library/classes/Gems/Default/OrganizationAction.php
trunk/library/classes/Gems/Export/ExportModel.php
trunk/library/classes/Gems/Model/DbaModel.php
trunk/library/classes/Gems/Tracker/SurveyModel.php
trunk/library/classes/MUtil/Lazy/ArrayAccessor.php
trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php
trunk/library/classes/MUtil/Model/FormBridge.php
trunk/library/classes/MUtil/Model/ModelAbstract.php
trunk/library/classes/MUtil/Model/ModelTransformerAbstract.php
trunk/library/classes/MUtil/Model/SelectModelPaginator.php
trunk/library/classes/MUtil/Model/TableBridgeAbstract.php
Added Paths:
-----------
trunk/library/classes/MUtil/Model/Type/
trunk/library/classes/MUtil/Model/Type/ConcatenatedRow.php
Removed Paths:
-------------
trunk/library/classes/MUtil/Form/Element/MultiCheckbox.php
trunk/library/classes/MUtil/Form/Element/MultiSelect.php
trunk/library/classes/MUtil/Model/Save/
Modified: trunk/library/changelog.txt
===================================================================
--- trunk/library/changelog.txt 2011-11-17 14:20:41 UTC (rev 229)
+++ trunk/library/changelog.txt 2011-11-17 16:19:26 UTC (rev 230)
@@ -7,6 +7,7 @@
The gems__respondent.grs_bsn has been renamed to grs_ssn, to make the code more international.
MailController is now called MailTemplateController.
EmailController is now called CronController (with stub for compatibility).
+ModelAbstract now declares an protected _load instead of a public load abstract, for implementation of setOnLoad() functions, check your own Models for overloading load() or loadXX() functions.
Important changes from 1.4.2 => 1.4.3
============================================================
Modified: trunk/library/classes/Gems/Default/OrganizationAction.php
===================================================================
--- trunk/library/classes/Gems/Default/OrganizationAction.php 2011-11-17 14:20:41 UTC (rev 229)
+++ trunk/library/classes/Gems/Default/OrganizationAction.php 2011-11-17 16:19:26 UTC (rev 230)
@@ -149,12 +149,11 @@
$model->set('gor_name', 'validator', $model->createUniqueValidator('gor_name'));
$model->set('gor_welcome', 'label', $this->_('Greeting'), 'description', $this->_('For emails and token forward screen.'), 'elementClass', 'Textarea', 'rows', 5);
$model->set('gor_signature', 'label', $this->_('Signature'), 'description', $this->_('For emails and token forward screen.'), 'elementClass', 'Textarea', 'rows', 5);
-
- $model->set('gor_accessible_by', 'label', $this->_('Accessible by'), 'description', $this->_('Checked organizations see this organizations respondents.'), 'elementClass', 'MultiCheckbox',
- 'multiOptions', $this->util->getDbLookup()->getOrganizations());
- MUtil_Model_Save_ArraySaver::create($model, 'gor_accessible_by', ':');
-
}
+ $model->set('gor_accessible_by', 'label', $this->_('Accessible by'), 'description', $this->_('Checked organizations see this organizations respondents.'),
+ 'elementClass', 'MultiCheckbox', 'multiOptions', $this->util->getDbLookup()->getOrganizations());
+ $tp = new MUtil_Model_Type_ConcatenatedRow(':', ', ');
+ $tp->apply($model, 'gor_accessible_by');
if ($this->project->multiLocale) {
$model->set('gor_name', 'description', 'ENGLISH please! Use translation file to translate.');
Modified: trunk/library/classes/Gems/Export/ExportModel.php
===================================================================
--- trunk/library/classes/Gems/Export/ExportModel.php 2011-11-17 14:20:41 UTC (rev 229)
+++ trunk/library/classes/Gems/Export/ExportModel.php 2011-11-17 16:19:26 UTC (rev 230)
@@ -54,6 +54,22 @@
parent::__construct('export');
}
+ /**
+ * Returns a nested array containing the items requested.
+ *
+ * @param mixed $filter True to use the stored filter, array to specify a different filter
+ * @param mixed $sort True to use the stored sort, array to specify a different sort
+ * @return array Nested array or false
+ */
+ protected function _load($filter = true, $sort = true)
+ {
+ $result = array();
+ foreach ($this->getItemsOrdered() as $item) {
+ $result[0][$item] = $item;
+ }
+ return $result;
+ }
+
public function delete($filter = true)
{
return false;
@@ -64,15 +80,6 @@
return false;
}
- public function load($filter = true, $sort = true)
- {
- $result = array();
- foreach ($this->getItemsOrdered() as $item) {
- $result[0][$item] = $item;
- }
- return $result;
- }
-
public function save(array $newValues, array $filter = null)
{
return $newValues;
Modified: trunk/library/classes/Gems/Model/DbaModel.php
===================================================================
--- trunk/library/classes/Gems/Model/DbaModel.php 2011-11-17 14:20:41 UTC (rev 229)
+++ trunk/library/classes/Gems/Model/DbaModel.php 2011-11-17 16:19:26 UTC (rev 230)
@@ -120,6 +120,28 @@
}
}
+ /**
+ * Returns a nested array containing the items requested.
+ *
+ * @param mixed $filter True to use the stored filter, array to specify a different filter
+ * @param mixed $sort True to use the stored sort, array to specify a different sort
+ * @return array Nested array or false
+ */
+ protected function _load($filter = true, $sort = true)
+ {
+ $data = $this->_loadAllData();
+
+ if ($filter) {
+ $data = $this->_filterData($data, $this->_checkFilterUsed($filter));
+ }
+
+ if ($sort) {
+ $data = $this->_sortData($data, $this->_checkSortUsed($sort));
+ }
+
+ return $data;
+ }
+
private function _loadAllData()
{
$tables = $this->db->listTables();
@@ -347,21 +369,6 @@
return true;
}
- public function load($filter = true, $sort = true)
- {
- $data = $this->_loadAllData();
-
- if ($filter) {
- $data = $this->_filterData($data, $this->_checkFilterUsed($filter));
- }
-
- if ($sort) {
- $data = $this->_sortData($data, $this->_checkSortUsed($sort));
- }
-
- return $data;
- }
-
public function loadTable($tableName)
{
return $this->loadFirst(array('name' => $tableName), false);
Modified: trunk/library/classes/Gems/Tracker/SurveyModel.php
===================================================================
--- trunk/library/classes/Gems/Tracker/SurveyModel.php 2011-11-17 14:20:41 UTC (rev 229)
+++ trunk/library/classes/Gems/Tracker/SurveyModel.php 2011-11-17 16:19:26 UTC (rev 230)
@@ -26,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- *
+ *
* @package Gems
* @subpackage Tracker
* @author Matijs de Jong <mj...@ma...>
@@ -75,6 +75,18 @@
}
/**
+ * Returns a nested array containing the items requested.
+ *
+ * @param mixed $filter True to use the stored filter, array to specify a different filter
+ * @param mixed $sort True to use the stored sort, array to specify a different sort
+ * @return array Nested array or false
+ */
+ protected function _load($filter = true, $sort = true)
+ {
+ return $this->addAnswers(parent::_load($filter, $sort));
+ }
+
+ /**
* Returns a nested array containing the items requested, including answers.
*
* @param array $inputRows Nested rows with Gems token information
@@ -113,18 +125,6 @@
}
/**
- * Returns a nested array containing the items requested.
- *
- * @param mixed $filter True to use the stored filter, array to specify a different filter
- * @param mixed $sort True to use the stored sort, array to specify a different sort
- * @return array Nested array or false
- */
- public function load($filter = true, $sort = true)
- {
- return $this->addAnswers(parent::load($filter, $sort));
- }
-
- /**
* Returns an array containing the first requested item.
*
* @param mixed $filter True to use the stored filter, array to specify a different filter
@@ -145,18 +145,7 @@
*/
public function loadPaginator($filter = true, $sort = true)
{
+ // Do not use a select paginator for the moment, till we can add addAnswers()
return Zend_Paginator::factory($this->load($filter, $sort));
}
-
- /**
- * Returns a MUtil_Lazy_RepeatableInterface for the items in the model
- *
- * @param mixed $filter True to use the stored filter, array to specify a different filter
- * @param mixed $sort True to use the stored sort, array to specify a different sort
- * @return MUtil_Lazy_RepeatableInterface
- */
- public function loadRepeatable($filter = true, $sort = true)
- {
- return MUtil_Lazy::repeat($this->load($filter, $sort));
- }
}
Deleted: trunk/library/classes/MUtil/Form/Element/MultiCheckbox.php
===================================================================
--- trunk/library/classes/MUtil/Form/Element/MultiCheckbox.php 2011-11-17 14:20:41 UTC (rev 229)
+++ trunk/library/classes/MUtil/Form/Element/MultiCheckbox.php 2011-11-17 16:19:26 UTC (rev 230)
@@ -1,143 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @package MUtil
- * @subpackage Form
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
- */
-
-/**
- * This object allows you to supply a string value when the object expects an
- * array value, splitting the string along the valueSeperatorChar.
- *
- * Return this value as a string is not practical as that breaks the workings
- * of all Filters, Validators and Decorators.
- *
- * @package MUtil
- * @subpackage Form
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @since Class available since version 1.5
- */
-class MUtil_Form_Element_MultiCheckbox extends Zend_Form_Element_MultiCheckbox
-{
- /**
- * En/disables padding the value in separators. The default is true as this
- * simplifies search commands (and usually costs only 2 characters).
- *
- * @var boolean
- */
- protected $_valuePad = true;
-
- /**
- * The value seperator enables this control to accept a single string as value
- * and split it into an array.
- *
- * A null seperator means this class behaves as it's parent class and returns an
- * array value.
- *
- * @var string
- */
- protected $_valueSeperatorChar = null;
-
- /**
- * En/disables padding the value in separators. The default is true as this
- * simplifies search commands (and usually costs only 2 characters).
- *
- * @return boolean
- */
- public function getValuePad()
- {
- return $this->_valuePad;
- }
-
- /**
- * The value seperator enables this control to accept a single string as value
- * and split it into an array.
- *
- * A null seperator means this class behaves as it's parent class and returns an
- * array value.
- *
- * @return string
- */
- public function getValueSeperatorChar()
- {
- return $this->_valueSeperatorChar;
- }
-
- /**
- * Set element value
- *
- * @param mixed $value
- * @return MUtil_Form_Element_MultiCheckbox (continuation pattern)
- */
- public function setValue($value)
- {
- if ((null !== $this->_valueSeperatorChar) && (! is_array($value))) {
- if ($this->_valuePad) {
- $value = trim($value, $this->_valueSeperatorChar);
- }
- $value = explode($this->_valueSeperatorChar, $value);
- }
-
- return parent::setValue($value);
- }
-
- /**
- * En/disables padding the value in separators. The default is true as this
- * simplifies search commands (and usually costs only 2 characters).
- *
- * @param boolean $value
- * @return MUtil_Form_Element_MultiCheckbox (continuation pattern)
- */
- public function setValuePad($value = true)
- {
- $this->_valuePad = $value;
- return $this;
- }
-
- /**
- * The value seperator enables this control to accept a single string as value
- * and split it into an array.
- *
- * A null seperator means this class behaves as it's parent class and returns an
- * array value.
- *
- * @param string $seperator
- * @return MUtil_Form_Element_MultiCheckbox (continuation pattern)
- */
- public function setValueSeperatorChar($seperator = ' ')
- {
- $this->_valueSeperatorChar = substr($seperator . ' ', 0, 1);
- return $this;
- }
-}
Deleted: trunk/library/classes/MUtil/Form/Element/MultiSelect.php
===================================================================
--- trunk/library/classes/MUtil/Form/Element/MultiSelect.php 2011-11-17 14:20:41 UTC (rev 229)
+++ trunk/library/classes/MUtil/Form/Element/MultiSelect.php 2011-11-17 16:19:26 UTC (rev 230)
@@ -1,143 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @package MUtil
- * @subpackage Form
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
- */
-
-/**
- * This object allows you to supply a string value when the object expects an
- * array value, splitting the string along the valueSeperatorChar.
- *
- * Return this value as a string is not practical as that breaks the workings
- * of all Filters, Validators and Decorators.
- *
- * @package MUtil
- * @subpackage Form
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @since Class available since version 1.5
- */
-class MUtil_Form_Element_MultiSelect extends Zend_Form_Element_MultiSelect
-{
- /**
- * En/disables padding the value in separators. The default is true as this
- * simplifies search commands (and usually costs only 2 characters).
- *
- * @var boolean
- */
- protected $_valuePad = true;
-
- /**
- * The value seperator enables this control to accept a single string as value
- * and split it into an array.
- *
- * A null seperator means this class behaves as it's parent class and returns an
- * array value.
- *
- * @var string
- */
- protected $_valueSeperatorChar = null;
-
- /**
- * En/disables padding the value in separators. The default is true as this
- * simplifies search commands (and usually costs only 2 characters).
- *
- * @return boolean
- */
- public function getValuePad()
- {
- return $this->_valuePad;
- }
-
- /**
- * The value seperator enables this control to accept a single string as value
- * and split it into an array.
- *
- * A null seperator means this class behaves as it's parent class and returns an
- * array value.
- *
- * @return string
- */
- public function getValueSeperatorChar()
- {
- return $this->_valueSeperatorChar;
- }
-
- /**
- * Set element value
- *
- * @param mixed $value
- * @return MUtil_Form_Element_MultiCheckbox (continuation pattern)
- */
- public function setValue($value)
- {
- if ((null !== $this->_valueSeperatorChar) && (! is_array($value))) {
- if ($this->_valuePad) {
- $value = trim($value, $this->_valueSeperatorChar);
- }
- $value = explode($this->_valueSeperatorChar, $value);
- }
-
- return parent::setValue($value);
- }
-
- /**
- * En/disables padding the value in separators. The default is true as this
- * simplifies search commands (and usually costs only 2 characters).
- *
- * @param boolean $value
- * @return MUtil_Form_Element_MultiCheckbox (continuation pattern)
- */
- public function setValuePad($value = true)
- {
- $this->_valuePad = $value;
- return $this;
- }
-
- /**
- * The value seperator enables this control to accept a single string as value
- * and split it into an array.
- *
- * A null seperator means this class behaves as it's parent class and returns an
- * array value.
- *
- * @param string $seperator
- * @return MUtil_Form_Element_MultiCheckbox (continuation pattern)
- */
- public function setValueSeperatorChar($seperator = ' ')
- {
- $this->_valueSeperatorChar = substr($seperator . ' ', 0, 1);
- return $this;
- }
-}
Modified: trunk/library/classes/MUtil/Lazy/ArrayAccessor.php
===================================================================
--- trunk/library/classes/MUtil/Lazy/ArrayAccessor.php 2011-11-17 14:20:41 UTC (rev 229)
+++ trunk/library/classes/MUtil/Lazy/ArrayAccessor.php 2011-11-17 16:19:26 UTC (rev 230)
@@ -1,41 +1,49 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
/**
- * @author Matijs de Jong
- * @since 1.0
- * @version 1.1
- * @package MUtil
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
* @subpackage Lazy
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
*/
+/**
+ *
+ * @package MUtil
+ * @subpackage Lazy
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.1
+ */
+
class MUtil_Lazy_ArrayAccessor extends MUtil_Lazy_LazyAbstract
{
private $_array;
@@ -67,12 +75,22 @@
$offset = $offset->__toValue($stack);
}
- // MUtil_Echo::r($array, '[' . $offset . ']');
+ // MUtil_Echo::track($array, 'offset', $offset);
if (null === $offset) {
if (isset($array[''])) {
return $array[''];
}
+ } elseif (is_array($offset)) {
+ // When the offset is itself an array, return an
+ // array of values applied to this offset.
+ $results = array();
+ foreach ($offset as $key => $value) {
+ if (isset($array[$value])) {
+ $results[$key] = $array[$value];
+ }
+ }
+ return $results;
} elseif (isset($array[$offset])) {
return $array[$offset];
}
Modified: trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2011-11-17 14:20:41 UTC (rev 229)
+++ trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2011-11-17 16:19:26 UTC (rev 230)
@@ -241,7 +241,7 @@
}
}
- return $this->_filterDataArray($tableData, $isNew);
+ return $this->_filterDataForSave($tableData, $isNew);
}
protected function _getKeysFor($table_name)
@@ -261,6 +261,18 @@
return $table->info(Zend_Db_Table_Abstract::NAME);
}
+ /**
+ * Returns a nested array containing the items requested.
+ *
+ * @param mixed $filter True to use the stored filter, array to specify a different filter
+ * @param mixed $sort True to use the stored sort, array to specify a different sort
+ * @return array Nested array or false
+ */
+ protected function _load($filter = true, $sort = true)
+ {
+ return $this->_createSelect($filter, $sort)->query(Zend_Db::FETCH_ASSOC)->fetchAll();
+ }
+
protected function _loadTableMetaData(Zend_Db_Table_Abstract $table)
{
$table_name = $this->_getTableName($table);
@@ -608,7 +620,7 @@
* @param array $context Optional, the other values being saved
* @return Zend_Date
*/
- public function formatSaveDate($value, $isNew = false, $name = null)
+ public function formatSaveDate($value, $isNew = false, $name = null, array $context = array())
{
if ($name && (! ((null === $value) || ($value instanceof Zend_Db_Expr)))) {
if ($saveFormat = $this->get($name, 'storageFormat')) {
@@ -714,18 +726,6 @@
}
/**
- * Returns a nested array containing the items requested.
- *
- * @param mixed $filter True to use the stored filter, array to specify a different filter
- * @param mixed $sort True to use the stored sort, array to specify a different sort
- * @return array Nested array or false
- */
- public function load($filter = true, $sort = true)
- {
- return $this->_createSelect($filter, $sort)->query(Zend_Db::FETCH_ASSOC)->fetchAll();
- }
-
- /**
* Returns an array containing the first requested item.
*
* @param mixed $filter True to use the stored filter, array to specify a different filter
@@ -737,7 +737,12 @@
$select = $this->_createSelect($filter, $sort);
$select->limit(1, 0);
- return $select->query(Zend_Db::FETCH_ASSOC)->fetch();
+ $data = $select->query(Zend_Db::FETCH_ASSOC)->fetch();
+ if (is_array($data)) {
+ $data = $this->_filterDataAfterLoad($data, false);
+ }
+
+ return $data;
}
/**
@@ -755,6 +760,26 @@
return new Zend_Paginator($adapter);
}
+ /**
+ * Helper function for SelectModelPaginator to process
+ * setOnLoads.
+ *
+ * @see MUtil_Model_SelectModelPaginator
+ *
+ * @param array $data Nested array
+ * @return array Nested
+ */
+ public function processAfterLoad(array $data)
+ {
+ if ($this->getMeta(parent::LOAD_TRANSFORMER)) {
+ foreach ($data as $key => $row) {
+ $data[$key] = $this->_filterDataAfterLoad($row, false);
+ }
+ }
+
+ return $data;
+ }
+
// abstract public function save(array $newValues);
public function setCreate($value = true)
Modified: trunk/library/classes/MUtil/Model/FormBridge.php
===================================================================
--- trunk/library/classes/MUtil/Model/FormBridge.php 2011-11-17 14:20:41 UTC (rev 229)
+++ trunk/library/classes/MUtil/Model/FormBridge.php 2011-11-17 16:19:26 UTC (rev 230)
@@ -85,7 +85,7 @@
self::FILE_OPTIONS => array('accept', 'count', 'destination', 'valueDisabled'),
self::GROUP_OPTIONS => array('elements', 'legend', 'separator'),
self::JQUERY_OPTIONS => array('jQueryParams'),
- self::MULTI_OPTIONS => array('disable', 'multiOptions', 'onchange', 'separator', 'size', 'valuePad', 'valueSeperatorChar'),
+ self::MULTI_OPTIONS => array('disable', 'multiOptions', 'onchange', 'separator', 'size'),
self::PASSWORD_OPTIONS => array('repeatLabel'),
self::TAB_OPTIONS => array('value'),
self::TEXT_OPTIONS => array('maxlength', 'minlength', 'onchange', 'onfocus', 'onselect', 'size'),
@@ -538,7 +538,7 @@
$options = $this->_mergeOptions($name, $options,
self::DISPLAY_OPTIONS, self::MULTI_OPTIONS);
- $element = new MUtil_Form_Element_MultiCheckbox($name, $options);
+ $element = new Zend_Form_Element_MultiCheckbox($name, $options);
return $this->_addToForm($name, $element);
}
@@ -562,7 +562,7 @@
...
[truncated message content] |
|
From: <gem...@li...> - 2011-11-19 18:01:13
|
Revision: 240
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=240&view=rev
Author: michieltcs
Date: 2011-11-19 18:01:07 +0000 (Sat, 19 Nov 2011)
Log Message:
-----------
Fix typo
Modified Paths:
--------------
trunk/library/classes/Gems/Auth.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__user_login_attempts.10.sql
Modified: trunk/library/classes/Gems/Auth.php
===================================================================
--- trunk/library/classes/Gems/Auth.php 2011-11-19 17:59:24 UTC (rev 239)
+++ trunk/library/classes/Gems/Auth.php 2011-11-19 18:01:07 UTC (rev 240)
@@ -110,7 +110,7 @@
try {
$login_name = $formValues['userlogin'];
$organization = $formValues['organization'];
- $sql = "SELECT gula_failed_logins, gula_last_failed FROM gems__user_login_attemps WHERE gula_login = ? AND gula_id_organization = ?";
+ $sql = "SELECT gula_failed_logins, gula_last_failed FROM gems__user_login_attempts WHERE gula_login = ? AND gula_id_organization = ?";
$values = $this->db->fetchRow($sql, array($login_name, $organization));
if (! $values) {
@@ -168,11 +168,11 @@
try {
if (isset($values['gula_login'])) {
- $this->db->insert('gems__user_login_attemps', $values);
+ $this->db->insert('gems__user_login_attempts', $values);
} else {
$where = $this->db->quoteInto('gula_login = ? AND ', $login_name);
$where .= $this->db->quoteInto('gula_id_organization = ?', $organization);
- $this->db->update('gems__user_login_attemps', $values, $where);
+ $this->db->update('gems__user_login_attempts', $values, $where);
}
} catch (Zend_Db_Exception $e) {
// Fall through as this does not work if the database upgrade did not run
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-11-19 17:59:24 UTC (rev 239)
+++ trunk/library/configs/db/patches.sql 2011-11-19 18:01:07 UTC (rev 240)
@@ -249,7 +249,7 @@
AUTO_INCREMENT = 10001
CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
-CREATE TABLE if not exists gems__user_login_attemps (
+CREATE TABLE if not exists gems__user_login_attempts (
gula_login varchar(30) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
gula_id_organization bigint not null references gems__organizations (gor_id_organization),
Modified: trunk/library/configs/db/tables/gems__user_login_attempts.10.sql
===================================================================
--- trunk/library/configs/db/tables/gems__user_login_attempts.10.sql 2011-11-19 17:59:24 UTC (rev 239)
+++ trunk/library/configs/db/tables/gems__user_login_attempts.10.sql 2011-11-19 18:01:07 UTC (rev 240)
@@ -1,7 +1,7 @@
-- Table for keeping track of fail;ed login attempts
--
-CREATE TABLE if not exists gems__user_login_attemps (
+CREATE TABLE if not exists gems__user_login_attempts (
gula_login varchar(30) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
gula_id_organization bigint not null references gems__organizations (gor_id_organization),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-11-22 14:29:49
|
Revision: 263
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=263&view=rev
Author: michieltcs
Date: 2011-11-22 14:29:43 +0000 (Tue, 22 Nov 2011)
Log Message:
-----------
Refs #307 - added ggp_allowed_ip_ranges, load in Gems_User_User and use in Gems_Auth::authenticate()
Modified Paths:
--------------
trunk/library/classes/Gems/Auth.php
trunk/library/classes/Gems/Default/GroupAction.php
trunk/library/classes/Gems/User/OldStaffUserDefinition.php
trunk/library/classes/Gems/User/ProjectUserDefinition.php
trunk/library/classes/Gems/User/StaffUserDefinition.php
trunk/library/classes/Gems/User/User.php
trunk/library/configs/db/patches.sql
Modified: trunk/library/classes/Gems/Auth.php
===================================================================
--- trunk/library/classes/Gems/Auth.php 2011-11-22 14:29:03 UTC (rev 262)
+++ trunk/library/classes/Gems/Auth.php 2011-11-22 14:29:43 UTC (rev 263)
@@ -54,13 +54,15 @@
*/
const ERROR_DATABASE_NOT_INSTALLED = -11;
const ERROR_PASSWORD_DELAY = -12;
+ const ERROR_INVALID_IP = -13;
/**
* @var array Message templates
*/
protected $_messageTemplates = array(
self::ERROR_DATABASE_NOT_INSTALLED => 'Installation not complete! Login is not yet possible!',
- self::ERROR_PASSWORD_DELAY => 'Your account is temporarily blocked, please wait %s seconds'
+ self::ERROR_PASSWORD_DELAY => 'Your account is temporarily blocked, please wait %s seconds',
+ self::ERROR_INVALID_IP => 'You are not allowed to login from this location.'
);
/**
@@ -144,7 +146,12 @@
// We only forward to auth adapter when we have no timeout to prevent hammering the auth system
if (! isset($result) ) {
- $result = parent::authenticate($adapter);
+ // Check if the client IP address is within allowed IP ranges
+ if (isset($formValues['allowed_ip_ranges']) && !Gems_Util::isAllowedIP($_SERVER['REMOTE_ADDR'], $formValues['allowed_ip_ranges'])) {
+ $result = $this->_error(self::ERROR_INVALID_IP);
+ } else {
+ $result = parent::authenticate($adapter);
+ }
}
if ($result->isValid()) {
Modified: trunk/library/classes/Gems/Default/GroupAction.php
===================================================================
--- trunk/library/classes/Gems/Default/GroupAction.php 2011-11-22 14:29:03 UTC (rev 262)
+++ trunk/library/classes/Gems/Default/GroupAction.php 2011-11-22 14:29:43 UTC (rev 263)
@@ -66,6 +66,7 @@
$bridge->addCheckbox('ggp_group_active');
$bridge->addCheckbox('ggp_staff_members');
$bridge->addCheckbox('ggp_respondent_members');
+ $bridge->addText('ggp_allowed_ip_ranges');
}
/**
@@ -91,6 +92,8 @@
$model->set('ggp_group_active', 'label', $this->_('Active'), 'multiOptions', $yesNo);
$model->set('ggp_staff_members', 'label', $this->_('Staff'), 'multiOptions', $yesNo);
$model->set('ggp_respondent_members', 'label', $this->_('Respondents'), 'multiOptions', $yesNo);
+
+ $model->set('ggp_allowed_ip_ranges', 'label', $this->_('Allowed IP Ranges'));
Gems_Model::setChangeFieldsByPrefix($model, 'ggp');
Modified: trunk/library/classes/Gems/User/OldStaffUserDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/OldStaffUserDefinition.php 2011-11-22 14:29:03 UTC (rev 262)
+++ trunk/library/classes/Gems/User/OldStaffUserDefinition.php 2011-11-22 14:29:43 UTC (rev 263)
@@ -147,7 +147,7 @@
// For a multi-layout project we need to select the appropriate style too,
// but as PATCHES may not be in effect we have to try two selects
$select2 = clone $select;
- $select2->columns(array('user_style' => 'gor_style'), 'gems__organizations');
+ $select2->columns(array('user_style' => 'gor_style', 'user_allowed_ip_ranges' => 'ggp_allowed_ip_ranges'), 'gems__organizations');
try {
// Fails before patch has run...
Modified: trunk/library/classes/Gems/User/ProjectUserDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/ProjectUserDefinition.php 2011-11-22 14:29:03 UTC (rev 262)
+++ trunk/library/classes/Gems/User/ProjectUserDefinition.php 2011-11-22 14:29:43 UTC (rev 263)
@@ -76,6 +76,7 @@
'user_style' => 'gems',
'user_organization_id' => $organization,
'user_organization_name' => 'SUPER ADMIN',
+ 'user_allowed_ip_ranges' => '',
'allowedOrgs' => array($organization => 'SUPER ADMIN')
);
}
Modified: trunk/library/classes/Gems/User/StaffUserDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/StaffUserDefinition.php 2011-11-22 14:29:03 UTC (rev 262)
+++ trunk/library/classes/Gems/User/StaffUserDefinition.php 2011-11-22 14:29:43 UTC (rev 263)
@@ -190,7 +190,7 @@
'user_locale'=>'gsf_iso_lang',
'user_logout'=>'gsf_logout_on_survey'))
->columns(array('user_name'=>"(concat(coalesce(concat(`gems__staff`.`gsf_first_name`,_utf8' '),_utf8''),coalesce(concat(`gems__staff`.`gsf_surname_prefix`,_utf8' '),_utf8''),coalesce(`gems__staff`.`gsf_last_name`,_utf8'')))"))
- ->join('gems__groups', 'gsf_id_primary_group = ggp_id_group', array('user_role'=>'ggp_role'))
+ ->join('gems__groups', 'gsf_id_primary_group = ggp_id_group', array('user_role'=>'ggp_role', 'user_allowed_ip_ranges' => 'ggp_allowed_ip_ranges'))
->join('gems__organizations', 'gul_id_organization = gor_id_organization',
array(
'user_organization_id'=>'gor_id_organization',
Modified: trunk/library/classes/Gems/User/User.php
===================================================================
--- trunk/library/classes/Gems/User/User.php 2011-11-22 14:29:03 UTC (rev 262)
+++ trunk/library/classes/Gems/User/User.php 2011-11-22 14:29:43 UTC (rev 263)
@@ -204,6 +204,9 @@
public function authenticate($formValues)
{
$auth = Gems_Auth::getInstance();
+
+ $formValues['allowed_ip_ranges'] = $this->getAllowedIPRanges();
+
$adapter = $this->definition->getAuthAdapter($formValues);
$authResult = $auth->authenticate($adapter, $formValues);
@@ -319,6 +322,16 @@
{
return $this->_getVar('user_group');
}
+
+ /**
+ * Returns the list of allowed IP ranges (separated by colon)
+ *
+ * @return string
+ */
+ public function getAllowedIPRanges()
+ {
+ return $this->_getVar('user_allowed_ip_ranges');
+ }
/**
* The locale set for this user..
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-11-22 14:29:03 UTC (rev 262)
+++ trunk/library/configs/db/patches.sql 2011-11-22 14:29:43 UTC (rev 263)
@@ -324,4 +324,7 @@
-- PATCH: Log failed logins
INSERT INTO `gems__log_actions` (`glac_id_action`, `glac_name`, `glac_change`, `glac_log`, `glac_created`)
- VALUES (NULL , 'loginFail', '0', '1', CURRENT_TIMESTAMP);
\ No newline at end of file
+ VALUES (NULL , 'loginFail', '0', '1', CURRENT_TIMESTAMP);
+
+-- PATCH: IP ranges for groups
+ALTER TABLE `gems__groups` ADD `ggp_allowed_ip_ranges` TEXT CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER `ggp_respondent_members`;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|