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-09-06 14:26:32
|
Revision: 932 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=932&view=rev Author: mennodekker Date: 2012-09-06 14:26:23 +0000 (Thu, 06 Sep 2012) Log Message: ----------- Improved SPSS export by cleaning html from value and variable labels Modified Paths: -------------- trunk/library/classes/Gems/Export/Spss.php Modified: trunk/library/classes/Gems/Export/Spss.php =================================================================== --- trunk/library/classes/Gems/Export/Spss.php 2012-09-06 13:34:32 UTC (rev 931) +++ trunk/library/classes/Gems/Export/Spss.php 2012-09-06 14:26:23 UTC (rev 932) @@ -184,7 +184,8 @@ $response->appendBody(".\nCACHE.\nEXECUTE.\n"); $response->appendBody("\n*Define variable labels.\n"); foreach ($labels as $key => $label) { - $response->appendBody("VARIABLE LABELS " . $fixedNames[$key] . ' "' . $label . '".' . "\n"); + $label = $this->formatString($label); + $response->appendBody("VARIABLE LABELS " . $fixedNames[$key] . " " . $label . "." . "\n"); } $response->appendBody("\n*Define value labels.\n"); @@ -192,12 +193,13 @@ if ($options = $answerModel->get($key, 'multiOptions')) { $response->appendBody('VALUE LABELS ' . $fixedNames[$key]); foreach ($options as $option => $label) { + $label = $this->formatString($label); if ($types[$key] == 'F') { //Numeric - $response->appendBody("\n" . $option . ' ' . '"' . $label . '"'); + $response->appendBody("\n" . $option . ' ' . $label); } else { //String - $response->appendBody("\n" . '"' . $option . '" ' . '"' . $label . '"'); + $response->appendBody("\n" . '"' . $option . '" ' . $label); } } $response->appendBody(".\n\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-06 13:34:38
|
Revision: 931 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=931&view=rev Author: matijsdejong Date: 2012-09-06 13:34:32 +0000 (Thu, 06 Sep 2012) Log Message: ----------- Clean up old style event code Removed Paths: ------------- trunk/new_project/application/events/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-06 13:32:18
|
Revision: 930 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=930&view=rev Author: matijsdejong Date: 2012-09-06 13:32:07 +0000 (Thu, 06 Sep 2012) Log Message: ----------- Deleted old events extension mechanism at GemsTracker level Enabled event definition in Project / Gems classes directories using standard Zend naming conventions (Re)defined the SurveyDisplayEventInterface.php - waiting for implementation Modified Paths: -------------- trunk/library/classes/Gems/Event/SurveyDisplayEventInterface.php trunk/library/classes/Gems/Events.php Added Paths: ----------- trunk/library/classes/Gems/Event/Survey/ trunk/library/classes/Gems/Event/Survey/BeforeAnswering/ trunk/library/classes/Gems/Event/Survey/BeforeAnswering/GetPreviousAnswers.php trunk/library/classes/Gems/Event/Survey/Completed/ trunk/library/classes/Gems/Event/Survey/Completed/BmiCalculation.php trunk/library/classes/Gems/Event/Survey/Completed/DisplayVars.php trunk/library/classes/Gems/Event/Survey/Display/ Removed Paths: ------------- trunk/library/events/ Added: trunk/library/classes/Gems/Event/Survey/BeforeAnswering/GetPreviousAnswers.php =================================================================== --- trunk/library/classes/Gems/Event/Survey/BeforeAnswering/GetPreviousAnswers.php (rev 0) +++ trunk/library/classes/Gems/Event/Survey/BeforeAnswering/GetPreviousAnswers.php 2012-09-06 13:32:07 UTC (rev 930) @@ -0,0 +1,93 @@ +<?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 Events + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $ + */ + +/** + * This events look for a previous copy of the same + * + * + * @package Gems + * @subpackage Events + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.4.4 + */ +class Gems_Event_Survey_BeforeAnswering_GetPreviousAnswers extends MUtil_Registry_TargetAbstract implements Gems_Event_SurveyBeforeAnsweringEventInterface +{ + /** + * Set as this is a MUtil_Registry_TargetInterface + * + * @var Zend_Translate $translate + */ + protected $translate; + + /** + * A pretty name for use in dropdown selection boxes. + * + * @return string Name + */ + public function getEventName() + { + return $this->translate->_('Previous Version Answers Lookup'); + } + + /** + * Process the data and return the answers that should be filled in beforehand. + * + * Storing the changed values is handled by the calling function. + * + * @param Gems_Tracker_Token $token Gems token object + * @return array Containing the changed values + */ + public function processTokenInsertion(Gems_Tracker_Token $token) + { + if ($token->hasSuccesCode() && (! $token->isCompleted())) { + // Preparation for a more general object class + $surveyId = $token->getSurveyId(); + + $prev = $token; + while ($prev = $prev->getPreviousToken()) { + + if ($prev->hasSuccesCode() && $prev->isCompleted()) { + // Check first on survey id and when that does not work by name. + if ($prev->getSurveyId() == $surveyId) { + return $prev->getRawAnswers(); + } + } + } + } + } +} Added: trunk/library/classes/Gems/Event/Survey/Completed/BmiCalculation.php =================================================================== --- trunk/library/classes/Gems/Event/Survey/Completed/BmiCalculation.php (rev 0) +++ trunk/library/classes/Gems/Event/Survey/Completed/BmiCalculation.php 2012-09-06 13:32:07 UTC (rev 930) @@ -0,0 +1,83 @@ +<?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 Events + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $ + */ + +/** + * Calculates someones BMI from LENGTH and WEIGHT. + * + * @package Gems + * @subpackage Events + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.4 + */ +class Gems_Event_Survey_Completed_BmiCalculation // extends MUtil_Registry_TargetAbstract + implements Gems_Event_SurveyCompletedEventInterface +{ + /** + * A pretty name for use in dropdown selection boxes. + * + * @return string Name + */ + public function getEventName() + { + return "Bmi Calculation"; + } + + /** + * Process the data and return the answers that should be changed. + * + * Storing the changed values is handled by the calling function. + * + * @param Gems_Tracker_Token $token Gems token object + * @return array Containing the changed values + */ + public function processTokenData(Gems_Tracker_Token $token) + { + $tokenAnswers = $token->getRawAnswers(); + + if (isset($tokenAnswers['LENGTH'], $tokenAnswers['WEIGHT']) && $tokenAnswers['LENGTH'] && $tokenAnswers['WEIGHT']) { + $length = $tokenAnswers['LENGTH'] / 100; + $newValue = round($tokenAnswers['WEIGHT'] / ($length * $length), 2); + + if ($newValue !== $tokenAnswers['BMI']) { + return array('BMI' => $newValue); + } + } + + return false; + } +} Added: trunk/library/classes/Gems/Event/Survey/Completed/DisplayVars.php =================================================================== --- trunk/library/classes/Gems/Event/Survey/Completed/DisplayVars.php (rev 0) +++ trunk/library/classes/Gems/Event/Survey/Completed/DisplayVars.php 2012-09-06 13:32:07 UTC (rev 930) @@ -0,0 +1,75 @@ +<?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 + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $ + */ + +/** + * Displays the variables and their values to help create a new calculation + * + * To start a new calculation you need to know the exact name of the variables returned + * by the survey source. This event will show this information and the values for each + * token it finds. + * + * @package Gems + * @subpackage Event + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.1 + */ +class Gems_Event_Survey_Completed_DisplayVars extends Gems_Event_EventCalculations implements Gems_Event_SurveyCompletedEventInterface +{ + + /** + * A pretty name for use in dropdown selection boxes. + * + * @return string Name + */ + public function getEventName() + { + return "Echo the variables"; + } + + /** + * Process the data and return the answers that should be changed. + * + * Storing the changed values is handled by the calling function. + * + * @param Gems_Tracker_Token $token Gems token object + * @return array Containing the changed values + */ + public function processTokenData(Gems_Tracker_Token $token) + { + MUtil_Echo::r($token->getRawAnswers(), $token->getTokenId()); + return false; + } +} \ No newline at end of file Modified: trunk/library/classes/Gems/Event/SurveyDisplayEventInterface.php =================================================================== --- trunk/library/classes/Gems/Event/SurveyDisplayEventInterface.php 2012-09-06 09:39:13 UTC (rev 929) +++ trunk/library/classes/Gems/Event/SurveyDisplayEventInterface.php 2012-09-06 13:32:07 UTC (rev 930) @@ -46,6 +46,13 @@ * @license New BSD License * @since Class available since version 1.5.6 */ -interface Gems_Event_SurveyDisplayEventInterface extends Gems_Event_EventInterface, MUtil_Snippets_SnippetInterface +interface Gems_Event_SurveyDisplayEventInterface extends Gems_Event_EventInterface { + /** + * Function that returns the snippets to use for this display. + * + * @param boolean $group Should answers be grouped + * @return array of Snippet names + */ + public function getSnippets($group); } Modified: trunk/library/classes/Gems/Events.php =================================================================== --- trunk/library/classes/Gems/Events.php 2012-09-06 09:39:13 UTC (rev 929) +++ trunk/library/classes/Gems/Events.php 2012-09-06 13:32:07 UTC (rev 930) @@ -46,13 +46,13 @@ */ class Gems_Events extends Gems_Loader_TargetLoaderAbstract { - const EVENTS_DIR = 'events'; + const EVENTS_DIR = 'Event'; - const TRACK_COMPLETION_EVENT = 'track/completed'; - 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'; + 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'; /** * Each event type must implement an event class or interface derived @@ -95,6 +95,28 @@ } /** + * + * @global array $GEMS_DIRS An array of directories that specify where to look for code. + * @param string $eventType An event subdirectory (may contain multiple levels split by '/' + * @return array An array of type prefix => classname + */ + protected function _getEventDirs($eventType) + { + global $GEMS_DIRS; + + $eventClass = str_replace('/', '_', $eventType); + + foreach ($GEMS_DIRS as $name => $dir) { + $prefix = $name . '_' . self::EVENTS_DIR . '_' . $eventClass . '_'; + $paths[$prefix] = $dir . '/' . $name . '/' . self::EVENTS_DIR . '/' . $eventType; + } + $paths[''] = GEMS_PROJECT_PATH . '/' . strtolower(self::EVENTS_DIR . 's/' . $eventType); + // MUtil_Echo::track($paths); + + return $paths; + } + + /** * Returns a list of selectable events with an empty element as the first option. * * @param string $eventType The type (i.e. lookup directory with an associated class) of the events to list @@ -102,18 +124,21 @@ */ protected function _listEvents($eventType) { - $paths[] = APPLICATION_PATH . '/' . self::EVENTS_DIR . '/' . $eventType; - $paths[] = GEMS_LIBRARY_DIR . '/' . self::EVENTS_DIR . '/' . $eventType; $results = array(); $eventClass = $this->_getEventClass($eventType); + $paths = $this->_getEventDirs($eventType); - foreach ($paths as $path) { + foreach ($paths as $prefix => $path) { if (file_exists($path)) { $eDir = dir($path); + $parts = explode('_', $prefix, 2); + if ($name = reset($parts)) { + $name = ' (' . $name . ')'; + } while (false !== ($filename = $eDir->read())) { if ('.php' === substr($filename, -4)) { - $eventName = substr($filename, 0, -4); + $eventName = $prefix . substr($filename, 0, -4); // Take care of double definitions if (! isset($results[$eventName])) { @@ -128,7 +153,7 @@ $this->applySource($event); } - $results[$eventName] = $event->getEventName(); + $results[$eventName] = trim($event->getEventName()) . $name; } // MUtil_Echo::track($eventName); } @@ -138,6 +163,7 @@ } natcasesort($results); $results = $this->util->getTranslated()->getEmptyDropdownArray() + $results; + // MUtil_Echo::track($paths, $results); return $results; } @@ -152,12 +178,16 @@ { $eventClass = $this->_getEventClass($eventType); - if (! class_exists($eventName)) { - $filename = APPLICATION_PATH . '/' . self::EVENTS_DIR . '/' . $eventType . '/' . $eventName . '.php'; + // MUtil_Echo::track($eventName); + if (! class_exists($eventName, true)) { + // Autoload is used for Zend standard defined classnames, + // so if the class is not autoloaded, define the path here. + $filename = APPLICATION_PATH . '/' . self::EVENTS_DIR . 's/' . $eventType . '/' . $eventName . '.php'; if (! file_exists($filename)) { throw new Gems_Exception_Coding("The event '$eventName' of type '$eventType' does not exist at location: $filename."); } + // MUtil_Echo::track($filename); include($filename); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-06 09:39:24
|
Revision: 929 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=929&view=rev Author: matijsdejong Date: 2012-09-06 09:39:13 +0000 (Thu, 06 Sep 2012) Log Message: ----------- Events can now be specified at the GemsTracker level as well as the project level Started on answer display 'event' Modified Paths: -------------- trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php trunk/library/classes/Gems/Events.php trunk/library/classes/Gems/Versions.php trunk/library/configs/db/patches.sql trunk/library/configs/db/tables/gems__surveys.30.sql trunk/library/languages/default-en.mo trunk/library/languages/default-en.po trunk/library/languages/default-nl.mo trunk/library/languages/default-nl.po Added Paths: ----------- trunk/library/classes/Gems/Event/SurveyDisplayEventInterface.php trunk/library/events/ trunk/library/events/survey/ trunk/library/events/survey/beforeanswering/ trunk/library/events/survey/beforeanswering/GetPreviousAnswers.php trunk/library/events/survey/completed/ trunk/library/events/survey/completed/BmiCalculation.php trunk/library/events/survey/display/ Modified: trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php =================================================================== --- trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2012-09-06 08:02:08 UTC (rev 928) +++ trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2012-09-06 09:39:13 UTC (rev 929) @@ -127,6 +127,7 @@ $bridge->addText( 'gsu_code'); $bridge->addSelect( 'gsu_beforeanswering_event'); $bridge->addSelect( 'gsu_completed_event'); + $bridge->addSelect( 'gsu_display_event'); $bridge->addFile( 'new_pdf', 'label', $this->_('Upload new PDF'), 'accept', 'application/pdf', @@ -442,6 +443,7 @@ $model->set('gsu_beforeanswering_event', 'label', $this->_('Before answering'), 'multiOptions', $events->listSurveyBeforeAnsweringEvents()); $model->set('gsu_completed_event', 'label', $this->_('After completion'), 'multiOptions', $events->listSurveyCompletionEvents()); + $model->set('gsu_display_event', 'label', $this->_('Answer display'), 'multiOptions', $events->listSurveyDisplayEvents()); } $model->setCreate(false); Added: trunk/library/classes/Gems/Event/SurveyDisplayEventInterface.php =================================================================== --- trunk/library/classes/Gems/Event/SurveyDisplayEventInterface.php (rev 0) +++ trunk/library/classes/Gems/Event/SurveyDisplayEventInterface.php 2012-09-06 09:39:13 UTC (rev 929) @@ -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 Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: SurveyCompletedEventInterface.php 59 2011-09-22 07:23:44Z mennodekker $ + */ + +/** + * Survey display event interface. + * + * Just a snippet with extra event code. + * + * @package Gems + * @subpackage Event + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.6 + */ +interface Gems_Event_SurveyDisplayEventInterface extends Gems_Event_EventInterface, MUtil_Snippets_SnippetInterface +{ +} Modified: trunk/library/classes/Gems/Events.php =================================================================== --- trunk/library/classes/Gems/Events.php 2012-09-06 08:02:08 UTC (rev 928) +++ trunk/library/classes/Gems/Events.php 2012-09-06 09:39:13 UTC (rev 929) @@ -52,6 +52,7 @@ 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'; /** * Each event type must implement an event class or interface derived @@ -66,6 +67,7 @@ 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', ); /** @@ -100,34 +102,42 @@ */ protected function _listEvents($eventType) { - $path = APPLICATION_PATH . '/' . self::EVENTS_DIR . '/' . $eventType; - $results = $this->util->getTranslated()->getEmptyDropdownArray(); + $paths[] = APPLICATION_PATH . '/' . self::EVENTS_DIR . '/' . $eventType; + $paths[] = GEMS_LIBRARY_DIR . '/' . self::EVENTS_DIR . '/' . $eventType; + $results = array(); $eventClass = $this->_getEventClass($eventType); - if (file_exists($path)) { - $eDir = dir($path); + foreach ($paths as $path) { + if (file_exists($path)) { + $eDir = dir($path); - while (false !== ($filename = $eDir->read())) { - if ('.php' === substr($filename, -4)) { - $eventName = substr($filename, 0, -4); + while (false !== ($filename = $eDir->read())) { + if ('.php' === substr($filename, -4)) { + $eventName = substr($filename, 0, -4); - if (! class_exists($eventName)) { - include($path . '/' . $filename); - } + // Take care of double definitions + if (! isset($results[$eventName])) { + if (! class_exists($eventName)) { + include($path . '/' . $filename); + } - $event = new $eventName(); + $event = new $eventName(); - if ($event instanceof $eventClass) { - if ($event instanceof MUtil_Registry_TargetInterface) { - $this->applySource($event); + if ($event instanceof $eventClass) { + if ($event instanceof MUtil_Registry_TargetInterface) { + $this->applySource($event); + } + + $results[$eventName] = $event->getEventName(); + } + // MUtil_Echo::track($eventName); } - - $results[$eventName] = $event->getEventName(); } - // MUtil_Echo::track($eventName); } } } + natcasesort($results); + $results = $this->util->getTranslated()->getEmptyDropdownArray() + $results; return $results; } @@ -167,7 +177,7 @@ /** * - * @return Gems_Event_RoundChangedEventInterface + * @return array eventname => string */ public function listRoundChangedEvents() { @@ -176,7 +186,7 @@ /** * - * @return Gems_Event_SurveyCompletedEventInterface + * @return array eventname => string */ public function listSurveyBeforeAnsweringEvents() { @@ -185,7 +195,7 @@ /** * - * @return Gems_Event_SurveyCompletedEventInterface + * @return array eventname => string */ public function listSurveyCompletionEvents() { @@ -194,8 +204,17 @@ /** * - * @return Gems_Event_TrackCompletedEventInterface + * @return array eventname => string */ + public function listSurveyDisplayEvents() + { + return $this->_listEvents(self::SURVEY_DISPLAY_EVENT); + } + + /** + * + * @return array eventname => string + */ public function listTrackCompletionEvents() { return $this->_listEvents(self::TRACK_COMPLETION_EVENT); Modified: trunk/library/classes/Gems/Versions.php =================================================================== --- trunk/library/classes/Gems/Versions.php 2012-09-06 08:02:08 UTC (rev 928) +++ trunk/library/classes/Gems/Versions.php 2012-09-06 09:39:13 UTC (rev 929) @@ -59,7 +59,7 @@ * This means that future patches for the current level * will be loaded, but that previous patches are ignored. */ - return 48; + return 49; } /** @@ -69,7 +69,7 @@ */ public final function getGemsVersion() { - return '1.5.5'; + return '1.5.6'; } /** Modified: trunk/library/configs/db/patches.sql =================================================================== --- trunk/library/configs/db/patches.sql 2012-09-06 08:02:08 UTC (rev 928) +++ trunk/library/configs/db/patches.sql 2012-09-06 09:39:13 UTC (rev 929) @@ -427,4 +427,7 @@ ALTER TABLE `gems__tokens` ADD INDEX ( `gto_round_order` ); ALTER TABLE `gems__tokens` ADD INDEX ( `gto_valid_from`, `gto_valid_until` ); ALTER TABLE `gems__tokens` ADD INDEX ( `gto_completion_time` ); -ALTER TABLE `gems__tracks` ADD INDEX ( `gtr_track_name` ); \ No newline at end of file +ALTER TABLE `gems__tracks` ADD INDEX ( `gtr_track_name` ); + +-- PATCH: Add snippet class to gems +ALTER TABLE `gems__surveys` ADD gsu_display_event varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' AFTER gsu_completed_event; Modified: trunk/library/configs/db/tables/gems__surveys.30.sql =================================================================== --- trunk/library/configs/db/tables/gems__surveys.30.sql 2012-09-06 08:02:08 UTC (rev 928) +++ trunk/library/configs/db/tables/gems__surveys.30.sql 2012-09-06 09:39:13 UTC (rev 929) @@ -12,9 +12,10 @@ gsu_token_table varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', -- end depreciated - gsu_survey_pdf varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', + gsu_survey_pdf varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', gsu_beforeanswering_event varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', - gsu_completed_event varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', + gsu_completed_event varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', + gsu_display_event varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', gsu_id_source int unsigned not null references gems__sources (gso_id_source), @@ -38,7 +39,7 @@ gsu_duration varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', gsu_code varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, - + gsu_changed timestamp not null default current_timestamp on update current_timestamp, gsu_changed_by bigint unsigned not null, gsu_created timestamp not null, Added: trunk/library/events/survey/beforeanswering/GetPreviousAnswers.php =================================================================== --- trunk/library/events/survey/beforeanswering/GetPreviousAnswers.php (rev 0) +++ trunk/library/events/survey/beforeanswering/GetPreviousAnswers.php 2012-09-06 09:39:13 UTC (rev 929) @@ -0,0 +1,93 @@ +<?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 Events + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $ + */ + +/** + * This events look for a previous copy of the same + * + * + * @package Gems + * @subpackage Events + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.4.4 + */ +class GetPreviousAnswers extends MUtil_Registry_TargetAbstract implements Gems_Event_SurveyBeforeAnsweringEventInterface +{ + /** + * Set as this is a MUtil_Registry_TargetInterface + * + * @var Zend_Translate $translate + */ + protected $translate; + + /** + * A pretty name for use in dropdown selection boxes. + * + * @return string Name + */ + public function getEventName() + { + return $this->translate->_('Previous Version Answers Lookup'); + } + + /** + * Process the data and return the answers that should be filled in beforehand. + * + * Storing the changed values is handled by the calling function. + * + * @param Gems_Tracker_Token $token Gems token object + * @return array Containing the changed values + */ + public function processTokenInsertion(Gems_Tracker_Token $token) + { + if ($token->hasSuccesCode() && (! $token->isCompleted())) { + // Preparation for a more general object class + $surveyId = $token->getSurveyId(); + + $prev = $token; + while ($prev = $prev->getPreviousToken()) { + + if ($prev->hasSuccesCode() && $prev->isCompleted()) { + // Check first on survey id and when that does not work by name. + if ($prev->getSurveyId() == $surveyId) { + return $prev->getRawAnswers(); + } + } + } + } + } +} Added: trunk/library/events/survey/completed/BmiCalculation.php =================================================================== --- trunk/library/events/survey/completed/BmiCalculation.php (rev 0) +++ trunk/library/events/survey/completed/BmiCalculation.php 2012-09-06 09:39:13 UTC (rev 929) @@ -0,0 +1,83 @@ +<?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 Events + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $ + */ + +/** + * Calculates someones BMI from LENGTH and WEIGHT. + * + * @package Gems + * @subpackage Events + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.4 + */ +class BmiCalculation // extends MUtil_Registry_TargetAbstract + implements Gems_Event_SurveyCompletedEventInterface +{ + /** + * A pretty name for use in dropdown selection boxes. + * + * @return string Name + */ + public function getEventName() + { + return "Bmi Calculation"; + } + + /** + * Process the data and return the answers that should be changed. + * + * Storing the changed values is handled by the calling function. + * + * @param Gems_Tracker_Token $token Gems token object + * @return array Containing the changed values + */ + public function processTokenData(Gems_Tracker_Token $token) + { + $tokenAnswers = $token->getRawAnswers(); + + if (isset($tokenAnswers['LENGTH'], $tokenAnswers['WEIGHT']) && $tokenAnswers['LENGTH'] && $tokenAnswers['WEIGHT']) { + $length = $tokenAnswers['LENGTH'] / 100; + $newValue = round($tokenAnswers['WEIGHT'] / ($length * $length), 2); + + if ($newValue !== $tokenAnswers['BMI']) { + return array('BMI' => $newValue); + } + } + + return false; + } +} Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2012-09-06 08:02:08 UTC (rev 928) +++ trunk/library/languages/default-en.po 2012-09-06 09:39:13 UTC (rev 929) @@ -2,9 +2,9 @@ msgstr "" "Project-Id-Version: GemsTracker EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-08-20 16:12+0100\n" +"POT-Creation-Date: 2012-09-06 11:29+0100\n" "PO-Revision-Date: \n" -"Last-Translator: Menno Dekker <men...@er...>\n" +"Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" "Language: en_GB\n" "MIME-Version: 1.0\n" @@ -21,33 +21,33 @@ msgid "Path %s not writable" msgstr "Path %s not writable" -#: classes/GemsEscort.php:601 +#: classes/GemsEscort.php:606 msgid " > " msgstr " > " -#: classes/GemsEscort.php:796 +#: classes/GemsEscort.php:801 #, php-format msgid "You are logged in as %s" msgstr "You are logged in as %s" -#: classes/GemsEscort.php:798 classes/Gems/Menu.php:263 +#: classes/GemsEscort.php:803 classes/Gems/Menu.php:263 msgid "Logoff" msgstr "Logoff" -#: classes/GemsEscort.php:801 +#: classes/GemsEscort.php:806 msgid "You are not logged in" msgstr "You are not logged in" -#: classes/GemsEscort.php:989 +#: classes/GemsEscort.php:994 #, php-format msgid "User: %s" msgstr "User: %s" -#: classes/GemsEscort.php:1014 +#: classes/GemsEscort.php:1019 msgid "version" msgstr "version" -#: classes/GemsEscort.php:1460 +#: classes/GemsEscort.php:1465 msgid "" "Take note: your session has expired, your inputs were not saved. Please " "check the input data and try again" @@ -55,43 +55,43 @@ "Take note: your session has expired, your inputs were not saved. Please " "check the input data and try again" -#: classes/GemsEscort.php:1589 +#: classes/GemsEscort.php:1594 msgid "Please check back later." msgstr "Please check back later." -#: classes/GemsEscort.php:1591 classes/GemsEscort.php:1595 -#: classes/GemsEscort.php:1596 +#: classes/GemsEscort.php:1596 classes/GemsEscort.php:1600 +#: classes/GemsEscort.php:1601 msgid "System is in maintenance mode" msgstr "System is in maintenance mode" -#: classes/GemsEscort.php:1606 +#: classes/GemsEscort.php:1611 msgid "No access to site." msgstr "No access to site." -#: classes/GemsEscort.php:1608 classes/GemsEscort.php:1651 +#: classes/GemsEscort.php:1613 classes/GemsEscort.php:1656 msgid "You have no access to this site." msgstr "You have no access to this site." -#: classes/GemsEscort.php:1624 classes/Gems/Default/StaffAction.php:317 +#: classes/GemsEscort.php:1629 classes/Gems/Default/StaffAction.php:317 msgid "No access to page" msgstr "No access to page" -#: classes/GemsEscort.php:1626 classes/Gems/Default/OrganizationAction.php:94 +#: classes/GemsEscort.php:1631 classes/Gems/Default/OrganizationAction.php:94 #: classes/Gems/Default/StaffAction.php:318 #: classes/Gems/Model/HiddenOrganizationModel.php:115 #, php-format msgid "Access to this page is not allowed for current role: %s." msgstr "Access to this page is not allowed for current role: %s." -#: classes/GemsEscort.php:1636 classes/GemsEscort.php:1649 +#: classes/GemsEscort.php:1641 classes/GemsEscort.php:1654 msgid "You are no longer logged in." msgstr "You are no longer logged in." -#: classes/GemsEscort.php:1637 +#: classes/GemsEscort.php:1642 msgid "You must login to access this page." msgstr "You must login to access this page." -#: classes/GemsEscort.php:1778 classes/GemsEscort.php:1780 +#: classes/GemsEscort.php:1783 classes/GemsEscort.php:1785 #, php-format msgid "%d survey" msgid_plural "%d surveys" @@ -201,9 +201,9 @@ msgstr "Groups" #: classes/Gems/Menu.php:204 -#: classes/Gems/Default/SurveyMaintenanceAction.php:202 +#: classes/Gems/Default/SurveyMaintenanceAction.php:203 #: classes/Gems/Default/TrackMaintenanceAction.php:131 -#: classes/Gems/Email/MailTemplateForm.php:103 +#: classes/Gems/Email/MailTemplateForm.php:101 #: classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php:140 msgid "Organizations" msgstr "Organizations" @@ -326,8 +326,8 @@ msgstr "Add" #: classes/Gems/Menu.php:324 classes/Gems/Menu.php:424 -#: classes/Gems/Email/EmailFormAbstract.php:282 -#: classes/Gems/Email/EmailFormAbstract.php:293 +#: classes/Gems/Email/EmailFormAbstract.php:280 +#: classes/Gems/Email/EmailFormAbstract.php:291 #: classes/Gems/Menu/MenuAbstract.php:367 #: classes/Gems/Menu/MenuAbstract.php:380 msgid "Preview" @@ -353,7 +353,7 @@ msgstr "Delete" #: classes/Gems/Menu.php:378 -#: classes/Gems/Default/SurveyMaintenanceAction.php:561 +#: classes/Gems/Default/SurveyMaintenanceAction.php:563 #: classes/Gems/Menu/MenuAbstract.php:383 #: classes/Gems/Menu/MenuAbstract.php:445 #: classes/Gems/Tracker/Model/TrackModel.php:100 @@ -474,7 +474,7 @@ #: classes/Gems/Default/RoleAction.php:231 #: classes/Gems/Default/SourceAction.php:195 #: classes/Gems/Default/StaffAction.php:328 -#: classes/Gems/Default/SurveyMaintenanceAction.php:411 +#: classes/Gems/Default/SurveyMaintenanceAction.php:412 #: classes/Gems/Default/TokenPlanAction.php:121 #: classes/Gems/Default/TrackFieldsAction.php:98 #: classes/Gems/Default/TrackMaintenanceAction.php:227 @@ -661,14 +661,14 @@ msgstr "New %1$s..." #: classes/Gems/Controller/BrowseEditAction.php:905 -#: classes/Gems/Email/MailTemplateForm.php:110 +#: classes/Gems/Email/MailTemplateForm.php:108 #: classes/Gems/User/Form/ChangePasswordForm.php:341 #: classes/MUtil/Snippets/ModelFormSnippetAbstract.php:245 msgid "Save" msgstr "Save" #: classes/Gems/Controller/BrowseEditAction.php:941 -#: classes/Gems/Default/MailTemplateAction.php:118 +#: classes/Gems/Default/MailTemplateAction.php:116 #: classes/MUtil/Snippets/ModelFormSnippetAbstract.php:209 #, php-format msgid "%2$u %1$s saved" @@ -684,13 +684,13 @@ msgstr "Input error! No changes saved!" #: classes/Gems/Controller/BrowseEditAction.php:981 -#: classes/Gems/Default/SurveyMaintenanceAction.php:590 +#: classes/Gems/Default/SurveyMaintenanceAction.php:592 #, php-format msgid "Show %s" msgstr "Show %s" #: classes/Gems/Controller/BrowseEditAction.php:988 -#: classes/Gems/Default/SurveyMaintenanceAction.php:599 +#: classes/Gems/Default/SurveyMaintenanceAction.php:601 #, php-format msgid "Unknown %s." msgstr "Unknown %s." @@ -810,8 +810,8 @@ #: classes/Gems/Default/GroupAction.php:88 #: classes/Gems/Default/ReceptionAction.php:81 #: classes/Gems/Default/RoleAction.php:232 -#: classes/Gems/Default/SurveyMaintenanceAction.php:198 -#: classes/Gems/Default/SurveyMaintenanceAction.php:412 +#: classes/Gems/Default/SurveyMaintenanceAction.php:199 +#: classes/Gems/Default/SurveyMaintenanceAction.php:413 #: classes/Gems/Default/TrackActionAbstract.php:200 #: classes/Gems/Default/TrackFieldsAction.php:101 #: classes/Gems/Default/UpgradeAction.php:176 @@ -885,15 +885,15 @@ msgid "Links concerning this web application:" msgstr "Links concerning this web application:" -#: classes/Gems/Default/CronAction.php:138 +#: classes/Gems/Default/CronAction.php:148 msgid "Cron jobs turned off." msgstr "Cron jobs turned off." -#: classes/Gems/Default/CronAction.php:211 +#: classes/Gems/Default/CronAction.php:223 msgid "No mails sent." msgstr "No mails sent." -#: classes/Gems/Default/CronAction.php:214 +#: classes/Gems/Default/CronAction.php:226 #: classes/Gems/Email/MultiMailForm.php:49 #: classes/Gems/Email/OneMailForm.php:47 msgid "On this test system all mail will be delivered to the from address." @@ -911,14 +911,13 @@ msgstr "No rows in %s." #: classes/Gems/Default/DatabaseAction.php:134 -#: classes/Gems/Default/MailTemplateAction.php:70 #: classes/Gems/Default/TrackFieldsAction.php:104 #: classes/Gems/Default/TrackMaintenanceAction.php:229 msgid "Type" msgstr "Type" #: classes/Gems/Default/DatabaseAction.php:138 -#: classes/Gems/Default/SurveyMaintenanceAction.php:433 +#: classes/Gems/Default/SurveyMaintenanceAction.php:434 msgid "Group" msgstr "Group" @@ -1234,8 +1233,8 @@ #: classes/Gems/Default/OrganizationAction.php:139 #: classes/Gems/Default/ReceptionAction.php:88 #: classes/Gems/Default/SourceAction.php:101 -#: classes/Gems/Default/SurveyMaintenanceAction.php:424 -#: classes/Gems/Default/SurveyMaintenanceAction.php:478 +#: classes/Gems/Default/SurveyMaintenanceAction.php:425 +#: classes/Gems/Default/SurveyMaintenanceAction.php:480 #: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:742 #: classes/Gems/Tracker/Model/TrackModel.php:102 #: classes/Gems/Util/TrackData.php:147 @@ -1466,7 +1465,7 @@ #: classes/Gems/Default/LogAction.php:192 #: classes/Gems/Default/MailTemplateAction.php:66 -#: classes/Gems/Email/EmailFormAbstract.php:170 +#: classes/Gems/Email/EmailFormAbstract.php:168 msgid "Message" msgstr "Message" @@ -1507,7 +1506,7 @@ #: classes/Gems/Default/MailJobAction.php:78 #: classes/Gems/Default/MailLogAction.php:118 -#: classes/Gems/Email/EmailFormAbstract.php:310 +#: classes/Gems/Email/EmailFormAbstract.php:308 msgid "Template" msgstr "Template" @@ -1630,7 +1629,7 @@ #: classes/Gems/Default/MailLogAction.php:115 #: classes/Gems/Default/MailTemplateAction.php:62 -#: classes/Gems/Email/EmailFormAbstract.php:351 +#: classes/Gems/Email/EmailFormAbstract.php:349 msgid "Subject" msgstr "Subject" @@ -1713,20 +1712,20 @@ msgid "Email servers" msgstr "Email servers" -#: classes/Gems/Default/MailTemplateAction.php:78 +#: classes/Gems/Default/MailTemplateAction.php:76 #: classes/Gems/Default/RespondentAction.php:349 #: classes/Gems/Default/StaffAction.php:335 #: classes/Gems/Default/StaffAction.php:405 msgid "(all organizations)" msgstr "(all organizations)" -#: classes/Gems/Default/MailTemplateAction.php:97 +#: classes/Gems/Default/MailTemplateAction.php:95 msgid "email template" msgid_plural "email templates" msgstr[0] "email template" msgstr[1] "email templates" -#: classes/Gems/Default/MailTemplateAction.php:102 +#: classes/Gems/Default/MailTemplateAction.php:100 msgid "Email templates" msgstr "Email templates" @@ -1809,7 +1808,7 @@ msgstr "Can the organization be used?" #: classes/Gems/Default/OrganizationAction.php:140 -#: classes/Gems/User/Form/LoginForm.php:151 views/scripts/index/login.phtml:7 +#: classes/Gems/User/Form/LoginForm.php:151 msgid "Login" msgstr "Login" @@ -1859,12 +1858,12 @@ msgstr "Checked organizations see this organizations patients." #: classes/Gems/Default/OrganizationAction.php:160 -#: classes/Gems/Default/SurveyMaintenanceAction.php:441 +#: classes/Gems/Default/SurveyMaintenanceAction.php:442 msgid "Code name" msgstr "Code name" #: classes/Gems/Default/OrganizationAction.php:160 -#: classes/Gems/Default/SurveyMaintenanceAction.php:441 +#: classes/Gems/Default/SurveyMaintenanceAction.php:442 msgid "Only for programmers." msgstr "Only for programmers." @@ -1890,7 +1889,7 @@ #: classes/Gems/Default/OverviewPlanAction.php:115 #: classes/Gems/Default/ProjectSurveysAction.php:88 #: classes/Gems/Default/SurveyAction.php:207 -#: classes/Gems/Default/SurveyMaintenanceAction.php:556 +#: classes/Gems/Default/SurveyMaintenanceAction.php:558 #: classes/Gems/Tracker/Snippets/EditSingleSurveyTokenSnippetAbstract.php:157 msgid "survey" msgid_plural "surveys" @@ -2024,9 +2023,9 @@ #: classes/Gems/Default/ProjectTracksAction.php:67 #: classes/Gems/Default/SurveyAction.php:193 #: classes/Gems/Default/TrackAction.php:330 -#: classes/Gems/Email/EmailFormAbstract.php:195 -#: classes/Gems/Email/EmailFormAbstract.php:253 -#: classes/Gems/Email/MailTemplateForm.php:83 +#: classes/Gems/Email/EmailFormAbstract.php:193 +#: classes/Gems/Email/EmailFormAbstract.php:251 +#: classes/Gems/Email/MailTemplateForm.php:81 #: classes/Gems/Tracker/Model/TrackModel.php:103 msgid "From" msgstr "From" @@ -2634,31 +2633,31 @@ msgid "Duration calculated" msgstr "Duration calculated" -#: classes/Gems/Default/SurveyMaintenanceAction.php:131 +#: classes/Gems/Default/SurveyMaintenanceAction.php:132 msgid "Upload new PDF" msgstr "Upload new PDF" -#: classes/Gems/Default/SurveyMaintenanceAction.php:139 +#: classes/Gems/Default/SurveyMaintenanceAction.php:140 msgid "Usage" msgstr "Usage" -#: classes/Gems/Default/SurveyMaintenanceAction.php:154 +#: classes/Gems/Default/SurveyMaintenanceAction.php:155 msgid "Single Survey Assignment" msgstr "Single Survey Assignment" -#: classes/Gems/Default/SurveyMaintenanceAction.php:199 +#: classes/Gems/Default/SurveyMaintenanceAction.php:200 msgid "Assignable since" msgstr "Assignable since" -#: classes/Gems/Default/SurveyMaintenanceAction.php:200 +#: classes/Gems/Default/SurveyMaintenanceAction.php:201 msgid "Assignable until" msgstr "Assignable until" -#: classes/Gems/Default/SurveyMaintenanceAction.php:206 +#: classes/Gems/Default/SurveyMaintenanceAction.php:207 msgid "Create Single Survey" msgstr "Create Single Survey" -#: classes/Gems/Default/SurveyMaintenanceAction.php:210 +#: classes/Gems/Default/SurveyMaintenanceAction.php:211 msgid "" "At the moment this survey can only be assigned to respondents as part of an " "existing track." @@ -2666,132 +2665,136 @@ "At the moment this survey can only be assigned to paitents as part of an " "existing track." -#: classes/Gems/Default/SurveyMaintenanceAction.php:265 +#: classes/Gems/Default/SurveyMaintenanceAction.php:266 msgid "Survey should be assigned to a group before making it active." msgstr "Survey should be assigned to a group before making it active." -#: classes/Gems/Default/SurveyMaintenanceAction.php:295 +#: classes/Gems/Default/SurveyMaintenanceAction.php:296 #, php-format msgid "Answered surveys: %d." msgstr "Answered surveys: %d." -#: classes/Gems/Default/SurveyMaintenanceAction.php:296 +#: classes/Gems/Default/SurveyMaintenanceAction.php:297 #, php-format msgid "Average answer time: %s." msgstr "Average answer time: %s." -#: classes/Gems/Default/SurveyMaintenanceAction.php:297 +#: classes/Gems/Default/SurveyMaintenanceAction.php:298 #, php-format msgid "Standard deviation: %s." msgstr "Standard deviation: %s." -#: classes/Gems/Default/SurveyMaintenanceAction.php:313 +#: classes/Gems/Default/SurveyMaintenanceAction.php:314 #, php-format msgid "Median value: %s." msgstr "Median value: %s." -#: classes/Gems/Default/SurveyMaintenanceAction.php:320 +#: classes/Gems/Default/SurveyMaintenanceAction.php:321 msgid "incalculable" msgstr "incalculable" -#: classes/Gems/Default/SurveyMaintenanceAction.php:333 +#: classes/Gems/Default/SurveyMaintenanceAction.php:334 #, php-format msgid "Checking survey results for the %s survey." msgstr "Checking survey results for the %s survey." -#: classes/Gems/Default/SurveyMaintenanceAction.php:337 +#: classes/Gems/Default/SurveyMaintenanceAction.php:338 msgid "This task checks all tokens for this survey." msgstr "This task checks all tokens for this survey." -#: classes/Gems/Default/SurveyMaintenanceAction.php:347 +#: classes/Gems/Default/SurveyMaintenanceAction.php:348 msgid "Checking survey results for all surveys." msgstr "Checking survey results for all surveys." -#: classes/Gems/Default/SurveyMaintenanceAction.php:350 +#: classes/Gems/Default/SurveyMaintenanceAction.php:351 msgid "This task checks all tokens for all surveys." msgstr "This task checks all tokens for all surveys." -#: classes/Gems/Default/SurveyMaintenanceAction.php:406 +#: classes/Gems/Default/SurveyMaintenanceAction.php:407 #: classes/Gems/Tracker/Form/AskTokenForm.php:98 #: classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php:150 msgid "OK" msgstr "OK" -#: classes/Gems/Default/SurveyMaintenanceAction.php:414 +#: classes/Gems/Default/SurveyMaintenanceAction.php:415 msgid "Source" msgstr "Source" -#: classes/Gems/Default/SurveyMaintenanceAction.php:416 -#: classes/Gems/Default/SurveyMaintenanceAction.php:439 +#: classes/Gems/Default/SurveyMaintenanceAction.php:417 +#: classes/Gems/Default/SurveyMaintenanceAction.php:440 msgid "Duration description" msgstr "Duration description" -#: classes/Gems/Default/SurveyMaintenanceAction.php:416 -#: classes/Gems/Default/SurveyMaintenanceAction.php:439 +#: classes/Gems/Default/SurveyMaintenanceAction.php:417 +#: classes/Gems/Default/SurveyMaintenanceAction.php:440 msgid "Text to inform the respondent, e.g. \"20 seconds\" or \"1 minute\"." msgstr "Text to inform the respondent, e.g. \"20 seconds\" or \"1 minute\"." -#: classes/Gems/Default/SurveyMaintenanceAction.php:418 +#: classes/Gems/Default/SurveyMaintenanceAction.php:419 msgid "Status in source" msgstr "Status in source" -#: classes/Gems/Default/SurveyMaintenanceAction.php:421 +#: classes/Gems/Default/SurveyMaintenanceAction.php:422 msgid "Active in source" msgstr "Active in source" -#: classes/Gems/Default/SurveyMaintenanceAction.php:422 +#: classes/Gems/Default/SurveyMaintenanceAction.php:423 #, php-format msgid "Active in %s" msgstr "Active in %s" -#: classes/Gems/Default/SurveyMaintenanceAction.php:429 +#: classes/Gems/Default/SurveyMaintenanceAction.php:430 msgid "Single" msgstr "Single" -#: classes/Gems/Default/SurveyMaintenanceAction.php:438 +#: classes/Gems/Default/SurveyMaintenanceAction.php:439 msgid "Result field" msgstr "Result field" -#: classes/Gems/Default/SurveyMaintenanceAction.php:443 +#: classes/Gems/Default/SurveyMaintenanceAction.php:444 msgid "Before answering" msgstr "Before answering" -#: classes/Gems/Default/SurveyMaintenanceAction.php:444 +#: classes/Gems/Default/SurveyMaintenanceAction.php:445 #: classes/Gems/Tracker/Model/TrackModel.php:108 msgid "After completion" msgstr "After completion" -#: classes/Gems/Default/SurveyMaintenanceAction.php:473 +#: classes/Gems/Default/SurveyMaintenanceAction.php:446 +msgid "Answer display" +msgstr "Answer display" + +#: classes/Gems/Default/SurveyMaintenanceAction.php:475 msgid "(all groups)" msgstr "(all groups)" -#: classes/Gems/Default/SurveyMaintenanceAction.php:479 +#: classes/Gems/Default/SurveyMaintenanceAction.php:481 msgid "OK in source, not active" msgstr "OK in source, not active" -#: classes/Gems/Default/SurveyMaintenanceAction.php:480 +#: classes/Gems/Default/SurveyMaintenanceAction.php:482 msgid "Blocked in source" msgstr "Blocked in source" -#: classes/Gems/Default/SurveyMaintenanceAction.php:482 +#: classes/Gems/Default/SurveyMaintenanceAction.php:484 msgid "(every state)" msgstr "(every state)" -#: classes/Gems/Default/SurveyMaintenanceAction.php:541 +#: classes/Gems/Default/SurveyMaintenanceAction.php:543 #, php-format msgid "%d times in track." msgstr "%d times in track." -#: classes/Gems/Default/SurveyMaintenanceAction.php:543 +#: classes/Gems/Default/SurveyMaintenanceAction.php:545 #, php-format msgid "%d times in %d track(s)." msgstr "%d times in %d track(s)." -#: classes/Gems/Default/SurveyMaintenanceAction.php:547 +#: classes/Gems/Default/SurveyMaintenanceAction.php:549 msgid "Not used in track." msgstr "Not used in track." -#: classes/Gems/Default/SurveyMaintenanceAction.php:549 +#: classes/Gems/Default/SurveyMaintenanceAction.php:551 msgid "Not used in tracks." msgstr "Not used in tracks." @@ -2880,7 +2883,7 @@ #: classes/Gems/Default/TokenPlanAction.php:327 #: classes/Gems/Selector/TokenByGroupDateSelector.php:129 -#: classes/Gems/Tracker/Token.php:965 +#: classes/Gems/Tracker/Token.php:969 #: snippets/RespondentTokenTabsSnippet.php:68 msgid "Missed" msgstr "Missed" @@ -3287,55 +3290,55 @@ msgid "Upgrades" msgstr "Upgrades" -#: classes/Gems/Email/EmailFormAbstract.php:103 +#: classes/Gems/Email/EmailFormAbstract.php:101 msgid "no email adress" msgstr "no email adress" -#: classes/Gems/Email/EmailFormAbstract.php:147 +#: classes/Gems/Email/EmailFormAbstract.php:145 msgid "Available fields" msgstr "Available fields" -#: classes/Gems/Email/EmailFormAbstract.php:155 +#: classes/Gems/Email/EmailFormAbstract.php:153 msgid "BBCode" msgstr "BBCode" -#: classes/Gems/Email/EmailFormAbstract.php:218 +#: classes/Gems/Email/EmailFormAbstract.php:216 msgid "Organization does not have an e-mail address." msgstr "Organization does not have an e-mail address." -#: classes/Gems/Email/EmailFormAbstract.php:233 +#: classes/Gems/Email/EmailFormAbstract.php:231 msgid "You do not have an e-mail address." msgstr "You do not have an e-mail address." -#: classes/Gems/Email/EmailFormAbstract.php:293 +#: classes/Gems/Email/EmailFormAbstract.php:291 msgid "Preview HTML" msgstr "Preview HTML" -#: classes/Gems/Email/EmailFormAbstract.php:302 +#: classes/Gems/Email/EmailFormAbstract.php:300 msgid "Preview text" msgstr "Preview text" -#: classes/Gems/Email/EmailFormAbstract.php:334 +#: classes/Gems/Email/EmailFormAbstract.php:332 msgid "Send" msgstr "Send" -#: classes/Gems/Email/EmailFormAbstract.php:431 +#: classes/Gems/Email/EmailFormAbstract.php:429 msgid "Input error! No changes made!" msgstr "Input error! No changes made!" -#: classes/Gems/Email/EmailFormAbstract.php:450 +#: classes/Gems/Email/EmailFormAbstract.php:446 msgid "Subject:" msgstr "Subject:" -#: classes/Gems/Email/EmailFormAbstract.php:478 +#: classes/Gems/Email/EmailFormAbstract.php:474 msgid "Field" msgstr "Field" -#: classes/Gems/Email/EmailFormAbstract.php:479 +#: classes/Gems/Email/EmailFormAbstract.php:475 msgid "Value" msgstr "Value" -#: classes/Gems/Email/EmailFormAbstract.php:482 +#: classes/Gems/Email/EmailFormAbstract.php:478 msgid "BBCode info page" msgstr "BBCode info page" @@ -3343,15 +3346,15 @@ msgid "Send (test)" msgstr "Send (test)" -#: classes/Gems/Email/MailTemplateForm.php:97 +#: classes/Gems/Email/MailTemplateForm.php:95 msgid "Test using" msgstr "Test using" -#: classes/Gems/Email/MailTemplateForm.php:126 +#: classes/Gems/Email/MailTemplateForm.php:124 msgid "To (test)" msgstr "To (test)" -#: classes/Gems/Email/MailTemplateForm.php:150 +#: classes/Gems/Email/MailTemplateForm.php:168 msgid "Test mail send, changes not saved!" msgstr "Test mail send, changes not saved!" @@ -3393,12 +3396,12 @@ msgstr "Last contact" #: classes/Gems/Email/OneMailForm.php:131 -#: classes/Gems/Email/TemplateMailer.php:274 +#: classes/Gems/Email/TemplateMailer.php:229 msgid "The sending of emails was blocked for this installation." msgstr "The sending of emails was blocked for this installation." #: classes/Gems/Email/OneMailForm.php:141 -#: classes/Gems/Email/TemplateMailer.php:308 +#: classes/Gems/Email/TemplateMailer.php:263 msgid "Mail failed to send." msgstr "Mail failed to send." @@ -3407,12 +3410,12 @@ msgid "Sent email to %s." msgstr "Sent email to %s." -#: classes/Gems/Email/TemplateMailer.php:328 +#: classes/Gems/Email/TemplateMailer.php:283 #, php-format msgid "Sent %d e-mails, updated %d tokens." msgstr "Sent %d e-mails, updated %d tokens." -#: classes/Gems/Email/TemplateMailer.php:405 +#: classes/Gems/Email/TemplateMailer.php:360 #, php-format msgid "Invalid e-mail address '%s'." msgstr "Invalid e-mail address '%s'." @@ -3515,7 +3518,6 @@ msgstr "Clean cache" #: classes/Gems/Menu/MenuAbstract.php:410 -#: views/scripts/index/resetpassword.phtml:1 msgid "Reset password" msgstr "Reset password" @@ -3854,16 +3856,16 @@ msgid "No tokens were changed." msgstr "No tokens were changed." -#: classes/Gems/Tracker/Token.php:956 +#: classes/Gems/Tracker/Token.php:960 msgid "Open" msgstr "Open" -#: classes/Gems/Tracker/Token.php:959 +#: classes/Gems/Tracker/Token.php:963 #: classes/Gems/Tracker/Model/StandardTokenModel.php:200 msgid "Completed" msgstr "Completed" -#: classes/Gems/Tracker/Token.php:967 classes/Gems/Tracker/Token.php:969 +#: classes/Gems/Tracker/Token.php:971 classes/Gems/Tracker/Token.php:973 msgid "Future" msgstr "Future" @@ -4742,6 +4744,10 @@ msgid "Do you really want to delete this item?" msgstr "Do you really want to delete this item?" +#: events/survey/beforeanswering/GetPreviousAnswers.php:64 +msgid "Previous Version Answers Lookup" +msgstr "Previous Version Answers Lookup" + #: languages/FakeTranslations.php:40 msgid "Value is required and can't be empty" msgstr "Value is required and can't be empty" @@ -5113,6 +5119,9 @@ msgstr[1] "" "After this survey there are another %d surveys we would like you to answer." +#~ msgid "Result display" +#~ msgstr "Result display" + #~ msgid "" #~ "Only for unanswered tokens: updates the survey of a token when changed in " #~ "the track." Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2012-09-06 08:02:08 UTC (rev 928) +++ trunk/library/languages/default-nl.po 2012-09-06 09:39:13 UTC (rev 929) @@ -2,9 +2,9 @@ msgstr "" "Project-Id-Version: GemsTracker NL\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-08-20 16:00+0100\n" +"POT-Creation-Date: 2012-09-06 11:35+0100\n" "PO-Revision-Date: \n" -"Last-Translator: Menno Dekker <men...@er...>\n" +"Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" "Language: nl_NL\n" "MIME-Version: 1.0\n" @@ -21,33 +21,33 @@ msgid "Path %s not writable" msgstr "Path %s niet schrijfbaar" -#: classes/GemsEscort.php:601 +#: classes/GemsEscort.php:606 msgid " > " msgstr " | " -#: classes/GemsEscort.php:796 +#: classes/GemsEscort.php:801 #, php-format msgid "You are logged in as %s" msgstr "Ingelogd als %s" -#: classes/GemsEscort.php:798 classes/Gems/Menu.php:263 +#: classes/GemsEscort.php:803 classes/Gems/Menu.php:263 msgid "Logoff" msgstr "Uitloggen" -#: classes/GemsEscort.php:801 +#: classes/GemsEscort.php:806 msgid "You are not logged in" msgstr "U bent niet ingelogd" -#: classes/GemsEscort.php:989 +#: classes/GemsEscort.php:994 #, php-format msgid "User: %s" msgstr "Login: %s" -#: classes/GemsEscort.php:1014 +#: classes/GemsEscort.php:1019 msgid "version" msgstr "versie" -#: classes/GemsEscort.php:1460 +#: classes/GemsEscort.php:1465 msgid "" "Take note: your session has expired, your inputs were not saved. Please " "check the input data and try again" @@ -55,43 +55,43 @@ "Let op: uw sessie is verlopen, uw invoer is niet opgeslagen. Controleer uw " "gegevens en probeer a.u.b. opnieuw." -#: classes/GemsEscort.php:1589 +#: classes/GemsEscort.php:1594 msgid "Please check back later." msgstr "Probeer het later opnieuw." -#: classes/GemsEscort.php:1591 classes/GemsEscort.php:1595 -#: classes/GemsEscort.php:1596 +#: classes/GemsEscort.php:1596 classes/GemsEscort.php:1600 +#: classes/GemsEscort.php:1601 msgid "System is in maintenance mode" msgstr "Systeem is in onderhoudsmodus" -#: classes/GemsEscort.php:1606 +#: classes/GemsEscort.php:1611 msgid "No access to site." msgstr "Geen toegang tot website." -#: classes/GemsEscort.php:1608 classes/GemsEscort.php:1651 +#: classes/GemsEscort.php:1613 classes/GemsEscort.php:1656 msgid "You have no access to this site." msgstr "U heeft geen toegang tot deze website." -#: classes/GemsEscort.php:1624 classes/Gems/Default/StaffAction.php:317 +#: classes/GemsEscort.php:1629 classes/Gems/Default/StaffAction.php:317 msgid "No access to page" msgstr "Geen toegang tot pagina" -#: classes/GemsEscort.php:1626 classes/Gems/Default/OrganizationAction.php:94 +#: classes/GemsEscort.php:1631 classes/Gems/Default/OrganizationAction.php:94 #: classes/Gems/Default/StaffAction.php:318 #: classes/Gems/Model/HiddenOrganizationModel.php:115 #, php-format msgid "Access to this page is not allowed for current role: %s." msgstr "U heeft geen toegang tot deze pagina. Uw huidige rol is: %s." -#: classes/GemsEscort.php:1636 classes/GemsEscort.php:1649 +#: classes/GemsEscort.php:1641 classes/GemsEscort.php:1654 msgid "You are no longer logged in." msgstr "U bent niet meer ingelogd." -#: classes/GemsEscort.php:1637 +#: classes/GemsEscort.php:1642 msgid "You must login to access this page." msgstr "U moet ingelogd zijn voor toegang tot deze pagina." -#: classes/GemsEscort.php:1778 classes/GemsEscort.php:1780 +#: classes/GemsEscort.php:1783 classes/GemsEscort.php:1785 #, php-format msgid "%d survey" msgid_plural "%d surveys" @@ -201,9 +201,9 @@ msgstr "Groepen" #: classes/Gems/Menu.php:204 -#: classes/Gems/Default/SurveyMaintenanceAction.php:202 +#: classes/Gems/Default/SurveyMaintenanceAction.php:203 #: classes/Gems/Default/TrackMaintenanceAction.php:131 -#: classes/Gems/Email/MailTemplateForm.php:103 +#: classes/Gems/Email/MailTemplateForm.php:101 #: classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php:140 msgid "Organizations" msgstr "Organisaties" @@ -326,8 +326,8 @@ msgstr "Voeg toe" #: classes/Gems/Menu.php:324 classes/Gems/Menu.php:424 -#: classes/Gems/Email/EmailFormAbstract.php:282 -#: classes/Gems/Email/EmailFormAbstract.php:293 +#: classes/Gems/Email/EmailFormAbstract.php:280 +#: classes/Gems/Email/EmailFormAbstract.php:291 #: classes/Gems/Menu/MenuAbstract.php:367 #: classes/Gems/Menu/MenuAbstract.php:380 msgid "Preview" @@ -353,7 +353,7 @@ msgstr "Verwijder" #: classes/Gems/Menu.php:378 -#: classes/Gems/Default/SurveyMaintenanceAction.php:561 +#: classes/Gems/Default/SurveyMaintenanceAction.php:563 #: classes/Gems/Menu/MenuAbstract.php:383 #: classes/Gems/Menu/MenuAbstract.php:445 #: classes/Gems/Tracker/Model/TrackModel.php:100 @@ -474,7 +474,7 @@ #: classes/Gems/Default/RoleAction.php:231 #: classes/Gems/Default/SourceAction.php:195 #: classes/Gems/Default/StaffAction.php:328 -#: classes/Gems/Default/SurveyMaintenanceAction.php:411 +#: classes/Gems/Default/SurveyMaintenanceAction.php:412 #: classes/Gems/Default/TokenPlanAction.php:121 #: classes/Gems/Default/TrackFieldsAction.php:98 #: classes/Gems/Default/TrackMaintenanceAction.php:227 @@ -661,14 +661,14 @@ msgstr "Nieuwe %1$s..." #: classes/Gems/Controller/BrowseEditAction.php:905 -#: classes/Gems/Email/MailTemplateForm.php:110 +#: classes/Gems/Email/MailTemplateForm.php:108 #: classes/Gems/User/Form/ChangePasswordForm.php:341 #: classes/MUtil/Snippets/ModelFormSnippetAbstract.php:245 msgid "Save" msgstr "Opslaan" #: classes/Gems/Controller/BrowseEditAction.php:941 -#: classes/Gems/Default/MailTemplateAction.php:118 +#: classes/Gems/Default/MailTemplateAction.php:116 #: classes/MUtil/Snippets/ModelFormSnippetAbstract.php:209 #, php-format msgid "%2$u %1$s saved" @@ -684,13 +684,13 @@ msgstr "Invoer fout! Veranderingen niet opgeslagen!" #: classes/Gems/Controller/BrowseEditAction.php:981 -#: classes/Gems/Default/SurveyMaintenanceAction.php:590 +#: classes/Gems/Default/SurveyMaintenanceAction.php:592 #, php-format msgid "Show %s" msgstr "Toon %s" #: classes/Gems/Controller/BrowseEditAction.php:988 -#: classes/Gems/Default/SurveyMaintenanceAction.php:599 +#: classes/Gems/Default/SurveyMaintenanceAction.php:601 #, php-format msgid "Unknown %s." msgstr "%s is onbekend." @@ -812,8 +812,8 @@ #: classes/Gems/Default/GroupAction.php:88 #: classes/Gems/Default/ReceptionAction.php:81 #: classes/Gems/Default/RoleAction.php:232 -#: classes/Gems/Default/SurveyMaintenanceAction.php:198 -#: classes/Gems/Default/SurveyMaintenanceAction.php:412 +#: classes/Gems/Default/SurveyMaintenanceAction.php:199 +#: classes/Gems/Default/SurveyMaintenanceAction.php:413 #: classes/Gems/Default/TrackActionAbstract.php:200 #: classes/Gems/Default/TrackFieldsAction.php:101 #: classes/Gems/Default/UpgradeAction.php:176 @@ -887,15 +887,15 @@ msgid "Links concerning this web application:" msgstr "Links met informatie over deze website:" -#: classes/Gems/Default/CronAction.php:138 +#: classes/Gems/Default/CronAction.php:148 msgid "Cron jobs turned off." msgstr "Cron opdrachten uitgezet." -#: classes/Gems/Default/CronAction.php:211 +#: classes/Gems/Default/CronAction.php:223 msgid "No mails sent." msgstr "Geen mail verzonden." -#: classes/Gems/Default/CronAction.php:214 +#: classes/Gems/Default/CronAction.php:226 #: classes/Gems/Email/MultiMailForm.php:49 #: classes/Gems/Email/OneMailForm.php:47 msgid "On this test system all mail will be delivered to the from address." @@ -914,14 +914,13 @@ msgstr "Geen gegevens in %s." #: classes/Gems/Default/DatabaseAction.php:134 -#: classes/Gems/Default/MailTemplateAction.php:70 #: classes/Gems/Default/TrackFieldsAction.php:104 #: classes/Gems/Default/TrackMaintenanceAction.php:229 msgid "Type" msgstr "Type" #: classes/Gems/Default/DatabaseAction.php:138 -#: classes/Gems/Default/SurveyMaintenanceAction.php:433 +#: classes/Gems/Default/SurveyMaintenanceAction.php:434 msgid "Group" msgstr "Groep" @@ -1239,8 +1238,8 @@ #: classes/Gems/Default/OrganizationAction.php:139 #: classes/Gems/Default/ReceptionAction.php:88 #: classes/Gems/Default/SourceAction.php:101 -#: classes/Gems/Default/SurveyMaintenanceAction.php:424 -#: classes/Gems/Default/SurveyMaintenanceAction.php:478 +#: classes/Gems/Default/SurveyMaintenanceAction.php:425 +#: classes/Gems/Default/SurveyMaintenanceAction.php:480 #: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:742 #: classes/Gems/Tracker/Model/TrackModel.php:102 #: classes/Gems/Util/TrackData.php:147 @@ -1474,7 +1473,7 @@ #: classes/Gems/Default/LogAction.php:192 #: classes/Gems/Default/MailTemplateAction.php:66 -#: classes/Gems/Email/EmailFormAbstract.php:170 +#: classes/Gems/Email/EmailFormAbstract.php:168 msgid "Message" msgstr "Bericht" @@ -1515,7 +1514,7 @@ #: classes/Gems/Default/MailJobAction.php:78 #: classes/Gems/Default/MailLogAction.php:118 -#: classes/Gems/Email/EmailFormAbstract.php:310 +#: classes/Gems/Email/EmailFormAbstract.php:308 msgid "Template" msgstr "Sjabloon" @@ -1638,7 +1637,7 @@ #: classes/Gems/Default/MailLogAction.php:115 #: classes/Gems/Default/MailTemplateAction.php:62 -#: classes/Gems/Email/EmailFormAbstract.php:351 +#: classes/Gems/Email/EmailFormAbstract.php:349 msgid "Subject" msgstr "Onderwerp" @@ -1722,20 +1721,20 @@ msgid "Email servers" msgstr "Email servers" -#: classes/Gems/Default/MailTemplateAction.php:78 +#: classes/Gems/Default/MailTemplateAction.php:76 #: classes/Gems/Default/RespondentAction.php:349 #: classes/Gems/Default/StaffAction.php:335 #: classes/Gems/Default/StaffAction.php:405 msgid "(all organizations)" msgstr "(alle organisaties)" -#: classes/Gems/Default/MailTemplateAction.php:97 +#: classes/Gems/Default/MailTemplateAction.php:95 msgid "email template" msgid_plural "email templates" msgstr[0] "email sjabloon" msgstr[1] "email sjablonen" -#: classes/Gems/Default/MailTemplateAction.php:102 +#: classes/Gems/Default/MailTemplateAction.php:100 msgid "Email templates" msgstr "Email sjabloon" @@ -1819,7 +1818,7 @@ msgstr "Is de organisatie in gebruik?" #: classes/Gems/Default/OrganizationAction.php:140 -#: classes/Gems/User/Form/LoginForm.php:151 views/scripts/index/login.phtml:7 +#: classes/Gems/User/Form/LoginForm.php:151 msgid "Login" msgstr "Inloggen" @@ -1870,12 +1869,12 @@ "Geselecteerde organizaties kunnen de patiënten van deze organisatie bekijken." #: classes/Gems/Default/OrganizationAction.php:160 -#: classes/Gems/Default/SurveyMaintenanceAction.php:441 +#: classes/Gems/Default/SurveyMaintenanceAction.php:442 msgid "Code name" msgstr "Code naam" #: classes/Gems/Default/OrganizationAction.php:160 -#: classes/Gems/Default/SurveyMaintenanceAction.php:441 +#: classes/Gems/Default/SurveyMaintenanceAction.php:442 msgid "Only for programmers." msgstr "Uitsluitend voor programmeurs." @@ -1901,7 +1900,7 @@ #: classes/Gems/Default/OverviewPlanAction.php:115 #: classes/Gems/Default/ProjectSurveysAction.php:88 #: classes/Gems/Default/SurveyAction.php:207 -#: classes/Gems/Default/SurveyMaintenanceAction.php:556 +#: classes/Gems/Default/SurveyMaintenanceAction.php:558 #: classes/Gems/Tracker/Snippets/EditSingleSurveyTokenSnippetAbstract.php:157 msgid "survey" msgid_plural "surveys" @@ -2035,9 +2034,9 @@ #: classes/Gems/Default/ProjectTracksAction.php:67 #: classes/Gems/Default/SurveyAction.php:193 #: classes/Gems/Default/TrackAction.php:330 -#: classes/Gems/Email/EmailFormAbstract.php:195 -#: classes/Gems/Email/EmailFormAbstract.php:253 -#: classes/Gems/Email/MailTemplateForm.php:83 +#: classes/Gems/Email/EmailFormAbstract.php:193 +#: classes/Gems/Email/EmailFormAbstract.php:251 +#: classes/Gems/Email/MailTemplateForm.php:81 #: classes/Gems/Tracker/Model/TrackModel.php:103 msgid "From" msgstr "Van" @@ -2650,31 +2649,31 @@ msgid "Duration calculated" msgstr "Afnametijd berekent" -#: classes/Gems/Default/SurveyMaintenanceAction.php:131 +#: classes/Gems/Default/SurveyMaintenanceAction.php:132 msgid "Upload new PDF" msgstr "Upload nieuwe PDF" -#: classes/Gems/Default/SurveyMaintenanceAction.php:139 +#: classes/Gems/Default/SurveyMaintenanceAction.php:140 msgid "Usage" msgstr "Gebruik" -#: classes/Gems/Default/SurveyMaintenanceAction.php:154 +#: classes/Gems/Default/SurveyMaintenanceAction.php:155 msgid "Single Survey Assignment" msgstr "Losse vragenlijst toewijzing" -#: classes/Gems/Default/SurveyMaintenanceAction.php:199 +#: classes/Gems/Default/SurveyMaintenanceAction.php:200 msgid "Assignable since" msgstr "Toewijsbaar sinds" -#: classes/Gems/Default/SurveyMaintenanceAction.php:200 +#: classes/Gems/Default/SurveyMaintenanceAction.php:201 msgid "Assignable until" msgstr "Toewijsbaar tot" -#: classes/Gems/Default/SurveyMaintenanceAction.php:206 +#: classes/Gems/Default/SurveyMaintenanceAction.php:207 msgid "Create Single Survey" msgstr "Maak losse vragenlijst" -#: classes/Gems/Default/SurveyMaintenanceAction.php:210 +#: classes/Gems/Default/SurveyMaintenanceAction.php:211 msgid "" "At the moment this survey can only be assigned to respondents as part of an " "existing track." @@ -2682,135 +2681,139 @@ "Op dit moment kan deze vragenlijst alleen aan patiënten toegewezen als " "onderdeel van een traject." -#: classes/Gems/Default/SurveyMaintenanceAction.php:265 +#: classes/Gems/Default/SurveyMaintenanceAction.php:266 msgid "Survey should be assigned to a group before making it active." msgstr "" "Vragenlijst moet aan een groep toegewezen worden voordat deze actief kan " "worden gemaakt." -#: classes/Gems/Default/SurveyMaintenanceAction.php:295 +#: classes/Gems/Default/SurveyMaintenanceAction.php:296 #, php-format msgid "Answered surveys: %d." msgstr "Beantwoorde vragenlijsten: %d." -#: classes/Gems/Default/SurveyMaintenanceAction.php:296 +#: classes/Gems/Default/SurveyMaintenanceAction.php:297 #, php-format msgid "Average answer time: %s." msgstr "Gemiddelde antwoordtijd: %s." -#: classes/Gems/Default/SurveyMaintenanceAction.php:297 +#: classes/Gems/Default/SurveyMaintenanceAction.php:298 #, php-format msgid "Standard deviation: %s." msgstr "Standaard deviatie: %s." -#: classes/Gems/Default/SurveyMaintenanceAction.php:313 +#: classes/Gems/Default/SurveyMaintenanceAction.php:314 #, php-format msgid "Median value: %s." msgstr "Median waarde: %s." -#: classes/Gems/Default/SurveyMaintenanceAction.php:320 +#: classes/Gems/Default/SurveyMaintenanceAction.php:321 msgid "incalculable" msgstr "onberekenbaar" -#: classes/Gems/Default/SurveyMaintenanceAction.php:333 +#: classes/Gems/Default/SurveyMaintenanceAction.php:334 #, php-format msgid "Checking survey results for the %s survey." msgstr "Controle op vragenlijstresultaten voor de vragenlijst '%s'." -#: classes/Gems/Default/SurveyMaintenanceAction.php:337 +#: classes/Gems/Default/SurveyMaintenanceAction.php:338 msgid "This task checks all tokens for this survey." msgstr "Deze opdracht controleert alle kenmerken voor deze vragenlijst." -#: classes/Gems/Default/SurveyMaintenanceAction.php:347 +#: classes/Gems/Default/SurveyMaintenanceAction.php:348 msgid "Checking survey results for all surveys." msgstr "Controle op vragenlijstresultaten voor alle vragenlijsten." -#: classes/Gems/Default/SurveyMaintenanceAction.php:350 +#: classes/Gems/Default/SurveyMaintenanc... [truncated message content] |
From: <gem...@li...> - 2012-09-06 08:02:14
|
Revision: 928 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=928&view=rev Author: mennodekker Date: 2012-09-06 08:02:08 +0000 (Thu, 06 Sep 2012) Log Message: ----------- Fixed jQuery activation when adding jQuery element Modified Paths: -------------- trunk/library/classes/MUtil/Model/FormBridge.php Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2012-09-05 12:24:28 UTC (rev 927) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2012-09-06 08:02:08 UTC (rev 928) @@ -348,6 +348,9 @@ $this->getModel()->set($name, 'dateFormat', $options['dateFormat']); } + // Make sure form knows it is a jQuery form + $this->form->activateJQuery(); + return $this->_addToForm($name, 'DatePicker', $options); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-05 12:24:38
|
Revision: 927 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=927&view=rev Author: mennodekker Date: 2012-09-05 12:24:28 +0000 (Wed, 05 Sep 2012) Log Message: ----------- Set required / optional again for labels Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2012-09-05 10:21:17 UTC (rev 926) +++ trunk/library/classes/Gems/Form/TableForm.php 2012-09-05 12:24:28 UTC (rev 927) @@ -78,7 +78,13 @@ $dec->setElement($element); $label .= $dec->render(''); } - $content = sprintf('<tr class="%s"><td class="label"><label for="%s">%s</label></td><td class="element">%s</td></tr>', $class, $element->getName(), $label, $content); + if ($element instanceof Zend_Form_Element) { + $style = $element->isRequired() ? 'required' : 'optional'; + $labelClass = sprintf(' class="%s"', $style); + } else { + $labelClass = ''; + } + $content = sprintf('<tr class="%s"><td class="label"><label for="%s"%s>%s</label></td><td class="element">%s</td></tr>', $class, $element->getName(), $labelClass, $label, $content); return $content; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-05 10:21:26
|
Revision: 926 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=926&view=rev Author: mennodekker Date: 2012-09-05 10:21:17 +0000 (Wed, 05 Sep 2012) Log Message: ----------- Made EventCalculations static and most methods public to make access easier Modified Paths: -------------- trunk/library/classes/Gems/Event/EventCalculations.php Modified: trunk/library/classes/Gems/Event/EventCalculations.php =================================================================== --- trunk/library/classes/Gems/Event/EventCalculations.php 2012-09-05 09:59:13 UTC (rev 925) +++ trunk/library/classes/Gems/Event/EventCalculations.php 2012-09-05 10:21:17 UTC (rev 926) @@ -56,7 +56,7 @@ * @param array $tokenAnswers The answers to compare to * @return boolean True when the value changed. */ - protected function addWhenChanged($name, $value, array &$results, array $tokenAnswers) + public static function addWhenChanged($name, $value, array &$results, array $tokenAnswers) { if ($value != $tokenAnswers[$name]) { $results[$name] = $value; @@ -73,7 +73,7 @@ * @param string $fieldNames * @return array */ - private function _arrayFindName(array $tokenAnswers, $fieldNames) + private static function _arrayFindName(array $tokenAnswers, $fieldNames) { $results = array(); @@ -95,10 +95,10 @@ * @param mixed $fieldNames An array of those names that should be used or a string that should occur in all names that have to be selected. * @return float */ - public function averageInt(array $tokenAnswers, $fieldNames) + public static function averageInt(array $tokenAnswers, $fieldNames) { if (is_string($fieldNames)) { - $fieldNames = $this->_arrayFindName($tokenAnswers, $fieldNames); + $fieldNames = self::_arrayFindName($tokenAnswers, $fieldNames); } $count = 0; @@ -119,7 +119,7 @@ * @param array $tokenAnswers * @return array Those values that were changed. */ - protected function checkFloatChanged(array $values, array $tokenAnswers) + public static function checkFloatChanged(array $values, array $tokenAnswers) { $results = array(); @@ -143,7 +143,7 @@ * @param array $tokenAnswers * @return array Those values that were changed. */ - protected function checkIntegerChanged(array $values, array $tokenAnswers) + public static function checkIntegerChanged(array $values, array $tokenAnswers) { $results = array(); @@ -168,7 +168,7 @@ * @param int $max * @return int */ - public function reverseCode($code, $min, $max) + public static function reverseCode($code, $min, $max) { return $max - ($code - $min); } @@ -182,7 +182,7 @@ * @param int $decimals * @return string */ - protected function roundFixed($value, $decimals = 2) + public static function roundFixed($value, $decimals = 2) { $value = round($value, $decimals); @@ -206,10 +206,10 @@ * @param mixed $fieldNames An array of those names that should be used or a string that should occur in all names that have to be selected. * @return int */ - public function sumInt(array $tokenAnswers, $fieldNames) + public static function sumInt(array $tokenAnswers, $fieldNames) { if (is_string($fieldNames)) { - $fieldNames = $this->_arrayFindName($tokenAnswers, $fieldNames); + $fieldNames = self::_arrayFindName($tokenAnswers, $fieldNames); } $sum = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-05 09:59:23
|
Revision: 925 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=925&view=rev Author: mennodekker Date: 2012-09-05 09:59:13 +0000 (Wed, 05 Sep 2012) Log Message: ----------- Documented property for easier access in editor Modified Paths: -------------- trunk/test/classes/Gems/Test/TestAbstract.php Modified: trunk/test/classes/Gems/Test/TestAbstract.php =================================================================== --- trunk/test/classes/Gems/Test/TestAbstract.php 2012-09-04 14:35:55 UTC (rev 924) +++ trunk/test/classes/Gems/Test/TestAbstract.php 2012-09-05 09:59:13 UTC (rev 925) @@ -58,6 +58,11 @@ * @var Zend_Db */ protected $db = null; + + /** + * @var Gems_Tracker + */ + protected $tracker = null; /** * Sets up the fixture, for example, opens a network connection. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-04 14:36:06
|
Revision: 924 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=924&view=rev Author: mennodekker Date: 2012-09-04 14:35:55 +0000 (Tue, 04 Sep 2012) Log Message: ----------- setDisableTranslator didn't propagate to subforms Modified Paths: -------------- trunk/library/classes/MUtil/Form.php Modified: trunk/library/classes/MUtil/Form.php =================================================================== --- trunk/library/classes/MUtil/Form.php 2012-09-04 14:14:03 UTC (rev 923) +++ trunk/library/classes/MUtil/Form.php 2012-09-04 14:35:55 UTC (rev 924) @@ -232,7 +232,7 @@ $this->setDisableTranslator($disableTranslateValidators); } } - + $valid = parent::isValid($data); if (isset($oldTranslations)) { @@ -276,7 +276,7 @@ if ($flag !== $this->translatorIsDisabled()) { parent::setDisableTranslator($flag); - foreach ($this->getElements() as $element) { + foreach ($this as $element) { $element->setDisableTranslator($flag); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-04 14:14:14
|
Revision: 923 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=923&view=rev Author: mennodekker Date: 2012-09-04 14:14:03 +0000 (Tue, 04 Sep 2012) Log Message: ----------- Fixed label rendering broken by last commit Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2012-09-04 12:18:48 UTC (rev 922) +++ trunk/library/classes/Gems/Form/TableForm.php 2012-09-04 14:14:03 UTC (rev 923) @@ -78,7 +78,7 @@ $dec->setElement($element); $label .= $dec->render(''); } - $content = sprintf('<tr class="%s"><td class="label">%s</td><td class="element">%s</td></tr>', $class, $label, $content); + $content = sprintf('<tr class="%s"><td class="label"><label for="%s">%s</label></td><td class="element">%s</td></tr>', $class, $element->getName(), $label, $content); return $content; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-04 12:18:59
|
Revision: 922 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=922&view=rev Author: mennodekker Date: 2012-09-04 12:18:48 +0000 (Tue, 04 Sep 2012) Log Message: ----------- Saving time by using a callback instead of multiple decorators Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2012-09-04 09:31:21 UTC (rev 921) +++ trunk/library/classes/Gems/Form/TableForm.php 2012-09-04 12:18:48 UTC (rev 922) @@ -53,16 +53,51 @@ private $_alternate = null; + /** + * + * @param string $content + * @param Zend_Form_Element $element + * @param array $options + * @return string + */ + public static function doRowElement($content, $element, array $options) + { + return self::doRow($content, $element->getLabel(), $options['class'], $element); + + return $content; + } + + public static function doRowDisplayGroup($content, $element, array $options) + { + return self::doRow($content, $element->getDescription(), $options['class'], $element); + } + + public static function doRow($content, $label, $class, $element) { + if ($element->getAttrib('tooltip')) { + $dec = new Gems_Form_Decorator_Tooltip(); + $dec->setElement($element); + $label .= $dec->render(''); + } + $content = sprintf('<tr class="%s"><td class="label">%s</td><td class="element">%s</td></tr>', $class, $label, $content); + return $content; + } + protected function _fixDecoratorDisplayGroup(&$element) { // Display group - $element->setDecorators(array('FormElements', + $element->setDecorators( + array('FormElements', + array('Callback', array('callback' => array($this, 'doRowDisplayGroup'), 'class' => $this->_alternate . ' ' . $element->getName(), 'placement'=>false)) + + /* + array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array(array('labelCellClose' => 'HtmlTag'), array('tag' => 'td', 'placement' => Zend_Form_Decorator_Abstract::PREPEND, 'closeOnly' => true)), 'Tooltip', array('Description', array('tag' => 'label', 'class' => 'optional', 'placement' => Zend_Form_Decorator_Abstract::PREPEND, 'escape' => false)), array(array('labelCellOpen' => 'HtmlTag'), array('tag' => 'td', 'class' => 'label', 'placement' => Zend_Form_Decorator_Abstract::PREPEND, 'openOnly' => true)), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'class' => $this->_alternate . ' ' . $element->getName() . ' ' . $element->getAttrib('class'))) + */ )); //Now add the right decorators to the elements @@ -99,12 +134,16 @@ $decorators = array( array('Description', array('class' => 'description')), 'Errors', - array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), - array(array('labelCellClose' => 'HtmlTag'), array('tag' => 'td', 'placement' => Zend_Form_Decorator_Abstract::PREPEND, 'closeOnly' => true)), - 'Tooltip', - array('Label', array('escape' => false)), - array(array('labelCellOpen' => 'HtmlTag'), array('tag' => 'td', 'class' => 'label', 'placement' => Zend_Form_Decorator_Abstract::PREPEND, 'openOnly' => true)), - array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'class' => $this->_alternate . ' ' . $element->getName())) + array('Callback', array('callback' => array($this, 'doRowElement'), 'class' => $this->_alternate . ' ' . $element->getName(), 'placement'=>false)) + + //array('Description', array('class' => 'description')), + //'Errors', + //array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), + //array(array('labelCellClose' => 'HtmlTag'), array('tag' => 'td', 'placement' => Zend_Form_Decorator_Abstract::PREPEND, 'closeOnly' => true)), + //'Tooltip', + //array('Label', array('escape' => false)), + //array(array('labelCellOpen' => 'HtmlTag'), array('tag' => 'td', 'class' => 'label', 'placement' => Zend_Form_Decorator_Abstract::PREPEND, 'openOnly' => true)), + //array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'class' => $this->_alternate . ' ' . $element->getName())) ); if (!is_null($dec1)) { array_unshift($decorators, $dec1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-04 09:31:32
|
Revision: 921 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=921&view=rev Author: mennodekker Date: 2012-09-04 09:31:21 +0000 (Tue, 04 Sep 2012) Log Message: ----------- Made formbridge more flexible by not creating specific elements but have the form create them (can be improved some more) Modified Paths: -------------- trunk/library/classes/MUtil/Model/FormBridge.php Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2012-09-04 08:50:20 UTC (rev 920) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2012-09-04 09:31:21 UTC (rev 921) @@ -114,9 +114,12 @@ * @param Zend_Form_Element $element * @return Zend_Form_Element */ - protected function _addToForm($name, Zend_Form_Element $element) + protected function _addToForm($name, $element, $options = null) { - $this->form->addElement($element); + $this->form->addElement($element, $name, $options); + if (is_string($element)) { + $element = $this->form->getElement($name); + } $this->_applyFilters($name, $element); $this->_applyValidators($name, $element); @@ -319,9 +322,7 @@ self::applyFixedOptions(__FUNCTION__, $options); - $element = new Zend_Form_Element_Checkbox($name, $options); - - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'Checkbox', $options); } /** @@ -339,8 +340,6 @@ $options = $this->_mergeOptions($name, $options, self::DATE_OPTIONS, self::DISPLAY_OPTIONS, self::JQUERY_OPTIONS, self::TEXT_OPTIONS); - $elementName = $name; - // Allow centrally set options self::applyFixedOptions(__FUNCTION__, $options); @@ -349,9 +348,7 @@ $this->getModel()->set($name, 'dateFormat', $options['dateFormat']); } - $element = new MUtil_JQuery_Form_Element_DatePicker($elementName, $options); - - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'DatePicker', $options); } /** @@ -521,9 +518,7 @@ $options['size'] = $count > 5 ? 5 : $count + 1; } - $element = new Zend_Form_Element_Select($name, $options); - - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'Select', $options); } public function addPassword($name, $arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null) @@ -578,11 +573,7 @@ $options = $this->_mergeOptions($name, $options, self::DISPLAY_OPTIONS, self::MULTI_OPTIONS); - $element = new Zend_Form_Element_Radio($name, $options); - - return $this->_addToForm($name, $element); - // $this->form->addDisplayGroup(array($name), $name . '__group', array('Legend' => 'Hi')); - // return $element; + return $this->_addToForm($name, 'Radio', $options); } public function addSelect($name, $arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null) @@ -596,9 +587,7 @@ $options = $this->_mergeOptions($name, $options, self::DISPLAY_OPTIONS, self::MULTI_OPTIONS); - $element = new MUtil_Form_Element_Select($name, $options); - - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'Select', $options); } @@ -622,9 +611,7 @@ $options = $this->_mergeOptions($name, $options, self::DISPLAY_OPTIONS, self::MULTI_OPTIONS); - $element = new Zend_Form_Element_MultiCheckbox($name, $options); - - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'MultiCheckbox', $options); } /** @@ -646,9 +633,7 @@ $options = $this->_mergeOptions($name, $options, self::DISPLAY_OPTIONS, self::MULTI_OPTIONS); - $element = new MUtil_Form_Element_Multiselect($name, $options); - - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'Multiselect', $options); } /** @@ -697,13 +682,11 @@ $stringlength = $this->_getStringLength($options); - $element = new Zend_Form_Element_Text($name, $options); - if ($stringlength) { - $element->addValidator('StringLength', true, $stringlength); + $this->model->set($name, 'validators[]', array('StringLength', true, $stringlength)); } - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'Text', $options); } public function addTextarea($name, $arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null) @@ -718,13 +701,11 @@ // Remove as size and maxlength are not used for textarea's unset($options['size'], $options['maxlength']); - $element = new Zend_Form_Element_Textarea($name, $options); - if ($stringlength) { - $element->addValidator('StringLength', true, $stringlength); + $this->model->set($name, 'validators[]', array('StringLength', true, $stringlength)); } - return $this->_addToForm($name, $element); + return $this->_addToForm($name, 'Textarea', $options); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-04 08:50:31
|
Revision: 920 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=920&view=rev Author: mennodekker Date: 2012-09-04 08:50:20 +0000 (Tue, 04 Sep 2012) Log Message: ----------- Cleaned up some paths we do not need in forms Simplified formbridge to be more efficient Removed unneeded render from tableform Modified Paths: -------------- trunk/library/classes/Gems/Form/TableForm.php trunk/library/classes/Gems/Form.php trunk/library/classes/MUtil/Form.php trunk/library/classes/MUtil/Model/FormBridge.php Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2012-08-30 15:21:34 UTC (rev 919) +++ trunk/library/classes/Gems/Form/TableForm.php 2012-09-04 08:50:20 UTC (rev 920) @@ -265,10 +265,12 @@ */ public function render(Zend_View_Interface $view = null) { - if (!$this->_getIsRendered()) { - $this->fixDecorators(); + if ($this->_getIsRendered()) { + return; } + $this->fixDecorators(); + return parent::render($view); } } \ No newline at end of file Modified: trunk/library/classes/Gems/Form.php =================================================================== --- trunk/library/classes/Gems/Form.php 2012-08-30 15:21:34 UTC (rev 919) +++ trunk/library/classes/Gems/Form.php 2012-09-04 08:50:20 UTC (rev 920) @@ -79,10 +79,8 @@ // $this->addPrefixPath(GEMS_PROJECT_NAME_UC . '_Form_Element', GEMS_PROJECT_NAME_UC . '/Form/Element/', Zend_Form::ELEMENT); parent::__construct($options); - $this->addPrefixPath('Gems_Form_Decorator', 'Gems/Form/Decorator/', Zend_Form::DECORATOR); - $this->addPrefixPath('Gems_Form_Element', 'Gems/Form/Element/', Zend_Form::ELEMENT); + $this->addPrefixPath('Gems_Form_Decorator', 'Gems/Form/Decorator', Zend_Form::DECORATOR); - $this->addElementPrefixPath(GEMS_PROJECT_NAME_UC . '_Validate', GEMS_PROJECT_NAME_UC . '/Validate/', Zend_Form_Element::VALIDATE); $this->addElementPrefixPath('Gems_Form_Decorator', 'Gems/Form/Decorator/', Zend_Form_Element::DECORATOR); $this->addElementPrefixPath('Gems_Filter', 'Gems/Filter/', Zend_Form_Element::FILTER); $this->addElementPrefixPath('Gems_Validate', 'Gems/Validate/', Zend_Form_Element::VALIDATE); Modified: trunk/library/classes/MUtil/Form.php =================================================================== --- trunk/library/classes/MUtil/Form.php 2012-08-30 15:21:34 UTC (rev 919) +++ trunk/library/classes/MUtil/Form.php 2012-09-04 08:50:20 UTC (rev 920) @@ -130,7 +130,7 @@ if ($this->_no_jquery) { ZendX_JQuery::enableForm($this); - $this->addPrefixPath('MUtil_JQuery_Form_Decorator', 'MUtil/JQuery/Form/Decorator/', Zend_Form::DECORATOR); + //$this->addPrefixPath('MUtil_JQuery_Form_Decorator', 'MUtil/JQuery/Form/Decorator/', Zend_Form::DECORATOR); $this->addPrefixPath('MUtil_JQuery_Form_Element', 'MUtil/JQuery/Form/Element/', Zend_Form::ELEMENT); $this->_activateJQueryView(); Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2012-08-30 15:21:34 UTC (rev 919) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2012-09-04 08:50:20 UTC (rev 920) @@ -108,7 +108,7 @@ } /** - * Add the element to the for and apply any filters & validators + * Add the element to the form and apply any filters & validators * * @param string $name * @param Zend_Form_Element $element @@ -173,13 +173,7 @@ } if ($validators) { - foreach ($validators as $validator) { - if (is_array($validator)) { - call_user_func_array(array($element, 'addValidator'), $validator); - } else { - $element->addValidator($validator); - } - } + $element->addValidators($validators); } } @@ -244,32 +238,36 @@ if ($allowedOptions) { // Remove options already filled. Using simple array addition // might trigger a lot of lazy calculations that are not needed. + $allowedOptionsFlipped = array_flip($allowedOptions); - //First strip the options that are not allowed + // First strip the options that are not allowed if (MUtil_Model::$verbose) { - $strippedKeys = array_keys(array_diff_key($options, array_flip($allowedOptions))); + $strippedKeys = array_keys(array_diff_key($options, $allowedOptionsflipped)); if (!empty($strippedKeys)) { MUtil_Echo::r($strippedKeys, 'stripped from options for ' . $name); } } - $options = array_intersect_key($options, array_flip($allowedOptions)); + $options = array_intersect_key($options, $allowedOptionsFlipped); - foreach ($allowedOptions as $key => $option) { - if (array_key_exists($option, $options)) { - unset($allowedOptions[$key]); - } - } + // Now get all options from the model, and extract only the allowed ones + $modelOptions = $this->model->get($name); + $modelOptions = array_intersect_key($modelOptions, $allowedOptionsFlipped); - if ($allowedOptions) { - // MUtil_Echo::r($allowedOptions); - $result = $this->model->get($name, $allowedOptions); - return (array) $result + (array) $options; - } + // Merge them: first use supplied $options, and add missing values from model + return (array) $options + (array) $modelOptions; } return $options; } + /** + * Find $name in the $options array and unset it. If not found, return the $default value + * + * @param string $name + * @param array $options + * @param mixed $default + * @return mixed + */ private function _moveOption($name, array &$options, $default = null) { if (isset($options[$name])) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-08-30 15:21:45
|
Revision: 919 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=919&view=rev Author: matijsdejong Date: 2012-08-30 15:21:34 +0000 (Thu, 30 Aug 2012) Log Message: ----------- Added TableModel fetch and insert tests Added Paths: ----------- trunk/test/classes/MUtil/Model/TableModelTest.php trunk/test/classes/MUtil/Model/TableModelTest.sql trunk/test/classes/MUtil/Model/TableModelTest.xml Property Changed: ---------------- trunk/scripts/ Property changes on: trunk/scripts ___________________________________________________________________ Added: svn:ignore + docs gems.lint reports tmp Added: trunk/test/classes/MUtil/Model/TableModelTest.php =================================================================== --- trunk/test/classes/MUtil/Model/TableModelTest.php (rev 0) +++ trunk/test/classes/MUtil/Model/TableModelTest.php 2012-08-30 15:21:34 UTC (rev 919) @@ -0,0 +1,117 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package MUtil + * @subpackage Model + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ + */ + +/** + * + * + * @package MUtil + * @subpackage Model + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.6 + */ +class MUtil_Model_TableModelTest extends Zend_Test_PHPUnit_DatabaseTestCase +{ + /** + * + * @var PHPUnit_Extensions_Database_DB_IDatabaseConnection + */ + private $_connectionMock; + + /** + * + * @var MUtil_Model_TableModel + */ + private $_model; + + /** + * Returns the test database connection. + * + * @return PHPUnit_Extensions_Database_DB_IDatabaseConnection + */ + protected function getConnection() + { + if($this->_connectionMock == null) { + $connection = Zend_Db::factory('Pdo_Sqlite', array('dbname' => ':memory:', 'username' => 'test')); + + $sql = file_get_contents(str_replace('.php', '.sql', __FILE__)); + $stmt = $connection->query($sql); + $this->_connectionMock = $this->createZendDbConnection( + $connection, 'zfunittests' + ); + Zend_Db_Table_Abstract::setDefaultAdapter($connection); + } + + return $this->_connectionMock; + } + + /** + * Returns the test dataset. + * + * @return PHPUnit_Extensions_Database_DataSet_IDataSet + */ + protected function getDataSet() + { + return $this->createFlatXMLDataSet(str_replace('.php', '.xml', __FILE__)); + } + + protected function getModel() + { + if (! $this->_model) { + $this->_model = new MUtil_Model_TableModel('t1'); + } + + return $this->_model; + } + + public function testHasFirstRow() + { + $model = $this->getModel(); + $rows = $model->load(); + $this->assertCount(1, $rows); + } + + public function testInsertARow() + { + $model = $this->getModel(); + $result = $model->save(array('id' => null, 'c1' => "col1-2", 'c2' => "col2-2")); + $this->assertEquals(2, $result['id']); + + $rows = $model->load(); + $this->assertCount(2, $rows); + } +} Added: trunk/test/classes/MUtil/Model/TableModelTest.sql =================================================================== --- trunk/test/classes/MUtil/Model/TableModelTest.sql (rev 0) +++ trunk/test/classes/MUtil/Model/TableModelTest.sql 2012-08-30 15:21:34 UTC (rev 919) @@ -0,0 +1,6 @@ + +CREATE TABLE t1 ( + id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + c1 VARCHAR(10), + c2 VARCHAR(10) +) Added: trunk/test/classes/MUtil/Model/TableModelTest.xml =================================================================== --- trunk/test/classes/MUtil/Model/TableModelTest.xml (rev 0) +++ trunk/test/classes/MUtil/Model/TableModelTest.xml 2012-08-30 15:21:34 UTC (rev 919) @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<dataset> + <t1 id="1" c1="col1-1" c2="col2-1" /> +</dataset> \ 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-08-30 14:24:49
|
Revision: 918 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=918&view=rev Author: mennodekker Date: 2012-08-30 14:24:40 +0000 (Thu, 30 Aug 2012) Log Message: ----------- Slightly better handling of not completely loaded token Modified Paths: -------------- trunk/library/classes/Gems/Tracker/Token.php Modified: trunk/library/classes/Gems/Tracker/Token.php =================================================================== --- trunk/library/classes/Gems/Tracker/Token.php 2012-08-30 14:12:18 UTC (rev 917) +++ trunk/library/classes/Gems/Tracker/Token.php 2012-08-30 14:24:40 UTC (rev 918) @@ -843,7 +843,11 @@ */ public function getRespondentId() { - return $this->_gemsData['gto_id_respondent']; + if (array_key_exists('gto_id_respondent', $this->_gemsData)) { + return $this->_gemsData['gto_id_respondent']; + } else { + throw new Gems_Exception('Token not loaded correctly'); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-08-30 14:12:24
|
Revision: 917 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=917&view=rev Author: michieltcs Date: 2012-08-30 14:12:18 +0000 (Thu, 30 Aug 2012) Log Message: ----------- Add todo annotation about ip2long Modified Paths: -------------- trunk/library/classes/Gems/Validate/IPRanges.php Modified: trunk/library/classes/Gems/Validate/IPRanges.php =================================================================== --- trunk/library/classes/Gems/Validate/IPRanges.php 2012-08-30 13:52:12 UTC (rev 916) +++ trunk/library/classes/Gems/Validate/IPRanges.php 2012-08-30 14:12:18 UTC (rev 917) @@ -68,6 +68,7 @@ * @param mixed $value * @return boolean * @throws Zend_Valid_Exception If validation of $value is impossible + * @todo ip2long is broken on Windows, find a replacement */ public function isValid($value, $context = array()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-08-30 13:52:18
|
Revision: 916 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=916&view=rev Author: mennodekker Date: 2012-08-30 13:52:12 +0000 (Thu, 30 Aug 2012) Log Message: ----------- added failing test, exposing flaw in Gems_Tracker_Token Modified Paths: -------------- trunk/test/classes/Gems/Tracker/TokenTest.php Modified: trunk/test/classes/Gems/Tracker/TokenTest.php =================================================================== --- trunk/test/classes/Gems/Tracker/TokenTest.php 2012-08-30 13:31:46 UTC (rev 915) +++ trunk/test/classes/Gems/Tracker/TokenTest.php 2012-08-30 13:52:12 UTC (rev 916) @@ -52,7 +52,7 @@ /** * @var Gems_Tracker_Token */ - protected $object; + protected $token; /** * Sets up the fixture, for example, opens a network connection. @@ -395,10 +395,7 @@ */ public function testGetRespondentId() { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $this->assertNotEmpty($this->token->getRespondentId(), 'Any token should have a respondentId'); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-08-30 13:31:58
|
Revision: 915 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=915&view=rev Author: michieltcs Date: 2012-08-30 13:31:46 +0000 (Thu, 30 Aug 2012) Log Message: ----------- Add abstract test class for Gems objects and first draft of Token test class Added Paths: ----------- trunk/test/classes/Gems/Test/ trunk/test/classes/Gems/Test/TestAbstract.php trunk/test/classes/Gems/Tracker/ trunk/test/classes/Gems/Tracker/TokenTest.php Added: trunk/test/classes/Gems/Test/TestAbstract.php =================================================================== --- trunk/test/classes/Gems/Test/TestAbstract.php (rev 0) +++ trunk/test/classes/Gems/Test/TestAbstract.php 2012-08-30 13:31:46 UTC (rev 915) @@ -0,0 +1,82 @@ +<?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. + * + * + * Base test class for Gems object test cases + * + * @package Gems + * @subpackage Test + * @author Michiel Rook <mi...@to...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $Id$ + */ + +/** + * Base test class for Gems object test cases + * + * @package Gems + * @subpackage Test + * @author Michiel Rook <mi...@to...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $Id$ + */ +abstract class Gems_Test_TestAbstract extends PHPUnit_Framework_TestCase +{ + /** + * @var Gems_Loader + */ + protected $loader = null; + + /** + * @var Zend_Db + */ + protected $db = null; + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + global $GEMS_DIRS; + + $this->db = Zend_Db::factory('pdo_sqlite', array('dbname'=>':memory:')); + + Zend_Registry::set('db', $this->db); + + $this->loader = new Gems_Loader(Zend_Registry::getInstance(), $GEMS_DIRS); + + Zend_Registry::set('loader', $this->loader); + + $this->tracker = $this->loader->getTracker(); + + Zend_Registry::set('tracker', $this->tracker); + } +} Property changes on: trunk/test/classes/Gems/Test/TestAbstract.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Added: svn:eol-style + native Added: trunk/test/classes/Gems/Tracker/TokenTest.php =================================================================== --- trunk/test/classes/Gems/Tracker/TokenTest.php (rev 0) +++ trunk/test/classes/Gems/Tracker/TokenTest.php 2012-08-30 13:31:46 UTC (rev 915) @@ -0,0 +1,823 @@ +<?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. + * + * + * Test class for Gems_Tracker_Token + * + * @package Gems + * @subpackage Test + * @author Michiel Rook <mi...@to...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $Id$ + */ + +/** + * Test class for Gems_Tracker_Token + * + * @package Gems + * @subpackage Tracker + * @author Michiel Rook <mi...@to...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $Id$ + */ +class Gems_Tracker_TokenTest extends Gems_Test_TestAbstract +{ + /** + * @var Gems_Tracker_Token + */ + protected $object; + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + parent::setUp(); + + $this->token = $this->tracker->getToken(array('gto_id_token' => 500)); + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + } + + /** + * @covers Gems_Tracker_Token::applyToMenuSource + * @todo Implement testApplyToMenuSource(). + */ + public function testApplyToMenuSource() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::cacheGet + * @covers Gems_Tracker_Token::cacheSet + */ + public function testCacheSetGet() + { + $this->token->cacheSet('foo1', 'baz'); + $this->assertEquals('baz', $this->token->cacheGet('foo1')); + } + + /** + * @covers Gems_Tracker_Token::cacheHas + */ + public function testCacheHas() + { + $this->assertEquals(null, $this->token->cacheHas('foo2')); + } + + /** + * @covers Gems_Tracker_Token::cacheReset + */ + public function testCacheReset() + { + $this->token->cacheSet('foo3', 'baz'); + $this->token->cacheReset(); + $this->assertEquals(null, $this->token->cacheGet('foo3')); + } + + /** + * @covers Gems_Tracker_Token::checkRegistryRequestsAnswers + * @todo Implement testCheckRegistryRequestsAnswers(). + */ + public function testCheckRegistryRequestsAnswers() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::checkTokenCompletion + * @todo Implement testCheckTokenCompletion(). + */ + public function testCheckTokenCompletion() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::createReplacement + * @todo Implement testCreateReplacement(). + */ + public function testCreateReplacement() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getAnswerDateTime + * @todo Implement testGetAnswerDateTime(). + */ + public function testGetAnswerDateTime() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getAnswerSnippetNames + * @todo Implement testGetAnswerSnippetNames(). + */ + public function testGetAnswerSnippetNames() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getChangedBy + * @todo Implement testGetChangedBy(). + */ + public function testGetChangedBy() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getCompletionTime + * @todo Implement testGetCompletionTime(). + */ + public function testGetCompletionTime() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getConsentCode + * @todo Implement testGetConsentCode(). + */ + public function testGetConsentCode() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getDateTime + * @todo Implement testGetDateTime(). + */ + public function testGetDateTime() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getDeleteSnippetNames + * @todo Implement testGetDeleteSnippetNames(). + */ + public function testGetDeleteSnippetNames() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getEditSnippetNames + * @todo Implement testGetEditSnippetNames(). + */ + public function testGetEditSnippetNames() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getModel + * @todo Implement testGetModel(). + */ + public function testGetModel() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getNextToken + * @todo Implement testGetNextToken(). + */ + public function testGetNextToken() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getNextUnansweredToken + * @todo Implement testGetNextUnansweredToken(). + */ + public function testGetNextUnansweredToken() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getOrganization + * @todo Implement testGetOrganization(). + */ + public function testGetOrganization() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getOrganizationId + * @todo Implement testGetOrganizationId(). + */ + public function testGetOrganizationId() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getPatientNumber + * @todo Implement testGetPatientNumber(). + */ + public function testGetPatientNumber() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getPreviousSuccessToken + * @todo Implement testGetPreviousSuccessToken(). + */ + public function testGetPreviousSuccessToken() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getPreviousToken + * @todo Implement testGetPreviousToken(). + */ + public function testGetPreviousToken() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getRawAnswers + * @todo Implement testGetRawAnswers(). + */ + public function testGetRawAnswers() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getReceptionCode + * @todo Implement testGetReceptionCode(). + */ + public function testGetReceptionCode() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getRespondentGender + * @todo Implement testGetRespondentGender(). + */ + public function testGetRespondentGender() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getRespondentGenderHello + * @todo Implement testGetRespondentGenderHello(). + */ + public function testGetRespondentGenderHello() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getRespondentId + * @todo Implement testGetRespondentId(). + */ + public function testGetRespondentId() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getRespondentLastName + * @todo Implement testGetRespondentLastName(). + */ + public function testGetRespondentLastName() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getRespondentName + * @todo Implement testGetRespondentName(). + */ + public function testGetRespondentName() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getRespondentTrack + * @todo Implement testGetRespondentTrack(). + */ + public function testGetRespondentTrack() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getRespondentTrackId + * @todo Implement testGetRespondentTrackId(). + */ + public function testGetRespondentTrackId() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getReturnUrl + * @todo Implement testGetReturnUrl(). + */ + public function testGetReturnUrl() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getRoundDescription + * @todo Implement testGetRoundDescription(). + */ + public function testGetRoundDescription() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getRoundId + * @todo Implement testGetRoundId(). + */ + public function testGetRoundId() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getRoundOrder + * @todo Implement testGetRoundOrder(). + */ + public function testGetRoundOrder() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getShowSnippetNames + * @todo Implement testGetShowSnippetNames(). + */ + public function testGetShowSnippetNames() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getStatus + * @todo Implement testGetStatus(). + */ + public function testGetStatus() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getSurvey + * @todo Implement testGetSurvey(). + */ + public function testGetSurvey() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getSurveyId + * @todo Implement testGetSurveyId(). + */ + public function testGetSurveyId() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getSurveyAnswerModel + * @todo Implement testGetSurveyAnswerModel(). + */ + public function testGetSurveyAnswerModel() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getSurveyName + * @todo Implement testGetSurveyName(). + */ + public function testGetSurveyName() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getTokenCountUnanswered + * @todo Implement testGetTokenCountUnanswered(). + */ + public function testGetTokenCountUnanswered() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getTokenId + * @todo Implement testGetTokenId(). + */ + public function testGetTokenId() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getTrackEngine + * @todo Implement testGetTrackEngine(). + */ + public function testGetTrackEngine() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getTrackId + * @todo Implement testGetTrackId(). + */ + public function testGetTrackId() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getUrl + * @todo Implement testGetUrl(). + */ + public function testGetUrl() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getValidFrom + * @todo Implement testGetValidFrom(). + */ + public function testGetValidFrom() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::getValidUntil + * @todo Implement testGetValidUntil(). + */ + public function testGetValidUntil() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::hasAnswersLoaded + * @todo Implement testHasAnswersLoaded(). + */ + public function testHasAnswersLoaded() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::hasResult + * @todo Implement testHasResult(). + */ + public function testHasResult() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::handleAfterCompletion + * @todo Implement testHandleAfterCompletion(). + */ + public function testHandleAfterCompletion() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::handleBeforeAnswering + * @todo Implement testHandleBeforeAnswering(). + */ + public function testHandleBeforeAnswering() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::hasRedoCode + * @todo Implement testHasRedoCode(). + */ + public function testHasRedoCode() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::hasRedoCopyCode + * @todo Implement testHasRedoCopyCode(). + */ + public function testHasRedoCopyCode() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::hasSuccesCode + * @todo Implement testHasSuccesCode(). + */ + public function testHasSuccesCode() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::inSource + * @todo Implement testInSource(). + */ + public function testInSource() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::isCompleted + * @todo Implement testIsCompleted(). + */ + public function testIsCompleted() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::refresh + * @todo Implement testRefresh(). + */ + public function testRefresh() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::setNextToken + * @todo Implement testSetNextToken(). + */ + public function testSetNextToken() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::setRawAnswers + * @todo Implement testSetRawAnswers(). + */ + public function testSetRawAnswers() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::setReceptionCode + * @todo Implement testSetReceptionCode(). + */ + public function testSetReceptionCode() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } + + /** + * @covers Gems_Tracker_Token::setValidFrom + * @todo Implement testSetValidFrom(). + */ + public function testSetValidFrom() + { + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); + } +} Property changes on: trunk/test/classes/Gems/Tracker/TokenTest.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-08-30 13:31:10
|
Revision: 914 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=914&view=rev Author: michieltcs Date: 2012-08-30 13:31:04 +0000 (Thu, 30 Aug 2012) Log Message: ----------- Switch to development mode by default Modified Paths: -------------- trunk/test/bootstrap.php Modified: trunk/test/bootstrap.php =================================================================== --- trunk/test/bootstrap.php 2012-08-30 13:29:30 UTC (rev 913) +++ trunk/test/bootstrap.php 2012-08-30 13:31:04 UTC (rev 914) @@ -46,7 +46,7 @@ define('GEMS_LIBRARY_DIR', realpath(dirname(__FILE__) . '/../library')); define('GEMS_PROJECT_NAME', 'newProject'); define('GEMS_PROJECT_NAME_UC', ucfirst(GEMS_PROJECT_NAME)); -define('APPLICATION_ENV', 'testing'); +define('APPLICATION_ENV', 'development'); define('APPLICATION_PATH', GEMS_ROOT_DIR . '/application'); $GLOBALS['GEMS_DIRS'] = array( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-08-30 13:29:39
|
Revision: 913 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=913&view=rev Author: michieltcs Date: 2012-08-30 13:29:30 +0000 (Thu, 30 Aug 2012) Log Message: ----------- Don't stop on failures Modified Paths: -------------- trunk/test/phpunit.xml Modified: trunk/test/phpunit.xml =================================================================== --- trunk/test/phpunit.xml 2012-08-30 13:00:42 UTC (rev 912) +++ trunk/test/phpunit.xml 2012-08-30 13:29:30 UTC (rev 913) @@ -7,7 +7,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="false" processIsolation="false" - stopOnFailure="true" + stopOnFailure="false" syntaxCheck="false" verbose="true" strict="true"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-08-30 13:00:48
|
Revision: 912 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=912&view=rev Author: mennodekker Date: 2012-08-30 13:00:42 +0000 (Thu, 30 Aug 2012) Log Message: ----------- Removed IPRanges test as ip2long is not reliable between windows and *nix based systems Removed Paths: ------------- trunk/test/classes/Gems/Validate/IPRangesTest.php Deleted: trunk/test/classes/Gems/Validate/IPRangesTest.php =================================================================== --- trunk/test/classes/Gems/Validate/IPRangesTest.php 2012-08-29 14:55:50 UTC (rev 911) +++ trunk/test/classes/Gems/Validate/IPRangesTest.php 2012-08-30 13:00:42 UTC (rev 912) @@ -1,66 +0,0 @@ -<?php -class Gems_Validate_IPRangesTest extends PHPUnit_Framework_TestCase -{ -/** - * @var Gems_Validate_IPRanges - */ - protected $object; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() - { - $this->object = new Gems_Validate_IPRanges(); - } - - /** - * @dataProvider providerValidIPRanges - */ - public function testValidIPRange($input) { - $this->assertTrue($this->object->isValid($input)); - } - - /** - * @dataProvider providerInValidIPRanges - */ - public function testInValidIPRange($input) { - $this->assertFalse($this->object->isValid($input)); - } - - /** - * This should be valid ip ranges - * - * @return array - */ - public static function providerValidIPRanges() { - return array( - array('1-2'), - array('10.1.1.2-20.1.2.3'), - array('1|2'), - ); - } - - /** - * This should be invalid ip ranges - * - * @return array - */ - public static function providerInValidIPRanges() { - return array( - array(''), - array('a'), - array('10.1.1.1-a'), - ); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - - } -} \ 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-08-29 14:56:01
|
Revision: 911 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=911&view=rev Author: matijsdejong Date: 2012-08-29 14:55:50 +0000 (Wed, 29 Aug 2012) Log Message: ----------- Removed Lazy functions from code Added comments Modified Paths: -------------- trunk/library/classes/Gems/Menu.php trunk/library/classes/MUtil/Lazy/Procrastinator.php trunk/library/classes/MUtil/Lazy.php trunk/library/pre_bootstrap.php trunk/test/classes/MUtil/Parser/Sql/WordsParserTest.php Modified: trunk/library/classes/Gems/Menu.php =================================================================== --- trunk/library/classes/Gems/Menu.php 2012-08-29 14:21:36 UTC (rev 910) +++ trunk/library/classes/Gems/Menu.php 2012-08-29 14:55:50 UTC (rev 911) @@ -290,7 +290,7 @@ ->setHiddenOrgId($orgId); /* - iff( + MUtil_Lazy::iff( is('gr2o_id_organization', $this->escort->getCurrentOrganization()), aget(MUtil_Model::REQUEST_ID, 'gr2o_patient_nr'), aget(MUtil_Model::REQUEST_ID1, 'gr2o_patient_nr', MUtil_Model::REQUEST_ID2, 'gr2o_id_organization') @@ -338,7 +338,7 @@ ->addAutofilterAction(); /* - iff(is('gtr_track_type', $trType), aget(MUtil_Model::REQUEST_ID, 'gr2o_patient_nr', Gems_Model::TRACK_ID, 'gtr_id_track')) + MUtil_Lazy::iff(is('gtr_track_type', $trType), aget(MUtil_Model::REQUEST_ID, 'gr2o_patient_nr', Gems_Model::TRACK_ID, 'gtr_id_track')) */ $trPage->addAction($this->_('Add'), 'pr.track.create', 'create') ->setNamedParameters($params) Modified: trunk/library/classes/MUtil/Lazy/Procrastinator.php =================================================================== --- trunk/library/classes/MUtil/Lazy/Procrastinator.php 2012-08-29 14:21:36 UTC (rev 910) +++ trunk/library/classes/MUtil/Lazy/Procrastinator.php 2012-08-29 14:55:50 UTC (rev 911) @@ -1,41 +1,46 @@ <?php - -/** - * Copyright (c) 2011, Erasmus MC - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Erasmus MC nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - /** - * @author Matijs de Jong - * @since 1.0 - * @version 1.1 - * @package MUtil + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * @package MUtil * @subpackage Lazy + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ */ +/** + * @package MUtil + * @subpackage Lazy + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 + */ interface MUtil_Lazy_Procrastinator { /** Modified: trunk/library/classes/MUtil/Lazy.php =================================================================== --- trunk/library/classes/MUtil/Lazy.php 2012-08-29 14:21:36 UTC (rev 910) +++ trunk/library/classes/MUtil/Lazy.php 2012-08-29 14:55:50 UTC (rev 911) @@ -126,6 +126,12 @@ return new MUtil_Lazy_Call(array($if, 'if'), array($then, $else)); } + /** + * Returns a Lazy version of the parameter + * + * @param mixed $var + * @return MUtil_Lazy_LazyInterface + */ public static function L($var) { if (is_object($var)) { @@ -269,4 +275,4 @@ { return MUtil_Lazy::L($var); } - } \ No newline at end of file + } Modified: trunk/library/pre_bootstrap.php =================================================================== --- trunk/library/pre_bootstrap.php 2012-08-29 14:21:36 UTC (rev 910) +++ trunk/library/pre_bootstrap.php 2012-08-29 14:55:50 UTC (rev 911) @@ -1,10 +1,9 @@ <?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 @@ -15,7 +14,7 @@ * * Neither the name of Erasmus MC nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -68,7 +67,7 @@ set_include_path( GEMS_LIBRARY_DIR . '/classes' . PATH_SEPARATOR . APPLICATION_PATH . '/classes' . PATH_SEPARATOR . - get_include_path() + get_include_path() //. PATH_SEPARATOR . GEMS_ROOT_DIR . '/library' //Shouldn't be needed, uncomment when neccessary ); @@ -78,7 +77,7 @@ ); // Make sure Lazy is loaded -defined('MUTIL_LAZY_FUNCTIONS') || define('MUTIL_LAZY_FUNCTIONS', 1); +// defined('MUTIL_LAZY_FUNCTIONS') || define('MUTIL_LAZY_FUNCTIONS', 1); require_once 'MUtil/Lazy.php'; // Zend_Application: loads the autoloader Modified: trunk/test/classes/MUtil/Parser/Sql/WordsParserTest.php =================================================================== --- trunk/test/classes/MUtil/Parser/Sql/WordsParserTest.php 2012-08-29 14:21:36 UTC (rev 910) +++ trunk/test/classes/MUtil/Parser/Sql/WordsParserTest.php 2012-08-29 14:55:50 UTC (rev 911) @@ -28,7 +28,7 @@ * * * @package MUtil - * @subpackage Parser + * @subpackage Parser_Sql * @author Matijs de Jong <mj...@ma...> * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License @@ -41,7 +41,7 @@ * * * @package MUtil - * @subpackage Parser + * @subpackage Parser_Sql * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License * @since Class available since version 1.5 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-08-29 14:21:47
|
Revision: 910 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=910&view=rev Author: mennodekker Date: 2012-08-29 14:21:36 +0000 (Wed, 29 Aug 2012) Log Message: ----------- Fixed FormBridgeTest, introduced IPRangesTest Modified Paths: -------------- trunk/test/classes/MUtil/Model/FormBridgeTest.php Added Paths: ----------- trunk/test/classes/Gems/Validate/ trunk/test/classes/Gems/Validate/IPRangesTest.php Removed Paths: ------------- trunk/test/data/TestModel.php Added: trunk/test/classes/Gems/Validate/IPRangesTest.php =================================================================== --- trunk/test/classes/Gems/Validate/IPRangesTest.php (rev 0) +++ trunk/test/classes/Gems/Validate/IPRangesTest.php 2012-08-29 14:21:36 UTC (rev 910) @@ -0,0 +1,66 @@ +<?php +class Gems_Validate_IPRangesTest extends PHPUnit_Framework_TestCase +{ +/** + * @var Gems_Validate_IPRanges + */ + protected $object; + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + $this->object = new Gems_Validate_IPRanges(); + } + + /** + * @dataProvider providerValidIPRanges + */ + public function testValidIPRange($input) { + $this->assertTrue($this->object->isValid($input)); + } + + /** + * @dataProvider providerInValidIPRanges + */ + public function testInValidIPRange($input) { + $this->assertFalse($this->object->isValid($input)); + } + + /** + * This should be valid ip ranges + * + * @return array + */ + public static function providerValidIPRanges() { + return array( + array('1-2'), + array('10.1.1.2-20.1.2.3'), + array('1|2'), + ); + } + + /** + * This should be invalid ip ranges + * + * @return array + */ + public static function providerInValidIPRanges() { + return array( + array(''), + array('a'), + array('10.1.1.1-a'), + ); + } + + /** + * Tears down the fixture, for example, closes a network connection. + * This method is called after a test is executed. + */ + protected function tearDown() + { + + } +} \ No newline at end of file Modified: trunk/test/classes/MUtil/Model/FormBridgeTest.php =================================================================== --- trunk/test/classes/MUtil/Model/FormBridgeTest.php 2012-08-29 14:03:22 UTC (rev 909) +++ trunk/test/classes/MUtil/Model/FormBridgeTest.php 2012-08-29 14:21:36 UTC (rev 910) @@ -23,7 +23,6 @@ { parent::setUp(); - require_once GEMS_WEB_DIR . '/data/TestModel.php'; $this->model = $this->getMockForAbstractClass('MUtil_Model_ModelAbstract', array('testModel')); $this->options = array( Deleted: trunk/test/data/TestModel.php =================================================================== --- trunk/test/data/TestModel.php 2012-08-29 14:03:22 UTC (rev 909) +++ trunk/test/data/TestModel.php 2012-08-29 14:21:36 UTC (rev 910) @@ -1,28 +0,0 @@ -<?php -/** - * This is a simple testmodel without any added functionality to be able to the the basic model workings except - * for the load, save and delete methods - */ -class TestModel extends MUtil_Model_ModelAbstract -{ - //put your code here - protected function _load($filter = true, $sort = true) - { - return false; - } - - public function delete($filter = true) - { - return 0; - } - - public function hasNew() - { - return false; - } - - public function save(array $newValues, array $filter = null) - { - return $newValues; - } -} \ 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-08-29 14:03:34
|
Revision: 909 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=909&view=rev Author: matijsdejong Date: 2012-08-29 14:03:22 +0000 (Wed, 29 Aug 2012) Log Message: ----------- WordParser now accepts double quotes as quotes as well Extra code comments New tests for MUtil/Ra.php and MUtil/Parser/Sql/WordsParser.php Modified Paths: -------------- trunk/library/classes/MUtil/Parser/Sql/WordsParser.php trunk/library/classes/MUtil/Ra.php trunk/test/classes/MUtil/RaTest.php Added Paths: ----------- trunk/test/classes/MUtil/Parser/ trunk/test/classes/MUtil/Parser/Sql/ trunk/test/classes/MUtil/Parser/Sql/WordsParserTest.php Modified: trunk/library/classes/MUtil/Parser/Sql/WordsParser.php =================================================================== --- trunk/library/classes/MUtil/Parser/Sql/WordsParser.php 2012-08-29 13:55:13 UTC (rev 908) +++ trunk/library/classes/MUtil/Parser/Sql/WordsParser.php 2012-08-29 14:03:22 UTC (rev 909) @@ -56,25 +56,22 @@ const MODE_COMMA = 3; const MODE_SEMI_COLON = 4; const MODE_QUOTED_STRING = 100; - const MODE_LINE_COMMENT = 101; - const MODE_ACCESS_NAME = 102; + const MODE_DOUBLE_QUOTED_STRING = 101; + const MODE_LINE_COMMENT = 102; + const MODE_ACCESS_NAME = 104; const MODE_MULTI_LINE_COMMENT = 201; - private $make_word_function; - private $len; - private $len_minus_1; - private $line; - private $pos; - private $start; - private $statement; + private $_makeWordFunction; + private $_len; + private $_lenMinusOne; + private $_line; + private $_pos; + private $_start; + private $_statement; /** * - * @param unknown_type $statements The sql statements to parse - * @param unknown_type $make_word_function aq function in the form: self::makeWord($word, $is_word, $start_line, $start_char) - * @return unknown_type - * - * $make_word_function should be a function accepting these + * $makeWordFunction should be a function accepting these * parameters and returning an object that should be added to * the array returned as a result from splitStatement(): * @@ -82,46 +79,50 @@ * * The default implementations does returns an array of words, * throwing out the positional and word information. + * + * @param string $statements The sql statements to parse + * @param callable $makeWordFunction A function with the parameters: + * function($word, $is_word, $start_line, $start_char) */ - public function __construct($statements, $make_word_function = null) + public function __construct($statements, $makeWordFunction = null) { - $this->statement = $statements; - $this->len = strlen($statements); - $this->len_minus_1 = $this->len - 1; - $this->line = 1; - $this->pos = 1; - $this->start = 0; - if ($make_word_function) { - $this->make_word_function = $make_word_function; + $this->_statement = $statements; + $this->_len = strlen($statements); + $this->_lenMinusOne = $this->_len - 1; + $this->_line = 1; + $this->_pos = 1; + $this->_start = 0; + if ($makeWordFunction) { + $this->_makeWordFunction = $makeWordFunction; } else { - $this->make_word_function = array(__CLASS__, 'makeWord'); + $this->_makeWordFunction = array(__CLASS__, 'makeWord'); } } private function findCharEnd($i, $char, $start_line = 0, $start_pos = 0) { if ($start_line == 0) { - $start_line = $this->line; - $start_pos = $this->pos; + $start_line = $this->_line; + $start_pos = $this->_pos; } - while ((++$i < $this->len) && ($this->statement[$i] != $char)) { + while ((++$i < $this->_len) && ($this->_statement[$i] != $char)) { $this->setLine($i); // Check for escape - if ($this->statement[$i] == '\\') { + if ($this->_statement[$i] == '\\') { $i++; - $this->pos++; + $this->_pos++; } } - if ($i >= $this->len) { + if ($i >= $this->_len) { throw new MUtil_Parser_Sql_WordsParserException('Opening '.$char.' does not close', $start_line, $start_pos); } // Check for character repeat - if (($i < $this->len_minus_1) && ($this->statement[$i + 1] == $char)) { - $this->pos += 2; + if (($i < $this->_lenMinusOne) && ($this->_statement[$i + 1] == $char)) { + $this->_pos += 2; return $this->findCharEnd($i + 1, $char, $start_line, $start_pos); } @@ -135,15 +136,15 @@ $char2 = $chars[1]; if ($start_line == 0) { - $start_line = $this->line; - $start_pos = $this->pos; + $start_line = $this->_line; + $start_pos = $this->_pos; } - while ((++$i < $this->len_minus_1) && (! (($this->statement[$i] == $char1) && ($this->statement[$i + 1] == $char2)))) { + while ((++$i < $this->_lenMinusOne) && (! (($this->_statement[$i] == $char1) && ($this->_statement[$i + 1] == $char2)))) { $this->setLine($i); } - if ($i >= $this->len) { + if ($i >= $this->_len) { throw new MUtil_Parser_Sql_WordsParserException('Opening '.$chars.' does not close', $start_line, $start_pos); } @@ -154,14 +155,14 @@ private function findLineEnd($i) { - $epos = strpos($this->statement, "\n", $i + 1); + $epos = strpos($this->_statement, "\n", $i + 1); if ($epos === false) { - return $this->len; + return $this->_len; } // One less on Windows line end - if ($this->statement[$epos - 1] == "\r") { + if ($this->_statement[$epos - 1] == "\r") { return $epos - 2; } return $epos - 1; @@ -187,7 +188,7 @@ private function mode($i) { - switch ($this->statement[$i]) { + switch ($this->_statement[$i]) { case ' ': case "\n": case "\t": @@ -195,6 +196,8 @@ return self::MODE_WHITESPACE; case '\'': return self::MODE_QUOTED_STRING; + case '"': + return self::MODE_DOUBLE_QUOTED_STRING; case ',': return self::MODE_COMMA; case ';': @@ -207,17 +210,17 @@ case '[': return self::MODE_ACCESS_NAME; case '-': - if (($i < $this->len_minus_1) && ($this->statement[$i + 1] == '-')) { + if (($i < $this->_lenMinusOne) && ($this->_statement[$i + 1] == '-')) { return self::MODE_LINE_COMMENT; } case '/': - if (($i < $this->len_minus_1) && ($this->statement[$i + 1] == '*') && ($this->statement[$i] != '-')) { + if (($i < $this->_lenMinusOne) && ($this->_statement[$i + 1] == '*') && ($this->_statement[$i] != '-')) { return self::MODE_MULTI_LINE_COMMENT; } default: // Last ditch check - if (ctype_space($this->statement[$i])) { + if (ctype_space($this->_statement[$i])) { return self::MODE_WHITESPACE; } @@ -261,19 +264,25 @@ private function setLine($i) { - if ($this->statement[$i] == "\n") { - $this->line++; - $this->pos = 0; + if ($this->_statement[$i] == "\n") { + $this->_line++; + $this->_pos = 0; } else { - $this->pos++; + $this->_pos++; } } - public function splitStatement($keep_comments = true) + /** + * Split the next statement into word parts + * + * @param boolean $keepComments When false comment statements are removed from the output + * @return array Of sql 'words' + */ + public function splitStatement($keepComments = true) { - $i = $this->start; + $i = $this->_start; - if ($i >= $this->len) { + if ($i >= $this->_len) { return; } @@ -281,6 +290,9 @@ case self::MODE_QUOTED_STRING: $i = $this->findCharEnd($i, '\''); break; + case self::MODE_DOUBLE_QUOTED_STRING: + $i = $this->findCharEnd($i, '"'); + break; case self::MODE_LINE_COMMENT: $i = $this->findLineEnd($i) + 1; break; @@ -293,12 +305,12 @@ } $last = null; $mode_start = $i; - $mode_start_line = $this->line; - $mode_start_char = $this->pos; + $mode_start_line = $this->_line; + $mode_start_char = $this->_pos; $sql = array(); - while ($i < $this->len) { + while ($i < $this->_len) { // Take care of positioning $this->setLine($i); @@ -307,17 +319,20 @@ $next_mode = $this->mode($i); if (($this_mode != $next_mode) || self::modeIsOneChar($this_mode)) { - if ($keep_comments || self::modeNotComment($this_mode)) { - $sql[] = call_user_func($this->make_word_function, substr($this->statement, $mode_start, $i - $mode_start), self::modeIsWord($this_mode), $mode_start_line, $mode_start_char); + if ($keepComments || self::modeNotComment($this_mode)) { + $sql[] = call_user_func($this->_makeWordFunction, substr($this->_statement, $mode_start, $i - $mode_start), self::modeIsWord($this_mode), $mode_start_line, $mode_start_char); } $mode_start = $i; - $mode_start_line = $this->line; - $mode_start_char = $this->pos; + $mode_start_line = $this->_line; + $mode_start_char = $this->_pos; switch ($next_mode) { case self::MODE_QUOTED_STRING: $i = $this->findCharEnd($i, '\''); break; + case self::MODE_DOUBLE_QUOTED_STRING: + $i = $this->findCharEnd($i, '"'); + break; case self::MODE_LINE_COMMENT: $i = $this->findLineEnd($i); break; @@ -328,7 +343,7 @@ $i = $this->findCharsEnd($i, '*/'); break; case self::MODE_SEMI_COLON: - $this->start = $i + 1; + $this->_start = $i + 1; return $sql; } } @@ -337,22 +352,32 @@ } // BUG WARNING: Use $next_mode in this line because the while loop has just // exited, so the current mode is the next mode. - if ($sql && ($keep_comments || self::modeNotComment($next_mode))) { - $sql[] = call_user_func($this->make_word_function, substr($this->statement, $mode_start, $i - $mode_start), self::modeIsWord($this_mode), $mode_start_line, $mode_start_char); + if ($sql && ($keepComments || self::modeNotComment($next_mode))) { + $sql[] = call_user_func($this->_makeWordFunction, substr($this->_statement, $mode_start, $i - $mode_start), self::modeIsWord($this_mode), $mode_start_line, $mode_start_char); } - $this->start = $this->len; + $this->_start = $this->_len; return $sql; } - public static function splitStatements($statements, $keep_comments = true, $make_strings = true, $make_word_function = null) + /** + * Split the whole input into statements + * + * @param string $statements One or more SQL statements separated by ';' semicolumns + * @param boolean $keepComments When false comment statements are removed from the output + * @param boolean $makeStrings Return the individual statements as (trimmed) strings instead of arrays + * @param callable $makeWordFunction A function with the parameters: + * function($word, $is_word, $start_line, $start_char) + * @return array Of statements + */ + public static function splitStatements($statements, $keepComments = true, $makeStrings = true, $makeWordFunction = null) { - $parser = new self($statements, $make_word_function); + $parser = new self($statements, $makeWordFunction); $stmts = array(); - while ($stmt = $parser->splitStatement($keep_comments)) { - if ($make_strings) { + while ($stmt = $parser->splitStatement($keepComments)) { + if ($makeStrings) { $sql = implode('', $stmt); if (strlen(trim($sql))) { Modified: trunk/library/classes/MUtil/Ra.php =================================================================== --- trunk/library/classes/MUtil/Ra.php 2012-08-29 13:55:13 UTC (rev 908) +++ trunk/library/classes/MUtil/Ra.php 2012-08-29 14:03:22 UTC (rev 909) @@ -375,7 +375,7 @@ * * @param string $index Index of the column to extract * @param array $input A nested array from which we extract a column - * @param int $mode RELAXED means a v + * @param int $mode STRICT means missing values are returned as 'null' * @return array An array containing the requested column */ public static function column($index, array $input, $mode = self::RELAXED) Added: trunk/test/classes/MUtil/Parser/Sql/WordsParserTest.php =================================================================== --- trunk/test/classes/MUtil/Parser/Sql/WordsParserTest.php (rev 0) +++ trunk/test/classes/MUtil/Parser/Sql/WordsParserTest.php 2012-08-29 14:03:22 UTC (rev 909) @@ -0,0 +1,140 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package MUtil + * @subpackage Parser + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ + */ + +require_once 'PHPUnit/Framework/TestCase.php'; + +/** + * + * + * @package MUtil + * @subpackage Parser + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5 + */ +class WordsParserTest extends PHPUnit_Framework_TestCase +{ + /** + * + * @var MUtil_Parser_Sql_WordsParser + */ + protected $_parser; + + /** + * Test script containing all kind of comments, quoted values, etc... + * + * @var string + */ + protected $_sql = " +SELECT /* comment */ Something as [Really Something] FROM Nothing; + +-- Hi Mom + +UPDATE Nothing SET Something = '\" /* -- bla' WHERE SomethingElse = \"'quoted'\"; + +-- Bye mom +"; + + /** + * Result array output without comments, contains the full whitespace + * + * This shows you how the raw split is performed + * + * @var array + */ + protected $_sqlOutputArray = array( + array(" +", "SELECT", " ", // Here was a comment + " ", "Something", " ", "as", " ", "[Really Something]", " ", "FROM", " ", "Nothing"), + array(" + +", // another comment +" + +", "UPDATE", " ", "Nothing", " ", "SET", " ", "Something", " ", "=", " ", "'\" /* -- bla'", " ", + "WHERE", " ", "SomethingElse", " ", "=", " ", "\"'quoted'\""), + array(" + +", // Third comment +" +")); + + /** + * Result string output without comments + * + * @var array + */ + protected $_sqlOutputString = array( + "SELECT Something as [Really Something] FROM Nothing", + "UPDATE Nothing SET Something = '\" /* -- bla' WHERE SomethingElse = \"'quoted'\""); + + public function setUp() + { + $this->_parser = new MUtil_Parser_Sql_WordsParser($this->_sql); + } + + public function testParse() + { + $result = $this->_parser->splitStatement(false); + $this->assertEquals($result[1], 'SELECT'); + $this->assertCount(13, $result); + } + + public function testParseComment() + { + $result = $this->_parser->splitStatement(true); + $this->assertEquals($result[3], '/* comment */'); + $this->assertCount(14, $result); + } + + public function testSplitAllArray() + { + $result = MUtil_Parser_Sql_WordsParser::splitStatements($this->_sql, false, false); + $this->assertCount(3, $result); + // $this->assertEquals($result[0], $this->_sqlOutputArray[0]); + // $this->assertEquals($result[1], $this->_sqlOutputArray[1]); + // $this->assertEquals($result[2], $this->_sqlOutputArray[2]); + $this->assertEquals($result, $this->_sqlOutputArray); + } + + public function testSplitAllString() + { + $result = MUtil_Parser_Sql_WordsParser::splitStatements($this->_sql, false, true); + $this->assertCount(2, $result); + $this->assertEquals($result, $this->_sqlOutputString); + } +} Modified: trunk/test/classes/MUtil/RaTest.php =================================================================== --- trunk/test/classes/MUtil/RaTest.php 2012-08-29 13:55:13 UTC (rev 908) +++ trunk/test/classes/MUtil/RaTest.php 2012-08-29 14:03:22 UTC (rev 909) @@ -11,27 +11,69 @@ */ class MUtil_RaTest extends PHPUnit_Framework_TestCase { - public function testFlatten() + protected $_columnTest = array( + 'r1' => array('c1' => 1, 'c2' => 'c1'), + 'r2' => array('c1' => 2, 'c2' => 'c2'), + 'r3' => array('c1' => 3), + ); + + public function testArgsDouble() { - $args = MUtil_Ra::args(array(0 => array(0 => 'f', 1 => array('o' => '0', 0 => 'b')), 1 => array('a' => array('r' => 'r')))); - $this->assertEquals($args, array(0 => 'f', 'o' => '0', 1 => 'b', 'a' => array('r' => 'r'))); - } - - public function testDouble() - { $args = MUtil_Ra::args(array(array('a' => 'b'), array('a' => 'c'))); $this->assertEquals($args, array('a' => 'c')); } - - public function testSkipOrName() + + public function testArgsSkipOrName() { $args = MUtil_Ra::args(array(0 => array(0 => 'f', 1 => array('o' => '0', 0 => 'b')), 1 => array('a' => array('r' => 'r'))), 1); $this->assertEquals($args, array('a' => array('r' => 'r'))); } - - public function testDefaults() + + public function testArgsDefaults() { $args = MUtil_Ra::args(array('r1'), array('class1', 'class2'), array('class1' => 'odd', 'class2' => 'even')); $this->assertEquals($args, array('class1' => 'r1', 'class2' => 'even')); } + + public function testBraceKeys() + { + $args = MUtil_Ra::braceKeys(array(0 => 'a', 'b' => 'c'), '{', '}'); + $this->assertEquals($args, array('{0}' => 'a', '{b}' => 'c')); + } + + public function testBraceKeysLeftOnly() + { + $args = MUtil_Ra::braceKeys(array(0 => 'a', 'b' => 'c'), '"'); + $this->assertEquals($args, array('"0"' => 'a', '"b"' => 'c')); + } + + public function testColumnRelaxed() + { + $args = MUtil_Ra::column('c2', $this->_columnTest, MUtil_Ra::RELAXED); + $this->assertEquals($args, array('r1' => 'c1', 'r2' => 'c2')); + } + + public function testColumnRelaxedEmpty() + { + $args = MUtil_Ra::column('c3', $this->_columnTest, MUtil_Ra::RELAXED); + $this->assertEmpty($args); + } + + public function testColumnRelaxedSkips() + { + $args = MUtil_Ra::column('c2', $this->_columnTest, MUtil_Ra::RELAXED); + $this->assertNotContains('r3', array_keys($args)); + } + + public function testColumnStrict() + { + $args = MUtil_Ra::column('c2', $this->_columnTest, MUtil_Ra::STRICT); + $this->assertEquals($args, array('r1' => 'c1', 'r2' => 'c2', 'r3' => null)); + } + + public function testFlatten() + { + $args = MUtil_Ra::args(array(0 => array(0 => 'f', 1 => array('o' => '0', 0 => 'b')), 1 => array('a' => array('r' => 'r')))); + $this->assertEquals($args, array(0 => 'f', 'o' => '0', 1 => 'b', 'a' => array('r' => 'r'))); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-08-29 13:55:23
|
Revision: 908 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=908&view=rev Author: michieltcs Date: 2012-08-29 13:55:13 +0000 (Wed, 29 Aug 2012) Log Message: ----------- Add first draft of HtmlTest Added Paths: ----------- trunk/test/classes/MUtil/HtmlTest.php Added: trunk/test/classes/MUtil/HtmlTest.php =================================================================== --- trunk/test/classes/MUtil/HtmlTest.php (rev 0) +++ trunk/test/classes/MUtil/HtmlTest.php 2012-08-29 13:55:13 UTC (rev 908) @@ -0,0 +1,36 @@ +<?php + +require_once 'PHPUnit/Framework/TestCase.php'; + +/** + * Unit test for class MUtil_Html + * + * @author Michiel Rook <in...@to...> + * @package MUtil + * @subpackage Html + */ +class MUtil_HtmlTest extends PHPUnit_Framework_TestCase +{ + public function testValidCreator() + { + $creator = MUtil_Html::getCreator(); + + $this->assertInstanceOf('MUtil_Html_Creator', $creator); + } + + public function testValidRenderer() + { + $renderer = MUtil_Html::getRenderer(); + + $this->assertInstanceOf('MUtil_Html_Renderer', $renderer); + } + + public function testDiv() + { + $div = MUtil_Html::div('bar', array('id' => 'foo')); + + $this->assertInstanceOf('MUtil_Html_HtmlElement', $div); + $this->assertEquals('div', $div->getTagName()); + $this->assertEquals('foo', $div->getAttrib('id')); + } +} Property changes on: trunk/test/classes/MUtil/HtmlTest.php ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date Author Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |