You can subscribe to this list here.
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(84) |
Oct
(70) |
Nov
(164) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(52) |
Feb
(77) |
Mar
(70) |
Apr
(58) |
May
(81) |
Jun
(74) |
Jul
(87) |
Aug
(30) |
Sep
(45) |
Oct
(37) |
Nov
(51) |
Dec
(31) |
2013 |
Jan
(47) |
Feb
(29) |
Mar
(40) |
Apr
(33) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <gem...@li...> - 2012-11-22 12:00:09
|
Revision: 1032 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1032&view=rev Author: mennodekker Date: 2012-11-22 11:59:58 +0000 (Thu, 22 Nov 2012) Log Message: ----------- Disabled debug statement Modified Paths: -------------- branches/receptioncodes/library/classes/Gems/Default/SurveyAction.php Modified: branches/receptioncodes/library/classes/Gems/Default/SurveyAction.php =================================================================== --- branches/receptioncodes/library/classes/Gems/Default/SurveyAction.php 2012-11-22 11:39:50 UTC (rev 1031) +++ branches/receptioncodes/library/classes/Gems/Default/SurveyAction.php 2012-11-22 11:59:58 UTC (rev 1032) @@ -151,7 +151,7 @@ if ($result) { $this->html->h3(sprintf($this->_('Assignments of this survey to %s: %s'), $respId, $this->getRespondentName())); - MUtil_Echo::track($result); + // MUtil_Echo::track($result); // Make sure request cache object is loaded. $this->getCachedRequestData(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-22 11:40:00
|
Revision: 1031 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1031&view=rev Author: mennodekker Date: 2012-11-22 11:39:50 +0000 (Thu, 22 Nov 2012) Log Message: ----------- Moved receptioncode from util to tracker Modified Paths: -------------- branches/receptioncodes/library/classes/Gems/Tracker/RespondentTrack.php branches/receptioncodes/library/classes/Gems/Tracker/Token.php branches/receptioncodes/library/classes/Gems/Tracker.php branches/receptioncodes/library/classes/Gems/Util.php Added Paths: ----------- branches/receptioncodes/library/classes/Gems/Tracker/ReceptionCode.php Removed Paths: ------------- branches/receptioncodes/library/classes/Gems/Util/ReceptionCode.php Copied: branches/receptioncodes/library/classes/Gems/Tracker/ReceptionCode.php (from rev 1030, branches/receptioncodes/library/classes/Gems/Util/ReceptionCode.php) =================================================================== --- branches/receptioncodes/library/classes/Gems/Tracker/ReceptionCode.php (rev 0) +++ branches/receptioncodes/library/classes/Gems/Tracker/ReceptionCode.php 2012-11-22 11:39:50 UTC (rev 1031) @@ -0,0 +1,202 @@ +<?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 Util + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ + */ + +/** + * Utility function for the user of reception codes. + * + * @package Gems + * @subpackage Util + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5 + */ +class Gems_Tracker_ReceptionCode extends Gems_Registry_CachedArrayTargetAbstract +{ + /** + * Variable to add tags to the cache for cleanup. + * + * @var array + */ + protected $_cacheTags = array('reception_code'); + + /** + * + * @var Zend_Db_Adapter_Abstract + */ + protected $db; + + /** + * Compatibility mode, for use with logical operators returns this->getCode() + * + * @return string + */ + public function __toString() + { + return $this->getCode(); + } + + /** + * Returns the complete record. + * + * @return array + */ + public function getAllData() + { + return $this->_data; + } + + /** + * The reception code. + * + * @return string + */ + public function getCode() + { + return $this->_id; + } + + /** + * + * @return boolean + */ + public function getDescription() + { + return $this->_get('grc_description'); + } + + /** + * + * @return boolean + */ + public function hasDescription() + { + return (boolean) $this->_get('grc_description'); + } + + /** + * + * @return boolean + */ + public function hasRedoCode() + { + return (boolean) $this->_get('grc_redo_survey'); + } + + /** + * True if the reception code is a redo survey copy. + * + * @return boolean + */ + public function hasRedoCopyCode() + { + return Gems_Util_ReceptionCodeLibrary::REDO_COPY == $this->_get('grc_redo_survey'); + } + + /** + * Is this code for respondent use? + * + * @return boolean + */ + public function isForRespondents() + { + return (boolean) $this->_get('grc_for_respondents'); + } + + /** + * Is this code for track use? + * + * @return boolean + */ + public function isForTracks() + { + return (boolean) $this->_get('grc_for_tracks'); + } + + /** + * Is this code for survey use? + * + * @return boolean + */ + public function isForSurveys() + { + return $this->_get('grc_for_surveys') > Gems_Util_ReceptionCodeLibrary::APPLY_NOT; + } + + /** + * Does this code overwrite set values? + * + * @return boolean + */ + public function isOverwriter() + { + return (boolean) $this->_get('grc_overwrite_answers'); + } + + /** + * Is this code a survey stop code. + * + * Then do not apply it to the track or respondent, but do apply it to the tokens. + * + * @return boolean + */ + public function isStopCode() + { + // MUtil_Echo::track($this->_data); + return $this->_get('grc_for_surveys') === Gems_Util_ReceptionCodeLibrary::APPLY_STOP; + } + + /** + * Is this code a success code. + * + * @return boolean + */ + public function isSuccess() + { + return (boolean) $this->_get('grc_success'); + } + + /** + * Load the data when the cache is empty. + * + * @param mixed $id + * @return array The array of data values + */ + protected function loadData($id) + { + $sql = "SELECT * FROM gems__reception_codes WHERE grc_id_reception_code = ? LIMIT 1"; + return $this->db->fetchRow($sql, $id); + } +} Modified: branches/receptioncodes/library/classes/Gems/Tracker/RespondentTrack.php =================================================================== --- branches/receptioncodes/library/classes/Gems/Tracker/RespondentTrack.php 2012-11-22 11:19:31 UTC (rev 1030) +++ branches/receptioncodes/library/classes/Gems/Tracker/RespondentTrack.php 2012-11-22 11:39:50 UTC (rev 1031) @@ -732,15 +732,15 @@ * Set the reception code for this respondent track and make sure the * necessary cascade to the tokens and thus the source takes place. * - * @param string $code The new (non-success) reception code or a Gems_Util_ReceptionCode object + * @param string $code The new (non-success) reception code or a Gems_Tracker_ReceptionCode object * @param string $comment Comment for tokens. False values leave value unchanged * @param int $userId The current user * @return int 1 if the token has changed, 0 otherwise */ public function setReceptionCode($code, $comment, $userId) { - // Make sure it is a Gems_Util_ReceptionCode object - if (! $code instanceof Gems_Util_ReceptionCode) { + // Make sure it is a Gems_Tracker_ReceptionCode object + if (! $code instanceof Gems_Tracker_ReceptionCode) { $code = $this->util->getReceptionCode($code); } $changed = 0; Modified: branches/receptioncodes/library/classes/Gems/Tracker/Token.php =================================================================== --- branches/receptioncodes/library/classes/Gems/Tracker/Token.php 2012-11-22 11:19:31 UTC (rev 1030) +++ branches/receptioncodes/library/classes/Gems/Tracker/Token.php 2012-11-22 11:39:50 UTC (rev 1031) @@ -842,13 +842,13 @@ } /** - * Return the Gems_Util_ReceptionCode object + * Return the Gems_Tracker_ReceptionCode object * - * @return Gems_Util_ReceptionCode reception code + * @return Gems_Tracker_ReceptionCode reception code */ public function getReceptionCode() { - return $this->util->getReceptionCode($this->_gemsData['gto_reception_code']); + return $this->tracker->getReceptionCode($this->_gemsData['gto_reception_code']); } /** @@ -1402,15 +1402,15 @@ * Set the reception code for this token and make sure the necessary * cascade to the source takes place. * - * @param string $code The new (non-success) reception code or a Gems_Util_ReceptionCode object + * @param string $code The new (non-success) reception code or a Gems_Tracker_ReceptionCode object * @param string $comment Comment False values leave value unchanged * @param int $userId The current user * @return int 1 if the token has changed, 0 otherwise */ public function setReceptionCode($code, $comment, $userId) { - // Make sure it is a Gems_Util_ReceptionCode object - if (! $code instanceof Gems_Util_ReceptionCode) { + // Make sure it is a Gems_Tracker_ReceptionCode object + if (! $code instanceof Gems_Tracker_ReceptionCode) { $code = $this->util->getReceptionCode($code); } Modified: branches/receptioncodes/library/classes/Gems/Tracker.php =================================================================== --- branches/receptioncodes/library/classes/Gems/Tracker.php 2012-11-22 11:19:31 UTC (rev 1030) +++ branches/receptioncodes/library/classes/Gems/Tracker.php 2012-11-22 11:39:50 UTC (rev 1031) @@ -339,7 +339,24 @@ } /** + * Returns a single reception code object. * + * @param string $code + * @return Gems_Tracker_ReceptionCode + */ + public function getReceptionCode($code) + { + static $codes = array(); + + if (! isset($codes[$code])) { + $codes[$code] = $this->_loadClass('receptionCode', true, array($code)); + } + + return $codes[$code]; + } + + /** + * * @param mixed $respTrackData Track id or array containing trackdata * @return Gems_Tracker_RespondentTrack */ Deleted: branches/receptioncodes/library/classes/Gems/Util/ReceptionCode.php =================================================================== --- branches/receptioncodes/library/classes/Gems/Util/ReceptionCode.php 2012-11-22 11:19:31 UTC (rev 1030) +++ branches/receptioncodes/library/classes/Gems/Util/ReceptionCode.php 2012-11-22 11:39:50 UTC (rev 1031) @@ -1,202 +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 Util - * @author Matijs de Jong <mj...@ma...> - * @copyright Copyright (c) 2011 Erasmus MC - * @license New BSD License - * @version $Id$ - */ - -/** - * Utility function for the user of reception codes. - * - * @package Gems - * @subpackage Util - * @copyright Copyright (c) 2011 Erasmus MC - * @license New BSD License - * @since Class available since version 1.5 - */ -class Gems_Util_ReceptionCode extends Gems_Registry_CachedArrayTargetAbstract -{ - /** - * Variable to add tags to the cache for cleanup. - * - * @var array - */ - protected $_cacheTags = array('reception_code'); - - /** - * - * @var Zend_Db_Adapter_Abstract - */ - protected $db; - - /** - * Compatibility mode, for use with logical operators returns this->getCode() - * - * @return string - */ - public function __toString() - { - return $this->getCode(); - } - - /** - * Returns the complete record. - * - * @return array - */ - public function getAllData() - { - return $this->_data; - } - - /** - * The reception code. - * - * @return string - */ - public function getCode() - { - return $this->_id; - } - - /** - * - * @return boolean - */ - public function getDescription() - { - return $this->_get('grc_description'); - } - - /** - * - * @return boolean - */ - public function hasDescription() - { - return (boolean) $this->_get('grc_description'); - } - - /** - * - * @return boolean - */ - public function hasRedoCode() - { - return (boolean) $this->_get('grc_redo_survey'); - } - - /** - * True if the reception code is a redo survey copy. - * - * @return boolean - */ - public function hasRedoCopyCode() - { - return Gems_Util_ReceptionCodeLibrary::REDO_COPY == $this->_get('grc_redo_survey'); - } - - /** - * Is this code for respondent use? - * - * @return boolean - */ - public function isForRespondents() - { - return (boolean) $this->_get('grc_for_respondents'); - } - - /** - * Is this code for track use? - * - * @return boolean - */ - public function isForTracks() - { - return (boolean) $this->_get('grc_for_tracks'); - } - - /** - * Is this code for survey use? - * - * @return boolean - */ - public function isForSurveys() - { - return $this->_get('grc_for_surveys') > Gems_Util_ReceptionCodeLibrary::APPLY_NOT; - } - - /** - * Does this code overwrite set values? - * - * @return boolean - */ - public function isOverwriter() - { - return (boolean) $this->_get('grc_overwrite_answers'); - } - - /** - * Is this code a survey stop code. - * - * Then do not apply it to the track or respondent, but do apply it to the tokens. - * - * @return boolean - */ - public function isStopCode() - { - // MUtil_Echo::track($this->_data); - return $this->_get('grc_for_surveys') === Gems_Util_ReceptionCodeLibrary::APPLY_STOP; - } - - /** - * Is this code a success code. - * - * @return boolean - */ - public function isSuccess() - { - return (boolean) $this->_get('grc_success'); - } - - /** - * Load the data when the cache is empty. - * - * @param mixed $id - * @return array The array of data values - */ - protected function loadData($id) - { - $sql = "SELECT * FROM gems__reception_codes WHERE grc_id_reception_code = ? LIMIT 1"; - return $this->db->fetchRow($sql, $id); - } -} Modified: branches/receptioncodes/library/classes/Gems/Util.php =================================================================== --- branches/receptioncodes/library/classes/Gems/Util.php 2012-11-22 11:19:31 UTC (rev 1030) +++ branches/receptioncodes/library/classes/Gems/Util.php 2012-11-22 11:39:50 UTC (rev 1031) @@ -239,17 +239,15 @@ * Returns a single reception code object. * * @param string $code - * @return Gems_Util_ReceptionCode + * @deprecated since 1.6 + * @return Gems_Tracker_ReceptionCode */ public function getReceptionCode($code) { - static $codes = array(); - - if (! isset($codes[$code])) { - $codes[$code] = $this->_loadClass('receptionCode', true, array($code)); - } - - return $codes[$code]; + MUtil_Echo::track('Using util->getReceptionCode please update to tracker->getReceptionCode'); + + // Forward to the right place + return GemsEscort::getInstance()->getLoader()->getTracker()->getReceptionCode($code); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-22 11:19:42
|
Revision: 1030 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1030&view=rev Author: mennodekker Date: 2012-11-22 11:19:31 +0000 (Thu, 22 Nov 2012) Log Message: ----------- doc fixes Modified Paths: -------------- trunk/library/classes/Gems/Snippets/Export/SurveyHeaderSnippet.php trunk/library/classes/Gems/Tracker/Survey.php Modified: trunk/library/classes/Gems/Snippets/Export/SurveyHeaderSnippet.php =================================================================== --- trunk/library/classes/Gems/Snippets/Export/SurveyHeaderSnippet.php 2012-11-22 11:17:29 UTC (rev 1029) +++ trunk/library/classes/Gems/Snippets/Export/SurveyHeaderSnippet.php 2012-11-22 11:19:31 UTC (rev 1030) @@ -39,7 +39,7 @@ * @subpackage Snippets * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @since Class available since version 1.6 + * @since Class available since version 1.5.6 */ class Gems_Snippets_Export_SurveyHeaderSnippet extends MUtil_Snippets_SnippetAbstract { Modified: trunk/library/classes/Gems/Tracker/Survey.php =================================================================== --- trunk/library/classes/Gems/Tracker/Survey.php 2012-11-22 11:17:29 UTC (rev 1029) +++ trunk/library/classes/Gems/Tracker/Survey.php 2012-11-22 11:19:31 UTC (rev 1030) @@ -111,7 +111,7 @@ } /** - * Makes sure the receptioncode data is part of the $this->_gemsData + * Makes sure the group data is part of the $this->_gemsSurvey * * @param boolean $reload Optional parameter to force reload. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-22 11:17:40
|
Revision: 1029 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1029&view=rev Author: mennodekker Date: 2012-11-22 11:17:29 +0000 (Thu, 22 Nov 2012) Log Message: ----------- initial setup Modified Paths: -------------- branches/receptioncodes/library/classes/Gems/Events.php Added Paths: ----------- branches/receptioncodes/library/classes/Gems/Event/ReceptionCode/ branches/receptioncodes/library/classes/Gems/Event/ReceptionCodeEventInterface.php Added: branches/receptioncodes/library/classes/Gems/Event/ReceptionCodeEventInterface.php =================================================================== --- branches/receptioncodes/library/classes/Gems/Event/ReceptionCodeEventInterface.php (rev 0) +++ branches/receptioncodes/library/classes/Gems/Event/ReceptionCodeEventInterface.php 2012-11-22 11:17:29 UTC (rev 1029) @@ -0,0 +1,51 @@ +<?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 Event + * @author Menno Dekker <men...@er...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: RoundChangedEventInterface.php 59 2011-09-22 07:23:44Z mennodekker $ + */ + +/** + * When settings a receptioncode this code runs + * + * The code should take care of delegation to other objects + * + * @package Gems + * @subpackage Event + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.6 + */ +class Gems_Event_ReceptionCodeEventInterface extends Gems_Event_EventInterface +{ + public function setReceptionCode($object, $receptionCode, $comment, $userId); +} \ No newline at end of file Modified: branches/receptioncodes/library/classes/Gems/Events.php =================================================================== --- branches/receptioncodes/library/classes/Gems/Events.php 2012-11-22 11:11:40 UTC (rev 1028) +++ branches/receptioncodes/library/classes/Gems/Events.php 2012-11-22 11:17:29 UTC (rev 1029) @@ -48,11 +48,12 @@ { const EVENTS_DIR = 'Event'; - const TRACK_COMPLETION_EVENT = 'Track/Completed'; + const RECEPTIONCODE_EVENT = 'ReceptionCode'; const ROUND_CHANGED_EVENT = 'Round/Changed'; const SURVEY_BEFORE_ANSWERING_EVENT = 'Survey/BeforeAnswering'; const SURVEY_COMPLETION_EVENT = 'Survey/Completed'; const SURVEY_DISPLAY_EVENT = 'Survey/Display'; + const TRACK_COMPLETION_EVENT = 'Track/Completed'; /** * Each event type must implement an event class or interface derived @@ -63,11 +64,12 @@ * @var array containing eventType => eventClass for all event classes */ protected $_eventClasses = array( - self::TRACK_COMPLETION_EVENT => 'Gems_Event_TrackCompletedEventInterface', + self::RECEPTIONCODE_EVENT => 'Gems_Event_ReceptionCodeEventInterface', self::ROUND_CHANGED_EVENT => 'Gems_Event_RoundChangedEventInterface', self::SURVEY_BEFORE_ANSWERING_EVENT => 'Gems_Event_SurveyBeforeAnsweringEventInterface', self::SURVEY_COMPLETION_EVENT => 'Gems_Event_SurveyCompletedEventInterface', self::SURVEY_DISPLAY_EVENT => 'Gems_Event_SurveyDisplayEventInterface', + self::TRACK_COMPLETION_EVENT => 'Gems_Event_TrackCompletedEventInterface' ); /** @@ -204,6 +206,15 @@ return $event; } + + /** + * + * @return array eventname => string + */ + public function listReceptionCodeEvents() + { + return $this->_listEvents(self::RECEPTIONCODE_EVENT); + } /** * @@ -249,10 +260,20 @@ { return $this->_listEvents(self::TRACK_COMPLETION_EVENT); } - + /** * * @param string $eventName + * @return Gems_Event_ReceptionCodeEventInterface + */ + public function loadReceptionCodeEvent($eventName) + { + return $this->_loadEvent($eventName, self::RECEPTIONCODE_EVENT); + } + + /** + * + * @param string $eventName * @return Gems_Event_RoundChangedEventInterface */ public function loadRoundChangedEvent($eventName) @@ -300,4 +321,4 @@ { return $this->_loadEvent($eventName, self::TRACK_COMPLETION_EVENT); } -} +} \ 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...> - 2012-11-22 11:11:51
|
Revision: 1028 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1028&view=rev Author: mennodekker Date: 2012-11-22 11:11:40 +0000 (Thu, 22 Nov 2012) Log Message: ----------- Start work on receptioncodes in a separate branch Added Paths: ----------- branches/receptioncodes/ Property changes on: branches/receptioncodes ___________________________________________________________________ Added: svn:ignore + nbproject Added: svn:mergeinfo + /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472,475-481 /tags/1.5.0beta1:305 /tags/1.5.1:485,489,509-510 /tags/1.5.3-rc2:612,614,616,618 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-21 19:09:39
|
Revision: 1027 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1027&view=rev Author: matijsdejong Date: 2012-11-21 19:09:32 +0000 (Wed, 21 Nov 2012) Log Message: ----------- tokenanswerspersistence is now required in LimeSurvey surveys Removed debugging code from DatabaseModelAbstract.php Modified Paths: -------------- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-11-21 16:03:11 UTC (rev 1026) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-11-21 19:09:32 UTC (rev 1027) @@ -380,7 +380,7 @@ // SELECT sid, surveyls_title AS short_title, surveyls_description AS description, active, datestamp, ' . $this->_anonymizedField . ' $select = $lsDb->select(); - $select->from($this->_getSurveysTableName(), array('active', 'datestamp', $this->_anonymizedField)) + $select->from($this->_getSurveysTableName(), array('active', 'datestamp', 'tokenanswerspersistence', $this->_anonymizedField)) ->joinInner( $this->_getSurveyLanguagesTableName(), 'sid = surveyls_survey_id AND language = surveyls_language', @@ -414,6 +414,11 @@ $surveyor_status .= 'Not date stamped. '; } + // DATESTAMP + if ($lsSurvey['tokenanswerspersistence'] == 'N') { + $surveyor_status .= 'Token-based persistence is disabled. '; + } + // IS ACTIVE if ($lsSurvey['active'] == 'Y') { $surveyor_active = true; Modified: trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2012-11-21 16:03:11 UTC (rev 1026) +++ trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2012-11-21 19:09:32 UTC (rev 1027) @@ -477,7 +477,7 @@ // Check for actual values for this table to save. // MUtil_Echo::track($newValues); if ($returnValues = $this->_filterDataFor($table_name, $newValues, ! $update)) { - if (true || MUtil_Model::$verbose) { + if (MUtil_Model::$verbose) { MUtil_Echo::r($returnValues, 'Return'); } // MUtil_Echo::track($returnValues); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-21 16:03:18
|
Revision: 1026 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1026&view=rev Author: matijsdejong Date: 2012-11-21 16:03:11 +0000 (Wed, 21 Nov 2012) Log Message: ----------- Added new standard APPLICATION_ENV "demo" next to "production", "testing" and "development" Modified Paths: -------------- trunk/library/classes/Gems/Versions.php Modified: trunk/library/classes/Gems/Versions.php =================================================================== --- trunk/library/classes/Gems/Versions.php 2012-11-21 16:02:59 UTC (rev 1025) +++ trunk/library/classes/Gems/Versions.php 2012-11-21 16:03:11 UTC (rev 1026) @@ -93,7 +93,7 @@ { $version = $this->getProjectVersion(); - if (APPLICATION_ENV !== 'production') { + if (APPLICATION_ENV !== 'production' && APPLICATION_ENV !== 'demo') { $version .= '.' . $this->getBuild() . ' [' . APPLICATION_ENV . ']'; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-21 16:03:10
|
Revision: 1025 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1025&view=rev Author: matijsdejong Date: 2012-11-21 16:02:59 +0000 (Wed, 21 Nov 2012) Log Message: ----------- Added new standard APPLICATION_ENV "demo" next to "production", "testing" and "development" Modified Paths: -------------- trunk/new_project/application/configs/application.ini trunk/new_project/application/configs/project.ini Modified: trunk/new_project/application/configs/application.ini =================================================================== --- trunk/new_project/application/configs/application.ini 2012-11-21 15:10:31 UTC (rev 1024) +++ trunk/new_project/application/configs/application.ini 2012-11-21 16:02:59 UTC (rev 1025) @@ -25,6 +25,8 @@ phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 +[demo : production] + [development : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 Modified: trunk/new_project/application/configs/project.ini =================================================================== --- trunk/new_project/application/configs/project.ini 2012-11-21 15:10:31 UTC (rev 1024) +++ trunk/new_project/application/configs/project.ini 2012-11-21 16:02:59 UTC (rev 1025) @@ -10,7 +10,7 @@ ; Put %s somewhere within the salt to mix the value ; in the salt. ;--------------------------------------------------- -salt = +salt = ;---------------------------------------------------------- ; The non database super user @@ -318,6 +318,12 @@ email.bounce = 1 +[demo : production] +admin.user = superadmin +admin.pwd = superadmin + +email.bounce = 1 + [development : production] cache = "none" admin.user = superadmin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-21 15:10:42
|
Revision: 1024 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1024&view=rev Author: matijsdejong Date: 2012-11-21 15:10:31 +0000 (Wed, 21 Nov 2012) Log Message: ----------- When there are no answers the answer headers are shown in OnlyAnswered.php FixBugfixes in maintenance actions Modified Paths: -------------- trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php trunk/library/classes/Gems/Default/TrackMaintenanceAction.php trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php trunk/library/classes/Gems/Event/SurveyAnswerFilterAbstract.php Modified: trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php =================================================================== --- trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2012-11-16 16:47:15 UTC (rev 1023) +++ trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2012-11-21 15:10:31 UTC (rev 1024) @@ -248,7 +248,7 @@ */ public function afterSave(array $data, $isNew) { - $this->cache->clean('matchTags', array('surveys', 'tracks')); + $this->cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('surveys', 'tracks')); return true; } Modified: trunk/library/classes/Gems/Default/TrackMaintenanceAction.php =================================================================== --- trunk/library/classes/Gems/Default/TrackMaintenanceAction.php 2012-11-16 16:47:15 UTC (rev 1023) +++ trunk/library/classes/Gems/Default/TrackMaintenanceAction.php 2012-11-21 15:10:31 UTC (rev 1024) @@ -161,7 +161,7 @@ */ public function afterSave(array $data, $isNew) { - $this->cache->clean('matchTags', array('surveys', 'tracks')); + $this->cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('surveys', 'tracks')); return true; } Modified: trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php =================================================================== --- trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php 2012-11-16 16:47:15 UTC (rev 1023) +++ trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php 2012-11-21 15:10:31 UTC (rev 1024) @@ -74,10 +74,16 @@ $keys += array_filter($row->getArrayCopy()); } - $results = array_intersect($currentNames, array_keys($keys)); + $results = array_intersect($currentNames, array_keys($keys), array_keys($this->token->getRawAnswers())); // MUtil_Echo::track($results); - return $this->restoreHeaderPositions($model, $results); + $results = $this->restoreHeaderPositions($model, $results); + + if ($results) { + return $results; + } + + return $this->getHeaders($model, $currentNames); } /** Modified: trunk/library/classes/Gems/Event/SurveyAnswerFilterAbstract.php =================================================================== --- trunk/library/classes/Gems/Event/SurveyAnswerFilterAbstract.php 2012-11-16 16:47:15 UTC (rev 1023) +++ trunk/library/classes/Gems/Event/SurveyAnswerFilterAbstract.php 2012-11-21 15:10:31 UTC (rev 1024) @@ -87,6 +87,30 @@ // public function getEventName() /** + * Returns only the headers + * + * @param MUtil_Model_ModelAbstract $model + * @param array $currentNames The current names in use (allows chaining) + * @return array Of the names of labels that should be shown + */ + protected function getHeaders(MUtil_Model_ModelAbstract $model, array $currentNames) + { + $lastParent = null; + $results = array(); + foreach ($currentNames as $name) { + if ($model->is($name, 'type', MUtil_Model::TYPE_NOVALUE)) { + $results[$name] = $name; + + } elseif ($parent = $model->get($name, 'parent_question')) { + // Insert parent header on name if it was not shown before + $results[$parent] = $parent; + } + } + + return $results; + } + + /** * Restores the header position of question before their corresponding question_sub * * When sub-questions with the same parent are shown continuous the parent is shown This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-16 16:47:21
|
Revision: 1023 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1023&view=rev Author: matijsdejong Date: 2012-11-16 16:47:15 +0000 (Fri, 16 Nov 2012) Log Message: ----------- Made background transparent Modified Paths: -------------- trunk/new_project/htdocs/gems/images/info.png Modified: trunk/new_project/htdocs/gems/images/info.png =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-16 16:47:12
|
Revision: 1022 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1022&view=rev Author: matijsdejong Date: 2012-11-16 16:47:05 +0000 (Fri, 16 Nov 2012) Log Message: ----------- Moved AddTrack storage to cache and clear the cache after Track or Survey update Modified Paths: -------------- trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php trunk/library/classes/Gems/Default/TrackMaintenanceAction.php trunk/library/snippets/AddTracksSnippet.php Modified: trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php =================================================================== --- trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2012-11-16 11:12:14 UTC (rev 1021) +++ trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2012-11-16 16:47:05 UTC (rev 1022) @@ -48,6 +48,12 @@ { public $autoFilter = true; + /** + * + * @var Zend_Cache_Core + */ + public $cache; + public $menuEditIncludeLevel = 100; public $menuShowIncludeLevel = 100; @@ -232,7 +238,23 @@ } /** + * Hook to perform action after a record (with changes) was saved * + * As the data was already saved, it can NOT be changed anymore + * + * @param array $data + * @param boolean $isNew + * @return boolean True when you want to display the default 'saved' messages + */ + public function afterSave(array $data, $isNew) + { + $this->cache->clean('matchTags', array('surveys', 'tracks')); + + return true; + } + + /** + * * @param array $data The data that will be saved. * @param boolean $isNew * $param Zend_Form $form Modified: trunk/library/classes/Gems/Default/TrackMaintenanceAction.php =================================================================== --- trunk/library/classes/Gems/Default/TrackMaintenanceAction.php 2012-11-16 11:12:14 UTC (rev 1021) +++ trunk/library/classes/Gems/Default/TrackMaintenanceAction.php 2012-11-16 16:47:05 UTC (rev 1022) @@ -52,6 +52,12 @@ */ protected $browseMode; + /** + * + * @var Zend_Cache_Core + */ + public $cache; + public $sortKey = array('gtr_track_name' => SORT_ASC); public $summarizedActions = array('index', 'autofilter', 'check-all'); @@ -145,7 +151,23 @@ } /** + * Hook to perform action after a record (with changes) was saved * + * As the data was already saved, it can NOT be changed anymore + * + * @param array $data + * @param boolean $isNew + * @return boolean True when you want to display the default 'saved' messages + */ + public function afterSave(array $data, $isNew) + { + $this->cache->clean('matchTags', array('surveys', 'tracks')); + + return true; + } + + /** + * * @param array $data The data that will be saved. * @param boolean $isNew * $param Zend_Form $form Modified: trunk/library/snippets/AddTracksSnippet.php =================================================================== --- trunk/library/snippets/AddTracksSnippet.php 2012-11-16 11:12:14 UTC (rev 1021) +++ trunk/library/snippets/AddTracksSnippet.php 2012-11-16 16:47:05 UTC (rev 1022) @@ -55,6 +55,12 @@ { /** * + * @var Zend_Cache_Core + */ + protected $cache; + + /** + * * @var Zend_Db_Adapter_Abstract */ public $db; @@ -85,12 +91,6 @@ protected $request; /** - * - * @var Zend_Session - */ - public $session; - - /** * Switch to set display of respondent dropdown on or off * * @var mixed When string, string is used for display, when false, nothing is displayed @@ -137,13 +137,11 @@ throw new exception('Invalid track type requested.'); } - $organization_id = intval($this->request->getParam(MUtil_Model::REQUEST_ID2)); - $trackTypeCache = $trackType . '_' . $organization_id; - $trackTypeTime = $trackType . '_time'; + $orgId = intval($this->request->getParam(MUtil_Model::REQUEST_ID2)); + $cacheId = __CLASS__ . '_' . $trackType . '_' . $orgId; + $tracks = $this->cache->load($cacheId); - if (isset($this->session->$trackTypeCache, $this->session->$trackTypeTime) && (time() < $this->session->$trackTypeTime)) { - $tracks = $this->session->$trackTypeCache; - } else { + if (! $tracks) { switch ($trackType) { case 'T': $sql = "SELECT gtr_id_track, gtr_track_name @@ -152,7 +150,7 @@ (gtr_date_until IS NULL OR gtr_date_until > CURRENT_TIMESTAMP) AND gtr_active = 1 AND gtr_track_type = 'T' AND - gtr_organizations LIKE '%|$organization_id|%' + gtr_organizations LIKE '%|$orgId|%' ORDER BY gtr_track_name"; break; case 'S': @@ -166,7 +164,7 @@ gtr_active = 1 AND gtr_track_type = 'S' AND ggp_respondent_members = 1 AND - gtr_organizations LIKE '%|$organization_id|%' + gtr_organizations LIKE '%|$orgId|%' ORDER BY gtr_track_name"; break; case 'M': @@ -180,7 +178,7 @@ gtr_active = 1 AND gtr_track_type = 'S' AND ggp_respondent_members = 0 AND - gtr_organizations LIKE '%|$organization_id|%' + gtr_organizations LIKE '%|$orgId|%' ORDER BY gtr_track_name"; break; // default: @@ -188,8 +186,7 @@ } $tracks = $this->db->fetchPairs($sql); - $this->session->$trackTypeCache = $tracks; - $this->session->$trackTypeTime = time() + 600; + $this->cache->save($tracks, $cacheId, array('surveys', 'tracks')); } $div = MUtil_Html::create()->div(array('class' => 'toolbox')); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-16 11:12:21
|
Revision: 1021 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1021&view=rev Author: roelfaber Date: 2012-11-16 11:12:14 +0000 (Fri, 16 Nov 2012) Log Message: ----------- minor - comment line adjustment Modified Paths: -------------- trunk/new_project/htdocs/index.php Modified: trunk/new_project/htdocs/index.php =================================================================== --- trunk/new_project/htdocs/index.php 2012-11-15 17:47:56 UTC (rev 1020) +++ trunk/new_project/htdocs/index.php 2012-11-16 11:12:14 UTC (rev 1021) @@ -51,7 +51,7 @@ define('GEMS_ROOT_DIR', realpath(GEMS_WEB_DIR . '/../')); define('GEMS_LIBRARY_DIR', realpath(GEMS_ROOT_DIR . '/library/Gems')); -// Pretty project name +// Internal pretty project name - no spaces etc., will be used for tags and IDs! define('GEMS_PROJECT_NAME', 'newProject'); defined('GEMS_PROJECT_NAME_UC') || define('GEMS_PROJECT_NAME_UC', ucfirst(GEMS_PROJECT_NAME)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-15 17:48:03
|
Revision: 1020 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1020&view=rev Author: matijsdejong Date: 2012-11-15 17:47:56 +0000 (Thu, 15 Nov 2012) Log Message: ----------- Fix for always getting last set of answers Fix for new Databasemodel save options Modified Paths: -------------- trunk/library/classes/Gems/Tracker/Model/SingleSurveyTokenModel.php trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php trunk/library/classes/MUtil/Model/TableModel.php Modified: trunk/library/classes/Gems/Tracker/Model/SingleSurveyTokenModel.php =================================================================== --- trunk/library/classes/Gems/Tracker/Model/SingleSurveyTokenModel.php 2012-11-15 16:18:58 UTC (rev 1019) +++ trunk/library/classes/Gems/Tracker/Model/SingleSurveyTokenModel.php 2012-11-15 17:47:56 UTC (rev 1020) @@ -83,7 +83,8 @@ * @param array $oldKeys The original keys as they where before the changes * @return array The values for this table as they were updated */ - protected function _saveTableData(Zend_Db_Table_Abstract $table, array $newValues, array $oldKeys = null) + protected function _saveTableData(Zend_Db_Table_Abstract $table, array $newValues, + array $oldKeys = null, $saveMode = self::SAVE_MODE_ALL) { $table_name = $this->_getTableName($table); @@ -98,7 +99,7 @@ return $tokenData; } else { - return parent::_saveTableData($table, $newValues, $oldKeys); + return parent::_saveTableData($table, $newValues, $oldKeys, $saveMode); } } Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-11-15 16:18:58 UTC (rev 1019) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-11-15 17:47:56 UTC (rev 1020) @@ -791,7 +791,9 @@ $token = $this->_getToken($tokenId); try { - $values = $lsDb->fetchRow("SELECT * FROM $lsTab WHERE token = ?", $token); + // Order by ID desc to get the same answers used as in the row retrieved by + // getRawTokenAnswerRows() in case of double rows + $values = $lsDb->fetchRow("SELECT * FROM $lsTab WHERE token = ? ORDER BY id DESC", $token); } catch (Zend_Db_Statement_Exception $exception) { $this->logger->logError($exception, $this->request); $values = false; @@ -874,16 +876,17 @@ // this way other sources that don't perform changes on the token field don't have to loop // over this field. The survey(answer)model could possibly perform the translation for this source if ($rows) { + $map = $this->_getFieldMap($sourceSurveyId); if (isset($filter[$tokenField])) { foreach ($rows as $values) { $token = $originals[$values['token']]; - $results[$token] = $this->_getFieldMap($sourceSurveyId)->mapKeysToTitles($values); + $results[$token] = $map->mapKeysToTitles($values); } return $results; } else { //@@TODO If we do the mapping in the select statement, maybe we can gain some performance here foreach ($rows as $values) { - $results[] = $this->_getFieldMap($sourceSurveyId)->mapKeysToTitles($values); + $results[] = $map->mapKeysToTitles($values); } return $results; } @@ -1052,9 +1055,13 @@ $lsTab = $this->_getSurveyTableName($sourceSurveyId); $lsTokenId = $this->_getToken($token->getTokenId()); + // MUtil_Echo::track($answers); + $answers = $this->_getFieldMap($sourceSurveyId)->mapTitlesToKeys($answers); $answers = $this->_filterAnswersOnly($sourceSurveyId, $answers); + // MUtil_Echo::track($answers); + if ($lsDb->fetchOne("SELECT token FROM $lsTab WHERE token = ?", $lsTokenId)) { $where = $lsDb->quoteInto("token = ?", $lsTokenId); $lsDb->update($lsTab, $answers, $where); @@ -1067,7 +1074,6 @@ $answers['startdate'] = $current; $lsDb->insert($lsTab, $answers); - } } Modified: trunk/library/classes/MUtil/Model/TableModel.php =================================================================== --- trunk/library/classes/MUtil/Model/TableModel.php 2012-11-15 16:18:58 UTC (rev 1019) +++ trunk/library/classes/MUtil/Model/TableModel.php 2012-11-15 17:47:56 UTC (rev 1020) @@ -119,6 +119,6 @@ { // $this->_saveTableData returns the new row values, including any automatic changes. // add $newValues to throw nothing away. - return $this->_saveTableData($this->_table, $newValues, $filter) + $newValues; + return $this->_saveTableData($this->_table, $newValues, $filter, parent::SAVE_MODE_ALL) + $newValues; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-15 16:19:09
|
Revision: 1019 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1019&view=rev Author: matijsdejong Date: 2012-11-15 16:18:58 +0000 (Thu, 15 Nov 2012) Log Message: ----------- Token/ask is now token language and organization aware - when survey answered by respondents Modified Paths: -------------- trunk/library/classes/Gems/Default/AskAction.php Modified: trunk/library/classes/Gems/Default/AskAction.php =================================================================== --- trunk/library/classes/Gems/Default/AskAction.php 2012-11-15 15:37:03 UTC (rev 1018) +++ trunk/library/classes/Gems/Default/AskAction.php 2012-11-15 16:18:58 UTC (rev 1019) @@ -133,7 +133,7 @@ return false; } - if (! $this->loader->getCurrentUser()->isActive()) { + if (! ($this->loader->getCurrentUser()->isActive() || $this->token->getSurvey()->isTakenByStaff())) { $tokenLang = strtolower($this->token->getRespondentLanguage()); // MUtil_Echo::track($tokenLang, $this->locale->getLanguage()); if ($tokenLang != $this->locale->getLanguage()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-15 15:37:10
|
Revision: 1018 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1018&view=rev Author: matijsdejong Date: 2012-11-15 15:37:03 +0000 (Thu, 15 Nov 2012) Log Message: ----------- Token/ask is now token language and organization aware Modified Paths: -------------- trunk/library/classes/Gems/Default/AskAction.php trunk/library/classes/Gems/Tracker/RespondentTrack.php trunk/library/classes/Gems/Tracker/Token.php trunk/library/classes/MUtil/Controller/Action.php Modified: trunk/library/classes/Gems/Default/AskAction.php =================================================================== --- trunk/library/classes/Gems/Default/AskAction.php 2012-11-15 14:18:41 UTC (rev 1017) +++ trunk/library/classes/Gems/Default/AskAction.php 2012-11-15 15:37:03 UTC (rev 1018) @@ -65,6 +65,39 @@ protected $labelWidthFactor = 0.8; /** + * + * @var Zend_Locale + */ + public $locale; + + /** + * The current token ID + * + * set by _initToken() + * + * @var Gems_Tracker + */ + protected $tokenId; + + /** + * The current token + * + * set by _initToken() + * + * @var Gems_Tracker_Token + */ + protected $token; + + /** + * The tracker + * + * set by _initToken() + * + * @var Gems_Tracker + */ + protected $tracker; + + /** * Set to true in child class for automatic creation of $this->html. * * To initiate the use of $this->html from the code call $this->initHtml() @@ -77,6 +110,52 @@ public $useHtmlView = true; /** + * Common handler utility to initialize tokens from parameters + * + * @return boolean True if there is a real token specified in the request + */ + protected function _initToken() + { + if ($this->tracker) { + return $this->token && $this->token->exists; + } + + $this->tracker = $this->loader->getTracker(); + $this->tokenId = $this->tracker->filterToken($this->_getParam(MUtil_Model::REQUEST_ID)); + + if (! $this->tokenId) { + return false; + } + + $this->token = $this->tracker->getToken($this->tokenId); + + if (! $this->token->exists) { + return false; + } + + if (! $this->loader->getCurrentUser()->isActive()) { + $tokenLang = strtolower($this->token->getRespondentLanguage()); + // MUtil_Echo::track($tokenLang, $this->locale->getLanguage()); + if ($tokenLang != $this->locale->getLanguage()) { + $this->locale->setLocale($tokenLang); + $this->translate->getAdapter()->setLocale($this->locale); + $this->session->user_locale = $tokenLang; + Gems_Cookies::setLocale($tokenLang, $this->basepath->getBasePath()); + } + + $currentOrg = $this->loader->getOrganization(); + $tokenOrgId = $this->token->getOrganizationId(); + + if ($tokenOrgId != $currentOrg->getId()) { + $this->loader->getOrganization($tokenOrgId) + ->setAsCurrentOrganization(); + } + } + + return true; + } + + /** * Function for overruling the display of the login form. * * @param Gems_Tracker_Form_AskTokenForm $form @@ -113,40 +192,47 @@ * Find token * **************/ - if ($tokenId = $this->_getParam(MUtil_Model::REQUEST_ID)) { - $tracker = $this->loader->getTracker(); - $tokenId = $tracker->filterToken($tokenId); - $token = $tracker->getToken($tokenId); + if (! $this->_initToken()) { + if ($this->tokenId) { + // There is a token but is incorrect + $this->addMessage(sprintf( + $this->_('The token %s does not exist (any more).'), + strtoupper($this->tokenId) + )); + } + $this->_forward('index'); + return; + } - if ($token->exists) { + /**************************** + * Update open tokens first * + ****************************/ + $this->tracker->processCompletedTokens( + $this->token->getRespondentId(), + $this->token->getChangedBy(), + $this->token->getOrganizationId() + ); - /**************************** - * Update open tokens first * - ****************************/ - $respId = $token->getRespondentId(); - $tracker->processCompletedTokens($respId, $token->getChangedBy()); + // Display token when possible + if ($this->html->snippet($this->forwardSnippets, 'token', $this->token)) { + return; + } - // Display token when possible - if ($this->html->snippet($this->forwardSnippets, 'token', $token)) { - return; - } - - // Snippet had nothing to display, because of an answer - if ($this->getRequest()->getActionName() == 'return') { - $this->addMessage(sprintf($this->_('Thank you for answering. At the moment we have no further surveys for you to take.'), strtoupper($tokenId))); - } else { - $this->addMessage(sprintf($this->_('The survey for token %s has been answered and no further surveys are open.'), strtoupper($tokenId))); - } - - // Do not enter a loop!! Reroute! - $this->_reroute(array('controller' => 'ask', 'action' => 'index'), true); - - } else { - $this->addMessage(sprintf($this->_('The token %s does not exist (any more).'), strtoupper($tokenId))); - } + // Snippet had nothing to display, because of an answer + if ($this->getRequest()->getActionName() == 'return') { + $this->addMessage(sprintf( + $this->_('Thank you for answering. At the moment we have no further surveys for you to take.'), + strtoupper($this->tokenId) + )); + } else { + $this->addMessage(sprintf( + $this->_('The survey for token %s has been answered and no further surveys are open.'), + strtoupper($this->tokenId) + )); } - $this->_forward('index'); + // Do not enter a loop!! Reroute! + $this->_reroute(array('controller' => 'ask', 'action' => 'index'), true); } /** @@ -161,7 +247,10 @@ $request = $this->getRequest(); $tracker = $this->loader->getTracker(); - $form = $tracker->getAskTokenForm(array('displayOrder' => array('element', 'description', 'errors'), 'labelWidthFactor' => 0.8)); + $form = $tracker->getAskTokenForm(array( + 'displayOrder' => array('element', 'description', 'errors'), + 'labelWidthFactor' => 0.8 + )); if ($request->isPost() && $form->isValid($request->getParams())) { $this->_forward('forward'); @@ -173,58 +262,51 @@ } /** - * Common handler utility to initialize tokens from parameters - */ - protected function initToken() - { - $this->tracker = $this->loader->getTracker(); - $this->tokenId = $this->tracker->filterToken($this->_getParam(MUtil_Model::REQUEST_ID)); - $this->token = $this->tracker->getToken($this->tokenId); - } - - /** * The action where survey sources should return to after survey completion */ public function returnAction() { - $tracker = $this->loader->getTracker(); + if (! $this->_initToken()) { + // In all other cases: the action that generates meaningfull warnings and is reachable for everyone + $this->_forward('forward'); + return; + } - if ($tokenId = $this->_getParam(MUtil_Model::REQUEST_ID)) { - $tokenId = $tracker->filterToken($tokenId); - $token = $tracker->getToken($tokenId); + if ($url = $this->token->getReturnUrl()) { + // Check for completed tokens + $this->tracker->processCompletedTokens( + $this->token->getRespondentId(), + $this->token->getChangedBy(), + $this->token->getOrganizationId() + ); - if ($url = $token->getReturnUrl()) { - // Check for completed tokens - $this->loader->getTracker()->processCompletedTokens($token->getRespondentId(), $token->getChangedBy()); + // Redirect at once, might be another site url + header('Location: ' . $url); + exit(); + } - // Redirect at once, might be another site url - header('Location: ' . $url); - exit(); - } + // No return? Check for old style user based return + $user = $this->loader->getCurrentUser(); - // Nor return? Check for old style user based return - $user = $this->loader->getCurrentUser(); + if (! $user->isActive()) { + $this->_forward('forward'); + return; + } - if ($user->isActive() && ($parameters = $user->getSurveyReturn())) { + // Check for completed tokens + $this->tracker->processCompletedTokens($this->token->getRespondentId(), $user->getUserId()); - // Check for completed tokens - $this->loader->getTracker()->processCompletedTokens($token->getRespondentId(), $user->getUserId()); - - if (! $parameters) { - // Default - $request = $this->getRequest(); - $parameters[$request->getControllerKey()] = 'respondent'; - $parameters[$request->getActionKey()] = 'show'; - $parameters[MUtil_Model::REQUEST_ID] = $token->getPatientNumber(); - } - - $this->_reroute($parameters, true); - return; - } + // Get return route parameters + $parameters = $user->getSurveyReturn(); + if (! $parameters) { + // Default fallback for the fallback + $request = $this->getRequest(); + $parameters[$request->getControllerKey()] = 'respondent'; + $parameters[$request->getActionKey()] = 'show'; + $parameters[MUtil_Model::REQUEST_ID] = $this->token->getPatientNumber(); } - // In all other cases: the action that generates meaningfull warnings as is reachable for everyone - $this->_forward('forward'); + $this->_reroute($parameters, true); } /** @@ -248,34 +330,39 @@ */ public function toSurveyAction() { - $tracker = $this->loader->getTracker(); - if ($tokenId = $this->_getParam(MUtil_Model::REQUEST_ID)) { - $tokenId = $tracker->filterToken($tokenId); + if (! $this->_initToken()) { + // Default option + $this->_forward('index'); + } - if ($token = $tracker->getToken($tokenId)) { - $language = $this->locale->getLanguage(); - $user = $this->loader->getCurrentUser(); + $language = $this->locale->getLanguage(); + $user = $this->loader->getCurrentUser(); - try { - $url = $token->getUrl($language, $user->getUserId() ? $user->getUserId() : $token->getRespondentId()); + try { + $url = $this->token->getUrl( + $language, + $user->getUserId() ? $user->getUserId() : $this->token->getRespondentId() + ); - /************************ - * Optional user logout * - ************************/ - if ($user->isLogoutOnSurvey()) { - $user->unsetAsCurrentUser(); - } + /************************ + * Optional user logout * + ************************/ + if ($user->isLogoutOnSurvey()) { + $user->unsetAsCurrentUser(); + } - // Redirect at once - header('Location: ' . $url); - exit(); - } catch (Gems_Tracker_Source_SurveyNotFoundException $e) { - $this->addMessage(sprintf($this->_('The survey for token %s is no longer active.'), $tokenId)); - } - } + // Redirect at once + header('Location: ' . $url); + exit(); + + } catch (Gems_Tracker_Source_SurveyNotFoundException $e) { + $this->addMessage(sprintf( + $this->_('The survey for token %s is no longer active.'), + strtoupper($this->tokenId) + )); + + // Default option + $this->_forward('index'); } - - // Default option - $this->_forward('index'); } } Modified: trunk/library/classes/Gems/Tracker/RespondentTrack.php =================================================================== --- trunk/library/classes/Gems/Tracker/RespondentTrack.php 2012-11-15 14:18:41 UTC (rev 1017) +++ trunk/library/classes/Gems/Tracker/RespondentTrack.php 2012-11-15 15:37:03 UTC (rev 1018) @@ -94,6 +94,12 @@ /** * + * @var Zend_Locale + */ + protected $locale; + + /** + * * @var Gems_Tracker */ protected $tracker; @@ -511,13 +517,32 @@ } /** + * Return the default language for the respondent + * + * @return string Two letter language code + */ + public function getRespondentLanguage() + { + if (! isset($this->_respTrackData['grs_iso_lang'])) { + $this->_ensureRespondentData(); + + if (! isset($this->_respTrackData['grs_iso_lang'])) { + // Still not set in a project? The it is single language + $this->_respTrackData['grs_iso_lang'] = $this->locale->getLanguage(); + } + } + + return $this->_respTrackData['grs_iso_lang']; + } + + /** * Return the name of the respondent * * @return string The respondents name */ public function getRespondentName() { - if (! isset($this->_respTrackData['grs_first_name'], $this->_respTrackData['grs_surname_prefix'], $this->_respTrackData['grs_last_name'])) { + if (! isset($this->_respTrackData['grs_first_name'], $this->_respTrackData['grs_last_name'])) { $this->_ensureRespondentData(); } Modified: trunk/library/classes/Gems/Tracker/Token.php =================================================================== --- trunk/library/classes/Gems/Tracker/Token.php 2012-11-15 14:18:41 UTC (rev 1017) +++ trunk/library/classes/Gems/Tracker/Token.php 2012-11-15 15:37:03 UTC (rev 1018) @@ -120,6 +120,12 @@ /** * + * @var Zend_Locale + */ + protected $locale; + + /** + * * @var Gems_Tracker_Survey */ protected $survey; @@ -132,7 +138,7 @@ /** * - * @var Zend_Translate_Adapter + * @var Zend_Translate */ public $translate; @@ -195,6 +201,7 @@ $respId = $this->_gemsData['gto_id_respondent']; $orgId = $this->_gemsData['gto_id_organization']; + MUtil_Echo::track($this->_gemsData); if ($row = $this->db->fetchRow($sql, array($respId, $orgId))) { $this->_gemsData = $this->_gemsData + $row; @@ -887,7 +894,26 @@ } /** + * Return the default language for the respondent * + * @return string Two letter language code + */ + public function getRespondentLanguage() + { + if (! isset($this->_gemsData['grs_iso_lang'])) { + $this->_ensureRespondentData(); + + if (! isset($this->_gemsData['grs_iso_lang'])) { + // Still not set in a project? The it is single language + $this->_gemsData['grs_iso_lang'] = $this->locale->getLanguage(); + } + } + + return $this->_gemsData['grs_iso_lang']; + } + + /** + * * @return string */ public function getRespondentLastName() @@ -989,24 +1015,27 @@ * Returns a string that tells if the token is open, completed or any other * status you might like. This will not be interpreted by the tracker it is * for display purposes only + * + * @return string Token status description */ public function getStatus() { $today = new Zend_Date(); - $status = $this->translate->_('Open'); if ($this->isCompleted()) { - $status = $this->translate->_('Completed'); + $status = $this->translate->getAdapter()->_('Completed'); } else { $validFrom = $this->getValidFrom(); $validUntil = $this->getValidUntil(); - if (!empty($validUntil) && $validUntil->isEarlier($today)) { - $status = $this->translate->_('Missed'); - } else if (!empty($validFrom) && $validFrom->isLater($today)) { - $status = $this->translate->_('Future'); - } else if (empty($validFrom) && empty($validUntil)) { - $status = $this->translate->_('Future'); + if (! empty($validUntil) && $validUntil->isEarlier($today)) { + $status = $this->translate->getAdapter()->_('Missed'); + } elseif (! empty($validFrom) && $validFrom->isLater($today)) { + $status = $this->translate->getAdapter()->_('Future'); + } elseif (empty($validFrom) && empty($validUntil)) { + $status = $this->translate->getAdapter()->_('Future'); + } else { + $status = $this->translate->getAdapter()->_('Open'); } } Modified: trunk/library/classes/MUtil/Controller/Action.php =================================================================== --- trunk/library/classes/MUtil/Controller/Action.php 2012-11-15 14:18:41 UTC (rev 1017) +++ trunk/library/classes/MUtil/Controller/Action.php 2012-11-15 15:37:03 UTC (rev 1018) @@ -88,7 +88,7 @@ * The code will use a Potemkin Translate adapter when Zend_Translate is not set in the registry, so * the code will still work, it just will not translate. * - * @var Zend_Translate $translate + * @var Zend_Translate */ public $translate; @@ -372,9 +372,9 @@ public function getTranslate() { if (! $this->translate) { - $translate = Zend_Registry::get('Zend_Translate'); - - if (null === $translate) { + if (Zend_Registry::isRegistered('Zend_Translate')) { + $translate = Zend_Registry::get('Zend_Translate'); + } else { // Make sure there always is a translator $translate = new MUtil_Translate_Adapter_Potemkin(); Zend_Registry::set('Zend_Translate', $translate); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-15 14:18:53
|
Revision: 1017 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1017&view=rev Author: matijsdejong Date: 2012-11-15 14:18:41 +0000 (Thu, 15 Nov 2012) Log Message: ----------- Made it possible to declare certain tables in a join model to be update or insert only Modified Paths: -------------- trunk/library/classes/Gems/Model/JoinModel.php trunk/library/classes/Gems/Model/RespondentModel.php trunk/library/classes/Gems/Model.php trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php trunk/library/classes/MUtil/Model/FormBridge.php trunk/library/classes/MUtil/Model/JoinModel.php Modified: trunk/library/classes/Gems/Model/JoinModel.php =================================================================== --- trunk/library/classes/Gems/Model/JoinModel.php 2012-11-13 12:48:38 UTC (rev 1016) +++ trunk/library/classes/Gems/Model/JoinModel.php 2012-11-15 14:18:41 UTC (rev 1017) @@ -49,14 +49,14 @@ /** * Create a model that joins two or more tables * - * @param string $name the name of the model - * @param string $startTable The base table for the model - * @param string $fieldPrefix Prefix to use for change fields (date/userid) - * @param bool $saveable Will changes to this table be saved + * @param string $name A name for the model + * @param string $startTable The base table for the model + * @param string $fieldPrefix Prefix to use for change fields (date/userid), if $saveable empty sets it to true + * @param mixed $saveable Will changes to this table be saved, true or a combination of SAVE_MODE constants */ public function __construct($name, $startTable, $fieldPrefix = null, $saveable = null) { - parent::__construct($name, $startTable, (null === $saveable ? $fieldPrefix : $saveable)); + parent::__construct($name, $startTable, $this->_checkSaveable($saveable, $fieldPrefix)); if ($fieldPrefix) { Gems_Model::setChangeFieldsByPrefix($this, $fieldPrefix); @@ -64,18 +64,33 @@ } /** + * + * @param mixed $saveable Will changes to this table be saved, true or a combination of SAVE_MODE constants + * @param string $fieldPrefix Prefix to use for change fields (date/userid), if $saveable empty sets it to true + * @return mixed The saveable setting to use + */ + protected function _checkSaveable($saveable, $fieldPrefix) + { + if (null === $saveable) { + return $fieldPrefix ? parent::SAVE_MODE_ALL : null; + } + + return $saveable; + } + + /** * Add a table to the model with a left join * - * @param string $table The name of the table to join - * @param array $joinFields Array of source->dest primary keys for this join - * @param string $fieldPrefix Prefix to use for change fields (date/userid) - * @param bool $saveable Will changes to this table be saved + * @param string $table The name of the table to join + * @param array $joinFields Array of source->dest primary keys for this join + * @param string $fieldPrefix Prefix to use for change fields (date/userid), if $saveable empty sets it to true + * @param mixed $saveable Will changes to this table be saved, true or a combination of SAVE_MODE constants * * @return Gems_Model_JoinModel */ public function addLeftTable($table, array $joinFields, $fieldPrefix = null, $saveable = null) { - parent::addLeftTable($table, $joinFields, (null === $saveable ? $fieldPrefix : $saveable)); + parent::addLeftTable($table, $joinFields, $this->_checkSaveable($saveable, $fieldPrefix)); if ($fieldPrefix) { Gems_Model::setChangeFieldsByPrefix($this, $fieldPrefix); @@ -87,16 +102,16 @@ /** * Add a table to the model with a right join * - * @param string $table The name of the table to join - * @param array $joinFields Array of source->dest primary keys for this join - * @param string $fieldPrefix Prefix to use for change fields (date/userid) - * @param bool $saveable Will changes to this table be saved + * @param string $table The name of the table to join + * @param array $joinFields Array of source->dest primary keys for this join + * @param string $fieldPrefix Prefix to use for change fields (date/userid), if $saveable empty sets it to true + * @param mixed $saveable Will changes to this table be saved, true or a combination of SAVE_MODE constants * * @return Gems_Model_JoinModel */ public function addRightTable($table, array $joinFields, $fieldPrefix = null, $saveable = null) { - parent::addRightTable($table, $joinFields, (null === $saveable ? $fieldPrefix : $saveable)); + parent::addRightTable($table, $joinFields, $this->_checkSaveable($saveable, $fieldPrefix)); if ($fieldPrefix) { Gems_Model::setChangeFieldsByPrefix($this, $fieldPrefix); @@ -108,16 +123,16 @@ /** * Add a table to the model with an inner join * - * @param string $table The name of the table to join - * @param array $joinFields Array of source->dest primary keys for this join - * @param string $fieldPrefix Prefix to use for change fields (date/userid) - * @param bool $saveable Will changes to this table be saved + * @param string $table The name of the table to join + * @param array $joinFields Array of source->dest primary keys for this join + * @param string $fieldPrefix Prefix to use for change fields (date/userid), if $saveable empty sets it to true + * @param mixed $saveable Will changes to this table be saved, true or a combination of SAVE_MODE constants * * @return Gems_Model_JoinModel */ public function addTable($table, array $joinFields, $fieldPrefix = null, $saveable = null) { - parent::addTable($table, $joinFields, (null === $saveable ? $fieldPrefix : $saveable)); + parent::addTable($table, $joinFields, $this->_checkSaveable($saveable, $fieldPrefix)); if ($fieldPrefix) { Gems_Model::setChangeFieldsByPrefix($this, $fieldPrefix); @@ -127,14 +142,14 @@ /** * - * @param string $table_name Does not test for existence - * @param string $fieldPrefix Prefix to use for change fields (date/userid) - * @param bool $saveable Will changes to this table be saved + * @param string $table_name Does not test for existence + * @param string $fieldPrefix Prefix to use for change fields (date/userid), if $saveable empty sets it to true + * @param mixed $saveable Will changes to this table be saved, true or a combination of SAVE_MODE constants * @return Gems_Model_JoinModel */ public function setTableSaveable($table_name, $fieldPrefix = null, $saveable = null) { - parent::setTableSaveable($table_name, (null === $saveable ? $fieldPrefix : $saveable)); + parent::setTableSaveable($table_name, $this->_checkSaveable($saveable, $fieldPrefix)); if ($fieldPrefix) { Gems_Model::setChangeFieldsByPrefix($this, $fieldPrefix); Modified: trunk/library/classes/Gems/Model/RespondentModel.php =================================================================== --- trunk/library/classes/Gems/Model/RespondentModel.php 2012-11-13 12:48:38 UTC (rev 1016) +++ trunk/library/classes/Gems/Model/RespondentModel.php 2012-11-15 14:18:41 UTC (rev 1017) @@ -128,9 +128,17 @@ */ public function addLoginCheck() { - $this->addLeftTable('gems__user_logins', array('gr2o_patient_nr' => 'gul_login', 'gr2o_id_organization' => 'gul_id_organization'), 'gul'); - $this->addColumn("CASE WHEN gul_id_user IS NULL OR gul_user_class = 'NoLogin' OR gul_can_login = 0 THEN 0 ELSE 1 END", 'has_login'); + $this->addLeftTable( + 'gems__user_logins', + array('gr2o_patient_nr' => 'gul_login', 'gr2o_id_organization' => 'gul_id_organization'), + 'gul', + MUtil_Model_DatabaseModelAbstract::SAVE_MODE_UPDATE | + MUtil_Model_DatabaseModelAbstract::SAVE_MODE_DELETE); + $this->addColumn( + "CASE WHEN gul_id_user IS NULL OR gul_user_class = 'NoLogin' OR gul_can_login = 0 THEN 0 ELSE 1 END", + 'has_login'); + return $this; } Modified: trunk/library/classes/Gems/Model.php =================================================================== --- trunk/library/classes/Gems/Model.php 2012-11-13 12:48:38 UTC (rev 1016) +++ trunk/library/classes/Gems/Model.php 2012-11-15 14:18:41 UTC (rev 1017) @@ -104,7 +104,13 @@ */ protected function addUserLogin(Gems_Model_JoinModel $model, $loginField, $organizationField) { - $model->addTable('gems__user_logins', array($loginField => 'gul_login', $organizationField => 'gul_id_organization'), 'gul'); + $model->addTable( + 'gems__user_logins', + array($loginField => 'gul_login', $organizationField => 'gul_id_organization'), + 'gul', + MUtil_Model_DatabaseModelAbstract::SAVE_MODE_UPDATE | + MUtil_Model_DatabaseModelAbstract::SAVE_MODE_DELETE + ); } /** Modified: trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2012-11-13 12:48:38 UTC (rev 1016) +++ trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2012-11-15 14:18:41 UTC (rev 1017) @@ -62,6 +62,30 @@ const KEY_COPIER = '__c_1_3_copy__%s__key_k_0_p_1__'; /** + * Default save mode: execute all saves + */ + const SAVE_MODE_ALL = 7; + + /** + * Allow deletes to be executed + */ + const SAVE_MODE_DELETE = 4; + + /** + * Allow inserts to be executed + */ + const SAVE_MODE_INSERT = 2; + + /** + * Allow updates to be executed + */ + const SAVE_MODE_UPDATE = 1; + + /** + * Do nothing + */ + const SAVE_MODE_NONE = 0; + /** * Name for query filter transformers */ const TEXTFILTER_TRANSFORMER = 'filter_transformer'; @@ -257,7 +281,6 @@ } } } - return $this->_filterDataForSave($tableData, $isNew); } @@ -373,142 +396,148 @@ * @see copyKeys() * * @param Zend_Db_Table_Abstract $table The table to save - * @param array $newValues The values to save, including those for other tables - * @param array $oldKeys The original keys as they where before the changes + * @param array $newValues The values to save, including those for other tables + * @param array $oldKeys The original keys as they where before the changes + * @param int $saveMode Should updates / inserts occur * @return array The values for this table as they were updated */ - protected function _saveTableData(Zend_Db_Table_Abstract $table, array $newValues, array $oldKeys = null) + protected function _saveTableData(Zend_Db_Table_Abstract $table, array $newValues, + array $oldKeys = null, $saveMode = self::SAVE_MODE_ALL) { - if ($newValues) { - $table_name = $this->_getTableName($table); - $primaryKeys = $this->_getKeysFor($table_name); - $primaryCount = count($primaryKeys); - $filter = array(); - $update = true; + if (! $newValues) { + return array(); + } - // MUtil_Echo::r($newValues, $table_name); + $table_name = $this->_getTableName($table); + $primaryKeys = $this->_getKeysFor($table_name); + $primaryCount = count($primaryKeys); + $filter = array(); + $update = true; - foreach ($primaryKeys as $key) { - if (array_key_exists($key, $newValues) && (0 == strlen($newValues[$key]))) { - // Never include null key values - unset($newValues[$key]); - if (MUtil_Model::$verbose) { - MUtil_Echo::r('Null key value: ' . $key, 'INSERT!!'); - } + // MUtil_Echo::r($newValues, $table_name); + foreach ($primaryKeys as $key) { + if (array_key_exists($key, $newValues) && (0 == strlen($newValues[$key]))) { + // Never include null key values + unset($newValues[$key]); + if (MUtil_Model::$verbose) { + MUtil_Echo::r('Null key value: ' . $key, 'INSERT!!'); + } - // Now we know we are not updating - $update = false; + // Now we know we are not updating + $update = false; - } elseif (isset($oldKeys[$key])) { + } elseif (isset($oldKeys[$key])) { + if (MUtil_Model::$verbose) { + MUtil_Echo::r($key . ' => ' . $oldKeys[$key], 'Old key'); + } + $filter[$key . ' = ?'] = $oldKeys[$key]; + // Key values left in $returnValues in case of partial key insert + + } else { + // Check for old key values being stored using copyKeys() + $copyKey = $this->getKeyCopyName($key); + + if (isset($newValues[$copyKey])) { + $filter[$key . ' = ?'] = $newValues[$copyKey]; if (MUtil_Model::$verbose) { - MUtil_Echo::r($key . ' => ' . $oldKeys[$key], 'Old key'); + MUtil_Echo::r($key . ' => ' . $newValues[$copyKey], 'Copy key'); } - $filter[$key . ' = ?'] = $oldKeys[$key]; - // Key values left in $returnValues in case of partial key insert - } else { - // Check for old key values being stored using copyKeys() - $copyKey = $this->getKeyCopyName($key); - - if (isset($newValues[$copyKey])) { - $filter[$key . ' = ?'] = $newValues[$copyKey]; - if (MUtil_Model::$verbose) { - MUtil_Echo::r($key . ' => ' . $newValues[$copyKey], 'Copy key'); - } - - } elseif (isset($newValues[$key])) { - $filter[$key . ' = ?'] = $newValues[$key]; - if (MUtil_Model::$verbose) { - MUtil_Echo::r($key . ' => ' . $newValues[$key], 'Key'); - } + } elseif (isset($newValues[$key])) { + $filter[$key . ' = ?'] = $newValues[$key]; + if (MUtil_Model::$verbose) { + MUtil_Echo::r($key . ' => ' . $newValues[$key], 'Key'); } } } + } + if (! $filter) { + $update = false; + } - if ($update) { - // MUtil_Echo::r($filter, 'Filter'); + if ($update) { + // MUtil_Echo::r($filter, 'Filter'); - $adapter = $this->getAdapter(); - $wheres = array(); - foreach ($filter as $text => $value) { - $wheres[] = $adapter->quoteInto($text, $value); - } - // Retrieve the record from the database - $oldValues = $table->fetchRow('(' . implode(' ) AND (', $wheres) . ')'); + $adapter = $this->getAdapter(); + $wheres = array(); + foreach ($filter as $text => $value) { + $wheres[] = $adapter->quoteInto($text, $value); + } + // Retrieve the record from the database + $oldValues = $table->fetchRow('(' . implode(' ) AND (', $wheres) . ')'); + if (! $oldValues) { + // MUtil_Echo::r('INSERT!!', 'Old not found'); + // Apparently the record does not exist in the database + $update = false; + } else { + $oldValues = $oldValues->toArray(); + } + } - if (! $oldValues) { - // MUtil_Echo::r('INSERT!!', 'Old not found'); - // Apparently the record does not exist in the database - $update = false; - } else { - $oldValues = $oldValues->toArray(); - } + // Check for actual values for this table to save. + // MUtil_Echo::track($newValues); + if ($returnValues = $this->_filterDataFor($table_name, $newValues, ! $update)) { + if (true || MUtil_Model::$verbose) { + MUtil_Echo::r($returnValues, 'Return'); } + // MUtil_Echo::track($returnValues); - // Check for actual values for this table to save. - // MUtil_Echo::track($newValues); - if ($returnValues = $this->_filterDataFor($table_name, $newValues, ! $update)) { - if (MUtil_Model::$verbose) { - MUtil_Echo::r($returnValues, 'Return'); - } - // MUtil_Echo::track($returnValues); + if ($update) { + // MUtil_Echo::r($filter); - if ($update) { - // MUtil_Echo::r($filter); + // Check for actual changes + foreach ($oldValues as $name => $value) { - // Check for actual changes - foreach ($oldValues as $name => $value) { + // The name is in the set being stored + if (array_key_exists($name, $returnValues)) { - // The name is in the set being stored - if (array_key_exists($name, $returnValues)) { + // Detect change that is not auto update + if (! (($returnValues[$name] == $value) || $this->isAutoSave($name))) { + // MUtil_Echo::rs($name, $returnValues[$name], $value); + // MUtil_Echo::r($returnValues); - // Detect change that is not auto update - if (! (($returnValues[$name] == $value) || $this->isAutoSave($name))) { - // MUtil_Echo::rs($name, $returnValues[$name], $value); - // MUtil_Echo::r($returnValues); + // Update the row, if the saveMode allows it + if (($saveMode & self::SAVE_MODE_UPDATE) && + $changed = $table->update($returnValues, $filter)) { + $this->addChanged($changed); + // Make sure the copy keys (if any) have the new values as well + $returnValues = $this->_updateCopyKeys($primaryKeys, $returnValues); - // Update the row - if ($changed = $table->update($returnValues, $filter)) { - $this->addChanged($changed); - // Make sure the copy keys (if any) have the new values as well - $returnValues = $this->_updateCopyKeys($primaryKeys, $returnValues); + // Add the old values as we have them and they may be of use later on. + $returnValues = $returnValues + $oldValues; - // Add the old values as we have them and they may be of use later on. - $returnValues = $returnValues + $oldValues; - - return $returnValues; - } + return $returnValues; } } } - // Add the old values as we have them and they may be of use later on. - return $returnValues + $oldValues; + } + // Add the old values as we have them and they may be of use later on. + return $returnValues + $oldValues; + } elseif ($saveMode & self::SAVE_MODE_INSERT) { + // Perform insert + // MUtil_Echo::r($returnValues); + $newKeyValues = $table->insert($returnValues); + $this->addChanged(); + // MUtil_Echo::rs($newKeyValues, $primaryKeys); + + // Composite key returned. + if (is_array($newKeyValues)) { + foreach ($newKeyValues as $key => $value) { + $returnValues[$key] = $value; + } + return $this->_updateCopyKeys($primaryKeys, $returnValues); } else { - // Perform insert - // MUtil_Echo::r($returnValues); - $newKeyValues = $table->insert($returnValues); - $this->addChanged(); - // MUtil_Echo::rs($newKeyValues, $primaryKeys); - - // Composite key returned. - if (is_array($newKeyValues)) { - foreach ($newKeyValues as $key => $value) { - $returnValues[$key] = $value; + // Single key returned + foreach ($primaryKeys as $key) { + // Fill the first empty value + if (! isset($returnValues[$key])) { + $returnValues[$key] = $newKeyValues; + return $this->_updateCopyKeys($primaryKeys, $returnValues); } - return $this->_updateCopyKeys($primaryKeys, $returnValues); - } else { - // Single key returned - foreach ($primaryKeys as $key) { - // Fill the first empty value - if (! isset($returnValues[$key])) { - $returnValues[$key] = $newKeyValues; - return $this->_updateCopyKeys($primaryKeys, $returnValues); - } - } - // But if all the key values were already filled, make sure the new values are returned. - return $this->_updateCopyKeys($primaryKeys, $returnValues); } + // But if all the key values were already filled, make sure the new values are returned. + return $this->_updateCopyKeys($primaryKeys, $returnValues); } } } Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2012-11-13 12:48:38 UTC (rev 1016) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2012-11-15 14:18:41 UTC (rev 1017) @@ -245,7 +245,7 @@ // First strip the options that are not allowed if (MUtil_Model::$verbose) { - $strippedKeys = array_keys(array_diff_key($options, $allowedOptionsflipped)); + $strippedKeys = array_keys(array_diff_key($options, $allowedOptionsFlipped)); if (!empty($strippedKeys)) { MUtil_Echo::r($strippedKeys, 'stripped from options for ' . $name); } @@ -349,7 +349,7 @@ // Make sure form knows it is a jQuery form $this->form->activateJQuery(); - + return $this->_addToForm($name, 'DatePicker', $options); } @@ -379,14 +379,14 @@ $options = func_get_args(); $options = MUtil_Ra::pairs($options, 2); - //MUtil_Echo::track($elements); + // MUtil_Echo::track($elements); if (isset($elements['elements'])) { - MUtil_Echo::track($elements, $options); + // MUtil_Echo::track($elements, $options); $tmpElements = $elements['elements']; unset($elements['elements']); $options = $elements + $options; $elements = $tmpElements; - //MUtil_Echo::track($elements, $options); + // MUtil_Echo::track($elements, $options); } $options = $this->_mergeOptions($name, $options, Modified: trunk/library/classes/MUtil/Model/JoinModel.php =================================================================== --- trunk/library/classes/MUtil/Model/JoinModel.php 2012-11-13 12:48:38 UTC (rev 1016) +++ trunk/library/classes/MUtil/Model/JoinModel.php 2012-11-15 14:18:41 UTC (rev 1017) @@ -60,9 +60,9 @@ /** * Create a model that joins two or more tables * - * @param string $name the name of the model - * @param string $startTable The base table for the model - * @param bool $saveable Will changes to this table be saved + * @param string $name A name for the model + * @param string $startTable The base table for the model + * @param mixed $saveable Will changes to this table be saved, true or a combination of SAVE_MODE constants */ public function __construct($name, $startTable, $saveable = false) { @@ -77,6 +77,40 @@ $this->_select->from($this->_getTableName($table), array()); } + /** + * Check the passed saveTable information and return 'new style' SAVE_MODE + * constant array + * + * @param array $saveTables Optional array containing the table names to save, + * otherwise the tables set to save at model level will be saved. + * @return array Containing savetable data + */ + protected function _checkSaveTables($saveTables) + { + if (null === $saveTables) { + return $this->_saveTables; + } + + $results = array(); + foreach ((array) $saveTables as $tableName => $setting) { + if (is_numeric($tableName) || (true === $setting)) { + $results[$setting] = self::SAVE_MODE_ALL; + } elseif ($setting) { + $results[$tableName] = $setting; + } + } + + return $results; + } + + /** + * Join a table to the select statement and load the table information + * + * @param string $join Join function name specifying the type of join + * @param mixed $table The name of the table to join or a table object + * @param array $joinFields Array of field pairs that form the join statement + * @param mixed $saveable Will changes to this table be saved, true or a combination of SAVE_MODE constants + */ protected function _joinTable($join, $table, array $joinFields, $saveable = false) { $table = $this->_loadTable($table, $saveable); @@ -91,32 +125,58 @@ $this->_select->$join($table_name, implode(' ' . Zend_Db_Select::SQL_AND . ' ', $joinSql), array()); } + /** + * Load table meta data and set the models table properties + * + * @param mixed $table The name of the table to join or a table object + * @param mixed $saveable Will changes to this table be saved, true or a combination of SAVE_MODE constants + * @return Zend_DB_Table + */ protected function _loadTable($table, $saveable = false) { if ($table instanceof Zend_Db_Table_Abstract) { - $table_name = $this->_getTableName($table); + $tableName = $this->_getTableName($table); } else { - $table_name = (string) $table; - $table = new Zend_DB_Table($table_name); + $tableName = (string) $table; + $table = new Zend_DB_Table($tableName); } - $this->_tables[$table_name] = $table; + $this->_tables[$tableName] = $table; - if ($saveable) { - $this->_saveTables[] = $table_name; - } - + $this->_setTableSaveable($tableName, $saveable); $this->_loadTableMetaData($table); return $table; } /** + * Add the table to the default save tables. + * + * This private functions saves against overloading + * + * Only tables marked as save tables are saved during a save() or delete(), + * unless this is overuled by the extra parameter for those functions in + * this object. + * + * @param string $tableName Does not test for existence + * @param mixed $saveable Will changes to this table be saved, true or a combination of SAVE_MODE constants + */ + private function _setTableSaveable($tableName, $saveable) + { + if (true === $saveable) { + $this->_saveTables[$tableName] = self::SAVE_MODE_ALL; + } elseif ($saveable) { + $this->_saveTables[$tableName] = $saveable; + } else { + unset($this->_saveTables[$tableName]); + } + } + + /** * Add a table to the model with a left join * - * @param string $table The name of the table to join - * @param array $joinFields Array of source->dest primary keys for this join - * @param bool $saveable Will changes to this table be saved - * + * @param string $table The name of the table to join + * @param array $joinFields Array of source->dest primary keys for this join + * @param mixed $saveable Will changes to this table be saved, true or a combination of SAVE_MODE constants * @return MUtil_Model_JoinModel */ public function addLeftTable($table, array $joinFields, $saveable = false) @@ -128,9 +188,9 @@ /** * Add a table to the model with a right join * - * @param string $table The name of the table to join - * @param array $joinFields Array of source->dest primary keys for this join - * @param bool $saveable Will changes to this table be saved + * @param string $table The name of the table to join + * @param array $joinFields Array of source->dest primary keys for this join + * @param mixed $saveable Will changes to this table be saved, true or a combination of SAVE_MODE constants * * @return MUtil_Model_JoinModel */ @@ -143,9 +203,9 @@ /** * Add a table to the model with an inner join * - * @param string $table The name of the table to join - * @param array $joinFields Array of source->dest primary keys for this join - * @param bool $saveable Will changes to this table be saved + * @param string $table The name of the table to join + * @param array $joinFields Array of source->dest primary keys for this join + * @param mixed $saveable Will changes to this table be saved, true or a combination of SAVE_MODE constants * * @return Gems_Model_JoinModel */ @@ -169,10 +229,8 @@ */ public function delete($filter = true, array $saveTables = null) { - if (null === $saveTables) { - $saveTables = $this->_saveTables; - } - $filter = $this->_checkFilterUsed($filter); + $saveTables = $this->_checkSaveTables($saveTables); + $filter = $this->_checkFilterUsed($filter); if ($this->_deleteValues) { // First get the old values so we can have all the key values @@ -182,12 +240,12 @@ $changed = $this->save($this->_deleteValues + $oldValues, $filter, $saveTables); } else { $changed = 0; - foreach ($saveTables as $table_name) { + foreach ($saveTables as $tableName => $saveMode) { $table_filter = array(); - $delete = true; + $delete = $saveMode & self::SAVE_MODE_DELETE; // Find per table key filters - foreach ($this->_getKeysFor($table_name) as $key) { + foreach ($this->_getKeysFor($tableName) as $key) { if (isset($filter[$key])) { $table_filter[$key] = $filter[$key]; } else { @@ -213,7 +271,7 @@ // MUtil_Echo::r($table_filter, $table_name); if ($delete && $table_filter) { - $changed = max($changed, $this->_deleteTableData($this->_tables[$table_name], $table_filter)); + $changed = max($changed, $this->_deleteTableData($this->_tables[$tableName], $table_filter)); } } } @@ -253,16 +311,13 @@ */ public function save(array $newValues, array $filter = null, array $saveTables = null) { - if (null === $saveTables) { - $saveTables = $this->_saveTables; - } - + $saveTables = $this->_checkSaveTables($saveTables); $oldChanged = $this->getChanged(); // MUtil_Echo::track($newValues, $filter, $saveTables, $this->_joinFields); $oldValues = $newValues; - foreach ($saveTables as $table_name) { + foreach ($saveTables as $tableName => $saveMode) { // Gotta repeat this every time, as keys may be set later foreach ($this->_joinFields as $source => $target) { // Use is_string as $target and $target can be e.g. a Zend_Db_Expr() object @@ -280,7 +335,9 @@ } elseif (! (isset($newValues[$source]) && $newValues[$source])) { $newValues[$source] = $newValues[$target]; - } elseif ((strlen($newValues[$target]) > 0) && (strlen($newValues[$source]) > 0) && $newValues[$target] != $newValues[$source]) { + } elseif ((strlen($newValues[$target]) > 0) && + (strlen($newValues[$source]) > 0) && + $newValues[$target] != $newValues[$source]) { // Join key values changed. // // Set the old values as the filter @@ -293,13 +350,15 @@ // The changing field must be stated first in the join statement. $newValues[$target] = $newValues[$source]; } - } elseif ($target instanceof Zend_Db_Expr && (! (isset($newValues[$source]) && $newValues[$source]))) { + } elseif ($target instanceof Zend_Db_Expr && + (! (isset($newValues[$source]) && $newValues[$source]))) { $newValues[$source] = $target; } } //$this->_saveTableData returns the new row values, including any automatic changes. - $newValues = $this->_saveTableData($this->_tables[$table_name], $newValues, $filter) + $oldValues; + $newValues = $this->_saveTableData($this->_tables[$tableName], $newValues, $filter, $saveMode) + + $oldValues; // MUtil_Echo::track($oldValues, $newValues, $filter); $oldValues = $newValues; } @@ -345,22 +404,13 @@ * unless this is overuled by the extra parameter for those functions in * this object. * - * @param string $table_name Does not test for existence - * @param boolean $saveable Will changes to this table be saved + * @param string $tableName Does not test for existence + * @param mixed $saveable Will changes to this table be saved, true or a combination of SAVE_MODE constants * @return MUtil_Model_JoinModel (continuation pattern) */ - public function setTableSaveable($table_name, $saveable = true) + public function setTableSaveable($tableName, $saveable = true) { - // MUtil_Echo::r(func_get_args(), __CLASS__ . '->' . __FUNCTION__); - if ($saveable) { - if (! in_array($table_name, $this->_saveTables)) { - $this->_saveTables[] = $table_name; - } - } else { - $key = array_search($table_name, $this->_saveTables); - unset($this->_saveTables[$key]); - } - + $this->_setTableSaveable($tableName, $saveable); return $this; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-13 12:48:49
|
Revision: 1016 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1016&view=rev Author: matijsdejong Date: 2012-11-13 12:48:38 +0000 (Tue, 13 Nov 2012) Log Message: ----------- Fix for display of datepicker div Modified Paths: -------------- trunk/new_project/htdocs/gems/css/gems.css Modified: trunk/new_project/htdocs/gems/css/gems.css =================================================================== --- trunk/new_project/htdocs/gems/css/gems.css 2012-11-13 12:47:48 UTC (rev 1015) +++ trunk/new_project/htdocs/gems/css/gems.css 2012-11-13 12:48:38 UTC (rev 1016) @@ -664,6 +664,10 @@ margin-bottom: 0.25em; } +#ui-datepicker-div { + display: none; +} + .ui-progressbar { margin: 4px; width: 98%; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-13 12:47:58
|
Revision: 1015 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1015&view=rev Author: matijsdejong Date: 2012-11-13 12:47:48 +0000 (Tue, 13 Nov 2012) Log Message: ----------- Small fix Modified Paths: -------------- trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php Modified: trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2012-11-12 18:37:42 UTC (rev 1014) +++ trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2012-11-13 12:47:48 UTC (rev 1015) @@ -416,7 +416,7 @@ MUtil_Echo::r($key . ' => ' . $newValues[$copyKey], 'Copy key'); } - } else { + } elseif (isset($newValues[$key])) { $filter[$key . ' = ?'] = $newValues[$key]; if (MUtil_Model::$verbose) { MUtil_Echo::r($key . ' => ' . $newValues[$key], 'Key'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-12 18:37:49
|
Revision: 1014 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1014&view=rev Author: matijsdejong Date: 2012-11-12 18:37:42 +0000 (Mon, 12 Nov 2012) Log Message: ----------- project-bootstrap.php did not point to the correct directories Modified Paths: -------------- trunk/test/library/project-bootstrap.php Modified: trunk/test/library/project-bootstrap.php =================================================================== --- trunk/test/library/project-bootstrap.php 2012-11-12 16:42:40 UTC (rev 1013) +++ trunk/test/library/project-bootstrap.php 2012-11-12 18:37:42 UTC (rev 1014) @@ -9,9 +9,9 @@ /** * Setup environment */ -define('GEMS_WEB_DIR', dirname(__FILE__)); -define('GEMS_ROOT_DIR', realpath(dirname(__FILE__) . '/../')); -define('GEMS_LIBRARY_DIR', realpath(dirname(__FILE__) . '/../library/Gems')); +define('GEMS_WEB_DIR', realpath(dirname(__FILE__) . '/../')); +define('GEMS_ROOT_DIR', realpath(dirname(__FILE__) . '/../../')); +define('GEMS_LIBRARY_DIR', realpath(dirname(__FILE__) . '/../../library/Gems')); define('GEMS_PROJECT_NAME_UC', ucfirst(GEMS_PROJECT_NAME)); define('APPLICATION_ENV', 'development'); define('APPLICATION_PATH', GEMS_ROOT_DIR . '/application'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-12 16:42:50
|
Revision: 1013 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1013&view=rev Author: matijsdejong Date: 2012-11-12 16:42:40 +0000 (Mon, 12 Nov 2012) Log Message: ----------- Updated documentation Modified Paths: -------------- trunk/library/classes/MUtil/JQuery.php Modified: trunk/library/classes/MUtil/JQuery.php =================================================================== --- trunk/library/classes/MUtil/JQuery.php 2012-11-12 13:39:56 UTC (rev 1012) +++ trunk/library/classes/MUtil/JQuery.php 2012-11-12 16:42:40 UTC (rev 1013) @@ -1,38 +1,55 @@ <?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 + * 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 JQuery + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ */ +/** + * + * @package MUtil + * @subpackage JQuery + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 + */ class MUtil_JQuery extends ZendX_JQuery { + /** + * Returns the jQuery container object assigned to the view helper. + * + * @staticvar ZendX_JQuery_View_Helper_JQuery_Container $jquery + * @return ZendX_JQuery_View_Helper_JQuery_Container + */ public static function jQuery() { static $jquery; @@ -45,7 +62,13 @@ return $jquery; } - public static function usesJQuery(Zend_View_Abstract $view) + /** + * Check if the view is using JQuery + * + * @param Zend_View_Abstract $view + * @return boolean + */ + public static function usesJQuery(Zend_View_Abstract $view) { return false !== $view->getPluginLoader('helper')->getPaths('ZendX_JQuery_View_Helper'); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-12 13:40:02
|
Revision: 1012 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1012&view=rev Author: roelfaber Date: 2012-11-12 13:39:56 +0000 (Mon, 12 Nov 2012) Log Message: ----------- dutch typo corrected Modified Paths: -------------- trunk/library/languages/default-nl.mo trunk/library/languages/default-nl.po Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2012-11-12 13:31:40 UTC (rev 1011) +++ trunk/library/languages/default-nl.po 2012-11-12 13:39:56 UTC (rev 1012) @@ -2403,7 +2403,7 @@ #: classes/Gems/Default/SurveyMaintenanceAction.php:483 msgid "Blocked in source" -msgstr "Gelokkeerd in bron" +msgstr "Geblokkeerd in bron" #: classes/Gems/Default/SurveyMaintenanceAction.php:485 msgid "(every state)" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-12 13:31:49
|
Revision: 1011 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1011&view=rev Author: roelfaber Date: 2012-11-12 13:31:40 +0000 (Mon, 12 Nov 2012) Log Message: ----------- https option example (not in action) added in htaccess Modified Paths: -------------- trunk/new_project/htdocs/.htaccess Modified: trunk/new_project/htdocs/.htaccess =================================================================== --- trunk/new_project/htdocs/.htaccess 2012-11-09 14:08:03 UTC (rev 1010) +++ trunk/new_project/htdocs/.htaccess 2012-11-12 13:31:40 UTC (rev 1011) @@ -7,6 +7,10 @@ RewriteEngine On +#Rewrite to https can be enabled using the next 2 lines +#RewriteCond %{HTTPS} =off +#RewriteRule (.*)$ https://%{SERVER_NAME}/[new_project]/$1 [R=301,L] + RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-09 14:08:13
|
Revision: 1010 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1010&view=rev Author: matijsdejong Date: 2012-11-09 14:08:03 +0000 (Fri, 09 Nov 2012) Log Message: ----------- New isBase64 function Modified Paths: -------------- trunk/library/classes/MUtil/String.php trunk/test/classes/MUtil/StringTest.php Modified: trunk/library/classes/MUtil/String.php =================================================================== --- trunk/library/classes/MUtil/String.php 2012-11-09 12:13:47 UTC (rev 1009) +++ trunk/library/classes/MUtil/String.php 2012-11-09 14:08:03 UTC (rev 1010) @@ -107,6 +107,26 @@ } /** + * Test if a string is a valid base64 string. + * + * This test is only performed based on character inputand + * does perform an actual decoding to be sure. + * + * @param string $input + * @return boolean + */ + public static function isBase64($input) + { + if (0 === (strlen($input) % 4)) { + if (preg_match('/^[A-Za-z0-9+\\/]{2,}={0,2}$/', $input)) { + return true; + } + } + + return false; + } + + /** * Split a string whereever the callback returns true (including * the character that returns true. * Modified: trunk/test/classes/MUtil/StringTest.php =================================================================== --- trunk/test/classes/MUtil/StringTest.php 2012-11-09 12:13:47 UTC (rev 1009) +++ trunk/test/classes/MUtil/StringTest.php 2012-11-09 14:08:03 UTC (rev 1010) @@ -166,6 +166,88 @@ } /** + * An invalid base 64 string + */ + public function testIsBase64False() + { + $result = MUtil_String::isBase64('YW55IGNhcm5hbCBwbGVhc3=y'); + $this->assertEquals($result, false); + } + + /** + * An invalid base 64 string that is not a multiple of 4 characters + */ + public function testIsBase64FalseLength() + { + $result = MUtil_String::isBase64('a=b&c=d'); + $this->assertEquals($result, false); + } + + /** + * A valid base 64 string ending with '=' + */ + public function testIsBase64Is1() + { + $result = MUtil_String::isBase64('YW55IGN+cm5hbCBwbGVhc3U='); + $this->assertEquals($result, true); + } + + /** + * A valid base 64 string ending with '==' + */ + public function testIsBase64Is2() + { + $result = MUtil_String::isBase64('YW55IGNh/m5hbCBwbGVhcw=='); + $this->assertEquals($result, true); + } + + /** + * An invalid base 64 string ending with '===' + */ + public function testIsBase64Is3() + { + $result = MUtil_String::isBase64('YW55IGNhcm5hbCBwbGVhc==='); + $this->assertEquals($result, false); + } + + /** + * A valid base 64 string + */ + public function testIsBase64NoIs() + { + $result = MUtil_String::isBase64('YW55IGNhcm5hbCBwbGVhc3Vy'); + $this->assertEquals($result, true); + } + + /** + * A valid base 64 string + */ + public function testIsBase64Plus() + { + $result = MUtil_String::isBase64('YW55I+Nhcm5+bCBwbGVhc3Vy'); + $this->assertEquals($result, true); + } + + /** + * A valid base 64 string + */ + public function testIsBase64Slash() + { + $result = MUtil_String::isBase64('YW55I/Nhcm5/bCBwbGVhc3Vy'); + $this->assertEquals($result, true); + } + + /** + * A valid base 64 string + */ + public function testIsBase64SlashPlus() + { + $result = MUtil_String::isBase64('YW55I+Nhcm5+bC/w/GVhc3Vy'); + $this->assertEquals($result, true); + } + + + /** * Test a default callback usage */ public function testSplitOnCharCallbackDefault() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-09 12:13:59
|
Revision: 1009 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1009&view=rev Author: matijsdejong Date: 2012-11-09 12:13:47 +0000 (Fri, 09 Nov 2012) Log Message: ----------- Fix for HtmlElement.php '0' was not seen as content. Speed improvement: removed __call() use in standard Zend_Translate Traits Modified Paths: -------------- trunk/library/classes/Gems/Default/SurveyAction.php trunk/library/classes/Gems/Export/ExportAbstract.php trunk/library/classes/Gems/Export/RespondentExport.php trunk/library/classes/Gems/Menu/MenuAbstract.php trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php trunk/library/classes/GemsEscort.php trunk/library/classes/MUtil/Controller/Action.php trunk/library/classes/MUtil/Html/HtmlElement.php trunk/library/classes/MUtil/Snippets/SnippetAbstract.php Modified: trunk/library/classes/Gems/Default/SurveyAction.php =================================================================== --- trunk/library/classes/Gems/Default/SurveyAction.php 2012-11-09 11:30:20 UTC (rev 1008) +++ trunk/library/classes/Gems/Default/SurveyAction.php 2012-11-09 12:13:47 UTC (rev 1009) @@ -56,33 +56,41 @@ public $trackType = 'S'; + /** + * Overrules specific translations for this action + * + * @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) { // Thanks to Potemkin adapter there is always a translate variable in MUtil_Controller_Action switch ($text) { case 'Add track': - return $this->translate->_('Add survey', $locale); + return $this->translate->getAdapter()->_('Add survey', $locale); case 'Add another %s track': - return $this->translate->_('Add another %s survey', $locale); + return $this->translate->getAdapter()->_('Add another %s survey', $locale); case 'Adding the %s track to respondent %s': - return $this->translate->_('Adding the %s survey to respondent %s', $locale); + return $this->translate->getAdapter()->_('Adding the %s survey to respondent %s', $locale); case 'Available tracks': - return $this->translate->_('Available surveys', $locale); + return $this->translate->getAdapter()->_('Available surveys', $locale); case 'No tracks found': - return $this->translate->_('No surveys found', $locale); + return $this->translate->getAdapter()->_('No surveys found', $locale); case 'Overview of %s track for respondent %s: %s': - return $this->translate->_('Overview of %s survey for respondent %s: %s', $locale); + return $this->translate->getAdapter()->_('Overview of %s survey for respondent %s: %s', $locale); case 'This track is currently not assigned to this respondent.': - return $this->translate->_('This survey has not been assigned to this respondent.', $locale); + return $this->translate->getAdapter()->_('This survey has not been assigned to this respondent.', $locale); case 'Track %s does not exist.': - return $this->translate->_('Survey %s does not exist.', $locale); + return $this->translate->getAdapter()->_('Survey %s does not exist.', $locale); default: return parent::_($text, $locale); Modified: trunk/library/classes/Gems/Export/ExportAbstract.php =================================================================== --- trunk/library/classes/Gems/Export/ExportAbstract.php 2012-11-09 11:30:20 UTC (rev 1008) +++ trunk/library/classes/Gems/Export/ExportAbstract.php 2012-11-09 12:13:47 UTC (rev 1009) @@ -79,6 +79,6 @@ */ public function _($text, $locale = null) { - return $this->translate->_($text, $locale); + return $this->translate->getAdapter()->_($text, $locale); } } \ No newline at end of file Modified: trunk/library/classes/Gems/Export/RespondentExport.php =================================================================== --- trunk/library/classes/Gems/Export/RespondentExport.php 2012-11-09 11:30:20 UTC (rev 1008) +++ trunk/library/classes/Gems/Export/RespondentExport.php 2012-11-09 12:13:47 UTC (rev 1009) @@ -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 @@ -52,21 +52,21 @@ * @var GemsEscort */ public $escort; - + protected $html; - + /** * * @var Gems_Loader */ public $loader; - + /** * * @var Gems_Project_ProjectSettings */ public $project; - + /** * @var Zend_Translate_Adapter */ @@ -79,7 +79,7 @@ public $util; public $view; - + /** * @var Gems_Pdf */ @@ -88,13 +88,24 @@ public function afterRegistry() { parent::afterRegistry(); - + $this->_pdf = $this->loader->getPdf(); } - + + /** + * 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 _($messageid, $locale = null) { - return $this->translate->_($messageid, $locale); + return $this->translate->getAdapter()->_($messageid, $locale); } /** @@ -125,7 +136,7 @@ if ($token->getReceptionCode()->isSuccess()) { return true; } - + return false; } @@ -178,7 +189,7 @@ } } - if ($showToken) { + if ($showToken) { $params = array( 'token' => $token, 'tokenId' => $token->getTokenId(), @@ -187,16 +198,16 @@ 'showSelected' => false, 'showTakeButton' => false, 'grouped' => $groupSurveys); - + $snippets = $token->getAnswerSnippetNames(); - + if (is_array($snippets)) { list($snippets, $snippetParams) = MUtil_Ra::keySplit($snippets); $params = $params + $snippetParams; } - + $this->html->snippet('Export_SurveyHeaderSnippet', 'token', $token); - + foreach($snippets as $snippet) { $this->html->snippet($snippet, $params); } @@ -288,7 +299,7 @@ $this->_exportTrack($track); } } - + /** * Constructs the form * Modified: trunk/library/classes/Gems/Menu/MenuAbstract.php =================================================================== --- trunk/library/classes/Gems/Menu/MenuAbstract.php 2012-11-09 11:30:20 UTC (rev 1008) +++ trunk/library/classes/Gems/Menu/MenuAbstract.php 2012-11-09 12:13:47 UTC (rev 1009) @@ -56,9 +56,20 @@ protected $_subItems; + /** + * 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->escort->translate->_($text, $locale); + return $this->escort->translate->getAdapter()->_($text, $locale); } public function __construct(GemsEscort $escort) @@ -604,6 +615,26 @@ abstract public function isVisible(); /** + * Copy from Zend_Translate_Adapter + * + * Translates the given string using plural notations + * Returns the translated string + * + * @see Zend_Locale + * @param string $singular Singular translation string + * @param string $plural Plural translation string + * @param integer $number Number for detecting the correct plural + * @param string|Zend_Locale $locale (Optional) Locale/Language to use, identical with + * locale identifier, @see Zend_Locale for more information + * @return string + */ + public function plural($singular, $plural, $number, $locale = null) + { + $args = func_get_args(); + return call_user_func_array(array($this->escort->translate->getAdapter(), 'plural'), $args); + } + + /** * Make sure only the active branch is visible * * @param array $activeBranch Of Gems_Menu_Menu Abstract items Modified: trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2012-11-09 11:30:20 UTC (rev 1008) +++ trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2012-11-09 12:13:47 UTC (rev 1009) @@ -130,7 +130,7 @@ */ public function _($text, $locale = null) { - return $this->translate->_($text, $locale); + return $this->translate->getAdapter()->_($text, $locale); } /** Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2012-11-09 11:30:20 UTC (rev 1008) +++ trunk/library/classes/GemsEscort.php 2012-11-09 12:13:47 UTC (rev 1009) @@ -66,13 +66,24 @@ */ public $menu; + /** + * 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) { if (! isset($this->request)) { // Locale is fixed by request. $this->setException(new Gems_Exception_Coding('Requested translation before request was made available.')); } - return $this->translate->_($text, $locale); + return $this->translate->getAdapter()->_($text, $locale); } /** @@ -1456,6 +1467,26 @@ } /** + * Copy from Zend_Translate_Adapter + * + * Translates the given string using plural notations + * Returns the translated string + * + * @see Zend_Locale + * @param string $singular Singular translation string + * @param string $plural Plural translation string + * @param integer $number Number for detecting the correct plural + * @param string|Zend_Locale $locale (Optional) Locale/Language to use, identical with + * locale identifier, @see Zend_Locale for more information + * @return string + */ + public function plural($singular, $plural, $number, $locale = null) + { + $args = func_get_args(); + return call_user_func_array(array($this->translate->getAdapter(), 'plural'), $args); + } + + /** * Hook 8: Start of dispatchLoop. Called before an action is dispatched * by Zend_Controller_Dispatcher. * Modified: trunk/library/classes/MUtil/Controller/Action.php =================================================================== --- trunk/library/classes/MUtil/Controller/Action.php 2012-11-09 11:30:20 UTC (rev 1008) +++ trunk/library/classes/MUtil/Controller/Action.php 2012-11-09 12:13:47 UTC (rev 1009) @@ -138,7 +138,7 @@ */ public function _($text, $locale = null) { - return $this->translate->_($text, $locale); + return $this->translate->getAdapter()->_($text, $locale); } /** @@ -483,7 +483,7 @@ public function plural($singular, $plural, $number, $locale = null) { $args = func_get_args(); - return call_user_func_array(array($this->translate, 'plural'), $args); + return call_user_func_array(array($this->translate->getAdapter(), 'plural'), $args); } /* currently not in use Modified: trunk/library/classes/MUtil/Html/HtmlElement.php =================================================================== --- trunk/library/classes/MUtil/Html/HtmlElement.php 2012-11-09 11:30:20 UTC (rev 1008) +++ trunk/library/classes/MUtil/Html/HtmlElement.php 2012-11-09 12:13:47 UTC (rev 1009) @@ -1068,8 +1068,11 @@ return $html; } - } elseif ($content = $renderer->renderAny($view, $this->_content)) { - return $content; + } else { + $content = $renderer->renderAny($view, $this->_content); + if (strlen($content)) { + return $content; + } } } Modified: trunk/library/classes/MUtil/Snippets/SnippetAbstract.php =================================================================== --- trunk/library/classes/MUtil/Snippets/SnippetAbstract.php 2012-11-09 11:30:20 UTC (rev 1008) +++ trunk/library/classes/MUtil/Snippets/SnippetAbstract.php 2012-11-09 12:13:47 UTC (rev 1009) @@ -102,7 +102,7 @@ */ public function _($text, $locale = null) { - return $this->translate->_($text, $locale); + return $this->translate->getAdapter()->_($text, $locale); } /** @@ -230,7 +230,7 @@ public function plural($singular, $plural, $number, $locale = null) { $args = func_get_args(); - return call_user_func_array(array($this->translate, 'plural'), $args); + return call_user_func_array(array($this->translate->getAdapter(), 'plural'), $args); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-11-09 11:30:31
|
Revision: 1008 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1008&view=rev Author: matijsdejong Date: 2012-11-09 11:30:20 +0000 (Fri, 09 Nov 2012) Log Message: ----------- Bug in array operations Modified Paths: -------------- trunk/library/classes/Gems/Event/Survey/Display/ByValue.php trunk/library/classes/Gems/Event/Survey/Display/YesOnTop.php Modified: trunk/library/classes/Gems/Event/Survey/Display/ByValue.php =================================================================== --- trunk/library/classes/Gems/Event/Survey/Display/ByValue.php 2012-11-08 16:10:47 UTC (rev 1007) +++ trunk/library/classes/Gems/Event/Survey/Display/ByValue.php 2012-11-09 11:30:20 UTC (rev 1008) @@ -68,7 +68,7 @@ foreach ($values as $key => $value) { if (isset($currentNames[$key])) { unset($currentNames[$key]); - $newOrder[] = $key; + $newOrder[$key] = $key; } } Modified: trunk/library/classes/Gems/Event/Survey/Display/YesOnTop.php =================================================================== --- trunk/library/classes/Gems/Event/Survey/Display/YesOnTop.php 2012-11-08 16:10:47 UTC (rev 1007) +++ trunk/library/classes/Gems/Event/Survey/Display/YesOnTop.php 2012-11-09 11:30:20 UTC (rev 1008) @@ -86,6 +86,7 @@ } } + $currentNames = array_combine($currentNames, $currentNames); // MUtil_Echo::track($onTop, $onTop + $currentNames, $currentNames); return $this->restoreHeaderPositions($model, $onTop + $currentNames); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |