From: <gem...@li...> - 2011-09-20 11:37:46
|
Revision: 44 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=44&view=rev Author: mennodekker Date: 2011-09-20 11:37:40 +0000 (Tue, 20 Sep 2011) Log Message: ----------- Fixing full-width in the new layout system Modified Paths: -------------- trunk/library/layouts/scripts/gemsnew.phtml trunk/new_project/htdocs/gems/css/gems-new.css trunk/templates/erasmusmc/css/erasmusmc.css Modified: trunk/library/layouts/scripts/gemsnew.phtml =================================================================== --- trunk/library/layouts/scripts/gemsnew.phtml 2011-09-20 11:22:55 UTC (rev 43) +++ trunk/library/layouts/scripts/gemsnew.phtml 2011-09-20 11:37:40 UTC (rev 44) @@ -42,7 +42,7 @@ </div><?php else: ?> - <div id="wrapper" class="main"> + <div id="wrapper" class="main fullwidth"> <div><?php if ($this->main) { echo $this->main->render($this); Modified: trunk/new_project/htdocs/gems/css/gems-new.css =================================================================== --- trunk/new_project/htdocs/gems/css/gems-new.css 2011-09-20 11:22:55 UTC (rev 43) +++ trunk/new_project/htdocs/gems/css/gems-new.css 2011-09-20 11:37:40 UTC (rev 44) @@ -48,6 +48,10 @@ height: 1.2em; } +.fullwidth > div { + margin: 0px 5px; /* provide a little 'air' on full-width */ +} + /* * END OF LAYOUT */ Modified: trunk/templates/erasmusmc/css/erasmusmc.css =================================================================== --- trunk/templates/erasmusmc/css/erasmusmc.css 2011-09-20 11:22:55 UTC (rev 43) +++ trunk/templates/erasmusmc/css/erasmusmc.css 2011-09-20 11:37:40 UTC (rev 44) @@ -7,6 +7,7 @@ .main, .menu { background: #ffffff; } .main { border-left: 1px solid #006; } +.fullwidth.main { border-left: 0px;} /* remove for full width layout */ #header { background: #ffffff url(../local/logo_erasmusmgz.gif) no-repeat; @@ -18,7 +19,7 @@ #header_bar, table.displayer caption, .tabrow .tab, -.tooldock, +.tooldock, .toolbox .toolanchor { border-top-left-radius: 4px; border-top-right-radius: 4px; @@ -30,12 +31,12 @@ /* shadow */ .tooldock, -button, +button, input.button, -a.actionlink, -a.browselink, +a.actionlink, +a.browselink, button.ui-datepicker-trigger, -table.browser, +table.browser, table.timeTable { box-shadow: 2px 2px 4px #0C2074; @@ -43,7 +44,7 @@ -webkit-box-shadow: 2px 2px 4px #0C2074; } -#header_bar, +#header_bar, .tooldock { background: #6DC3F1; } @@ -83,7 +84,7 @@ button:hover, input.button:hover { background: #0C2074 url(../local/button_hover.png) repeat-x left center; border: 1px solid #0C2074; - color: #ffffff; + color: #ffffff; text-decoration: none; } @@ -106,7 +107,7 @@ a.actionlink:hover, a.browselink:hover, button:hover.small, button.ui-datepicker-trigger:hover, input.button.small:hover { background: #0C2074 url(../local/imagelink_hover.png) repeat-x left center; border: 1px solid #0C2074; - color: #ffffff; + color: #ffffff; text-decoration: none; } @@ -125,7 +126,7 @@ font-size: 80%; height: 16px; vertical-align: middle; -} +} #autofilter_target table tbody td strong.marked { border-left: 1px dotted; @@ -139,7 +140,7 @@ h1, h2, h3, h4 { color: #0C2074; -} +} #header h1 { background: url(../local/pulse.gif) repeat-x 0px 15px; /* play with the numbers to move the 'heartbeat' */ @@ -256,10 +257,10 @@ border-right: 2px solid #0C2074; } -table tfoot td.selectedColumn, +table tfoot td.selectedColumn, table tr.selectedRow td.selectedColumn, table thead th.selectedColumn, -table.timeTable td[onclick]:hover, +table.timeTable td[onclick]:hover, table.timeTable th[onclick]:hover { border-color: #0C2074; background-color: #0C2074; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2011-09-20 13:04:42
|
Revision: 47 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=47&view=rev Author: mennodekker Date: 2011-09-20 13:04:31 +0000 (Tue, 20 Sep 2011) Log Message: ----------- Improved printing of tab-forms: the tab-title now displays above the tab (in print only) Modified Paths: -------------- trunk/library/classes/Gems/JQuery/View/Helper/TabContainer.php trunk/new_project/htdocs/gems/css/gems-new.css trunk/new_project/htdocs/gems/css/gems.css trunk/new_project/htdocs/gems/css/gems_print.css Modified: trunk/library/classes/Gems/JQuery/View/Helper/TabContainer.php =================================================================== --- trunk/library/classes/Gems/JQuery/View/Helper/TabContainer.php 2011-09-20 12:32:55 UTC (rev 46) +++ trunk/library/classes/Gems/JQuery/View/Helper/TabContainer.php 2011-09-20 13:04:31 UTC (rev 47) @@ -92,6 +92,7 @@ $list .= '<li class="ui-tabs-nav-item' . $class . '"><a href="'.$opts['contentUrl'].'"><span>'.$v['name'].'</span></a></li>'.PHP_EOL; } else { $list .= '<li class="ui-tabs-nav-item' . $class . '"><a href="#'.$frag_name.'"><span>'.$v['name'].'</span></a></li>'.PHP_EOL; + $html .= '<h3 class="print-only">' . $v['name'] . '</h3>'; /* For printing of tab forms */ $html .= '<div id="'.$frag_name.'" class="ui-tabs-panel">'.$v['content'].'</div>'.PHP_EOL; } } Modified: trunk/new_project/htdocs/gems/css/gems-new.css =================================================================== --- trunk/new_project/htdocs/gems/css/gems-new.css 2011-09-20 12:32:55 UTC (rev 46) +++ trunk/new_project/htdocs/gems/css/gems-new.css 2011-09-20 13:04:31 UTC (rev 47) @@ -379,6 +379,8 @@ margin: 0.5em; } +.print-only { display: none; } + .rightAlign { text-align: right; } @@ -658,4 +660,4 @@ span.thetooltip { display: none; -} \ No newline at end of file +} Modified: trunk/new_project/htdocs/gems/css/gems.css =================================================================== --- trunk/new_project/htdocs/gems/css/gems.css 2011-09-20 12:32:55 UTC (rev 46) +++ trunk/new_project/htdocs/gems/css/gems.css 2011-09-20 13:04:31 UTC (rev 47) @@ -335,6 +335,8 @@ margin: 0.5em; } +.print-only { display: none; } + .rightAlign { text-align: right; } Modified: trunk/new_project/htdocs/gems/css/gems_print.css =================================================================== --- trunk/new_project/htdocs/gems/css/gems_print.css 2011-09-20 12:32:55 UTC (rev 46) +++ trunk/new_project/htdocs/gems/css/gems_print.css 2011-09-20 13:04:31 UTC (rev 47) @@ -1,9 +1,9 @@ /* Style for printing, disables certain UI elements */ @media print { body { - font-family: Arial,Verdana,Helvetica,Sans-serif; + font-family: Arial,Verdana,Helvetica,Sans-serif; } - + #header_bar, #menu, .noprint, a.actionlink { display: none; } table { @@ -30,4 +30,6 @@ table.browser { width: 100%; } + + .print-only { display: inline; } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2011-09-23 07:57:48
|
Revision: 71 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=71&view=rev Author: mennodekker Date: 2011-09-23 07:57:42 +0000 (Fri, 23 Sep 2011) Log Message: ----------- Updated new project to allow stand alone surveys Fixed AddTracks to display only what the Gems_Project marker interfaces allow TODO: what to do when add track/survey is not allowed? now we get a not allowed error Modified Paths: -------------- trunk/library/snippets/AddTracksSnippet.php trunk/new_project/application/classes/NewProject/Escort.php Modified: trunk/library/snippets/AddTracksSnippet.php =================================================================== --- trunk/library/snippets/AddTracksSnippet.php 2011-09-22 14:13:27 UTC (rev 70) +++ trunk/library/snippets/AddTracksSnippet.php 2011-09-23 07:57:42 UTC (rev 71) @@ -1,5 +1,4 @@ <?php - /** * Copyright (c) 2011, Erasmus MC * All rights reserved. @@ -36,8 +35,12 @@ */ /** - * Displays a toolbox of drop down UL's om tracks/ surveys toe te voegen. + * Displays a toolbox of drop down UL's to assign tracks / surveys to a patient. * + * If project uses the Gems_Project_Tracks_MultiTracksInterface, show a track drowpdown + * If project uses the Gems_Project_Tracks_StandAloneSurveysInterface, show a survey + * drowpdown for both staff and patient + * * A snippet is a piece of html output that is reused on multiple places in the code. * * Variables are intialized using the {@see MUtil_Registry_TargetInterface} mechanism. @@ -178,23 +181,34 @@ } /** - * Create the snippets content + * Allow manual assignment of surveys/tracks to a patient * - * This is a stub function either override getHtmlOutput() or override render() + * If project uses the Gems_Project_Tracks_MultiTracksInterface, show a track drowpdown + * If project uses the Gems_Project_Tracks_StandAloneSurveysInterface, show a survey + * drowpdown for both staff and patient * * @param Zend_View_Abstract $view Just in case it is needed here * @return MUtil_Html_HtmlInterface Something that can be rendered */ public function getHtmlOutput(Zend_View_Abstract $view) { - $pageRef = array(MUtil_Model::REQUEST_ID => $this->request->getParam(MUtil_Model::REQUEST_ID)); + if ($this->escort instanceof Gems_Project_Tracks_MultiTracksInterface || + $this->escort instanceof Gems_Project_Tracks_StandAloneSurveysInterface) { - $addToLists = MUtil_Html::create()->div(array('class' => 'tooldock')); - $addToLists->strong($this->_('Add')); - $addToLists[] = $this->_getTracks('T', $pageRef); - $addToLists[] = $this->_getTracks('S', $pageRef); - $addToLists[] = $this->_getTracks('M', $pageRef); + $pageRef = array(MUtil_Model::REQUEST_ID => $this->request->getParam(MUtil_Model::REQUEST_ID)); - return $addToLists; + $addToLists = MUtil_Html::create()->div(array('class' => 'tooldock')); + $addToLists->strong($this->_('Add')); + if ($this->escort instanceof Gems_Project_Tracks_MultiTracksInterface) { + $addToLists[] = $this->_getTracks('T', $pageRef); + } + if ($this->escort instanceof Gems_Project_Tracks_StandAloneSurveysInterface) { + $addToLists[] = $this->_getTracks('S', $pageRef); + $addToLists[] = $this->_getTracks('M', $pageRef); + } + + return $addToLists; + } + return null; } } Modified: trunk/new_project/application/classes/NewProject/Escort.php =================================================================== --- trunk/new_project/application/classes/NewProject/Escort.php 2011-09-22 14:13:27 UTC (rev 70) +++ trunk/new_project/application/classes/NewProject/Escort.php 2011-09-23 07:57:42 UTC (rev 71) @@ -1,51 +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. - */ - + +/** + * 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. + */ + include_once('GemsEscort.php'); include_once('Gems/Project/Layout/SingleLayoutInterface.php'); include_once('Gems/Project/Log/LogRespondentAccessInterface.php'); include_once('Gems/Project/Organization/MultiOrganizationInterface.php'); include_once('Gems/Project/Tracks/MultiTracksInterface.php'); -include_once('Gems/Project/Tracks/TracksOnlyInterface.php'); +include_once('Gems/Project/Tracks/StandAloneSurveysInterface.php'); class NewProject_Escort extends GemsEscort implements Gems_Project_Layout_SingleLayoutInterface, Gems_Project_Log_LogRespondentAccessInterface, Gems_Project_Organization_MultiOrganizationInterface, Gems_Project_Tracks_MultiTracksInterface, - Gems_Project_Tracks_TracksOnlyInterface + Gems_Project_Tracks_StandAloneSurveysInterface { public function getUserOrganization() { // Gems_Project_Organization_MultiOrganizationInterface return $this->session->user_organization_id; } - + public function getAllowedOrganizations($userId = null) { // Gems_Project_Organization_MultiOrganizationInterface return parent::getAllowedOrganizations($userId); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2011-11-22 13:33:02
|
Revision: 261 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=261&view=rev Author: michieltcs Date: 2011-11-22 13:32:52 +0000 (Tue, 22 Nov 2011) Log Message: ----------- Refs #307 - add Gems_Util::isAllowedIP() and associated unit tests Modified Paths: -------------- trunk/library/classes/Gems/Util.php Added Paths: ----------- trunk/test/classes/Gems/UtilTest.php Modified: trunk/library/classes/Gems/Util.php =================================================================== --- trunk/library/classes/Gems/Util.php 2011-11-22 12:13:40 UTC (rev 260) +++ trunk/library/classes/Gems/Util.php 2011-11-22 13:32:52 UTC (rev 261) @@ -215,4 +215,51 @@ { return $this->_getClass('translated'); } + + /** + * Checks if a given IP is allowed according to a set + * of IP addresses / ranges. + * + * Multiple addresses/ranges are separated by a colon, + * an individual range takes the form of + * 10.0.0.0-10.0.0.255 (subnet masks are not supported) + * + * @param string $ip + * @param string $ipRanges + * @return bool + */ + public static function isAllowedIP($ip, $ipRanges = "") + { + if (!strlen($ipRanges)) { + return true; + } + + $ipLong = ip2long($ip); + + $ranges = explode(':', $ipRanges); + + foreach ($ranges as $range) { + if (($sep = strpos($range, '-')) !== false) { + $min = ip2long(substr($range, 0, $sep)); + $max = ip2long(substr($range, $sep + 1)); + + $validate = new Zend_Validate_Between( + array( + 'min' => $min, + 'max' => $max + ) + ); + + if ($min <= $ipLong && $ipLong <= $max) { + return true; + } + } else { + if ($ipLong == ip2long($range)) { + return true; + } + } + } + + return false; + } } Added: trunk/test/classes/Gems/UtilTest.php =================================================================== --- trunk/test/classes/Gems/UtilTest.php (rev 0) +++ trunk/test/classes/Gems/UtilTest.php 2011-11-22 13:32:52 UTC (rev 261) @@ -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. + * + * + * @package Gems + * @subpackage Util + * @author Michiel Rook <mi...@to...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ + */ + +/** + * Test class for Gems_Util + * + * @author Michiel Rook <mi...@to...> + * @package Gems + * @subpackage Util + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 + */ +class Gems_UtilTest extends PHPUnit_Framework_TestCase +{ + public function testAllowedIP1() { + $this->assertTrue(Gems_Util::isAllowedIP('10.0.0.1', '10.0.0.0-10.0.0.255')); + } + + public function testAllowedIP2() { + $this->assertFalse(Gems_Util::isAllowedIP('10.0.1.1', '10.0.0.0-10.0.0.255')); + } + + public function testAllowedIP3() { + $this->assertTrue(Gems_Util::isAllowedIP('127.0.0.1', '127.0.0.1')); + } + + public function testAllowedIP4() { + $this->assertFalse(Gems_Util::isAllowedIP('127.0.0.1', '192.168.0.1')); + } + + public function testAllowedIP5() { + $this->assertTrue(Gems_Util::isAllowedIP('127.0.0.1', '192.168.0.1:127.0.0.1')); + } + + public function testAllowedIPEmptyRange() { + $this->assertTrue(Gems_Util::isAllowedIP('127.0.0.1', '')); + } + + /** + * 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 Property changes on: trunk/test/classes/Gems/UtilTest.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-02-07 12:27:04
|
Revision: 457 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=457&view=rev Author: mennodekker Date: 2012-02-07 11:24:23 +0000 (Tue, 07 Feb 2012) Log Message: ----------- Merged all changes up to rev 455 (=tags/1.5.0) Revision Links: -------------- http://gemstracker.svn.sourceforge.net/gemstracker/?rev=455&view=rev Modified Paths: -------------- trunk/library/classes/Gems/Auth/Adapter/Callback.php trunk/library/classes/Gems/Communication/RespondentWriter.php trunk/library/classes/Gems/Controller/BrowseEditAction.php trunk/library/classes/Gems/Controller/ModelActionAbstract.php trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php trunk/library/classes/Gems/Default/DatabaseAction.php trunk/library/classes/Gems/Default/OrganizationAction.php trunk/library/classes/Gems/Default/SourceAction.php trunk/library/classes/Gems/Default/StaffAction.php trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php trunk/library/classes/Gems/Default/TrackAction.php trunk/library/classes/Gems/Default/TrackActionAbstract.php trunk/library/classes/Gems/Default/TrackMaintenanceAction.php trunk/library/classes/Gems/Form/TableForm.php trunk/library/classes/Gems/Menu.php trunk/library/classes/Gems/Model/DbaModel.php trunk/library/classes/Gems/Project/ProjectSettings.php trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php trunk/library/classes/Gems/Snippets/ModelFormSnippetGeneric.php trunk/library/classes/Gems/Snippets/ModelItemTableSnippetAbstract.php trunk/library/classes/Gems/Snippets/ModelItemTableSnippetGeneric.php trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetGeneric.php trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php trunk/library/classes/Gems/TabForm.php trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php trunk/library/classes/Gems/Tracker/Model/TrackModel.php trunk/library/classes/Gems/Tracker/RespondentTrack.php trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php trunk/library/classes/Gems/Tracker.php trunk/library/classes/Gems/Upgrades.php trunk/library/classes/Gems/UpgradesAbstract.php trunk/library/classes/Gems/User/OldStaffUserDefinition.php trunk/library/classes/Gems/User/UserLoader.php trunk/library/classes/MUtil/Controller/Action.php trunk/library/classes/MUtil/Html/Creator.php trunk/library/classes/MUtil/Html/HtmlElement.php trunk/library/classes/MUtil/Html/ImgElement.php trunk/library/classes/MUtil/Html/TBodyElement.php trunk/library/classes/MUtil/Html.php trunk/library/classes/MUtil/Lazy.php trunk/library/classes/MUtil/Model/FormBridge.php trunk/library/classes/MUtil/Model/VerticalTableBridge.php trunk/library/classes/MUtil/Snippets/ModelFormSnippetAbstract.php trunk/library/configs/db/patches.sql trunk/library/configs/db/tables/gems__radius_config.999.sql trunk/library/layouts/scripts/gemsnew.phtml trunk/library/snippets/AddTracksSnippet.php trunk/library/snippets/EditTrackEngineSnippet.php trunk/library/snippets/EditTrackSnippet.php trunk/library/snippets/Generic/AutosearchForm.php trunk/library/snippets/Generic/CurrentButtonRow.php trunk/library/snippets/Generic/ModelFormSnippet.php trunk/library/snippets/Generic/ModelItemTableSnippet.php trunk/library/snippets/Generic/ModelItemYesNoDeleteSnippet.php trunk/library/snippets/Generic/ModelTabFormSnippet.php trunk/library/snippets/Generic/ModelTableSnippet.php trunk/library/snippets/Mail/Log/MailLogBrowseSnippet.php trunk/library/snippets/Organization/ChooseOrganizationSnippet.php trunk/library/snippets/Organization/OrganizationEditSnippet.php trunk/library/snippets/Organization/OrganizationTableSnippet.php trunk/library/snippets/Respondent/MultiOrganizationTab.php trunk/library/snippets/RespondentTokenSnippet.php trunk/library/snippets/ShowTrackTokenSnippet.php trunk/library/snippets/Track/AvailableTracksSnippets.php trunk/new_project/htdocs/gems/css/gems-new.css trunk/new_project/htdocs/gems/css/gems.css Added Paths: ----------- trunk/library/classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php Property Changed: ---------------- trunk/ trunk/library/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse:306-342,344,346 /tags/1.5.0beta1:305 + /branches/1.5.0-pulse:306-430 /branches/1.5.x:426-455 /tags/1.5.0beta1:305 Property changes on: trunk/library ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse/library:306-344,346 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 + /branches/1.5.0-pulse/library:306-344,346 /branches/1.5.x/library:426-455 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 Modified: trunk/library/classes/Gems/Auth/Adapter/Callback.php =================================================================== --- trunk/library/classes/Gems/Auth/Adapter/Callback.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Auth/Adapter/Callback.php 2012-02-07 11:24:23 UTC (rev 457) @@ -43,8 +43,25 @@ */ class Gems_Auth_Adapter_Callback implements Zend_Auth_Adapter_Interface { + /** + * The callback to use + * + * @var callback + */ private $_callback; + + /** + * The identity to check + * + * @var string + */ private $_identity; + + /** + * The optional parameters to pass to the callback + * + * @var array + */ private $_params; /** @@ -54,9 +71,9 @@ * return true or false and in that case this adapter will wrap the result * in a Zend_Auth_Result * - * @param type $callback A valid callback - * @param type $identity The identity to use - * @param type $params Array of parameters needed for the callback + * @param callback $callback A valid callback + * @param string $identity The identity to use + * @param array $params Array of parameters needed for the callback */ public function __construct($callback, $identity, $params) { Modified: trunk/library/classes/Gems/Communication/RespondentWriter.php =================================================================== --- trunk/library/classes/Gems/Communication/RespondentWriter.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Communication/RespondentWriter.php 2012-02-07 11:24:23 UTC (rev 457) @@ -41,9 +41,11 @@ interface Gems_Communication_RespondentWriter { /** - * Writes the respondent + * Writes the respondent, creating a new one or updating the existing record + * * @param Gems_Communication_RespondentContainer $respondent - * @return int The internal id of the created/updated respondent + * @param int $userId + * @return boolean True if a new respondent was added, false if one was updated * @throws Gems_Communication_Exception */ public function writeRespondent(Gems_Communication_RespondentContainer $respondent, &$userId); Modified: trunk/library/classes/Gems/Controller/BrowseEditAction.php =================================================================== --- trunk/library/classes/Gems/Controller/BrowseEditAction.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Controller/BrowseEditAction.php 2012-02-07 11:24:23 UTC (rev 457) @@ -292,7 +292,7 @@ */ public function beforeFormDisplay ($form, $isNew) { - if ($this->useTabbedForms) { + if ($this->useTabbedForms || $form instanceof Gems_Form_TableForm) { /* Not needed anymore @@TODO: Remove when proven, as there is a set tab //Create the tabs tried in $form->render() but somehow that is never reached if ($form instanceof Gems_TabForm) { @@ -304,8 +304,11 @@ $element = new MUtil_Form_Element_Html('formLinks'); $element->setValue($links); $element->setOrder(999); - $form->resetContext(); + if ($form instanceof Gems_TabForm) { + $form->resetContext(); + } $form->addElement($element); + $form->addDisplayGroup(array('formLinks'), 'form_buttons'); } } else { $table = new MUtil_Html_TableElement(array('class' => 'formTable')); @@ -359,6 +362,7 @@ $form = new Gems_TabForm($options); } else { $form = parent::createForm($options); + //$form = new Gems_Form_TableForm($options); } return $form; @@ -713,6 +717,9 @@ $data = $newData + $data; } + if ($form instanceof Gems_TabForm) { + $form->resetContext(); + } return $form; } Modified: trunk/library/classes/Gems/Controller/ModelActionAbstract.php =================================================================== --- trunk/library/classes/Gems/Controller/ModelActionAbstract.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Controller/ModelActionAbstract.php 2012-02-07 11:24:23 UTC (rev 457) @@ -147,13 +147,30 @@ } } + /** + * Return the current request ID, if any. + * + * Overrule this function if the last item in the page title + * should be something other than te value of + * MUtil_Model::REQUEST_ID. + * + * @return mixed + */ public function getInstanceId() { - if ($id = $this->request->getParam(MUtil_Model::REQUEST_ID)) { + if ($id = $this->_getParam(MUtil_Model::REQUEST_ID)) { return $id; } } + /** + * Returns the current html/head/title for this page. + * + * If the title is an array the seperator concatenates the parts. + * + * @param string $separator + * @return string + */ public function getTitle($separator = null) { if ($title_set = parent::getTitle($separator)) { Modified: trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php =================================================================== --- trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php 2012-02-07 11:24:23 UTC (rev 457) @@ -208,6 +208,47 @@ } /** + * Return the current request ID, if any. + * + * Overrule this function if the last item in the page title + * should be something other than te value of + * MUtil_Model::REQUEST_ID. + * + * @return mixed + */ + public function getInstanceId() + { + if ($id = $this->_getParam(MUtil_Model::REQUEST_ID)) { + return $id; + } + } + + /** + * Returns the current html/head/title for this page. + * + * If the title is an array the seperator concatenates the parts. + * + * @param string $separator + * @return string + */ + public function getTitle($separator = null) + { + if ($title_set = parent::getTitle($separator)) { + return $title_set; + } + + $title = array(); + foreach($this->menu->getActivePath($this->getRequest()) as $menuItem) { + $title[] = $menuItem->get('label'); + } + if ($id = $this->getInstanceId()) { + $title[] = $id; + } + + return implode($separator, $title); + } + + /** * Intializes the html component. * * @param boolean $reset Throws away any existing html output when true Modified: trunk/library/classes/Gems/Default/DatabaseAction.php =================================================================== --- trunk/library/classes/Gems/Default/DatabaseAction.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Default/DatabaseAction.php 2012-02-07 11:24:23 UTC (rev 457) @@ -48,50 +48,6 @@ { public $sortKey = array('group' => SORT_ASC, 'type' => SORT_ASC, 'name' => SORT_ASC); - private function _runScript(array $data, $includeResultSets = false) - { - $results = array(); - $this->_runScripts($data, $results, $includeResultSets); - return $results; - } - - private function _runScripts(array $data, array &$results, $includeResultSets = false) - { - if ($data['script']) { - $queries = MUtil_Parser_Sql_WordsParser::splitStatements($data['script'], false); - $qCount = count($queries); - - $results[] = sprintf($this->_('Executed %2$s creation script %1$s:'), $data['name'], $this->_(strtolower($data['type']))); - $i = 1; - $resultSet = 1; - - foreach ($queries as $query) { - $sql = (string) $query; - try { - $stmt = $this->db->query($sql); - if ($rows = $stmt->rowCount()) { - if ($includeResultSets && ($data = $stmt->fetchAll())) { - $results[] = sprintf($this->_('%d record(s) returned as result set %d in step %d of %d.'), $rows, $resultSet, $i, $qCount); - $results[] = $data; - $resultSet++; - } else { - $results[] = sprintf($this->_('%d record(s) updated in step %d of %d.'), $rows, $i, $qCount); - } - } else { - $results[] = sprintf($this->_('Script ran step %d of %d succesfully.'), $i, $qCount); - } - } catch (Zend_Db_Statement_Exception $e) { - $results[] = $e->getMessage() . $this->_(' in step ') . $i . ':<pre>' . $sql . '</pre>'; - } - $i++; - } - } else { - $results[] = sprintf($this->_('No script for %1$s.'), $data['name']); - } - - return $results; - } - /** * Set the parameters needed by the menu. * @@ -168,10 +124,7 @@ $model->set('location', 'label', $this->_('Location')); } // $model->set('path', 'label', $this->_('Path')); - $model->set('state', 'label', $this->_('Status'), 'multiOptions', array( - Gems_Model_DbaModel::STATE_CREATED => $this->_('created'), - Gems_Model_DbaModel::STATE_DEFINED => $this->_('not created'), - Gems_Model_DbaModel::STATE_UNKNOWN => $this->_('unknown'))); + $model->set('state', 'label', $this->_('Status')); if ($detailed) { $model->set('script', 'label', $this->_('Script'), 'itemDisplay', 'pre'); @@ -482,7 +435,7 @@ $model = $this->getModel(); $data = $model->loadFirst(); - $results = $this->_runScript($data); + $results = $model->runScript($data); $this->addMessage($results); $this->_reroute(array('action' => 'show')); @@ -497,11 +450,13 @@ if ($this->_getParam('confirmed')) { if ($objects) { + $results = array(); $results[] = sprintf($this->_('Starting %d object creation scripts.'), $oCount) . '<br/>'; $i = 1; foreach ($objects as $data) { - $this->_runScripts($data, $results); + $result = $model->runScript($data); + $results = array_merge($results, $result); $results[] = sprintf($this->_('Finished %s creation script for object %d of %d'), $this->_(strtolower($data['type'])), $i, $oCount) . '<br/>'; $i++; } @@ -559,7 +514,8 @@ $data['name'] = ''; $data['type'] = $this->_('raw'); - $results = $this->_runScript($data, true); + $model = $this->getModel(); + $results = $model->runScript($data, true); $resultSet = 1; $echos = MUtil_Html::create()->array(); foreach ($results as $result) { Modified: trunk/library/classes/Gems/Default/OrganizationAction.php =================================================================== --- trunk/library/classes/Gems/Default/OrganizationAction.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Default/OrganizationAction.php 2012-02-07 11:24:23 UTC (rev 457) @@ -166,7 +166,8 @@ if($model->has('gor_user_class')) { $definitions = $this->loader->getUserLoader()->getAvailableStaffDefinitions(); //Use first element as default - $default = array_shift(array_keys($definitions)); + $tmp = array_keys($definitions); + $default = array_shift($tmp); $model->set('gor_user_class', 'default', $default); if (count($definitions)>1) { if ($action !== 'create') { Modified: trunk/library/classes/Gems/Default/SourceAction.php =================================================================== --- trunk/library/classes/Gems/Default/SourceAction.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Default/SourceAction.php 2012-02-07 11:24:23 UTC (rev 457) @@ -231,7 +231,7 @@ { $source = $this->getSourceById(); - if ($source->checkSourceActive($this->session->user_id)) { + if ($source->checkSourceActive($this->loader->getCurrentUser()->getUserId())) { $this->addMessage($this->_('This installation is active.')); } else { $this->addMessage($this->_('Inactive installation.')); @@ -244,7 +244,7 @@ { $source = $this->getSourceById(); - if ($messages = $source->synchronizeSurveys($this->session->user_id)) { + if ($messages = $source->synchronizeSurveys($this->loader->getCurrentUser()->getUserId())) { $this->addMessage($messages); } else { $this->addMessage($this->_('No changes.')); @@ -263,7 +263,7 @@ $source = $this->getSourceById($row['gso_id_source']); $this->addMessage(sprintf($this->_('Synchronization of source %s:'), $row['gso_source_name'])); - if ($messages = $source->synchronizeSurveys($this->session->user_id)) { + if ($messages = $source->synchronizeSurveys($this->loader->getCurrentUser()->getUserId())) { $this->addMessage($messages); } else { $this->addMessage($this->_('No changes.')); Modified: trunk/library/classes/Gems/Default/StaffAction.php =================================================================== --- trunk/library/classes/Gems/Default/StaffAction.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Default/StaffAction.php 2012-02-07 11:24:23 UTC (rev 457) @@ -188,9 +188,6 @@ $this->_instanceId = $data['gsf_login']; } - $sql = "SELECT ggp_id_group,ggp_role FROM gems__groups WHERE ggp_id_group = " . (int) $data['gsf_id_primary_group']; - $groups = $this->db->fetchPairs($sql); - if (!isset($data['gsf_id_organization']) || empty($data['gsf_id_organization'])) { $data['gsf_id_organization'] = $this->menu->getParameterSource()->getMenuParameter('gsf_id_organization', $this->loader->getCurrentUser()->getCurrentOrganizationId()); } Modified: trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php =================================================================== --- trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2012-02-07 11:24:23 UTC (rev 457) @@ -69,7 +69,7 @@ // Add pdf button if allowed if ($menuItem = $this->findAllowedMenuItem('pdf')) { - $bridge->addItemLink(iif($bridge->gsu_has_pdf,$menuItem->toActionLinkLower($this->getRequest(), $bridge))); + $bridge->addItemLink(MUtil_Lazy::iif($bridge->gsu_has_pdf, $menuItem->toActionLinkLower($this->getRequest(), $bridge))); } } Modified: trunk/library/classes/Gems/Default/TrackAction.php =================================================================== --- trunk/library/classes/Gems/Default/TrackAction.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Default/TrackAction.php 2012-02-07 11:24:23 UTC (rev 457) @@ -71,8 +71,9 @@ protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model) { $bridge->gr2t_id_respondent_track; //For show and edit button - $bridge->tr()->appendAttrib('class', $bridge->row_class); + $bridge->tbody()->getFirst(true)->appendAttrib('class', $bridge->row_class); + // Add edit button if allowed, otherwise show, again if allowed if ($menuItem = $this->findAllowedMenuItem('show-track')) { $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge)); @@ -461,6 +462,9 @@ } } + /** + * Show information on a single track assigned to a respondent + */ public function showTrackAction() { $request = $this->getRequest(); @@ -498,9 +502,9 @@ $fieldValues = $this->db->fetchAll($sql, array('gr2t2f_id_respondent_track' => $data['gr2t_id_respondent_track'])); foreach ($fieldValues as $field) { + $table->tr(); $table->tdh($field['gtf_field_name']); $table->td($field['gr2t2f_value']); - $table->tr(); } $this->html[] = $table; Modified: trunk/library/classes/Gems/Default/TrackActionAbstract.php =================================================================== --- trunk/library/classes/Gems/Default/TrackActionAbstract.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Default/TrackActionAbstract.php 2012-02-07 11:24:23 UTC (rev 457) @@ -203,6 +203,7 @@ { $model = $this->loader->getTracker()->getRespondentTrackModel(); + $model->resetOrder(); $model->set('gtr_track_name', 'label', $this->_('Track')); $model->set('gr2t_track_info', 'label', $this->_('Description'), 'description', $this->_('Enter the particulars concerning the assignment to this respondent.')); Modified: trunk/library/classes/Gems/Default/TrackMaintenanceAction.php =================================================================== --- trunk/library/classes/Gems/Default/TrackMaintenanceAction.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Default/TrackMaintenanceAction.php 2012-02-07 11:24:23 UTC (rev 457) @@ -1,6 +1,5 @@ <?php - /** * Copyright (c) 2011, Erasmus MC * All rights reserved. @@ -46,6 +45,13 @@ */ class Gems_Default_TrackMaintenanceAction extends Gems_Controller_BrowseEditAction { + /** + * Mode for the current addBrowse drawing. + * + * @var string + */ + protected $browseMode; + public $sortKey = array('gtr_track_name' => SORT_ASC); public $summarizedActions = array('index', 'autofilter', 'check-all'); @@ -61,20 +67,27 @@ */ protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model) { - if ($this->getRequest()->getActionName() == 'index') { - if ($menuItem = $this->findAllowedMenuItem('show')) { - $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge)); - } - if ($menuItem = $this->findAllowedMenuItem('edit')) { - $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge)); - } + $request = $this->getRequest(); + + $actionKey = $request->getActionKey(); + $contrKey = $request->getControllerKey(); + $controller = $this->browseMode ? $this->browseMode : $request->getControllerName(); + + if ($menuItem = $this->menu->find(array($contrKey => $controller, $actionKey => 'show'))) { + $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge)); } + $menuItem = $this->menu->find(array($contrKey => $controller, $actionKey => 'edit')); + foreach($model->getItemsOrdered() as $name) { if ($label = $model->get($name, 'label')) { $bridge->addSortable($name, $label); } } + + if ($menuItem) { + $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge)); + } } /** @@ -283,24 +296,13 @@ $model = $this->getModel(); $repeatable = $model->loadRepeatable(); + $this->browseMode = 'track-' . $mode; + $table = $this->getBrowseTable($baseurl); $table->setOnEmpty(sprintf($this->_('No %s found'), $this->_($mode))); $table->getOnEmpty()->class = 'centerAlign'; $table->setRepeater($repeatable); - $url = array( - 'controller' => 'track-' . $mode, - 'action' => 'edit' - ); - - foreach ($keys as $idx => $key) { - $url[$idx] = $repeatable->$key; - } - - $href = new MUtil_Html_HrefArrayAttribute($url); - $body = $table->tbody(); - $body[0]->onclick = array('location.href=\'', $href, '\';'); - $this->html->h3(sprintf($this->_('%s in track'), $this->_(ucfirst($mode)))); $this->html[] = $table; $this->html->actionLink(array('controller' => 'track-' . $mode, 'action' => 'create', 'id' => $this->getRequest()->getParam(MUtil_Model::REQUEST_ID)), $this->_('Add')); Modified: trunk/library/classes/Gems/Form/TableForm.php =================================================================== --- trunk/library/classes/Gems/Form/TableForm.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Form/TableForm.php 2012-02-07 11:24:23 UTC (rev 457) @@ -28,7 +28,7 @@ * Short description of file * * @package Gems - * @subpackage + * @subpackage Form * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License * @version $Id$ Modified: trunk/library/classes/Gems/Menu.php =================================================================== --- trunk/library/classes/Gems/Menu.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Menu.php 2012-02-07 11:24:23 UTC (rev 457) @@ -282,7 +282,7 @@ $trType = 'T'; $subPage = $page->addPage($this->_('Track'), 'pr.track', 'track', 'show-track') ->addNamedParameters(MUtil_Model::REQUEST_ID, 'gr2o_patient_nr') - ->addHiddenParameter(Gems_Model::TRACK_ID, $this->escort->getTrackId(), 'gtr_track_type', 'T'); + ->addHiddenParameter(Gems_Model::TRACK_ID, $this->escort->getTrackId(), 'gtr_track_type', $trType); $tkPages[$trType] = $subPage->addAction($this->_('Token'), 'pr.token', 'show') ->addNamedParameters(MUtil_Model::REQUEST_ID, 'gto_id_token') Modified: trunk/library/classes/Gems/Model/DbaModel.php =================================================================== --- trunk/library/classes/Gems/Model/DbaModel.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Model/DbaModel.php 2012-02-07 11:24:23 UTC (rev 457) @@ -60,6 +60,10 @@ protected $file_encoding; protected $locations; protected $mainDirectory; + /** + * @var Zend_Translate_Adapter + */ + protected $translate; private $_sorts; @@ -73,6 +77,9 @@ $this->db = $db; + //Grab translate object from the Escort + $this->translate = GemsEscort::getInstance()->translate; + $this->set('group', 'maxlength', 40, 'type', MUtil_Model::TYPE_STRING); $this->set('name', 'key', true, 'maxlength', 40, 'type', MUtil_Model::TYPE_STRING); $this->set('type', 'maxlength', 40, 'type', MUtil_Model::TYPE_STRING); @@ -86,8 +93,25 @@ $this->set('script', 'type', MUtil_Model::TYPE_STRING); $this->set('lastChanged', 'type', MUtil_Model::TYPE_DATETIME); $this->set('location', 'maxlength', 12, 'type', MUtil_Model::TYPE_STRING); + $this->set('state', 'multiOptions', array( + Gems_Model_DbaModel::STATE_CREATED => $this->_('created'), + Gems_Model_DbaModel::STATE_DEFINED => $this->_('not created'), + Gems_Model_DbaModel::STATE_UNKNOWN => $this->_('unknown'))); } + /** + * proxy for easy access to translations + * + * @param string $messageId Translation string + * @param string|Zend_Locale $locale (optional) Locale/Language to use, identical with locale + * identifier, @see Zend_Locale for more information + * @return string + */ + private function _($messageId, $locale = null) + { + return $this->translate->_($messageId, $locale); + } + private function _getGroupName($name) { if ($pos = strpos($name, '__')) { @@ -374,6 +398,56 @@ return $this->loadFirst(array('name' => $tableName), false); } + /** + * Run a sql statement from an object loaded through this model + * + * $data is an array with the following keys: + * script The sql statement to be executed + * name The name of the table, used in messages + * type Type of db element (table or view), used in messages + * + * @param array $data + * @param type $includeResultSets + * @return type + */ + public function runScript(array $data, $includeResultSets = false) + { + $results = array(); + if ($data['script']) { + $queries = MUtil_Parser_Sql_WordsParser::splitStatements($data['script'], false); + $qCount = count($queries); + + $results[] = sprintf($this->_('Executed %2$s creation script %1$s:'), $data['name'], $this->_(strtolower($data['type']))); + $i = 1; + $resultSet = 1; + + foreach ($queries as $query) { + $sql = (string) $query; + try { + $stmt = $this->db->query($sql); + if ($rows = $stmt->rowCount()) { + if ($includeResultSets && ($data = $stmt->fetchAll())) { + $results[] = sprintf($this->_('%d record(s) returned as result set %d in step %d of %d.'), $rows, $resultSet, $i, $qCount); + $results[] = $data; + $resultSet++; + } else { + $results[] = sprintf($this->_('%d record(s) updated in step %d of %d.'), $rows, $i, $qCount); + } + } else { + $results[] = sprintf($this->_('Script ran step %d of %d succesfully.'), $i, $qCount); + } + } catch (Zend_Db_Statement_Exception $e) { + $results[] = $e->getMessage() . $this->_(' in step ') . $i . ':<pre>' . $sql . '</pre>'; + } + $i++; + } + } else { + $results[] = sprintf($this->_('No script for %1$s.'), $data['name']); + } + + return $results; + } + public function save(array $newValues, array $filter = null) { // TODO: Save of data Modified: trunk/library/classes/Gems/Project/ProjectSettings.php =================================================================== --- trunk/library/classes/Gems/Project/ProjectSettings.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Project/ProjectSettings.php 2012-02-07 11:24:23 UTC (rev 457) @@ -193,7 +193,7 @@ */ public function getAccountDelayFactor() { - if (isset($this->account['delayFactor'])) { + if (isset($this->account) && isset($this->account['delayFactor'])) { return intval($this->account['delayFactor']); } else { return 4; @@ -225,6 +225,24 @@ } /** + * Returns an (optional) default organization from the project settings + * + * @return int Organization number or -1 when not set + */ + public function getDefaultOrganization() + { + if ($this->offsetExists('organization')) { + $orgs = $this->offsetGet('organization'); + + if (isset($orgs['default'])) { + return $orgs['default']; + } + } + + return -1; + } + + /** * Returns the public name of this project. * @return string */ @@ -275,7 +293,7 @@ public function getSuperAdminName() { if (isset($this->admin) && isset($this->admin['user'])) { - return $this->admin['user']; + return trim($this->admin['user']); } } @@ -287,7 +305,7 @@ protected function getSuperAdminPassword() { if (isset($this->admin) && isset($this->admin['pwd'])) { - return $this->admin['pwd']; + return trim($this->admin['pwd']); } } Modified: trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php =================================================================== --- trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php 2012-02-07 11:24:23 UTC (rev 457) @@ -167,8 +167,9 @@ } /** + * Retrieve the header title to display * - * @return string The header title to display + * @return string */ protected function getTitle() { Modified: trunk/library/classes/Gems/Snippets/ModelFormSnippetGeneric.php =================================================================== --- trunk/library/classes/Gems/Snippets/ModelFormSnippetGeneric.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Snippets/ModelFormSnippetGeneric.php 2012-02-07 11:24:23 UTC (rev 457) @@ -27,7 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * - * @package MUtil + * @package Gems * @subpackage Snippets * @author Matijs de Jong <mj...@ma...> * @copyright Copyright (c) 2011 Erasmus MC @@ -44,7 +44,7 @@ * their naming conventions, but exists only to make it simple to extend this class * for a specific implementation. * - * @package MUtil + * @package Gems * @subpackage Snippets * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License Modified: trunk/library/classes/Gems/Snippets/ModelItemTableSnippetAbstract.php =================================================================== --- trunk/library/classes/Gems/Snippets/ModelItemTableSnippetAbstract.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Snippets/ModelItemTableSnippetAbstract.php 2012-02-07 11:24:23 UTC (rev 457) @@ -88,7 +88,7 @@ * Overrule this function to add different columns to the browse table, without * having to recode the core table building code. * - * @param MUtil_Model_TableBridge $bridge + * @param MUtil_Model_VerticalTableBridge $bridge * @param MUtil_Model_ModelAbstract $model * @return void */ @@ -167,7 +167,7 @@ * Overrule this function to set the header differently, without * having to recode the core table building code. * - * @param MUtil_Model_TableBridge $bridge + * @param MUtil_Model_VerticalTableBridge $bridge * @param MUtil_Model_ModelAbstract $model * @return void */ Modified: trunk/library/classes/Gems/Snippets/ModelItemTableSnippetGeneric.php =================================================================== --- trunk/library/classes/Gems/Snippets/ModelItemTableSnippetGeneric.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Snippets/ModelItemTableSnippetGeneric.php 2012-02-07 11:24:23 UTC (rev 457) @@ -27,7 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * - * @package MUtil + * @package Gems * @subpackage Snippets * @author Matijs de Jong <mj...@ma...> * @copyright Copyright (c) 2011 Erasmus MC @@ -45,7 +45,7 @@ * their naming conventions, but exists only to make it simple to extend this class * for a specific implementation. * - * @package MUtil + * @package Gems * @subpackage Snippets * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License Modified: trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetGeneric.php =================================================================== --- trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetGeneric.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetGeneric.php 2012-02-07 11:24:23 UTC (rev 457) @@ -27,7 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * - * @package MUtil + * @package Gems * @subpackage Snippets * @author Matijs de Jong <mj...@ma...> * @copyright Copyright (c) 2011 Erasmus MC @@ -46,7 +46,7 @@ * their naming conventions, but exists only to make it simple to extend this class * for a specific implementation. * - * @package MUtil + * @package Gems * @subpackage Snippets * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License Modified: trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php =================================================================== --- trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php 2012-02-07 11:24:23 UTC (rev 457) @@ -56,6 +56,19 @@ protected $_form; /** + * Simple default function for making sure there is a $this->_saveButton. + * + * As the save button is not part of the model - but of the interface - it + * does deserve it's own function. + */ + protected function addSaveButton() + { + $this->_form->resetContext(); + parent::addSaveButton(); + } + + + /** * Perform some actions on the form, right before it is displayed but already populated * * Here we add the table display to the form. Modified: trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php =================================================================== --- trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php 2012-02-07 11:24:23 UTC (rev 457) @@ -27,7 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * - * @package MUtil + * @package Gems * @subpackage Snippets * @author Matijs de Jong <mj...@ma...> * @copyright Copyright (c) 2011 Erasmus MC @@ -45,7 +45,7 @@ * their naming conventions, but exists only to make it simple to extend this class * for a specific implementation. * - * @package MUtil + * @package Gems * @subpackage Snippets * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License Modified: trunk/library/classes/Gems/TabForm.php =================================================================== --- trunk/library/classes/Gems/TabForm.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/TabForm.php 2012-02-07 11:24:23 UTC (rev 457) @@ -33,6 +33,8 @@ */ /** + * Creates a form using tab-layout where each tab is a subform + * * @package Gems * @subpackage Form * @copyright Copyright (c) 2011 Erasmus MC @@ -41,6 +43,8 @@ class Gems_TabForm extends Gems_Form { /** + * Holds the last tab we added information to + * * @var Gems_Form_TabSubForm */ private $currentTab = null; @@ -168,7 +172,7 @@ /** * Retrieve a named tab (subform) and set the active tab to this one * - * @param type $name + * @param string $name * @return Gems_Form_TabSubForm */ public function getTab($name) @@ -316,6 +320,11 @@ $jquery->addOnLoad($js); } + /** + * Load the default decorators + * + * @return void + */ public function loadDefaultDecorators() { if ($this->loadDefaultDecoratorsIsDisabled()) { return; @@ -335,6 +344,8 @@ } /** + * Reset the currentTab to be the main form again + * * As addElement and addDisplayGroup provide a fluent way of working with subforms * we need to provide a method to skip back to the main form again. */ @@ -342,6 +353,11 @@ $this->currentTab = null; } + /** + * Select a tab by it's numerical index + * + * @param int $tabIdx + */ public function selectTab($tabIdx) { $this->getElement('tab')->setValue($tabIdx); $this->setAttrib('selected', $tabIdx); Modified: trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php 2012-02-07 11:24:23 UTC (rev 457) @@ -311,7 +311,12 @@ */ public function checkTokensFromStart(Gems_Tracker_RespondentTrack $respTrack, $userId) { - return $this->checkTokensFrom($respTrack, $respTrack->getFirstToken(), $userId); + $token = $respTrack->getFirstToken(); + if ($token instanceof Gems_Tracker_Token) { + return $this->checkTokensFrom($respTrack, $respTrack->getFirstToken(), $userId); + } else { + return 0; + } } /** Modified: trunk/library/classes/Gems/Tracker/Model/TrackModel.php =================================================================== --- trunk/library/classes/Gems/Tracker/Model/TrackModel.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Tracker/Model/TrackModel.php 2012-02-07 11:24:23 UTC (rev 457) @@ -95,7 +95,7 @@ * Sets the labels, format functions, etc... * * @param boolean $detailed True when shopwing detailed information - * @return Gems_Tracker_Model_StandardTokenModel + * @return Gems_Tracker_Model_TrackModel */ public function applyFormatting($detailed = false) { @@ -110,6 +110,8 @@ $this->set('gtr_active', 'label', $this->translate->_('Active'), 'multiOptions', $translated->getYesNo()); $this->set('gtr_date_start', 'label', $this->translate->_('From'), 'dateFormat', $translated->dateFormatString, 'formatFunction', $translated->formatDate); $this->set('gtr_date_until', 'label', $this->translate->_('Use until'), 'dateFormat', $translated->dateFormatString, 'formatFunction', $translated->formatDateForever); + + return $this; } /** Modified: trunk/library/classes/Gems/Tracker/RespondentTrack.php =================================================================== --- trunk/library/classes/Gems/Tracker/RespondentTrack.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Tracker/RespondentTrack.php 2012-02-07 11:24:23 UTC (rev 457) @@ -201,7 +201,7 @@ /** * Makes sure the respondent data is part of the $this->_respTrackData */ - private function _ensureRespondentData() + protected function _ensureRespondentData() { if (! isset($this->_respTrackData['grs_id_user'], $this->_respTrackData['gr2o_id_user'], $this->_respTrackData['gco_code'])) { $sql = "SELECT * @@ -452,6 +452,16 @@ } /** + * Returns the description of this track as stored in the fields. + * + * @return string + */ + public function getFieldsInfo() + { + return $this->_respTrackData['gr2t_track_info']; + } + + /** * Returns the first token in this track * * @return Gems_Tracker_Token Modified: trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php =================================================================== --- trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php 2012-02-07 11:24:23 UTC (rev 457) @@ -90,6 +90,13 @@ protected $showButtons = true; /** + * Switch to put the display of the headers on or off + * + * @var boolean + */ + protected $showHeaders = true; + + /** * Switch to put the display of the current token as select to true or false. * * @var boolean @@ -204,14 +211,16 @@ if ($this->tokenId) { if ($this->token->exists) { - $htmlDiv->h3(sprintf($this->_('%s answers for patient number %s'), $this->token->getSurveyName(), $this->token->getPatientNumber())); + if ($this->showHeaders) { + $htmlDiv->h3(sprintf($this->_('%s answers for patient number %s'), $this->token->getSurveyName(), $this->token->getPatientNumber())); - $htmlDiv->pInfo(sprintf( - $this->_('Answers for token %s, patient number %s: %s.'), - strtoupper($this->tokenId), - $this->token->getPatientNumber(), - $this->token->getRespondentName())) - ->appendAttrib('class', 'noprint'); + $htmlDiv->pInfo(sprintf( + $this->_('Answers for token %s, patient number %s: %s.'), + strtoupper($this->tokenId), + $this->token->getPatientNumber(), + $this->token->getRespondentName())) + ->appendAttrib('class', 'noprint'); + } $table = parent::getHtmlOutput($view); $table->setPivot(true, 2, 1); Copied: trunk/library/classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php (from rev 455, branches/1.5.x/library/classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php) =================================================================== --- trunk/library/classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php (rev 0) +++ trunk/library/classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php 2012-02-07 11:24:23 UTC (rev 457) @@ -0,0 +1,304 @@ +<?php + +/** + * Copyright (c) 2012, 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 Tracker + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: EditTrackEngineSnippetGeneric.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * Basic snippet for editing track engines instances + * + * @package Gems + * @subpackage Tracker + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5 + */ +class Gems_Tracker_Snippets_EditTrackEngineSnippetGeneric extends Gems_Snippets_ModelFormSnippetAbstract +{ + /** + * + * @var string Field for storing the old track class + */ + protected $_oldClassName = 'old__gtr_track_class'; + + /** + * + * @var Zend_Db_Adapter_Abstract + */ + protected $db; + + /** + * Required + * + * @var Gems_Loader + */ + protected $loader; + + /** + * Optional, required when creating or $trackId should be set + * + * @var Gems_Tracker_Engine_TrackEngineInterface + */ + protected $trackEngine; + + /** + * Optional, required when creating or $engine should be set + * + * @var int Track Id + */ + protected $trackId; + + /** + * @var Gems_Util + */ + protected $util; + + /** + * Adds elements from the model to the bridge that creates the form. + * + * Overrule this function to add different elements to the browse table, without + * having to recode the core table building code. + * + * @param MUtil_Model_FormBridge $bridge + * @param MUtil_Model_ModelAbstract $model + */ + protected function addFormElements(MUtil_Model_FormBridge $bridge, MUtil_Model_ModelAbstract $model) + { + if (! $this->createData) { + $bridge->addHidden('gtr_id_track'); + } + $bridge->addText('gtr_track_name', 'size', 30, 'minlength', 4, 'validator', $model->createUniqueValidator('gtr_track_name')); + + // gtr_track_class + if ($this->trackEngine) { + $options = $model->get('gtr_track_class', 'multiOptions'); + $alternatives = $this->trackEngine->getConversionTargets($options); + if (count($alternatives) > 1) { + $options = $alternatives; + + $bridge->addHidden($this->_oldClassName); + + if (! isset($this->formData[$this->_oldClassName])) { + $this->formData[$this->_oldClassName] = $this->formData['gtr_track_class']; + } + + $classEdit = true; + } else { + $classEdit = false; + } + } else { + $tracker = $this->loader->getTracker(); + $options = $tracker->getTrackEngineList(true, true); + $classEdit = true; + } + $model->set('gtr_track_class', 'multiOptions', $options, 'escape', false); + if ($classEdit) { + $bridge->addRadio( 'gtr_track_class'); + } else { + $bridge->addExhibitor('gtr_track_class'); + } + + $bridge->addDate('gtr_date_start'); + $bridge->addDate('gtr_date_until'); + if (! $this->createData) { + $bridge->addCheckbox('gtr_active'); + } + $bridge->addMultiCheckbox('gtr_organizations', 'label', $this->_('Organizations'), 'multiOptions', $this->util->getDbLookup()->getOrganizations(), 'required', true); + } + + /** + * Should be called after answering the request to allow the Target + * to check if all required registry values have been set correctly. + * + * @return boolean False if required are missing. + */ + public function checkRegistryRequestsAnswers() + { + return $this->db && $this->loader && parent::checkRegistryRequestsAnswers(); + } + + /** + * Creates the model + * + * @return MUtil_Model_ModelAbstract + */ + protected function createModel() + { + $model = $this->loader->getTracker()->getTrackModel(); + $model->applyFormatting(true); + + return $model; + } + + /** + * + * @return Gems_Menu_MenuList + * / + protected function getMenuList() + { + $links = $this->menu->getMenuList(); + $links->addParameterSources($this->request, $this->menu->getParameterSource()); + + $links->addByController('track', 'show-track', $this->_('Show track')) + ->addByController('track', 'index', $this->_('Show tracks')) + ->addByController('respondent', 'show', $this->_('Show respondent')); + + return $links; + } // */ + + /** + * Helper function to allow generalized statements about the items in the model to used specific item names. + * + * @param int $count + * @return $string + */ + public function getTopic($count = 1) + { + return $this->plural('track', 'tracks', $count); + } + + /** + * + * @return string The header title to display + */ + protected function getTitle() + { + if ($this->createData) { + return $this->_('Add new track'); + } else { + return parent::getTitle(); + } + } + + /** + * The place to check if the data set in the snippet is valid + * to generate the snippet. + * + * When invalid data should result in an error, you can throw it + * here but you can also perform the check in the + * checkRegistryRequestsAnswers() function from the + * {@see MUtil_Registry_TargetInterface}. + * + * @return boolean + */ + public function hasHtmlOutput() + { + if ($this->trackEngine && (! $this->trackId)) { + $this->trackId = $this->trackEngine->getTrackId(); + } + + if ($this->trackId) { + // We are updating + $this->createData = false; + + // Try to get $this->trackEngine filled + if (! $this->trackEngine) { + // Set the engine used + $this->trackEngine = $this->loader->getTracker()->getTrackEngine($this->trackId); + } + + } else { + // We are inserting + $this->createData = true; + $this->saveLabel = $this->_($this->_('Add new track')); + } + + return parent::hasHtmlOutput(); + } + + /** + * Hook that loads the form data from $_POST or the model + * + * Or from whatever other source you specify here. + */ + protected function loadFormData() + { + parent::loadFormData(); + + // feature request #200 + if (isset($this->formData['gtr_organizations']) && (! is_array($this->formData['gtr_organizations']))) { + $this->formData['gtr_organizations'] = explode('|', trim($this->formData['gtr_organizations'], '|')); + } + } + + /** + * Hook containing the actual save code. + * + * Call's afterSave() for user interaction. + * + * @see afterSave() + */ + protected function saveData() + { + // feature request #200 + if (isset($this->formData['gtr_organizations']) && is_array($this->formData['gtr_organizations'])) { + $this->formData['gtr_organizations'] = '|' . implode('|', $this->formData['gtr_organizations']) . '|'; + } + if ($this->trackEngine) { + $this->formData['gtr_survey_rounds'] = $this->trackEngine->calculateRoundCount(); + } else { + $this->formData['gtr_survey_rounds'] = 0; + } + + parent::saveData(); + + // Check for creation + if ($this->createData) { + if (isset($this->formData['gtr_id_track'])) { + $this->trackId = $this->formData['gtr_id_track']; + } + } elseif ($this->trackEngine && + isset($this->formData[$this->_oldClassName], $this->formData['gtr_track_class']) && + $this->formData[$this->_oldClassName] != $this->formData['gtr_track_class']) { + + // Track conversion + $this->trackEngine->convertTo($this->formData['gtr_track_class']); + } + } + + /** + * Set what to do when the form is 'finished'. + * + * @return EditTrackEngineSnippet (continuation pattern) + */ + protected function setAfterSaveRoute() + { + // Default is just go to the index + if ($this->routeAction && ($this->request->getActionName() !== $this->routeAction)) { + $this->afterSaveRouteUrl = array($this->request->getActionKey() => $this->routeAction, MUtil_Model::REQUEST_ID => $this->trackId); + } + + return $this; + } +} Modified: trunk/library/classes/Gems/Tracker.php =================================================================== --- trunk/library/classes/Gems/Tracker.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Tracker.php 2012-02-07 11:24:23 UTC (rev 457) @@ -842,9 +842,9 @@ $batch = $this->_loadClass('Batch_ProcessTokensBatch', true, array($batch_id)); if (! $batch->isLoaded()) { - $tokenRows = $tokenSelect->fetchAll(); - - foreach ($tokenRows as $tokenData) { + $statement = $tokenSelect->getSelect()->query(); + //Process one row at a time to prevent out of memory errors for really big resultsets + while ($tokenData = $statement->fetch()) { $batch->addToken($tokenData['gto_id_token'], $userId); } } @@ -898,16 +898,16 @@ public function recalculateTokensBatch($batch_id, $userId = null, $cond = null) { $userId = $this->_checkUserId($userId); - $tokenSelect = $this->getTokenSelect(); - $tokenSelect->andReceptionCodes() - ->andRespondents() - ->andRespondentOrganizations() - ->andConsents(); + $tokenSelect = $this->getTokenSelect(array('gto_id_token')); + $tokenSelect->andReceptionCodes(array()) + ->andRespondents(array()) + ->andRespondentOrganizations(array()) + ->andConsents(array()); if ($cond) { $tokenSelect->forWhere($cond); } //Only select surveys that are active in the source (so we can recalculate inactive in Gems) - $tokenSelect->andSurveys(); + $tokenSelect->andSurveys(array()); $tokenSelect->forWhere('gsu_surveyor_active = 1'); self::$verbose = true; Modified: trunk/library/classes/Gems/Upgrades.php =================================================================== --- trunk/library/classes/Gems/Upgrades.php 2012-02-07 11:12:45 UTC (rev 456) +++ trunk/library/classes/Gems/Upgrades.php 2012-02-07 11:24:23 UTC (rev 457) @@ -61,14 +61,42 @@ /** * To upgrade from 143 to 15 we need to do some work: - * 1. execute db patches + * 1. execute db patches 42 and 43 + * 2. create new tables */ public function Upgrade143to15() { + $this->addMessage($this->_('Executing patchlevel 42')); $this->patcher->executePatch(42); - + $this->addMessage($this->_('Executing patchlevel 43')); + $this->patcher->executePatch(43); + $this->invalidateCache(); + $this->addMessage($this->_('Creating new tables')); + $this->createNewTables(); + + $this->invalidateCache(); + + $this->addMessage($this->_('Syncing surveys for all sources')); + //Now sync the db sources to allow limesurvey source to add a field to the tokentable + $model = new MUtil_Model_TableModel('gems__sources'); + $data = $model->load(false); + + $tracker = $this->loader->getTracker(); + + foreach... [truncated message content] |
From: <gem...@li...> - 2012-02-14 14:36:56
|
Revision: 473 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=473&view=rev Author: mennodekker Date: 2012-02-14 14:36:43 +0000 (Tue, 14 Feb 2012) Log Message: ----------- Merged revision(s) 458-472 from branches/1.5.x: Fixed recalc problem: always saving the completion time, even when it was the same as before ........ Fixed #55: Do not allow reset email when person has no email ........ ........ Icons for track rounds ........ Standard button use for BrowseEditAction.php Added Icons for track rounds ........ Icons for track rounds ........ Removed reference to getPhysician() ........ Small corrections ........ Version numbers update to 1.5.1 Track fields with code names added to mail template variables New _layoutLogin moved to GemsEscort ........ Fix E_NOTICE ........ Fixed crash on respondent/show without pr.respondent.result ........ Merge r467 from 1.5.0-pulse ........ updated translations ........ minor display fixes and added login to project.ini ........ Hide 'salt' from project information overview ........ Revision Links: -------------- http://gemstracker.svn.sourceforge.net/gemstracker/?rev=467&view=rev Modified Paths: -------------- trunk/library/classes/Gems/Controller/BrowseEditAction.php trunk/library/classes/Gems/Default/MailJobAction.php trunk/library/classes/Gems/Default/ProjectInformationAction.php trunk/library/classes/Gems/Default/RespondentAction.php trunk/library/classes/Gems/Email/EmailFormAbstract.php trunk/library/classes/Gems/Html.php trunk/library/classes/Gems/Snippets/TokenModelSnippetAbstract.php trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php trunk/library/classes/Gems/Tracker/Token.php trunk/library/classes/Gems/Tracker.php trunk/library/classes/Gems/Upgrades.php trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php trunk/library/classes/Gems/Versions.php trunk/library/classes/GemsEscort.php trunk/library/classes/MUtil/Model/FormBridge.php trunk/library/classes/MUtil/Version.php trunk/library/configs/db/patches.sql trunk/library/configs/db/tables/gems__rounds.40.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 trunk/library/snippets/RespondentTokenSnippet.php trunk/library/snippets/ShowRoundStepSnippet.php trunk/library/snippets/TrackSurveyOverviewSnippet.php trunk/library/snippets/TrackTokenOverviewSnippet.php trunk/new_project/application/configs/project.ini trunk/new_project/htdocs/gems/css/gems-new.css Added Paths: ----------- trunk/library/classes/MUtil/Form/Element/Multiselect.php trunk/library/classes/MUtil/Form/Element/Select.php trunk/library/classes/MUtil/View/Helper/FormSelectHtml.php Property Changed: ---------------- trunk/ trunk/library/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse:306-430 /branches/1.5.x:426-455 /tags/1.5.0beta1:305 + /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472 /tags/1.5.0beta1:305 Property changes on: trunk/library ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse/library:306-344,346 /branches/1.5.x/library:426-455 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 + /branches/1.5.0-pulse/library:306-344,346,467 /branches/1.5.x/library:426-455,458-472 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 Modified: trunk/library/classes/Gems/Controller/BrowseEditAction.php =================================================================== --- trunk/library/classes/Gems/Controller/BrowseEditAction.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/Gems/Controller/BrowseEditAction.php 2012-02-14 14:36:43 UTC (rev 473) @@ -186,11 +186,16 @@ protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model) { // Add edit button if allowed, otherwise show, again if allowed - if ($menuItem = $this->findAllowedMenuItem('edit', 'show')) { + if ($menuItem = $this->findAllowedMenuItem('show')) { $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge)); } parent::addBrowseTableColumns($bridge, $model); + + // Add edit button if allowed, otherwise show, again if allowed + if ($menuItem = $this->findAllowedMenuItem('edit')) { + $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge)); + } } /** @@ -959,7 +964,12 @@ $table->setOnEmpty(sprintf($this->_('Unknown %s.'), $this->getTopic(1))); $table->setRepeater($repeater); $table->tfrow($this->createMenuLinks($this->menuShowIncludeLevel), array('class' => 'centerAlign')); + + if ($menuItem = $this->findAllowedMenuItem('edit')) { + $table->tbody()->onclick = array('location.href=\'', $menuItem->toHRefAttribute($this->getRequest()), '\';'); + } + $this->html[] = $table; } } Modified: trunk/library/classes/Gems/Default/MailJobAction.php =================================================================== --- trunk/library/classes/Gems/Default/MailJobAction.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/Gems/Default/MailJobAction.php 2012-02-14 14:36:43 UTC (rev 473) @@ -111,7 +111,7 @@ $model->set('gmj_from_fixed', 'label', $this->_('From other'), 'description', sprintf($this->_("Only when '%s' is '%s'."), $model->get('gmj_from_method', 'label'), end($fromMethods))); } - $model->set('gmj_process_method', 'label', $this->_('Processing Method'), 'multiOptions', $unselected + $translated->getBulkMailProcessOptions()); + $model->set('gmj_process_method', 'label', $this->_('Processing Method'), 'default', 'O', 'multiOptions', $translated->getBulkMailProcessOptions()); $model->set('gmj_filter_mode', 'label', $this->_('Filter for'), 'multiOptions', $unselected + $this->getBulkMailFilterOptions()); $model->set('gmj_filter_days_between', 'label', $this->_('Days between reminders'), 'validators[]', 'Digits'); Modified: trunk/library/classes/Gems/Default/ProjectInformationAction.php =================================================================== --- trunk/library/classes/Gems/Default/ProjectInformationAction.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/Gems/Default/ProjectInformationAction.php 2012-02-14 14:36:43 UTC (rev 473) @@ -202,8 +202,12 @@ public function projectAction() { - $project = $this->project; + //Clone the object, we don't want to modify the original + $project = clone $this->escort->project; + + //Now remove some keys want want to keep for ourselves unset($project['admin']); + unset($project['salt']); $this->html->h2($this->_('Project settings')); $this->_showTable(GEMS_PROJECT_NAME . 'Project.ini', $project); Modified: trunk/library/classes/Gems/Default/RespondentAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentAction.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/Gems/Default/RespondentAction.php 2012-02-14 14:36:43 UTC (rev 473) @@ -148,7 +148,7 @@ $bridge->addDate( 'grs_birthday', 'jQueryParams', array('defaultDate' => '-30y', 'maxDate' => 0, 'yearRange' => ($year - 130) . ':' . $year)) ->addValidator(new MUtil_Validate_Date_DateBefore()); - $bridge->addSelect( 'gr2o_id_physician'); + //$bridge->addSelect( 'gr2o_id_physician'); $bridge->addText( 'gr2o_treatment', 'size', 30, 'description', $this->_('DBC\'s, etc...')); $bridge->addTextarea('gr2o_comments', 'rows', 4, 'cols', 60); @@ -202,7 +202,6 @@ if ($detailed) { $model->set('gr2o_comments', 'label', $this->_('Comments')); - $model->set('gr2o_id_physician', 'label', $this->_('Physician'), 'multiOptions', MUtil_Lazy::call(array($this, 'getPhysicians'))); $model->set('gr2o_treatment', 'label', $this->_('Treatment')); $model->addColumn('CASE WHEN grs_email IS NULL OR LENGTH(TRIM(grs_email)) = 0 THEN 1 ELSE 0 END', 'calc_email'); @@ -405,4 +404,4 @@ $params['respondentData'] = $data; $this->addSnippets($this->showSnippets, $params); } -} \ No newline at end of file +} Modified: trunk/library/classes/Gems/Email/EmailFormAbstract.php =================================================================== --- trunk/library/classes/Gems/Email/EmailFormAbstract.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/Gems/Email/EmailFormAbstract.php 2012-02-14 14:36:43 UTC (rev 473) @@ -54,7 +54,7 @@ */ protected $escort; - protected $messages; + protected $messages = array(); protected $model; Modified: trunk/library/classes/Gems/Html.php =================================================================== --- trunk/library/classes/Gems/Html.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/Gems/Html.php 2012-02-14 14:36:43 UTC (rev 473) @@ -1,49 +1,49 @@ <?php - -/** - * Copyright (c) 2011, Erasmus MC - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Erasmus MC nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - + /** - * File description of Gems_Html + * Copyright (c) 2011, Erasmus MC + * All rights reserved. * - * @author Matijs de Jong <mj...@ma...> - * @since 1.0 - * @version 1.4 - * @package Gems + * 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 Html + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ */ /** - * Class description of Gems_Html + * Gems specific Html elements and settings * - * @author Matijs de Jong <mj...@ma...> - * @package Gems + * @package Gems * @subpackage Html + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 */ class Gems_Html { @@ -87,6 +87,7 @@ // Set the image directories MUtil_Html_ImgElement::addImageDir('gems/images'); + MUtil_Html_ImgElement::addImageDir('gems/icons'); $escort = GemsEscort::getInstance(); if (isset($escort->project->imagedir)) { MUtil_Html_ImgElement::addImageDir($escort->project->imagedir); @@ -146,7 +147,7 @@ } else { $args['class'] = new MUtil_Html_ClassArrayAttribute('browselink'); } - + // MUtil_Echo::r($args); $pager = new MUtil_Html_PagePanel($panel_args); Modified: trunk/library/classes/Gems/Snippets/TokenModelSnippetAbstract.php =================================================================== --- trunk/library/classes/Gems/Snippets/TokenModelSnippetAbstract.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/Gems/Snippets/TokenModelSnippetAbstract.php 2012-02-14 14:36:43 UTC (rev 473) @@ -54,6 +54,26 @@ */ public $loader; + protected function addTokenLinks(MUtil_Model_TableBridge $bridge) + { + $title = MUtil_Html::create()->strong($this->_('+')); + + $showLinks[] = $this->createMenuLink($bridge, 'track', 'show', $title); + $showLinks[] = $this->createMenuLink($bridge, 'survey', 'show', $title); + + // Remove nulls + $showLinks = array_filter($showLinks); + + if ($showLinks) { + foreach ($showLinks as $showLink) { + if ($showLink) { + $showLink->title = array($this->_('Token'), $bridge->gto_id_token->strtoupper()); + } + } + } + $bridge->addItemLink($showLinks); + } + /** * Creates the model * @@ -71,10 +91,12 @@ 'calc_valid_from', 'gto_valid_from'); $model->addColumn( - 'CASE WHEN gto_completion_time IS NULL THEN gto_id_token ELSE NULL END', + 'CASE WHEN gto_completion_time IS NULL AND grc_success = 1 AND gto_valid_from <= CURRENT_TIMESTAMP AND gto_completion_time IS NULL AND (gto_valid_until IS NULL OR gto_valid_until >= CURRENT_TIMESTAMP) THEN gto_id_token ELSE NULL END', 'calc_id_token', 'gto_id_token'); - + $model->addColumn( + 'CASE WHEN gto_completion_time IS NULL AND grc_success = 1 AND gto_valid_from <= CURRENT_TIMESTAMP AND gto_completion_time IS NULL AND gto_valid_until < CURRENT_TIMESTAMP THEN 1 ELSE 0 END', + 'was_missed'); return $model; } Modified: trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php 2012-02-14 14:36:43 UTC (rev 473) @@ -438,6 +438,7 @@ $model->set('gro_id_survey'); $model->set('gro_round_description'); $model->set('gro_id_order'); + $model->set('gro_icon_file'); // Calculate valid from $model->set('valid_after', 'elementClass', 'html', 'label', ' ', 'value', MUTil_Html::create()->h4($this->_('Valid from calculation'))); Modified: trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2012-02-14 14:36:43 UTC (rev 473) @@ -112,6 +112,12 @@ protected $util; /** + * + * @var Zend_View + */ + protected $view; + + /** * Copy from Zend_Translate_Adapter * * Translates the given string @@ -191,6 +197,27 @@ } /** + * Returns a list of available icons under 'htdocs/pulse/icons' + * @return string[] + */ + protected function _getAvailableIcons() + { + $icons = array(); + $iterator = new DirectoryIterator(realpath(GEMS_WEB_DIR . '/gems/icons')); + + foreach ($iterator as $fileinfo) { + if ($fileinfo->isFile()) { + // $icons[$fileinfo->getFilename()] = $fileinfo->getFilename(); + $filename = $fileinfo->getFilename(); + $url = $this->view->baseUrl() . MUtil_Html_ImgElement::getImageDir($filename); + $icons[$fileinfo->getFilename()] = MUtil_Html::create('span', $filename, array('style' => 'background: transparent url(' . $url . $filename . ') center right no-repeat; padding-right: 20px;')); + } + } + + return $icons; + } + + /** * Update the track, both in the database and in memory. * * @param array $values The values that this token should be set to @@ -707,17 +734,29 @@ } $model->set('gro_id_survey', 'label', $this->_('Survey'), 'multiOptions', $this->util->getTrackData()->getAllSurveysAndDescriptions()); + $model->set('gro_icon_file', 'label', $this->_('Icon')); $model->set('gro_id_order', 'label', $this->_('Order'), 'default', 10, 'validators[]', $model->createUniqueValidator(array('gro_id_order', 'gro_id_track'))); $model->set('gro_round_description', 'label', $this->_('Description'), 'size', '30'); //, 'minlength', 4, 'required', true); $model->set('gro_changed_event', 'label', $this->_('After change'), 'multiOptions', $this->events->listRoundChangedEvents()); $model->set('gro_active', 'label', $this->_('Active'), 'multiOptions', $this->util->getTranslated()->getYesNo(), 'elementClass', 'checkbox'); - if ($action == 'create') { - $this->_ensureRounds(); + switch ($action) { + case 'create': + $this->_ensureRounds(); - if ($this->_rounds && ($round = end($this->_rounds))) { - $model->set('gro_id_order', 'default', $round['gro_id_order'] + 10); - } + if ($this->_rounds && ($round = end($this->_rounds))) { + $model->set('gro_id_order', 'default', $round['gro_id_order'] + 10); + } + // Intentional fall through + // break; + case 'edit': + $model->set('gro_icon_file', 'multiOptions', $this->util->getTranslated()->getEmptyDropdownArray() + $this->_getAvailableIcons()); + break; + + default: + $model->set('gro_icon_file', 'formatFunction', array('MUtil_Html_ImgElement', 'imgFile')); + break; + } return $model; Modified: trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php =================================================================== --- trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php 2012-02-14 14:36:43 UTC (rev 473) @@ -167,10 +167,16 @@ } //If we are allowed to see who filled out a survey, modify the model accordingly - if (GemsEscort::getInstance()->hasPrivilege('pr.respondent.who')) { + $escort = GemsEscort::getInstance(); + if ($escort->hasPrivilege('pr.respondent.who')) { $this->addLeftTable('gems__staff', array('gto_by' => 'gems__staff_2.gsf_id_user')); $this->addColumn('CASE WHEN gems__staff_2.gsf_id_user IS NULL THEN ggp_name ELSE COALESCE(CONCAT_WS(" ", CONCAT(COALESCE(gems__staff_2.gsf_last_name,"-"),","), gems__staff_2.gsf_first_name, gems__staff_2.gsf_surname_prefix)) END', 'ggp_name'); } + if ($escort->hasPrivilege('pr.respondent.result')) { + $this->addColumn('gto_result', 'calc_result', 'gto_result'); + } else { + $this->addColumn(new Zend_Db_Expr('NULL'), 'calc_result', 'gto_result'); + } $this->useTokenAsKey(); } Modified: trunk/library/classes/Gems/Tracker/Token.php =================================================================== --- trunk/library/classes/Gems/Tracker/Token.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/Gems/Tracker/Token.php 2012-02-14 14:36:43 UTC (rev 473) @@ -349,6 +349,8 @@ //Set completion time for completion event if ($setCompletionTime) { $values['gto_completion_time'] = $complTime->toString(Gems_Tracker::DB_DATETIME_FORMAT); + //Save the old value + $originalCompletionTime = $this->_gemsData['gto_completion_time']; $this->_gemsData['gto_completion_time'] = $values['gto_completion_time']; } @@ -364,8 +366,8 @@ } if ($setCompletionTime) { - //Make sure to unset otherwise it won't get saved - $this->_gemsData['gto_completion_time'] = null; + //Reset to old value, so changes will be picked up + $this->_gemsData['gto_completion_time'] = $originalCompletionTime; } $values['gto_duration_in_sec'] = max($complTime->diffSeconds($startTime), 0); @@ -1233,4 +1235,4 @@ public function cacheSet($key, $value) { $this->_cache[$key] = $value; } -} +} \ No newline at end of file Modified: trunk/library/classes/Gems/Tracker.php =================================================================== --- trunk/library/classes/Gems/Tracker.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/Gems/Tracker.php 2012-02-14 14:36:43 UTC (rev 473) @@ -168,7 +168,7 @@ */ private function _checkUserId($userId = null) { if (empty($userId)) { - $userId = $this->session->user_id; + $userId = isset($this->session->user_id) ? $this->session->user_id : 0; } return $userId; } Modified: trunk/library/classes/Gems/Upgrades.php =================================================================== --- trunk/library/classes/Gems/Upgrades.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/Gems/Upgrades.php 2012-02-14 14:36:43 UTC (rev 473) @@ -66,9 +66,9 @@ */ public function Upgrade143to15() { - $this->addMessage($this->_('Executing patchlevel 42')); + $this->addMessage(sprintf($this->_('Executing patchlevel %d'),42)); $this->patcher->executePatch(42); - $this->addMessage($this->_('Executing patchlevel 43')); + $this->addMessage(sprintf($this->_('Executing patchlevel %d'),43)); $this->patcher->executePatch(43); $this->invalidateCache(); Modified: trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php =================================================================== --- trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php 2012-02-14 14:36:43 UTC (rev 473) @@ -71,7 +71,14 @@ { if ($user) { // Depends on the user. - return $user->hasEmailAddress() && $user->canSetPassword(); + if ($user->hasEmailAddress() && $user->canSetPassword()) { + $email = $user->getEmailAddress(); + if (empty($email)) { + return false; + } else { + return true; + } + } } else { return true; } Modified: trunk/library/classes/Gems/Versions.php =================================================================== --- trunk/library/classes/Gems/Versions.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/Gems/Versions.php 2012-02-14 14:36:43 UTC (rev 473) @@ -43,12 +43,12 @@ { public final function getBuild() { - return 43; + return 44; } public final function getGemsVersion() { - return '1.5'; + return '1.5.1'; } public function getProjectVersion() Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/GemsEscort.php 2012-02-14 14:36:43 UTC (rev 473) @@ -719,12 +719,42 @@ } /** + * Display either a link to the login screen or displays the name of the current user + * and a logoff link. + * * Function called if specified in the Project.ini layoutPrepare section before * the layout is drawn, but after the rest of the program has run it's course. * * @return mixed If null nothing is set, otherwise the name of * the function is used as Zend_View variable name. */ + protected function _layoutLogin(array $args = null) + { + $user = $this->getLoader()->getCurrentUser(); + + $div = MUtil_Html::create('div', array('id' => 'login'), $args); + + $p = $div->p(); + if ($user->isActive()) { + $p->append(sprintf($this->_('You are logged in as %s'), $user->getFullName())); + $item = $this->menu->findFirst(array($this->request->getControllerKey() => 'index', $this->request->getActionKey() => 'logoff')); + $p->a($item->toHRefAttribute(), $this->_('Logoff'), array('class' => 'logout')); + } else { + $item = $this->menu->findFirst(array($this->request->getControllerKey() => 'index', $this->request->getActionKey() => 'login')); + $p->a($item->toHRefAttribute(), $this->_('You are not logged in'), array('class' => 'logout')); + } + $item->set('visible', false); + + return $div; + } + + /** + * Function called if specified in the Project.ini layoutPrepare section before + * the layout is drawn, but after the rest of the program has run it's course. + * + * @return mixed If null nothing is set, otherwise the name of + * the function is used as Zend_View variable name. + */ protected function _layoutMessages(array $args = null) { // Do not trust $messenger being set in the view, @@ -1609,6 +1639,13 @@ return $this; } + /** + * Returns an array of {field_names} => values for this token for + * use in an e-mail tamplate. + * + * @param array $tokenData + * @return array + */ public function tokenMailFields(array $tokenData) { $locale = isset($tokenData['grs_iso_lang']) ? $tokenData['grs_iso_lang'] : $this->locale; @@ -1668,6 +1705,19 @@ $result['{track}'] = $tokenData['gtr_track_name']; + $join = $this->db->quoteInto('gtf_id_field = gr2t2f_id_field AND gr2t2f_id_respondent_track = ?', $tokenData['gto_id_respondent_track']); + $select = $this->db->select(); + $select->from('gems__track_fields', array(new Zend_Db_Expr("CONCAT('{track.', gtf_field_code, '}')"))) + ->joinLeft('gems__respondent2track2field', $join, array('gr2t2f_value')) + ->distinct() + ->where('gtf_field_code IS NOT NULL') + ->order('gtf_field_code'); + $codes = $this->db->fetchPairs($select); + + $result = $result + $codes; + // MUtil_Echo::track($codes); + + return $result; } } Copied: trunk/library/classes/MUtil/Form/Element/Multiselect.php (from rev 472, branches/1.5.x/library/classes/MUtil/Form/Element/Multiselect.php) =================================================================== --- trunk/library/classes/MUtil/Form/Element/Multiselect.php (rev 0) +++ trunk/library/classes/MUtil/Form/Element/Multiselect.php 2012-02-14 14:36:43 UTC (rev 473) @@ -0,0 +1,54 @@ +<?php + +/** + * Copyright (c) 2012, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package MUtil + * @subpackage Form + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: MultiselectRaw.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * Add Html labels to standard parent + * + * @package MUtil + * @subpackage Form + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5 + */ +class MUtil_Form_Element_Multiselect extends Zend_Form_Element_Multiselect +{ + /** + * Use formSelect view helper by default + * @var string + */ + public $helper = 'formSelectHtml'; +} Copied: trunk/library/classes/MUtil/Form/Element/Select.php (from rev 472, branches/1.5.x/library/classes/MUtil/Form/Element/Select.php) =================================================================== --- trunk/library/classes/MUtil/Form/Element/Select.php (rev 0) +++ trunk/library/classes/MUtil/Form/Element/Select.php 2012-02-14 14:36:43 UTC (rev 473) @@ -0,0 +1,54 @@ +<?php + +/** + * Copyright (c) 2012, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package MUtil + * @subpackage Form + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: Select.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * Add Html labels to standard parent + * + * @package MUtil + * @subpackage Form + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5 + */ +class MUtil_Form_Element_Select extends Zend_Form_Element_Select +{ + /** + * Use formSelect view helper by default + * @var string + */ + public $helper = 'formSelectHtml'; +} Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2012-02-14 14:36:43 UTC (rev 473) @@ -553,7 +553,7 @@ $options = $this->_mergeOptions($name, $options, self::DISPLAY_OPTIONS, self::MULTI_OPTIONS); - $element = new Zend_Form_Element_Select($name, $options); + $element = new MUtil_Form_Element_Select($name, $options); return $this->_addToForm($name, $element); } @@ -603,7 +603,7 @@ $options = $this->_mergeOptions($name, $options, self::DISPLAY_OPTIONS, self::MULTI_OPTIONS); - $element = new Zend_Form_Element_Multiselect($name, $options); + $element = new MUtil_Form_Element_Multiselect($name, $options); return $this->_addToForm($name, $element); } Modified: trunk/library/classes/MUtil/Version.php =================================================================== --- trunk/library/classes/MUtil/Version.php 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/classes/MUtil/Version.php 2012-02-14 14:36:43 UTC (rev 473) @@ -34,7 +34,7 @@ { const MAJOR = 1; const MINOR = 0; - const BUILD = 30; + const BUILD = 31; public static function get() { Copied: trunk/library/classes/MUtil/View/Helper/FormSelectHtml.php (from rev 472, branches/1.5.x/library/classes/MUtil/View/Helper/FormSelectHtml.php) =================================================================== --- trunk/library/classes/MUtil/View/Helper/FormSelectHtml.php (rev 0) +++ trunk/library/classes/MUtil/View/Helper/FormSelectHtml.php 2012-02-14 14:36:43 UTC (rev 473) @@ -0,0 +1,132 @@ +<?php + +/** + * Copyright (c) 2012, 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 View + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: FormSelectHtml.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package MUtil + * @subpackage View + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5 + */ +class MUtil_View_Helper_FormSelectHtml extends Zend_View_Helper_FormSelect +{ + /** + * Builds the actual <option> tag + * + * @param string $value Options Value + * @param string $label Options Label + * @param array $selected The option value(s) to mark as 'selected' + * @param array|bool $disable Whether the select is disabled, or individual options are + * @return string Option Tag XHTML + */ + protected function _build($value, $label, $selected, $disable) + { + if (is_bool($disable)) { + $disable = array(); + } + + $opt = '<option' + . ' value="' . $this->view->escape($value) . '"'; + + if ($label instanceof MUtil_Html_HtmlElement) { + // Element not allowed, get parts that are allowed + foreach (array('class', 'dir', 'id', 'label', 'lang', 'style', 'title') as $attr) { + if (isset($label->$attr)) { + $opt .= ' ' . $attr . '="' . $this->view->escape($label->$attr) . '"'; + } + } + + // Now get the content + $renderer = MUtil_Html::getRenderer(); + $content = ''; + foreach ($label->getIterator() as $part) { + $content .= $renderer->renderAny($this->view, $part); + } + + } elseif ($label instanceof MUtil_Html_HtmlInterface) { + $content = $label->render($this->view); + } else { + $content = $this->view->escape($label); + $opt .= ' label="' . $this->view->escape($label) . '"'; + + } + + // selected? + if (in_array((string) $value, $selected)) { + $opt .= ' selected="selected"'; + } + + // disabled? + if (in_array($value, $disable)) { + $opt .= ' disabled="disabled"'; + } + + $opt .= '>' . $content . "</option>"; + + return $opt; + } + /** + * Generates 'select' list of options. + * + * @access public + * + * @param string|array $name If a string, the element name. If an + * array, all other parameters are ignored, and the array elements + * are extracted in place of added parameters. + * + * @param mixed $value The option value to mark as 'selected'; if an + * array, will mark all values in the array as 'selected' (used for + * multiple-select elements). + * + * @param array|string $attribs Attributes added to the 'select' tag. + * + * @param array $options An array of key-value pairs where the array + * key is the radio value, and the array value is the radio text. + * + * @param string $listsep When disabled, use this list separator string + * between list values. + * + * @return string The select tag and options XHTML. + */ + public function formSelectHtml($name, $value = null, $attribs = null, + $options = null, $listsep = "<br />\n") + { + return parent::formSelect($name, $value, $attribs, $options, $listsep); + } +} Modified: trunk/library/configs/db/patches.sql =================================================================== --- trunk/library/configs/db/patches.sql 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/configs/db/patches.sql 2012-02-14 14:36:43 UTC (rev 473) @@ -364,4 +364,8 @@ -- PATCH: Default userdefinition per organization ALTER TABLE gems__organizations ADD `gor_user_class` VARCHAR( 30 ) NOT NULL DEFAULT 'StaffUser' AFTER `gor_code`; -ALTER TABLE `gems__radius_config` CHANGE `grcfg_ip` `grcfg_ip` VARCHAR( 39 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL \ No newline at end of file +ALTER TABLE `gems__radius_config` CHANGE `grcfg_ip` `grcfg_ip` VARCHAR( 39 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL + +-- GEMS VERSION: 44 +-- PATCH: Add icon field to rounds +ALTER TABLE `gems__rounds` ADD gro_icon_file VARCHAR(100) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER `gro_round_description`; Modified: trunk/library/configs/db/tables/gems__rounds.40.sql =================================================================== --- trunk/library/configs/db/tables/gems__rounds.40.sql 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/configs/db/tables/gems__rounds.40.sql 2012-02-14 14:36:43 UTC (rev 473) @@ -12,6 +12,7 @@ gro_survey_name varchar(100) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null, gro_round_description varchar(100) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, + gro_icon_file VARCHAR(100) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, gro_changed_event varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, -- depreciated Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2012-02-14 14:03:35 UTC (rev 472) +++ trunk/library/languages/default-en.po 2012-02-14 14:36:43 UTC (rev 473) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-01-24 12:42+0100\n" +"POT-Creation-Date: 2012-02-14 10:57+0100\n" "PO-Revision-Date: \n" "Last-Translator: Menno Dekker <men...@er...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -18,58 +18,72 @@ "X-Poedit-KeywordsList: plural:1,2\n" "X-Poedit-SearchPath-0: .\n" -#: classes/GemsEscort.php:207 +#: classes/GemsEscort.php:211 #, php-format msgid "Path %s not writable" msgstr "Path %s not writable" -#: classes/GemsEscort.php:893 +#: classes/GemsEscort.php:739 #, php-format +msgid "You are logged in as %s" +msgstr "You are logged in as %s" + +#: classes/GemsEscort.php:741 +#: classes/Gems/Menu.php:248 +msgid "Logoff" +msgstr "Logoff" + +#: classes/GemsEscort.php:744 +msgid "You are not logged in" +msgstr "You are not logged in" + +#: classes/GemsEscort.php:927 +#, php-format msgid "User: %s" msgstr "User: %s" -#: classes/GemsEscort.php:918 +#: classes/GemsEscort.php:952 msgid "version" msgstr "version" -#: classes/GemsEscort.php:1349 +#: classes/GemsEscort.php:1383 msgid "Take note: your session has expired, your inputs were not saved. Please check the input data and try again" msgstr "Take note: your session has expired, your inputs were not saved. Please check the input data and try again" -#: classes/GemsEscort.php:1479 +#: classes/GemsEscort.php:1513 msgid "Please check back later." msgstr "Please check back later." -#: classes/GemsEscort.php:1481 -#: classes/GemsEscort.php:1485 -#: classes/GemsEscort.php:1486 +#: classes/GemsEscort.php:1515 +#: classes/GemsEscort.php:1519 +#: classes/GemsEscort.php:1520 msgid "System is in maintenance mode" msgstr "System is in maintenance mode" -#: classes/GemsEscort.php:1496 +#: classes/GemsEscort.php:1530 msgid "No access to site." msgstr "No access to site." -#: classes/GemsEscort.php:1498 -#: classes/GemsEscort.php:1540 +#: classes/GemsEscort.php:1532 +#: classes/GemsEscort.php:1574 msgid "You have no access to this site." msgstr "You have no access to this site." -#: classes/GemsEscort.php:1514 +#: classes/GemsEscort.php:1548 msgid "No access to page" msgstr "No access to page" -#: classes/GemsEscort.php:1516 +#: classes/GemsEscort.php:1550 #, 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:1526 -#: classes/GemsEscort.php:1538 +#: classes/GemsEscort.php:1560 +#: classes/GemsEscort.php:1572 msgid "You are no longer logged in." msgstr "You are no longer logged in." -#: classes/GemsEscort.php:1527 +#: classes/GemsEscort.php:1561 msgid "You must login to access this page." msgstr "You must login to access this page." @@ -81,31 +95,31 @@ msgid "Combination of organization, username and password not found." msgstr "Combination of organization, username and password not found." -#: classes/Gems/Html.php:154 +#: classes/Gems/Html.php:155 msgid "<< First" msgstr "<< First" -#: classes/Gems/Html.php:155 +#: classes/Gems/Html.php:156 msgid "< Previous" msgstr "< Previous" -#: classes/Gems/Html.php:156 +#: classes/Gems/Html.php:157 msgid "Next >" msgstr "Next >" -#: classes/Gems/Html.php:157 +#: classes/Gems/Html.php:158 msgid "Last >>" msgstr "Last >>" -#: classes/Gems/Html.php:158 +#: classes/Gems/Html.php:159 msgid " | " msgstr " | " -#: classes/Gems/Html.php:162 +#: classes/Gems/Html.php:163 msgid "to" msgstr "to" -#: classes/Gems/Html.php:163 +#: classes/Gems/Html.php:164 msgid "of" msgstr "of" @@ -251,10 +265,6 @@ msgid "Token" msgstr "Token" -#: classes/Gems/Menu.php:248 -msgid "Logoff" -msgstr "Logoff" - #: classes/Gems/Menu.php:283 msgid "Track" msgstr "Track" @@ -413,114 +423,138 @@ msgid "Checks performed" msgstr "Checks performed" -#: classes/Gems/UpgradesAbstract.php:164 +#: classes/Gems/Upgrades.php:69 +#: classes/Gems/Upgrades.php:71 +#, php-format +msgid "Executing patchlevel %d" +msgstr "Executing patchlevel %d" + +#: classes/Gems/Upgrades.php:76 +msgid "Creating new tables" +msgstr "Creating new tables" + +#: classes/Gems/Upgrades.php:81 +msgid "Syncing surveys for all sources" +msgstr "Syncing surveys for all sources" + +#: classes/Gems/UpgradesAbstract.php:175 +#, php-format +msgid "Finished %s creation script for object %d of %d" +msgstr "Finished %s creation script for object %d of %d" + +#: classes/Gems/UpgradesAbstract.php:206 msgid "Already at max. level." msgstr "Already at max. level." -#: classes/Gems/UpgradesAbstract.php:171 +#: classes/Gems/UpgradesAbstract.php:213 #, php-format msgid "Trying upgrade for %s from level %s to level %s" msgstr "Trying upgrade for %s from level %s to level %s" -#: classes/Gems/UpgradesAbstract.php:179 +#: classes/Gems/UpgradesAbstract.php:221 #, php-format msgid "Trying upgrade for %s to level %s: %s" msgstr "Trying upgrade for %s to level %s: %s" -#: classes/Gems/UpgradesAbstract.php:337 +#: classes/Gems/UpgradesAbstract.php:379 msgid "Cache cleaned" msgstr "Cache cleaned" -#: classes/Gems/Controller/BrowseEditAction.php:346 +#: classes/Gems/Controller/BrowseEditAction.php:352 #, php-format msgid "New %s..." msgstr "New %s..." -#: classes/Gems/Controller/BrowseEditAction.php:378 +#: classes/Gems/Controller/BrowseEditAction.php:385 #, php-format msgid "Delete %s" msgstr "Delete %s" -#: classes/Gems/Controller/BrowseEditAction.php:382 +#: classes/Gems/Controller/BrowseEditAction.php:389 #, php-format msgid "%2$u %1$s deleted" msgstr "%2$u %1$s deleted" -#: classes/Gems/Controller/BrowseEditAction.php:396 +#: classes/Gems/Controller/BrowseEditAction.php:403 #, php-format msgid "Edit %s" msgstr "Edit %s" -#: classes/Gems/Controller/BrowseEditAction.php:493 +#: classes/Gems/Controller/BrowseEditAction.php:500 msgid "Free search text" msgstr "Free search text" -#: classes/Gems/Controller/BrowseEditAction.php:564 +#: classes/Gems/Controller/BrowseEditAction.php:571 msgid "Search" msgstr "Search" -#: classes/Gems/Controller/BrowseEditAction.php:580 +#: classes/Gems/Controller/BrowseEditAction.php:587 #, php-format msgid "No %s found" msgstr "No %s found" -#: classes/Gems/Controller/BrowseEditAction.php:653 +#: classes/Gems/Controller/BrowseEditAction.php:660 +#: classes/Gems/Default/ExportAction.php:234 #, php-format msgid "No %s found." msgstr "No %s found." -#: classes/Gems/Controller/BrowseEditAction.php:768 +#: classes/Gems/Controller/BrowseEditAction.php:778 msgid "Are you sure?" msgstr "Are you sure?" -#: classes/Gems/Controller/BrowseEditAction.php:784 +#: classes/Gems/Controller/BrowseEditAction.php:794 +#: classes/Gems/Default/DatabaseAction.php:171 +#: classes/Gems/Default/DatabaseAction.php:483 msgid "Yes" msgstr "Yes" -#: classes/Gems/Controller/BrowseEditAction.php:785 +#: classes/Gems/Controller/BrowseEditAction.php:795 +#: classes/Gems/Default/DatabaseAction.php:172 +#: classes/Gems/Default/DatabaseAction.php:484 msgid "No" msgstr "No" -#: classes/Gems/Controller/BrowseEditAction.php:838 +#: classes/Gems/Controller/BrowseEditAction.php:848 #, php-format msgid "Unknown %s requested" msgstr "Unknown %s requested" -#: classes/Gems/Controller/BrowseEditAction.php:861 +#: classes/Gems/Controller/BrowseEditAction.php:871 #, php-format msgid "New %1$s..." msgstr "New %1$s..." -#: classes/Gems/Controller/BrowseEditAction.php:869 +#: classes/Gems/Controller/BrowseEditAction.php:879 msgid "Save" msgstr "Save" -#: classes/Gems/Controller/BrowseEditAction.php:905 +#: classes/Gems/Controller/BrowseEditAction.php:915 #, php-format msgid "%2$u %1$s saved" msgstr "%2$u %1$s saved" -#: classes/Gems/Controller/BrowseEditAction.php:908 +#: classes/Gems/Controller/BrowseEditAction.php:918 msgid "No changes to save." msgstr "No changes to save." -#: classes/Gems/Controller/BrowseEditAction.php:917 +#: classes/Gems/Controller/BrowseEditAction.php:927 msgid "Input error! No changes saved!" msgstr "Input error! No changes saved!" -#: classes/Gems/Controller/BrowseEditAction.php:945 +#: classes/Gems/Controller/BrowseEditAction.php:955 #, php-format msgid "Show %s" msgstr "Show %s" -#: classes/Gems/Controller/BrowseEditAction.php:952 +#: classes/Gems/Controller/BrowseEditAction.php:962 #, php-format msgid "Unknown %s." msgstr "Unknown %s." #: classes/Gems/Controller/ModelActionAbstract.php:97 #: classes/Gems/Default/AskAction.php:150 -#: classes/Gems/Default/DatabaseAction.php:532 +#: classes/Gems/Default/DatabaseAction.php:487 msgid "Cancel" msgstr "Cancel" @@ -634,7 +668,7 @@ msgstr "Description" #: classes/Gems/Default/ConsentAction.php:70 -#: classes/Gems/Default/DatabaseAction.php:167 +#: classes/Gems/Default/DatabaseAction.php:123 msgid "Order" msgstr "Order" @@ -700,306 +734,260 @@ msgid "On this test system all mail will be delivered to the from address." msgstr "On this test system all mail will be delivered to the from address." -#: classes/Gems/Default/DatabaseAction.php:64 -#, php-format -msgid "Executed %2$s creation script %1$s:" -msgstr "Executed %2$s creation script %1$s:" - -#: classes/Gems/Default/DatabaseAction.php:74 -#, php-format -msgid "%d record(s) returned as result set %d in step %d of %d." -msgstr "%d record(s) returned as result set %d in step %d of %d." - -#: classes/Gems/Default/DatabaseAction.php:78 -#, php-format -msgid "%d record(s) updated in step %d of %d." -msgstr "%d record(s) updated in step %d of %d." - -#: classes/Gems/Default/DatabaseAction.php:81 -#, php-format -msgid "Script ran step %d of %d succesfully." -msgstr "Script ran step %d of %d succesfully." - -#: classes/Gems/Default/DatabaseAction.php:84 -msgid " in step " -msgstr " in step " - #: classes/Gems/Default/DatabaseAction.php:89 #, php-format -msgid "No script for %1$s." -msgstr "No script for %1$s." - -#: classes/Gems/Default/DatabaseAction.php:133 -#, php-format msgid "No rows in %s." msgstr "No rows in %s." -#: classes/Gems/Default/DatabaseAction.php:162 +#: classes/Gems/Default/DatabaseAction.php:118 msgid "Type" msgstr "Type" -#: classes/Gems/Default/DatabaseAction.php:166 +#: classes/Gems/Default/DatabaseAction.php:122 msgid "Group" msgstr "Group" -#: classes/Gems/Default/DatabaseAction.php:168 +#: classes/Gems/Default/DatabaseAction.php:124 msgid "Location" msgstr "Location" -#: classes/Gems/Default/DatabaseAction.php:171 +#: classes/Gems/Default/DatabaseAction.php:127 msgid "Status" msgstr "Status" -#: classes/Gems/Default/DatabaseAction.php:172 -msgid "created" -msgstr "created" - -#: classes/Gems/Default/DatabaseAction.php:173 -msgid "not created" -msgstr "not created" - -#: classes/Gems/Default/DatabaseAction.php:174 -msgid "unknown" -msgstr "unknown" - -#: classes/Gems/Default/DatabaseAction.php:177 +#: classes/Gems/Default/DatabaseAction.php:130 msgid "Script" msgstr "Script" -#: classes/Gems/Default/DatabaseAction.php:179 +#: classes/Gems/Default/DatabaseAction.php:132 msgid "Changed on" msgstr "Changed on" -#: classes/Gems/Default/DatabaseAction.php:198 +#: classes/Gems/Default/DatabaseAction.php:151 msgid "This database object does not exist. You cannot delete it." msgstr "This database object does not exist. You cannot delete it." -#: classes/Gems/Default/DatabaseAction.php:203 +#: classes/Gems/Default/DatabaseAction.php:156 #, php-format msgid "Drop %s" msgstr "Drop %s" -#: classes/Gems/Default/DatabaseAction.php:211 +#: classes/Gems/Default/DatabaseAction.php:164 #, php-format msgid "There are %d rows in the table." msgstr "There are %d rows in the table." -#: classes/Gems/Default/DatabaseAction.php:213 +#: classes/Gems/Default/DatabaseAction.php:166 #, php-format msgid "Drop table with %d rows" msgstr "Drop table with %d rows" -#: classes/Gems/Default/DatabaseAction.php:214 +#: classes/Gems/Default/DatabaseAction.php:167 msgid "Are you really sure?" msgstr "Are you really sure?" -#: classes/Gems/Default/DatabaseAction.php:230 +#: classes/Gems/Default/DatabaseAction.php:183 #, php-format msgid "%1$s %2$s dropped" msgstr "%1$s %2$s dropped" -#: classes/Gems/Default/DatabaseAction.php:235 +#: classes/Gems/Default/DatabaseAction.php:188 msgid " during statement " msgstr " during statement " -#: classes/Gems/Default/DatabaseAction.php:246 +#: classes/Gems/Default/DatabaseAction.php:199 #, php-format msgid "%s no longer exists in the database." msgstr "%s no longer exists in the database." -#: classes/Gems/Default/DatabaseAction.php:249 +#: classes/Gems/Default/DatabaseAction.php:202 #, php-format msgid "%s does not yet exist in the database." msgstr "%s does not yet exist in the database." -#: classes/Gems/Default/DatabaseAction.php:252 +#: classes/Gems/Default/DatabaseAction.php:205 #, php-format msgid "%s object does exist." msgstr "%s object does exist." -#: classes/Gems/Default/DatabaseAction.php:270 +#: classes/Gems/Default/DatabaseAction.php:223 msgid "Object is not a table." msgstr "Object is not a table." -#: classes/Gems/Default/DatabaseAction.php:293 +#: classes/Gems/Default/DatabaseAction.php:246 msgid "Structure" msgstr "Structure" -#: classes/Gems/Default/DatabaseAction.php:302 +#: classes/Gems/Default/DatabaseAction.php:255 msgid "database object" msgid_plural "database objects" msgstr[0] "database object" msgstr[1] "database objects" -#: classes/Gems/Default/DatabaseAction.php:307 +#: classes/Gems/Default/DatabaseAction.php:260 msgid "Database object overview" msgstr "Database object overview" -#: classes/Gems/Default/DatabaseAction.php:316 -#: classes/Gems/Default/DatabaseAction.php:368 +#: classes/Gems/Default/DatabaseAction.php:269 +#: classes/Gems/Default/DatabaseAction.php:321 msgid "Level" msgstr "Level" -#: classes/Gems/Default/DatabaseAction.php:317 -#: classes/Gems/Default/DatabaseAction.php:369 +#: classes/Gems/Default/DatabaseAction.php:270 +#: classes/Gems/Default/DatabaseAction.php:322 msgid "Subtype" msgstr "Subtype" -#: classes/Gems/Default/DatabaseAction.php:319 +#: classes/Gems/Default/DatabaseAction.php:272 msgid "To be executed" msgstr "To be executed" -#: classes/Gems/Default/DatabaseAction.php:320 -#: classes/Gems/Default/DatabaseAction.php:372 +#: classes/Gems/Default/DatabaseAction.php:273 +#: classes/Gems/Default/DatabaseAction.php:325 msgid "Executed" msgstr "Executed" -#: classes/Gems/Default/DatabaseAction.php:321 -#: classes/Gems/Default/DatabaseAction.php:373 +#: classes/Gems/Default/DatabaseAction.php:274 +#: classes/Gems/Default/DatabaseAction.php:326 msgid "Finished" msgstr "Finished" -#: classes/Gems/Default/DatabaseAction.php:324 +#: classes/Gems/Default/DatabaseAction.php:277 msgid "Create the patch table!" msgstr "Create the patch table!" -#: classes/Gems/Default/DatabaseAction.php:326 +#: classes/Gems/Default/DatabaseAction.php:279 #, php-format msgid "%d new or changed patch(es)." msgstr "%d new or changed patch(es)." -#: classes/Gems/Default/DatabaseAction.php:331 +#: classes/Gems/Default/DatabaseAction.php:284 msgid "Gems build" msgstr "Gems build" -#: classes/Gems/Default/DatabaseAction.php:332 +#: classes/Gems/Default/DatabaseAction.php:285 msgid "Database build" msgstr "Database build" -#: classes/Gems/Default/DatabaseAction.php:334 +#: classes/Gems/Default/DatabaseAction.php:287 msgid "Execute level" msgstr "Execute level" -#: classes/Gems/Default/DatabaseAction.php:338 +#: classes/Gems/Default/DatabaseAction.php:291 msgid "Ignore finished" msgstr "Ignore finished" -#: classes/Gems/Default/DatabaseAction.php:339 +#: classes/Gems/Default/DatabaseAction.php:292 msgid "Ignore executed" msgstr "Ignore executed" -#: classes/Gems/Default/DatabaseAction.php:340 +#: classes/Gems/Default/DatabaseAction.php:293 msgid "Show patches" msgstr "Show patches" -#: classes/Gems/Default/DatabaseAction.php:354 +#: classes/Gems/Default/DatabaseAction.php:307 #, php-format msgid "%d patch(es) executed." msgstr "%d patch(es) executed." -#: classes/Gems/Default/DatabaseAction.php:367 +#: classes/Gems/Default/DatabaseAction.php:320 msgid "Patch" msgstr "Patch" -#: classes/Gems/Default/DatabaseAction.php:371 +#: classes/Gems/Default/DatabaseAction.php:324 msgid "Query" msgstr "Query" -#: classes/Gems/Default/DatabaseAction.php:374 +#: classes/Gems/Default/DatabaseAction.php:327 msgid "Result" msgstr "Result" -#: classes/Gems/Default/DatabaseAction.php:398 +#: classes/Gems/Default/DatabaseAction.php:351 msgid "Patch maintenance" msgstr "Patch maintenance" -#: classes/Gems/Default/DatabaseAction.php:402 +#: classes/Gems/Default/DatabaseAction.php:355 msgid "Patch overview" msgstr "Patch overview" -#: classes/Gems/Default/DatabaseAction.php:464 +#: classes/Gems/Default/DatabaseAction.php:417 msgid "This database object does not exist. You cannot create it." msgstr "This database object does not exist. You cannot create it." -#: classes/Gems/Default/DatabaseAction.... [truncated message content] |
From: <gem...@li...> - 2012-02-15 14:58:52
|
Revision: 483 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=483&view=rev Author: matijsdejong Date: 2012-02-15 14:58:41 +0000 (Wed, 15 Feb 2012) Log Message: ----------- Reintegration of tagged version 1.5.1 Modified Paths: -------------- trunk/library/changelog.txt trunk/library/classes/Gems/Events.php trunk/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php trunk/library/classes/Gems/Tracker/Model/TrackModel.php trunk/library/classes/Gems/Tracker/RespondentTrack.php trunk/library/classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php trunk/library/classes/Gems/Util/Translated.php trunk/library/classes/GemsEscort.php trunk/library/configs/db/patches.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/TrackCompletedEventInterface.php Property Changed: ---------------- trunk/ trunk/library/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472 /tags/1.5.0beta1:305 + /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472,475-481 /tags/1.5.0beta1:305 Property changes on: trunk/library ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse/library:306-344,346,467 /branches/1.5.x/library:426-455,458-472 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 + /branches/1.5.0-pulse/library:306-344,346,467 /branches/1.5.x/library:426-455,458-472,475-481 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 Modified: trunk/library/changelog.txt =================================================================== --- trunk/library/changelog.txt 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/changelog.txt 2012-02-15 14:58:41 UTC (rev 483) @@ -1,3 +1,7 @@ +Important changes from 1.5.0 => 1.5.1 +============================================================ +New event introduced: TrackCompletedEvent + Important changes from 1.4.3 => 1.5 ============================================================ Passwords should be set with a project.ini->salt. Salt is now a required project setting! Copied: trunk/library/classes/Gems/Event/TrackCompletedEventInterface.php (from rev 481, branches/1.5.x/library/classes/Gems/Event/TrackCompletedEventInterface.php) =================================================================== --- trunk/library/classes/Gems/Event/TrackCompletedEventInterface.php (rev 0) +++ trunk/library/classes/Gems/Event/TrackCompletedEventInterface.php 2012-02-15 14:58:41 UTC (rev 483) @@ -0,0 +1,59 @@ +<?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 $ + */ + +/** + * Track completed event interface + * + * Run on completion of an event + * + * @package Gems + * @subpackage Event + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.1 + */ +interface Gems_Event_TrackCompletedEventInterface extends Gems_Event_EventInterface +{ + /** + * Process the data and return the answers that should be changed. + * + * Storing the changed $values is handled by the calling function. + * + * @param Gems_Tracker_RespondentTrack $track Gems repsondent track object + * @param array $values The values to update the track with, before they were saved + * @param int $userId The current userId + * @return void + */ + public function processTrackCompletion(Gems_Tracker_RespondentTrack $track, &$values, $userId); +} Modified: trunk/library/classes/Gems/Events.php =================================================================== --- trunk/library/classes/Gems/Events.php 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/classes/Gems/Events.php 2012-02-15 14:58:41 UTC (rev 483) @@ -48,6 +48,7 @@ { const EVENTS_DIR = 'events'; + 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'; @@ -61,6 +62,7 @@ * @var array containing eventType => eventClass for all event classes */ protected $_eventClasses = array( + self::TRACK_COMPLETION_EVENT => 'Gems_Event_TrackCompletedEventInterface', self::ROUND_CHANGED_EVENT => 'Gems_Event_RoundChangedEventInterface', self::SURVEY_BEFORE_ANSWERING_EVENT => 'Gems_Event_SurveyBeforeAnsweringEventInterface', self::SURVEY_COMPLETION_EVENT => 'Gems_Event_SurveyCompletedEventInterface', @@ -174,35 +176,44 @@ /** * - * @param string $eventName - * @return Gems_Event_RoundChangedEventInterface + * @return Gems_Event_SurveyCompletedEventInterface */ - public function loadRoundChangedEvent($eventName) + public function listSurveyBeforeAnsweringEvents() { - return $this->_loadEvent($eventName, self::ROUND_CHANGED_EVENT); + return $this->_listEvents(self::SURVEY_BEFORE_ANSWERING_EVENT); } /** * * @return Gems_Event_SurveyCompletedEventInterface */ - public function listSurveyBeforeAnsweringEvents() + public function listSurveyCompletionEvents() { - return $this->_listEvents(self::SURVEY_BEFORE_ANSWERING_EVENT); + return $this->_listEvents(self::SURVEY_COMPLETION_EVENT); } /** * - * @return Gems_Event_SurveyCompletedEventInterface + * @return Gems_Event_TrackCompletedEventInterface */ - public function listSurveyCompletionEvents() + public function listTrackCompletionEvents() { - return $this->_listEvents(self::SURVEY_COMPLETION_EVENT); + return $this->_listEvents(self::TRACK_COMPLETION_EVENT); } /** * * @param string $eventName + * @return Gems_Event_RoundChangedEventInterface + */ + public function loadRoundChangedEvent($eventName) + { + return $this->_loadEvent($eventName, self::ROUND_CHANGED_EVENT); + } + + /** + * + * @param string $eventName * @return Gems_Event_SurveyBeforeAnsweringEventInterface */ public function loadSurveyBeforeAnsweringEvent($eventName) @@ -219,4 +230,14 @@ { return $this->_loadEvent($eventName, self::SURVEY_COMPLETION_EVENT); } + + /** + * + * @param string $eventName + * @return Gems_Event_TrackCompletedEventInterface + */ + public function loadTrackCompletionEvent($eventName) + { + return $this->_loadEvent($eventName, self::TRACK_COMPLETION_EVENT); + } } Modified: trunk/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php =================================================================== --- trunk/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/classes/Gems/Tracker/Batch/ProcessTokensBatch.php 2012-02-15 14:58:41 UTC (rev 483) @@ -58,6 +58,11 @@ */ protected $translate; + /** + * Set a little higher, to reduce the effect of the server response time and application startup + */ + public $minimalStepDurationMs = 3000; + public function addToken($tokenData, $userId) { if (is_array($tokenData)) { Modified: trunk/library/classes/Gems/Tracker/Model/TrackModel.php =================================================================== --- trunk/library/classes/Gems/Tracker/Model/TrackModel.php 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/classes/Gems/Tracker/Model/TrackModel.php 2012-02-15 14:58:41 UTC (rev 483) @@ -48,7 +48,18 @@ class Gems_Tracker_Model_TrackModel extends MUtil_Model_TableModel implements MUtil_Registry_TargetInterface { /** - * + * Holds the trackData in array with key trackId, for internal caching use only + * + * @var array + */ + protected $_trackData = array(); + + /** + * @var Gems_Loader + */ + protected $loader; + + /** * @var Gems_Tracker */ protected $tracker; @@ -111,6 +122,12 @@ $this->set('gtr_date_start', 'label', $this->translate->_('From'), 'dateFormat', $translated->dateFormatString, 'formatFunction', $translated->formatDate); $this->set('gtr_date_until', 'label', $this->translate->_('Use until'), 'dateFormat', $translated->dateFormatString, 'formatFunction', $translated->formatDateForever); + if ($detailed) { + $this->setIfExists('gtr_completed_event', + 'label', $this->translate->_('After completion'), + 'multiOptions', $this->loader->getEvents()->listTrackCompletionEvents()); + } + return $this; } @@ -147,4 +164,31 @@ { return array_filter(array_keys(get_object_vars($this)), array($this, 'filterRequestNames')); } + + /** + * Get the TrackCompletedEvent for the given trackId + * + * @param int $trackId + * @return Gems_Event_TrackCompletedEventInterface|null + */ + public function getTrackCompletionEvent($trackId) + { + static $trackData = array(); + + if (array_key_exists($trackId, $trackData)) { + $track = $trackData[$trackId]; + } else { + if ($track = $this->loadFirst(array('gtr_id_track' => $trackId))) { + $trackData[$trackId] = $track; + } else { + $track = array(); + } + } + + if (array_key_exists('gtr_completed_event', $track)) { + if (!empty($track['gtr_completed_event'])) { + return $this->loader->getEvents()->loadTrackCompletionEvent($track['gtr_completed_event']); + } + } + } } Modified: trunk/library/classes/Gems/Tracker/RespondentTrack.php =================================================================== --- trunk/library/classes/Gems/Tracker/RespondentTrack.php 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/classes/Gems/Tracker/RespondentTrack.php 2012-02-15 14:58:41 UTC (rev 483) @@ -126,7 +126,7 @@ */ public function _checkTrackCount($userId) { - $sqlCount = 'SELECT COUNT(*) AS count, COALESCE(SUM(CASE WHEN gto_completion_time IS NULL THEN 0 ELSE 1 END), 0) AS completed + $sqlCount = 'SELECT COUNT(*) AS count, SUM(CASE WHEN gto_completion_time IS NULL THEN 0 ELSE 1 END) AS completed FROM gems__tokens JOIN gems__reception_codes ON gto_reception_code = grc_id_reception_code AND grc_success = 1 WHERE gto_id_respondent_track = ?'; @@ -142,6 +142,10 @@ ->onlySucces(); $values['gr2t_end_date'] = $tokenSelect->fetchOne(); + + //Handle TrackCompletionEvent, send only changed fields in $values array + $this->tracker->filterChangesOnly($this->_respTrackData, $values); + $this->handleTrackCompletion($values, $userId); } else { $values['gr2t_end_date'] = null; } @@ -623,7 +627,25 @@ } /** + * Find out if there are track completion events and delegate to the event if needed * + * @param array $values The values changed before entering this event + * @param int $userId + */ + public function handleTrackCompletion(&$values, $userId) { + // Process any events + $trackModel = $this->tracker->getTrackModel(); + + //to be backward compatible, first check if the engine has a + if (is_callable(array($trackModel, 'getTrackCompletionEvent'))) { + if ($event = $trackModel->getTrackCompletionEvent($this->getTrackId())) { + $event->processTrackCompletion($this, $values, $userId); + } + } + } + + /** + * * @return boolean */ public function hasSuccesCode() Modified: trunk/library/classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php =================================================================== --- trunk/library/classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php 2012-02-15 14:58:41 UTC (rev 483) @@ -134,6 +134,9 @@ if (! $this->createData) { $bridge->addCheckbox('gtr_active'); } + if ($model->has('gtr_completed_event')) { + $bridge->add('gtr_completed_event'); + } $bridge->addMultiCheckbox('gtr_organizations', 'label', $this->_('Organizations'), 'multiOptions', $this->util->getDbLookup()->getOrganizations(), 'required', true); } Modified: trunk/library/classes/Gems/Util/Translated.php =================================================================== --- trunk/library/classes/Gems/Util/Translated.php 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/classes/Gems/Util/Translated.php 2012-02-15 14:58:41 UTC (rev 483) @@ -193,27 +193,27 @@ return self::$emptyDropdownArray; } - public function getGenders() + public function getGenders($locale = null) { - return array('M' => $this->_('Male'), 'F' => $this->_('Female'), 'U' => $this->_('Unknown')); + return array('M' => $this->_('Male', $locale), 'F' => $this->_('Female', $locale), 'U' => $this->_('Unknown', $locale)); } - public function getGenderGreeting() + public function getGenderGreeting($locale = null) { - return array('M' => $this->_('mr.'), 'F' => $this->_('mrs.'), 'U' => $this->_('mr./mrs.')); + return array('M' => $this->_('mr.', $locale), 'F' => $this->_('mrs.', $locale), 'U' => $this->_('mr./mrs.', $locale)); } - public function getGenderHello() + public function getGenderHello($locale = null) { - return array('M' => $this->_('Mr.'), 'F' => $this->_('Mrs.'), 'U' => $this->_('Mr./Mrs.')); + return array('M' => $this->_('Mr.', $locale), 'F' => $this->_('Mrs.', $locale), 'U' => $this->_('Mr./Mrs.', $locale)); } - public function getYesNo() + public function getYesNo($locale = null) { static $data; if (! $data) { - $data = array(1 => $this->_('Yes'), 0 => $this->_('No')); + $data = array(1 => $this->_('Yes', $locale), 0 => $this->_('No', $locale)); } return $data; Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/classes/GemsEscort.php 2012-02-15 14:58:41 UTC (rev 483) @@ -1650,7 +1650,8 @@ { $locale = isset($tokenData['grs_iso_lang']) ? $tokenData['grs_iso_lang'] : $this->locale; - $genderHello = $this->getUtil()->getTranslated()->getGenderHello(); + // Prepare values + $genderHello = $this->getUtil()->getTranslated()->getGenderHello($locale); $hello[] = $genderHello[$tokenData['grs_gender']]; $hello[] = $tokenData['grs_first_name']; if ($tokenData['grs_surname_prefix']) { @@ -1658,13 +1659,24 @@ } $hello[] = $tokenData['grs_last_name']; - $genderGreeting = $this->getUtil()->getTranslated()->getGenderGreeting(); + $genderGreeting = $this->getUtil()->getTranslated()->getGenderGreeting($locale); $greeting[] = $genderGreeting[$tokenData['grs_gender']]; if ($tokenData['grs_surname_prefix']) { $greeting[] = $tokenData['grs_surname_prefix']; } $greeting[] = $tokenData['grs_last_name']; + // Count todo + $tSelect = $this->getLoader()->getTracker()->getTokenSelect(array( + 'all' => 'COUNT(*)', + 'track' => $this->db->quoteInto('SUM(CASE WHEN gto_id_respondent_track = ? THEN 1 ELSE 0 END)', $tokenData['gto_id_respondent_track']))); + $tSelect->andSurveys(array()) + ->forRespondent($tokenData['gto_id_respondent'], $tokenData['gto_id_organization']) + ->forGroupId($tokenData['gsu_id_primary_group']) + ->onlyValid(); + $todo = $tSelect->fetchRow(); + + // Set the basic fields $result['{email}'] = $tokenData['grs_email']; $result['{first_name}'] = $tokenData['grs_first_name']; $result['{full_name}'] = implode(' ', $hello); @@ -1681,30 +1693,34 @@ $result['{organization_url}'] = $tokenData['gor_url']; $result['{organization_welcome}'] = $tokenData['gor_welcome']; - $result['{physician}'] = ($tokenData['gsf_surname_prefix'] ? $tokenData['grs_surname_prefix'] . ' ' : '') . $tokenData['gsf_last_name']; + $result['{round}'] = $tokenData['gto_round_description']; - $result['{round}'] = $tokenData['gto_round_description']; + $result['{site_ask_url}'] = $this->util->getCurrentURI('ask/'); + // Url's + $url = $this->util->getCurrentURI('ask/forward/' . MUtil_Model::REQUEST_ID . '/' . $tokenData['gto_id_token']); + $url_input = $result['{site_ask_url}'] . 'index/' . MUtil_Model::REQUEST_ID . '/' . $tokenData['gto_id_token']; - $result['{site_ask_url}'] = $this->util->getCurrentURI('ask/'); + $result['{survey}'] = $tokenData['gsu_survey_name']; - $result['{survey}'] = $tokenData['gsu_survey_name']; + $result['{todo_all}'] = sprintf($this->translate->plural('%d survey', '%d surveys', $todo['all'], $locale), $todo['all']); + $result['{todo_all_count}'] = $todo['all']; + $result['{todo_track}'] = sprintf($this->translate->plural('%d survey', '%d surveys', $todo['track'], $locale), $todo['track']); + $result['{todo_track_count}'] = $todo['track']; - $url = $this->util->getCurrentURI('ask/forward/' . MUtil_Model::REQUEST_ID . '/' . $tokenData['gto_id_token']); - $url_input = $result['{site_ask_url}'] . 'index/' . MUtil_Model::REQUEST_ID . '/' . $tokenData['gto_id_token']; + $result['{token}'] = strtoupper($tokenData['gto_id_token']); + $result['{token_from}'] = MUtil_Date::format($tokenData['gto_valid_from'], Zend_Date::DATE_LONG, 'yyyy-MM-dd', $locale); + // $result['{token_input}'] = MUtil_Html::create()->a($url_input, $tokenData['gsu_survey_name']); + // $result['{token_link}'] = MUtil_Html::create()->a($url, $tokenData['gsu_survey_name']); + // $result['{token_link}'] = '<a href="' . $url . '">' . $tokenData['gsu_survey_name'] . '</a>'; + $result['{token_link}'] = '[url=' . $url . ']' . $tokenData['gsu_survey_name'] . '[/url]'; - $result['{token}'] = strtoupper($tokenData['gto_id_token']); - $result['{token_from}'] = MUtil_Date::format($tokenData['gto_valid_from'], Zend_Date::DATE_LONG, 'yyyy-MM-dd', $locale); - // $result['{token_input}'] = MUtil_Html::create()->a($url_input, $tokenData['gsu_survey_name']); - // $result['{token_link}'] = MUtil_Html::create()->a($url, $tokenData['gsu_survey_name']); - // $result['{token_link}'] = '<a href="' . $url . '">' . $tokenData['gsu_survey_name'] . '</a>'; - $result['{token_link}'] = '[url=' . $url . ']' . $tokenData['gsu_survey_name'] . '[/url]'; + $result['{token_until}'] = MUtil_Date::format($tokenData['gto_valid_until'], Zend_Date::DATE_LONG, 'yyyy-MM-dd', $locale); + $result['{token_url}'] = $url; + $result['{token_url_input}'] = $url_input; - $result['{token_until}'] = MUtil_Date::format($tokenData['gto_valid_until'], Zend_Date::DATE_LONG, 'yyyy-MM-dd', $locale); - $result['{token_url}'] = $url; - $result['{token_url_input}'] = $url_input; + $result['{track}'] = $tokenData['gtr_track_name']; - $result['{track}'] = $tokenData['gtr_track_name']; - + // Add the code fields $join = $this->db->quoteInto('gtf_id_field = gr2t2f_id_field AND gr2t2f_id_respondent_track = ?', $tokenData['gto_id_respondent_track']); $select = $this->db->select(); $select->from('gems__track_fields', array(new Zend_Db_Expr("CONCAT('{track.', gtf_field_code, '}')"))) @@ -1721,4 +1737,3 @@ return $result; } } - Modified: trunk/library/configs/db/patches.sql =================================================================== --- trunk/library/configs/db/patches.sql 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/configs/db/patches.sql 2012-02-15 14:58:41 UTC (rev 483) @@ -369,3 +369,9 @@ -- GEMS VERSION: 44 -- PATCH: Add icon field to rounds ALTER TABLE `gems__rounds` ADD gro_icon_file VARCHAR(100) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER `gro_round_description`; + +-- PATCH: Add index for receptioncode to token table +ALTER TABLE `gems__tokens` ADD INDEX ( `gto_reception_code` ) + +-- PATCH: Add track completion event +ALTER TABLE `gems__tracks` ADD gtr_completed_event varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' AFTER gtr_track_class; Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/languages/default-en.po 2012-02-15 14:58:41 UTC (rev 483) @@ -2,9 +2,9 @@ msgstr "" "Project-Id-Version: Pulse EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-14 10:57+0100\n" +"POT-Creation-Date: 2012-02-15 14:22+0100\n" "PO-Revision-Date: \n" -"Last-Translator: Menno Dekker <men...@er...>\n" +"Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -87,6 +87,14 @@ msgid "You must login to access this page." msgstr "You must login to access this page." +#: classes/GemsEscort.php:1705 +#: classes/GemsEscort.php:1707 +#, php-format +msgid "%d survey" +msgid_plural "%d surveys" +msgstr[0] "%d survey" +msgstr[1] "%d surveys" + #: classes/Gems/AccessLog.php:236 msgid "Database needs to be updated!" msgstr "Database needs to be updated!" @@ -460,94 +468,89 @@ msgid "Cache cleaned" msgstr "Cache cleaned" -#: classes/Gems/Controller/BrowseEditAction.php:352 +#: classes/Gems/Controller/BrowseEditAction.php:354 #, php-format msgid "New %s..." msgstr "New %s..." -#: classes/Gems/Controller/BrowseEditAction.php:385 +#: classes/Gems/Controller/BrowseEditAction.php:387 #, php-format msgid "Delete %s" msgstr "Delete %s" -#: classes/Gems/Controller/BrowseEditAction.php:389 +#: classes/Gems/Controller/BrowseEditAction.php:391 #, php-format msgid "%2$u %1$s deleted" msgstr "%2$u %1$s deleted" -#: classes/Gems/Controller/BrowseEditAction.php:403 +#: classes/Gems/Controller/BrowseEditAction.php:405 #, php-format msgid "Edit %s" msgstr "Edit %s" -#: classes/Gems/Controller/BrowseEditAction.php:500 +#: classes/Gems/Controller/BrowseEditAction.php:502 msgid "Free search text" msgstr "Free search text" -#: classes/Gems/Controller/BrowseEditAction.php:571 +#: classes/Gems/Controller/BrowseEditAction.php:573 msgid "Search" msgstr "Search" -#: classes/Gems/Controller/BrowseEditAction.php:587 +#: classes/Gems/Controller/BrowseEditAction.php:589 #, php-format msgid "No %s found" msgstr "No %s found" -#: classes/Gems/Controller/BrowseEditAction.php:660 -#: classes/Gems/Default/ExportAction.php:234 +#: classes/Gems/Controller/BrowseEditAction.php:662 #, php-format msgid "No %s found." msgstr "No %s found." -#: classes/Gems/Controller/BrowseEditAction.php:778 +#: classes/Gems/Controller/BrowseEditAction.php:780 msgid "Are you sure?" msgstr "Are you sure?" -#: classes/Gems/Controller/BrowseEditAction.php:794 -#: classes/Gems/Default/DatabaseAction.php:171 -#: classes/Gems/Default/DatabaseAction.php:483 +#: classes/Gems/Controller/BrowseEditAction.php:796 msgid "Yes" msgstr "Yes" -#: classes/Gems/Controller/BrowseEditAction.php:795 -#: classes/Gems/Default/DatabaseAction.php:172 -#: classes/Gems/Default/DatabaseAction.php:484 +#: classes/Gems/Controller/BrowseEditAction.php:797 msgid "No" msgstr "No" -#: classes/Gems/Controller/BrowseEditAction.php:848 +#: classes/Gems/Controller/BrowseEditAction.php:850 #, php-format msgid "Unknown %s requested" msgstr "Unknown %s requested" -#: classes/Gems/Controller/BrowseEditAction.php:871 +#: classes/Gems/Controller/BrowseEditAction.php:873 #, php-format msgid "New %1$s..." msgstr "New %1$s..." -#: classes/Gems/Controller/BrowseEditAction.php:879 +#: classes/Gems/Controller/BrowseEditAction.php:881 msgid "Save" msgstr "Save" -#: classes/Gems/Controller/BrowseEditAction.php:915 +#: classes/Gems/Controller/BrowseEditAction.php:917 #, php-format msgid "%2$u %1$s saved" msgstr "%2$u %1$s saved" -#: classes/Gems/Controller/BrowseEditAction.php:918 +#: classes/Gems/Controller/BrowseEditAction.php:920 msgid "No changes to save." msgstr "No changes to save." -#: classes/Gems/Controller/BrowseEditAction.php:927 +#: classes/Gems/Controller/BrowseEditAction.php:929 msgid "Input error! No changes saved!" msgstr "Input error! No changes saved!" -#: classes/Gems/Controller/BrowseEditAction.php:955 +#: classes/Gems/Controller/BrowseEditAction.php:957 #, php-format msgid "Show %s" msgstr "Show %s" -#: classes/Gems/Controller/BrowseEditAction.php:962 +#: classes/Gems/Controller/BrowseEditAction.php:964 #, php-format msgid "Unknown %s." msgstr "Unknown %s." @@ -1001,6 +1004,7 @@ msgstr "Export data" #: classes/Gems/Default/ExportAction.php:153 +#: classes/Gems/Default/MailJobAction.php:121 msgid "Survey" msgstr "Survey" @@ -1012,6 +1016,7 @@ #: classes/Gems/Default/ExportAction.php:172 #: classes/Gems/Default/IndexAction.php:203 #: classes/Gems/Default/LogAction.php:197 +#: classes/Gems/Default/MailJobAction.php:119 msgid "Organization" msgstr "Organization" @@ -1025,6 +1030,7 @@ msgstr "Role" #: classes/Gems/Default/GroupAction.php:92 +#: classes/Gems/Default/MailJobAction.php:104 msgid "Active" msgstr "Active" @@ -1250,7 +1256,6 @@ msgstr "New automatic mail job..." #: classes/Gems/Default/MailJobAction.php:100 -#: classes/Gems/Default/MailLogAction.php:116 msgid "Template" msgstr "Template" @@ -1634,6 +1639,7 @@ #: classes/Gems/Default/OverviewPlanAction.php:115 #: classes/Gems/Default/ProjectSurveysAction.php:88 +#: classes/Gems/Default/SurveyAction.php:203 msgid "survey" msgid_plural "surveys" msgstr[0] "survey" @@ -1743,29 +1749,32 @@ msgid "Server PHP Info" msgstr "Server PHP Info" -#: classes/Gems/Default/ProjectInformationAction.php:208 +#: classes/Gems/Default/ProjectInformationAction.php:212 msgid "Project settings" msgstr "Project settings" -#: classes/Gems/Default/ProjectInformationAction.php:215 +#: classes/Gems/Default/ProjectInformationAction.php:219 msgid "Session content" msgstr "Session content" -#: classes/Gems/Default/ProjectInformationAction.php:216 +#: classes/Gems/Default/ProjectInformationAction.php:220 msgid "Session" msgstr "Session" #: classes/Gems/Default/ProjectSurveysAction.php:68 +#: classes/Gems/Default/SurveyAction.php:192 msgid "By" msgstr "By" #: classes/Gems/Default/ProjectSurveysAction.php:69 #: classes/Gems/Default/ProjectTracksAction.php:67 +#: classes/Gems/Default/SurveyAction.php:193 msgid "From" msgstr "From" #: classes/Gems/Default/ProjectSurveysAction.php:70 #: classes/Gems/Default/ProjectTracksAction.php:68 +#: classes/Gems/Default/SurveyAction.php:195 msgid "Until" msgstr "Until" @@ -1793,6 +1802,7 @@ msgstr "Questions in survey %s" #: classes/Gems/Default/ProjectTracksAction.php:118 +#: classes/Gems/Default/SurveyAction.php:85 #, php-format msgid "Survey %s does not exist." msgstr "Survey %s does not exist." @@ -1968,6 +1978,7 @@ msgstr "Please settle the informed consent form for this patient." #: classes/Gems/Default/RespondentPlanAction.php:67 +#: classes/Gems/Default/SurveyAction.php:171 msgid "Show respondent" msgstr "Show patient" @@ -4071,9 +4082,8 @@ msgid "Can access" msgstr "Can access" -#: views/scripts/index/login.phtml:12 -msgid "The Pulse software was made possible thanks to support from " -msgstr "The Pulse software was made possible thanks to support from " +#~ msgid "The Pulse software was made possible thanks to support from " +#~ msgstr "The Pulse software was made possible thanks to support from " #~ msgid "Physician" #~ msgstr "Physician" Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2012-02-15 14:41:28 UTC (rev 482) +++ trunk/library/languages/default-nl.po 2012-02-15 14:58:41 UTC (rev 483) @@ -2,9 +2,9 @@ msgstr "" "Project-Id-Version: Pulse NL\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-14 10:56+0100\n" +"POT-Creation-Date: 2012-02-15 14:22+0100\n" "PO-Revision-Date: \n" -"Last-Translator: Menno Dekker <men...@er...>\n" +"Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -87,6 +87,14 @@ msgid "You must login to access this page." msgstr "U moet ingelogd zijn voor toegang tot deze pagina." +#: classes/GemsEscort.php:1705 +#: classes/GemsEscort.php:1707 +#, php-format +msgid "%d survey" +msgid_plural "%d surveys" +msgstr[0] "%d vragenlijst" +msgstr[1] "%d vragenlijsten" + #: classes/Gems/AccessLog.php:236 msgid "Database needs to be updated!" msgstr "Database dient ververst te worden!" @@ -354,7 +362,7 @@ #: classes/Gems/Model.php:206 msgid "Opened" -msgstr "Bekeken" +msgstr "Bekeken op" #: classes/Gems/Model.php:207 msgid "Consent" @@ -460,94 +468,89 @@ msgid "Cache cleaned" msgstr "Cache opgeschoond" -#: classes/Gems/Controller/BrowseEditAction.php:352 +#: classes/Gems/Controller/BrowseEditAction.php:354 #, php-format msgid "New %s..." msgstr "Nieuw %s..." -#: classes/Gems/Controller/BrowseEditAction.php:385 +#: classes/Gems/Controller/BrowseEditAction.php:387 #, php-format msgid "Delete %s" msgstr "Verwijder %s" -#: classes/Gems/Controller/BrowseEditAction.php:389 +#: classes/Gems/Controller/BrowseEditAction.php:391 #, php-format msgid "%2$u %1$s deleted" msgstr "%2$u %1$s verwijderd" -#: classes/Gems/Controller/BrowseEditAction.php:403 +#: classes/Gems/Controller/BrowseEditAction.php:405 #, php-format msgid "Edit %s" msgstr "Bewerk %s" -#: classes/Gems/Controller/BrowseEditAction.php:500 +#: classes/Gems/Controller/BrowseEditAction.php:502 msgid "Free search text" msgstr "Vrije zoek tekst" -#: classes/Gems/Controller/BrowseEditAction.php:571 +#: classes/Gems/Controller/BrowseEditAction.php:573 msgid "Search" msgstr "Zoeken" -#: classes/Gems/Controller/BrowseEditAction.php:587 +#: classes/Gems/Controller/BrowseEditAction.php:589 #, php-format msgid "No %s found" msgstr "Geen %s gevonden" -#: classes/Gems/Controller/BrowseEditAction.php:660 -#: classes/Gems/Default/ExportAction.php:234 +#: classes/Gems/Controller/BrowseEditAction.php:662 #, php-format msgid "No %s found." msgstr "Geen %s gevonden." -#: classes/Gems/Controller/BrowseEditAction.php:778 +#: classes/Gems/Controller/BrowseEditAction.php:780 msgid "Are you sure?" msgstr "Weet u het zeker?" -#: classes/Gems/Controller/BrowseEditAction.php:794 -#: classes/Gems/Default/DatabaseAction.php:171 -#: classes/Gems/Default/DatabaseAction.php:483 +#: classes/Gems/Controller/BrowseEditAction.php:796 msgid "Yes" msgstr "Ja" -#: classes/Gems/Controller/BrowseEditAction.php:795 -#: classes/Gems/Default/DatabaseAction.php:172 -#: classes/Gems/Default/DatabaseAction.php:484 +#: classes/Gems/Controller/BrowseEditAction.php:797 msgid "No" msgstr "Nee" -#: classes/Gems/Controller/BrowseEditAction.php:848 +#: classes/Gems/Controller/BrowseEditAction.php:850 #, php-format msgid "Unknown %s requested" msgstr "Onjuist %s verzoek" -#: classes/Gems/Controller/BrowseEditAction.php:871 +#: classes/Gems/Controller/BrowseEditAction.php:873 #, php-format msgid "New %1$s..." msgstr "Nieuwe %1$s..." -#: classes/Gems/Controller/BrowseEditAction.php:879 +#: classes/Gems/Controller/BrowseEditAction.php:881 msgid "Save" msgstr "Opslaan" -#: classes/Gems/Controller/BrowseEditAction.php:915 +#: classes/Gems/Controller/BrowseEditAction.php:917 #, php-format msgid "%2$u %1$s saved" msgstr "%2$u %1$s opgeslagen" -#: classes/Gems/Controller/BrowseEditAction.php:918 +#: classes/Gems/Controller/BrowseEditAction.php:920 msgid "No changes to save." msgstr "Geen verandering om op te slaan." -#: classes/Gems/Controller/BrowseEditAction.php:927 +#: classes/Gems/Controller/BrowseEditAction.php:929 msgid "Input error! No changes saved!" msgstr "Invoer fout! Veranderingen niet opgeslagen!" -#: classes/Gems/Controller/BrowseEditAction.php:955 +#: classes/Gems/Controller/BrowseEditAction.php:957 #, php-format msgid "Show %s" msgstr "Toon %s" -#: classes/Gems/Controller/BrowseEditAction.php:962 +#: classes/Gems/Controller/BrowseEditAction.php:964 #, php-format msgid "Unknown %s." msgstr "%s is onbekend." @@ -1001,6 +1004,7 @@ msgstr "Exporteer gegevens" #: classes/Gems/Default/ExportAction.php:153 +#: classes/Gems/Default/MailJobAction.php:121 msgid "Survey" msgstr "Vragenlijst" @@ -1012,6 +1016,7 @@ #: classes/Gems/Default/ExportAction.php:172 #: classes/Gems/Default/IndexAction.php:203 #: classes/Gems/Default/LogAction.php:197 +#: classes/Gems/Default/MailJobAction.php:119 msgid "Organization" msgstr "Organisatie" @@ -1025,6 +1030,7 @@ msgstr "Rol" #: classes/Gems/Default/GroupAction.php:92 +#: classes/Gems/Default/MailJobAction.php:104 msgid "Active" msgstr "Actief" @@ -1250,7 +1256,6 @@ msgstr "Nieuwe automatische mail opdracht..." #: classes/Gems/Default/MailJobAction.php:100 -#: classes/Gems/Default/MailLogAction.php:116 msgid "Template" msgstr "Sjabloon" @@ -1634,6 +1639,7 @@ #: classes/Gems/Default/OverviewPlanAction.php:115 #: classes/Gems/Default/ProjectSurveysAction.php:88 +#: classes/Gems/Default/SurveyAction.php:203 msgid "survey" msgid_plural "surveys" msgstr[0] "vragenlijst" @@ -1743,29 +1749,32 @@ msgid "Server PHP Info" msgstr "Server PHP Info" -#: classes/Gems/Default/ProjectInformationAction.php:208 +#: classes/Gems/Default/ProjectInformationAction.php:212 msgid "Project settings" msgstr "Project instellingen" -#: classes/Gems/Default/ProjectInformationAction.php:215 +#: classes/Gems/Default/ProjectInformationAction.php:219 msgid "Session content" msgstr "Sessie inhoud" -#: classes/Gems/Default/ProjectInformationAction.php:216 +#: classes/Gems/Default/ProjectInformationAction.php:220 msgid "Session" msgstr "Sessie" #: classes/Gems/Default/ProjectSurveysAction.php:68 +#: classes/Gems/Default/SurveyAction.php:192 msgid "By" msgstr "Door" #: classes/Gems/Default/ProjectSurveysAction.php:69 #: classes/Gems/Default/ProjectTracksAction.php:67 +#: classes/Gems/Default/SurveyAction.php:193 msgid "From" msgstr "Van" #: classes/Gems/Default/ProjectSurveysAction.php:70 #: classes/Gems/Default/ProjectTracksAction.php:68 +#: classes/Gems/Default/SurveyAction.php:195 msgid "Until" msgstr "Tot" @@ -1793,6 +1802,7 @@ msgstr "Vragen in vragenlijsten %s" #: classes/Gems/Default/ProjectTracksAction.php:118 +#: classes/Gems/Default/SurveyAction.php:85 #, php-format msgid "Survey %s does not exist." msgstr "Vragenlijst %s bestaat niet." @@ -1968,6 +1978,7 @@ msgstr "A.u.b. het informed consent formulier doornemen met deze patiënt" #: classes/Gems/Default/RespondentPlanAction.php:67 +#: classes/Gems/Default/SurveyAction.php:171 msgid "Show respondent" msgstr "Toon patiënt" @@ -4071,9 +4082,8 @@ msgid "Can access" msgstr "Toegang tot" -#: views/scripts/index/login.phtml:12 -msgid "The Pulse software was made possible thanks to support from " -msgstr "De PULSE software is mede mogelijk gemaakt met steun van " +#~ msgid "The Pulse software was made possible thanks to support from " +#~ msgstr "De PULSE software is mede mogelijk gemaakt met steun van " #, fuzzy #~ msgid "Executing patchlevel 43" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-16 10:52:19
|
Revision: 491 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=491&view=rev Author: mennodekker Date: 2012-02-16 10:52:09 +0000 (Thu, 16 Feb 2012) Log Message: ----------- Changed rounds in StandardTokenModel to joinLeft as sometimes there is a token not attached to a round Removed contact from header_bar in new_project Modified Paths: -------------- trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php trunk/new_project/application/configs/project.ini Modified: trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php =================================================================== --- trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php 2012-02-16 10:03:47 UTC (rev 490) +++ trunk/library/classes/Gems/Tracker/Model/StandardTokenModel.php 2012-02-16 10:52:09 UTC (rev 491) @@ -96,7 +96,7 @@ } $this->addTable( 'gems__tracks', array('gto_id_track' => 'gtr_id_track')); - $this->addTable( 'gems__rounds', array('gto_id_round' => 'gro_id_round')); + $this->addLeftTable('gems__rounds', array('gto_id_round' => 'gro_id_round')); $this->addTable( 'gems__surveys', array('gto_id_survey' => 'gsu_id_survey')); $this->addTable( 'gems__groups', array('gsu_id_primary_group' => 'ggp_id_group')); $this->addTable( 'gems__respondents', array('gto_id_respondent' => 'grs_id_user')); Modified: trunk/new_project/application/configs/project.ini =================================================================== --- trunk/new_project/application/configs/project.ini 2012-02-16 10:03:47 UTC (rev 490) +++ trunk/new_project/application/configs/project.ini 2012-02-16 10:52:09 UTC (rev 491) @@ -173,7 +173,7 @@ layoutPrepare.title = 1 layoutPrepare.projectName = header layoutPrepare.login = header_bar -layoutPrepare.contact = header_bar +layoutPrepare.contact = 0 layoutPrepare.localeSet = header_bar layoutPrepare.organizationSwitcher = header_bar layoutPrepare.version = footer @@ -188,7 +188,7 @@ layoutPrepare.jQuery = 1 layoutPrepare.login.class = rightFloat -layoutPrepareArgs.contact.class = rightFloat +;layoutPrepareArgs.contact.class = rightFloat layoutPrepareArgs.time.class = rightFloat layoutPrepareArgs.user.class = rightFloat layoutPrepareArgs.version.class = leftFloat This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-02-23 10:52:51
|
Revision: 511 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=511&view=rev Author: matijsdejong Date: 2012-02-23 10:52:42 +0000 (Thu, 23 Feb 2012) Log Message: ----------- Added revisions 508 & 510 from tags/1.5.1 Modified Paths: -------------- trunk/library/classes/Gems/Default/DatabaseAction.php trunk/library/classes/Gems/Email/EmailFormAbstract.php trunk/library/classes/Gems/Email/OneMailForm.php Property Changed: ---------------- trunk/ trunk/library/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472,475-481 /tags/1.5.0beta1:305 /tags/1.5.1:485,489 + /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472,475-481 /tags/1.5.0beta1:305 /tags/1.5.1:485,489,509-510 Property changes on: trunk/library ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse/library:306-344,346,467 /branches/1.5.x/library:426-455,458-472,475-481 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 /tags/1.5.1/library:485,489 + /branches/1.5.0-pulse/library:306-344,346,467 /branches/1.5.x/library:426-455,458-472,475-481 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 /tags/1.5.1/library:485,489,509-510 Modified: trunk/library/classes/Gems/Default/DatabaseAction.php =================================================================== --- trunk/library/classes/Gems/Default/DatabaseAction.php 2012-02-23 10:07:53 UTC (rev 510) +++ trunk/library/classes/Gems/Default/DatabaseAction.php 2012-02-23 10:52:42 UTC (rev 511) @@ -243,6 +243,7 @@ $model = $this->getModel(); if ($model->isMeta('action', 'show')) { + $table->tr(); $table->tdh($this->_('Structure')); $table->td($this->getFieldTable($this->_getParam(MUtil_Model::REQUEST_ID))); } Modified: trunk/library/classes/Gems/Email/EmailFormAbstract.php =================================================================== --- trunk/library/classes/Gems/Email/EmailFormAbstract.php 2012-02-23 10:07:53 UTC (rev 510) +++ trunk/library/classes/Gems/Email/EmailFormAbstract.php 2012-02-23 10:52:42 UTC (rev 511) @@ -241,6 +241,7 @@ if ($email = $this->escort->project->email['site']) { $options['S'] = $this->_createMultiOption(array(), $this->escort->project->name, $email); + $valid[] = 'S'; } } @@ -252,6 +253,7 @@ 'required' => true, )); + $element->addValidator('InArray', false, array('haystack' => $valid)); $this->defaultFrom = reset($valid); Modified: trunk/library/classes/Gems/Email/OneMailForm.php =================================================================== --- trunk/library/classes/Gems/Email/OneMailForm.php 2012-02-23 10:07:53 UTC (rev 510) +++ trunk/library/classes/Gems/Email/OneMailForm.php 2012-02-23 10:52:42 UTC (rev 511) @@ -132,6 +132,7 @@ } else { $tokenData = $this->getTokenData(); + $this->mailer->setFrom($this->getValue('from')); $this->mailer->setSubject($this->getValue('gmt_subject')); $this->mailer->setBody($this->getValue('gmt_body')); $this->mailer->setTemplateId($this->getValue('select_subject')); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-03-09 15:05:40
|
Revision: 544 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=544&view=rev Author: mennodekker Date: 2012-03-09 15:05:30 +0000 (Fri, 09 Mar 2012) Log Message: ----------- Fixing unit tests, new base test class is now ControllerTestAbstract for controller test and objects that depend on the application being loaded like Gems_Util Modified Paths: -------------- trunk/library/classes/Gems/Util.php trunk/test/classes/Gems/UtilTest.php trunk/test/classes/IndexControllerTest.php Added Paths: ----------- trunk/test/classes/ControllerTestAbstract.php Modified: trunk/library/classes/Gems/Util.php =================================================================== --- trunk/library/classes/Gems/Util.php 2012-03-09 08:41:53 UTC (rev 543) +++ trunk/library/classes/Gems/Util.php 2012-03-09 15:05:30 UTC (rev 544) @@ -122,11 +122,11 @@ */ public function getConsentRejected() { - if (isset($this->project->consentRejected)) { + if ($this->project->offsetExists('consentRejected')) { return $this->project->consentRejected; } - if (isset($this->project->concentRejected)) { + if ($this->project->offsetExists('concentRejected')) { throw new Gems_Exception_Coding('project.ini setting was changed from "concentRejected" to "consentRejected", please update your project.ini'); return $this->project->concentRejected; } Added: trunk/test/classes/ControllerTestAbstract.php =================================================================== --- trunk/test/classes/ControllerTestAbstract.php (rev 0) +++ trunk/test/classes/ControllerTestAbstract.php 2012-03-09 15:05:30 UTC (rev 544) @@ -0,0 +1,29 @@ +<?php +class ControllerTestAbstract extends Zend_Test_PHPUnit_ControllerTestCase +{ + public function setUp() + { + // Zend_Application: loads the autoloader + require_once 'Zend/Application.php'; + + // Create application, bootstrap, and run + $application = new Zend_Application( + APPLICATION_ENV, + APPLICATION_PATH . '/configs/application.ini' + ); + + $this->bootstrap = $application; + + parent::setUp(); + } + + /** + * Here we fix the intentional errors that are in de default setup + * + * At the moment we only set a salt in the project resource + */ + protected function _fixSetup() { + $project = $this->bootstrap->getBootstrap()->getResource('project'); + $project->salt = 'TESTCASE'; + } +} Modified: trunk/test/classes/Gems/UtilTest.php =================================================================== --- trunk/test/classes/Gems/UtilTest.php 2012-03-09 08:41:53 UTC (rev 543) +++ trunk/test/classes/Gems/UtilTest.php 2012-03-09 15:05:30 UTC (rev 544) @@ -1,5 +1,5 @@ <?php -require_once 'IndexControllerTest.php'; +require_once 'ControllerTestAbstract.php'; /** * Copyright (c) 2011, Erasmus MC @@ -48,7 +48,7 @@ * @license New BSD License * @since Class available since version 1.0 */ -class Gems_UtilTest extends IndexControllerTest//Zend_Test_PHPUnit_ControllerTestCase +class Gems_UtilTest extends ControllerTestAbstract { /** * @var Gems_Util @@ -148,7 +148,6 @@ $this->assertEquals($expected, $actual); //Check for incorrect spelling used before 1.5.2 - unset($project->consentRejected); $project->concentRejected = 'test2'; try { $actual = $this->object->getConsentRejected(); Modified: trunk/test/classes/IndexControllerTest.php =================================================================== --- trunk/test/classes/IndexControllerTest.php 2012-03-09 08:41:53 UTC (rev 543) +++ trunk/test/classes/IndexControllerTest.php 2012-03-09 15:05:30 UTC (rev 544) @@ -1,33 +1,7 @@ <?php - -class IndexControllerTest extends Zend_Test_PHPUnit_ControllerTestCase +require_once 'ControllerTestAbstract.php'; +class IndexControllerTest extends ControllerTestAbstract { - public function setUp() - { - // Zend_Application: loads the autoloader - require_once 'Zend/Application.php'; - - // Create application, bootstrap, and run - $application = new Zend_Application( - APPLICATION_ENV, - APPLICATION_PATH . '/configs/application.ini' - ); - - $this->bootstrap = $application; - - parent::setUp(); - } - - /** - * Here we fix the intentional errors that are in de default setup - * - * At the moment we only set a salt in the project resource - */ - protected function _fixSetup() { - $project = $this->bootstrap->getBootstrap()->getResource('project'); - $project->salt = 'TESTCASE'; - } - public function testSaltRequired() { $this->dispatch('/'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-16 11:38:18
|
Revision: 619 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=619&view=rev Author: matijsdejong Date: 2012-04-16 11:38:07 +0000 (Mon, 16 Apr 2012) Log Message: ----------- Merged revision(s) 618 from tags/1.5.3-rc2: New staff can login by default Some extra comment for debugging ........ Modified Paths: -------------- trunk/library/classes/Gems/Default/StaffAction.php trunk/library/classes/Gems/User/UserLoader.php Property Changed: ---------------- trunk/ trunk/library/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472,475-481 /tags/1.5.0beta1:305 /tags/1.5.1:485,489,509-510 /tags/1.5.3-rc2:612,614,616 + /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472,475-481 /tags/1.5.0beta1:305 /tags/1.5.1:485,489,509-510 /tags/1.5.3-rc2:612,614,616,618 Property changes on: trunk/library ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse/library:306-344,346,467 /branches/1.5.x/library:426-455,458-472,475-481 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 /tags/1.5.1/library:485,489,509-510,534 /tags/1.5.3-rc2/library:612,614,616 + /branches/1.5.0-pulse/library:306-344,346,467 /branches/1.5.x/library:426-455,458-472,475-481 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 /tags/1.5.1/library:485,489,509-510,534 /tags/1.5.3-rc2/library:612,614,616,618 Modified: trunk/library/classes/Gems/Default/StaffAction.php =================================================================== --- trunk/library/classes/Gems/Default/StaffAction.php 2012-04-16 11:35:08 UTC (rev 618) +++ trunk/library/classes/Gems/Default/StaffAction.php 2012-04-16 11:38:07 UTC (rev 619) @@ -292,7 +292,7 @@ $orgDef = $org->get('gor_user_class', $this->defaultStaffDefinition); $model->set('gul_user_class', 'default', $orgDef, 'multiOptions', $this->loader->getUserLoader()->getAvailableStaffDefinitions()); $model->set('gsf_iso_lang', 'label', $this->_('Language'), 'multiOptions', $this->util->getLocalized()->getLanguages()); - $model->set('gul_can_login', 'label', $this->_('Can login'), 'multiOptions', $this->util->getTranslated()->getYesNo()); + $model->set('gul_can_login', 'label', $this->_('Can login'), 'multiOptions', $this->util->getTranslated()->getYesNo(), 'default', 1); $model->set('gsf_logout_on_survey', 'label', $this->_('Logout on survey'), 'multiOptions', $this->util->getTranslated()->getYesNo()); } Modified: trunk/library/classes/Gems/User/UserLoader.php =================================================================== --- trunk/library/classes/Gems/User/UserLoader.php 2012-04-16 11:35:08 UTC (rev 618) +++ trunk/library/classes/Gems/User/UserLoader.php 2012-04-16 11:38:07 UTC (rev 619) @@ -503,7 +503,10 @@ // Fail over for pre 1.5 projects // - // No login as other organization or with e-mail possible for first login + // No login as other organization or with e-mail possible for first login, before running of upgrade / patches + // + // Test code voor old user, code for password 'guest' is: 084e0343a0486ff05530df6c705c8bb4, + // for 'test4': 86985e105f79b95d6bc918fb45ec7727 $sql = "SELECT gsf_id_user FROM gems__staff INNER JOIN gems__organizations ON gsf_id_organization = gor_id_organization This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-07-12 13:10:32
|
Revision: 834 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=834&view=rev Author: michieltcs Date: 2012-07-12 13:10:26 +0000 (Thu, 12 Jul 2012) Log Message: ----------- Add some more clarification about export.pdfExportCommand Modified Paths: -------------- trunk/library/changelog.txt trunk/new_project/application/configs/project.ini Modified: trunk/library/changelog.txt =================================================================== --- trunk/library/changelog.txt 2012-07-12 12:50:23 UTC (rev 833) +++ trunk/library/changelog.txt 2012-07-12 13:10:26 UTC (rev 834) @@ -5,6 +5,7 @@ Externally the organization id is still left out of the url when not needed UPGRADE WARNING: Check all your (snippet) extensions to RespondentAction, TrackAction, SurveyAction and project specific versions of ShowTrackTokenSnippet and ShowSingleSurveySnippet: you may need to specify extra parameters as the menu items need to know the organization id New projects start with a basic css template +In project.ini, export.wkhtmltopdf has been renamed to export.pdfExportCommand, and which now stores the entire command line to the pdf export binary (wkhtmltopdf, Phantom.js or similar). Important changes from 1.5.3 => 1.5.4 ============================================================ Modified: trunk/new_project/application/configs/project.ini =================================================================== --- trunk/new_project/application/configs/project.ini 2012-07-12 12:50:23 UTC (rev 833) +++ trunk/new_project/application/configs/project.ini 2012-07-12 13:10:26 UTC (rev 834) @@ -293,6 +293,12 @@ ;--------------------------------------------------------- ; Command line to the pdf export binary (such as ; wkhtmltopdf, Phantom.js or similar) +; +; Use as follows: +; export.pdfExportCommand = '/bin/wkhtmltopdf %s %s' +; +; where %s %s is respecitively the input (url) and +; the output (file) export.pdfExportCommand = [testing : production] 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-09-11 14:01:07
|
Revision: 938 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=938&view=rev Author: matijsdejong Date: 2012-09-11 14:00:57 +0000 (Tue, 11 Sep 2012) Log Message: ----------- Added keySplit function to MUtil_Ra Modified Paths: -------------- trunk/library/classes/MUtil/Ra.php trunk/test/classes/MUtil/RaTest.php Property Changed: ---------------- trunk/scripts/ Modified: trunk/library/classes/MUtil/Ra.php =================================================================== --- trunk/library/classes/MUtil/Ra.php 2012-09-11 13:10:36 UTC (rev 937) +++ trunk/library/classes/MUtil/Ra.php 2012-09-11 14:00:57 UTC (rev 938) @@ -470,6 +470,31 @@ } /** + * This functions splits an array into two arrays, one containing + * the integer keys and one containing the string keys and returns + * an array containing first the integer key array and then the + * string key array. + * + * @param array $arg The input array + * @return array array(integer_keys, string_keys) + */ + public static function keySplit(array $arg) + { + $nums = array(); + $strings = array(); + + foreach ($arg as $key => $value) { + if (is_integer($key)) { + $nums[$key] = $value; + } else { + $strings[$key] = $value; + } + } + + return array($nums, $strings); + } + + /** * A function that transforms an array in the form key1, value1, key2, value2 into array(key1 => value1, key2 => value2). * * When the $args array contains only a single sub array, then this value is assumed to be the return value. This allows Property changes on: trunk/scripts ___________________________________________________________________ Modified: svn:ignore - docs gems.lint reports tmp + depend-chart_map.shtml depend-overview_map.shtml docs gems.lint reports tmp Modified: trunk/test/classes/MUtil/RaTest.php =================================================================== --- trunk/test/classes/MUtil/RaTest.php 2012-09-11 13:10:36 UTC (rev 937) +++ trunk/test/classes/MUtil/RaTest.php 2012-09-11 14:00:57 UTC (rev 938) @@ -76,4 +76,36 @@ $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 testKeySplit() + { + $args = array(0 => '0', 'a' => 'a', 1 => '1', 'b' => 'b', '2' => '2'); + list($nums, $strings) = MUtil_Ra::keySplit($args); + $this->assertEquals($nums, array(0 => '0', 1 => '1', '2' => '2')); + $this->assertEquals($strings, array('a' => 'a', 'b' => 'b')); + } + + public function testKeySplitNumOnly() + { + $args = array(0 => '0', 1 => '1', '2' => '2'); + list($nums, $strings) = MUtil_Ra::keySplit($args); + $this->assertEquals($nums, array(0 => '0', 1 => '1', '2' => '2')); + $this->assertEquals($strings, array()); + } + + public function testKeySplitStringOnly() + { + $args = array('a' => 'a', 'b' => 'b'); + list($nums, $strings) = MUtil_Ra::keySplit($args); + $this->assertEquals($nums, array()); + $this->assertEquals($strings, array('a' => 'a', 'b' => 'b')); + } + + public function testKeySplitEmpty() + { + $args = array(); + list($nums, $strings) = MUtil_Ra::keySplit($args); + $this->assertEquals($nums, array()); + $this->assertEquals($strings, array()); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-10-18 12:21:49
|
Revision: 989 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=989&view=rev Author: mennodekker Date: 2012-10-18 12:21:38 +0000 (Thu, 18 Oct 2012) Log Message: ----------- preparing for 1.5.6 release Modified Paths: -------------- trunk/library/classes/Gems/Upgrades.php Removed Paths: ------------- trunk/new_project/application/snippets/ Modified: trunk/library/classes/Gems/Upgrades.php =================================================================== --- trunk/library/classes/Gems/Upgrades.php 2012-10-17 11:03:07 UTC (rev 988) +++ trunk/library/classes/Gems/Upgrades.php 2012-10-18 12:21:38 UTC (rev 989) @@ -62,6 +62,7 @@ $this->register(array($this, 'Upgrade152to153'), 'Upgrade from 1.5.2 to 1.5.3'); $this->register(array($this, 'Upgrade153to154'), 'Upgrade from 1.5.3 to 1.5.4'); $this->register(array($this, 'Upgrade154to155'), 'Upgrade from 1.5.4 to 1.5.5'); + $this->register(array($this, 'Upgrade155to156'), 'Upgrade from 1.5.5 to 1.5.6'); /** * To have the new_project updated to the highest level, update @@ -150,4 +151,16 @@ return true; } + + /** + * To upgrade to 1.5.6 just execute patchlevel 48 + */ + public function Upgrade155to156() + { + $this->_batch->addTask('Db_ExecutePatch', 49); + + $this->_batch->addTask('Echo', $this->_('Make sure to read the changelog as it contains important instructions')); + + return true; + } } \ 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-10-29 12:08:53
|
Revision: 999 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=999&view=rev Author: matijsdejong Date: 2012-10-29 12:08:44 +0000 (Mon, 29 Oct 2012) Log Message: ----------- New MUtil_String::splitOnCharCallback function Modified Paths: -------------- trunk/library/classes/MUtil/String.php trunk/test/classes/MUtil/StringTest.php Modified: trunk/library/classes/MUtil/String.php =================================================================== --- trunk/library/classes/MUtil/String.php 2012-10-25 15:05:27 UTC (rev 998) +++ trunk/library/classes/MUtil/String.php 2012-10-29 12:08:44 UTC (rev 999) @@ -81,6 +81,44 @@ } /** + * Split a string whereever the callback returns true (including + * the character that returns true. + * + * MUtil_String::splitOnCharCallback('abcDef', 'ctype_upper') => array(0 => 'abc', 1 => 'Def'); + * + * MUtil_String::splitOnCharCallback('abCDef', 'ctype_upper', true) => array(0 => 'ab', 2 => 'ef'); + * + * @param string $input + * @param callback $callBack Taking a single character as input + * @param boolean $excludeDelimiter When excluded and 2 delimiters are next to each other, the output + * index in the array will skip a value + * @return array index => split portion + */ + public static function splitOnCharCallback($input, $callBack, $excludeDelimiter = false) + { + $current = 0; + $length = strlen($input); + $results = array(); + + for ($i = 0; $i < $length; $i++) { + if ($callBack($input[$i])) { + $current++; + + if ($excludeDelimiter) { + continue; + } + } + if (isset($results[$current])) { + $results[$current] .= $input[$i]; + } else { + $results[$current] = $input[$i]; + } + } + + return $results; + } + + /** * Return the part after $input and $filter have stopped being the same * * stripStringLeft('abcdef', 'abcx') => 'def' Modified: trunk/test/classes/MUtil/StringTest.php =================================================================== --- trunk/test/classes/MUtil/StringTest.php 2012-10-25 15:05:27 UTC (rev 998) +++ trunk/test/classes/MUtil/StringTest.php 2012-10-29 12:08:44 UTC (rev 999) @@ -103,6 +103,82 @@ } /** + * Test a default callback usage + */ + public function testSplitOnCharCallbackDefault() + { + $result = MUtil_String::splitOnCharCallback('abcDef', 'ctype_upper'); + $test[0] = 'abc'; + $test[1] = 'Def'; + $this->assertEquals($result, $test); + } + + /** + * Test callback usage, with two consecutive delimiters + */ + public function testSplitOnCharCallbackDoubleD() + { + $result = MUtil_String::splitOnCharCallback('abcDDef', 'ctype_upper'); + $test[0] = 'abc'; + $test[1] = 'D'; + $test[2] = 'Def'; + $this->assertEquals($result, $test); + } + + /** + * Test a callback usage where nothing happens + */ + public function testSplitOnCharCallbackEmptyString() + { + $result = MUtil_String::splitOnCharCallback('', 'ctype_upper'); + $this->assertEquals($result, array()); + } + + /** + * Test callback usage, excluding the delimiter + */ + public function testSplitOnCharCallbackNoDelimeter() + { + $result = MUtil_String::splitOnCharCallback('abcDef', 'ctype_upper', true); + $test[0] = 'abc'; + $test[1] = 'ef'; + $this->assertEquals($result, $test); + } + + /** + * Test callback usage where there are no delimiters + */ + public function testSplitOnCharCallbackNosplit() + { + $result = MUtil_String::splitOnCharCallback('abcdef', 'ctype_upper'); + $test[0] = 'abcdef'; + $this->assertEquals($result, $test); + } + + /** + * Test callback usage, with two consecutive caps, excluding the delimiter + */ + public function testSplitOnCharCallbackNoDelimiterDoubleD() + { + $result = MUtil_String::splitOnCharCallback('abcDDef', 'ctype_upper', true); + $test[0] = 'abc'; + $test[2] = 'ef'; + $this->assertEquals($result, $test); + } + + /** + * Test callback usage with another function + */ + public function testSplitOnCharCallbackNumeric() + { + $result = MUtil_String::splitOnCharCallback('ab1cD2ef', 'is_numeric'); + $test[0] = 'ab'; + $test[1] = '1cD'; + $test[2] = '2ef'; + $this->assertEquals($result, $test); + } + + /** * Remove the characters where both strings are the same */ public function testStripStringLeftRemovepartFilter() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-03-14 11:05:30
|
Revision: 1181 http://sourceforge.net/p/gemstracker/code/1181 Author: mennodekker Date: 2013-03-14 11:05:26 +0000 (Thu, 14 Mar 2013) Log Message: ----------- Made default values for project.ini settings visible in project information Modified Paths: -------------- trunk/library/classes/Gems/Project/ProjectSettings.php trunk/new_project/application/configs/project.ini Modified: trunk/library/classes/Gems/Project/ProjectSettings.php =================================================================== --- trunk/library/classes/Gems/Project/ProjectSettings.php 2013-03-14 10:43:13 UTC (rev 1180) +++ trunk/library/classes/Gems/Project/ProjectSettings.php 2013-03-14 11:05:26 UTC (rev 1181) @@ -94,15 +94,49 @@ } elseif (! is_array($array)) { $array = (array) $array; } + + // Now load default values for (new) keys and merge them with the ones provided by project.ini + $projectValues = $array + $this->_getDefaultValues(); + + parent::__construct($projectValues, ArrayObject::ARRAY_AS_PROPS); - parent::__construct($array, ArrayObject::ARRAY_AS_PROPS); - if (! ($this->offsetExists('name') && $this->offsetGet('name'))) { $this->offsetSet('name', GEMS_PROJECT_NAME); } $this->offsetSet('multiLocale', $this->offsetExists('locales') && (count($this->offsetGet('locales')) > 1)); } + + /** + * Set the default values for all keys. + * + * By doing this, we make sure the settings show up in the project information + * with the defaults even if the settings was not present in the project.ini + */ + public function _getDefaultValues() + { + + return array( + '>>> defaults <<<' => '>>> Below are default settings, since they were not found in your project.ini <<<', + + // What to do when user is going to or has answered a survey + 'askNextDelay' => -1, // No auto advance + 'askDelay' => -1, // No auto advance + + // How to react to false token attempts + 'askThrottle' => array( + 'period' => 15 * 60, // Detection window: 15 minutes + 'threshold' => 15 * 20, // Threshold: 20 requests per minute + 'delay' => 10 // Delay: 10 seconds + ), + + 'cache' => 'apc', // Use apc cache as default + + 'organization' => array( + 'default' => -1 // No default organization + ) + ); + } /** * Add recursively the rules active for this specific set of codes. @@ -275,8 +309,8 @@ return -1; } + - /** * Returns the public description of this project. * Modified: trunk/new_project/application/configs/project.ini =================================================================== --- trunk/new_project/application/configs/project.ini 2013-03-14 10:43:13 UTC (rev 1180) +++ trunk/new_project/application/configs/project.ini 2013-03-14 11:05:26 UTC (rev 1181) @@ -87,7 +87,7 @@ ; ; askDelay ; -; When no askDelay is specified the user will see +; When no askDelay is specified or is -1 the user will see ; greeting screen were he or she will a have to click ; on a button to fill in a survey. ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2011-10-25 14:39:03
|
Revision: 138 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=138&view=rev Author: matijsdejong Date: 2011-10-25 14:38:56 +0000 (Tue, 25 Oct 2011) Log Message: ----------- Locks now set using LockFile object. #29 closed, mail jobs can be set on or off. Modified Paths: -------------- trunk/new_project/application/configs/project.ini Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Added: svn:ignore + nbproject Modified: trunk/new_project/application/configs/project.ini =================================================================== --- trunk/new_project/application/configs/project.ini 2011-10-25 14:32:10 UTC (rev 137) +++ trunk/new_project/application/configs/project.ini 2011-10-25 14:38:56 UTC (rev 138) @@ -70,26 +70,12 @@ ; testing without altering respondent e-mail ; addresses. ; site = Supply a general site FROM address. -; automatic = A series of settings for automatic e-mail sending -; organization = ID of the organization sending this batch -; user = Username to fake a login -; from = O/S/U or an actual e-mail address -; method = M/A/U -; mode = notmailed/reminder -; days = number of days between reminders -; template = ID of the template to use for the mail ;------------------------------------------------------- ; email.bcc = email.block = 0 email.bounce = 0 ; email.site = -;email.automatic.organization[] = 70 -;email.automatic.user[] = tester -;email.automatic.from[] = O -;email.automatic.method[] = M -;email.automatic.mode[] = notmailed -;email.automatic.template[] = 20 ;------------------------------------------------------- ; LAYOUT SECTION This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2011-11-22 14:43:11
|
Revision: 267 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=267&view=rev Author: michieltcs Date: 2011-11-22 14:43:01 +0000 (Tue, 22 Nov 2011) Log Message: ----------- Refs #307 - change delimiter to | Modified Paths: -------------- trunk/library/classes/Gems/Util.php trunk/test/classes/Gems/UtilTest.php Modified: trunk/library/classes/Gems/Util.php =================================================================== --- trunk/library/classes/Gems/Util.php 2011-11-22 14:36:11 UTC (rev 266) +++ trunk/library/classes/Gems/Util.php 2011-11-22 14:43:01 UTC (rev 267) @@ -236,7 +236,7 @@ $ipLong = ip2long($ip); - $ranges = explode(':', $ipRanges); + $ranges = explode('|', $ipRanges); foreach ($ranges as $range) { if (($sep = strpos($range, '-')) !== false) { Modified: trunk/test/classes/Gems/UtilTest.php =================================================================== --- trunk/test/classes/Gems/UtilTest.php 2011-11-22 14:36:11 UTC (rev 266) +++ trunk/test/classes/Gems/UtilTest.php 2011-11-22 14:43:01 UTC (rev 267) @@ -64,7 +64,7 @@ } public function testAllowedIP5() { - $this->assertTrue(Gems_Util::isAllowedIP('127.0.0.1', '192.168.0.1:127.0.0.1')); + $this->assertTrue(Gems_Util::isAllowedIP('127.0.0.1', '192.168.0.1|127.0.0.1')); } public function testAllowedIPEmptyRange() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2011-11-29 11:15:22
|
Revision: 312 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=312&view=rev Author: michieltcs Date: 2011-11-29 11:15:11 +0000 (Tue, 29 Nov 2011) Log Message: ----------- Merge Modified Paths: -------------- trunk/library/classes/Gems/User/Organization.php Property Changed: ---------------- trunk/ trunk/library/ trunk/library/classes/Gems/User/UserPasswordValidator.php Property changes on: trunk ___________________________________________________________________ Added: svn:mergeinfo + /branches/1.5.0-pulse:306-311 /tags/1.5.0beta1:305 Property changes on: trunk/library ___________________________________________________________________ Modified: svn:mergeinfo - /branches/newUser:113-150 /branches/newUser2:175-207 + /branches/1.5.0-pulse/library:306-311 /branches/newUser:113-150 /branches/newUser2:175-207 /tags/1.5.0beta1/library:305 Modified: trunk/library/classes/Gems/User/Organization.php =================================================================== --- trunk/library/classes/Gems/User/Organization.php 2011-11-29 10:58:17 UTC (rev 311) +++ trunk/library/classes/Gems/User/Organization.php 2011-11-29 11:15:11 UTC (rev 312) @@ -195,17 +195,21 @@ $data = $this->db->fetchRow($sql, $id); if ($data) { - $dbOrgId = $this->db->quote($id, Zend_Db::INT_TYPE); - $sql = "SELECT gor_id_organization, gor_name - FROM gems__organizations - WHERE gor_active = 1 AND - ( - gor_id_organization = $dbOrgId OR - gor_accessible_by LIKE '%:$dbOrgId:%' - ) - ORDER BY gor_name"; - $data['can_access'] = $this->db->fetchPairs($sql); - natsort($data['can_access']); + try { + $dbOrgId = $this->db->quote($id, Zend_Db::INT_TYPE); + $sql = "SELECT gor_id_organization, gor_name + FROM gems__organizations + WHERE gor_active = 1 AND + ( + gor_id_organization = $dbOrgId OR + gor_accessible_by LIKE '%:$dbOrgId:%' + ) + ORDER BY gor_name"; + $data['can_access'] = $this->db->fetchPairs($sql); + natsort($data['can_access']); + } catch (Exception $e) { + $data['can_access'] = array(); + } // MUtil_Echo::track($sql, $data['can_access']); } else { Property changes on: trunk/library/classes/Gems/User/UserPasswordValidator.php ___________________________________________________________________ Deleted: svn:mergeinfo - /branches/newUser/classes/Gems/User/UserPasswordValidator.php:113-150 /branches/newUser2/classes/Gems/User/UserPasswordValidator.php:175-207 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2011-12-06 11:07:23
|
Revision: 343 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=343&view=rev Author: michieltcs Date: 2011-12-06 11:07:11 +0000 (Tue, 06 Dec 2011) Log Message: ----------- Merge from branch 1.5.0-pulse Modified Paths: -------------- trunk/library/classes/Gems/Default/AskAction.php trunk/library/classes/Gems/Default/IndexAction.php trunk/library/classes/Gems/Default/StaffAction.php trunk/library/classes/Gems/Default/TokenPlanAction.php trunk/library/classes/Gems/Menu/ParameterCollector.php trunk/library/classes/Gems/Tracker/ChangeTracker.php trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php trunk/library/classes/Gems/Tracker.php trunk/library/classes/Gems/User/Organization.php trunk/library/classes/Gems/User/User.php trunk/library/classes/Gems/User/UserLoader.php trunk/library/classes/Gems/Versions.php trunk/library/classes/GemsEscort.php trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php trunk/library/classes/MUtil/Model/FormBridge.php trunk/library/classes/MUtil/Model/JoinModel.php trunk/library/classes/MUtil/Model/Type/ConcatenatedRow.php trunk/library/classes/MUtil/Version.php trunk/library/configs/db/patches.sql trunk/library/configs/db/tables/gems__organizations.20.sql trunk/library/languages/default-nl.mo trunk/library/languages/default-nl.po trunk/new_project/htdocs/gems/js/autoSubmitForm.js Property Changed: ---------------- trunk/ trunk/library/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse:306-311 /tags/1.5.0beta1:305 + /branches/1.5.0-pulse:306-342 /tags/1.5.0beta1:305 Property changes on: trunk/library ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse/library:306-311 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 + /branches/1.5.0-pulse/library:306-342 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 Modified: trunk/library/classes/Gems/Default/AskAction.php =================================================================== --- trunk/library/classes/Gems/Default/AskAction.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/Gems/Default/AskAction.php 2011-12-06 11:07:11 UTC (rev 343) @@ -239,7 +239,7 @@ $this->db->insert( 'gems__token_attempts', array( - 'gta_id_token' => $_POST[MUtil_Model::REQUEST_ID], + 'gta_id_token' => substr($_POST[MUtil_Model::REQUEST_ID], 0, $max_length), 'gta_ip_address' => $this->getRequest()->getClientIp() ) ); Modified: trunk/library/classes/Gems/Default/IndexAction.php =================================================================== --- trunk/library/classes/Gems/Default/IndexAction.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/Gems/Default/IndexAction.php 2011-12-06 11:07:11 UTC (rev 343) @@ -343,6 +343,7 @@ $authResult = $user->authenticate($formValues); if ($authResult->isValid()) { + $previousRequestParameters = $this->session->previousRequestParameters; $user->setAsCurrentUser(); @@ -370,7 +371,7 @@ */ Gems_AccessLog::getLog($this->db)->log("index.login", $this->getRequest(), null, $user->getUserId(), true); - if ($previousRequestParameters = $this->session->previousRequestParameters) { + if ($previousRequestParameters) { $this->_reroute(array('controller' => $previousRequestParameters['controller'], 'action' => $previousRequestParameters['action']), false); } else { // This reroutes to the first available menu page after login. @@ -441,8 +442,12 @@ if (isset($this->escort->project->email['site'])) { $mail->setFrom($this->escort->project->email['site']); + } elseif ($from = $user->getCurrentOrganization()->getEmail()) { + $mail->setFrom($from); + } elseif ($from = $user->getBaseOrganization()->getEmail()) { + $mail->setFrom($from); } - if (isset($this->escort->project->email['bcc'])) { + if (isset($this->escort->project->email) && isset($this->escort->project->email['bcc'])) { $mail->addBcc($this->escort->project->email['bcc']); } Modified: trunk/library/classes/Gems/Default/StaffAction.php =================================================================== --- trunk/library/classes/Gems/Default/StaffAction.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/Gems/Default/StaffAction.php 2011-12-06 11:07:11 UTC (rev 343) @@ -119,8 +119,8 @@ } elseif ($definition instanceof Gems_User_OldStaffUserDefinition) { $passwordField = 'gsf_password'; $model->setOnSave($passwordField, array($this, 'getOldPasswordHash')); + } } - } $model->set('gsf_id_primary_group', 'multiOptions', MUtil_Lazy::call($dbLookup->getAllowedStaffGroups)); if ($new) { @@ -132,18 +132,15 @@ $ucfirst = new Zend_Filter_Callback('ucfirst'); - $bridge->addHidden( 'gsf_id_user'); - $bridge->addHidden( 'gul_id_user'); - $bridge->addHidden( 'gup_id_user'); - $bridge->addHidden( 'gul_user_class'); + $bridge->addHiddenMulti('gsf_id_user', 'gul_id_user', 'gup_id_user', 'gul_user_class', 'gul_login', 'gul_id_organization'); //@@TODO: How do we change this? Only per org, or allow per user? //What classes are available? Maybe use something like event loader and add a little desc. to each type? - $bridge->addText( 'gsf_login', 'size', 15, 'minlength', 4, + $bridge->addText('gsf_login', 'size', 15, 'minlength', 4, 'validator', $model->createUniqueValidator(array('gsf_login', 'gsf_id_organization'), array('gsf_id_user'))); // Can the organization be changed? if ($this->escort->hasPrivilege('pr.staff.edit.all')) { - $bridge->addHiddenMulti($model->getKeyCopyName('gsf_id_organization')); + // $bridge->addHiddenMulti($model->getKeyCopyName('gsf_id_organization')); $bridge->addSelect('gsf_id_organization'); } else { $bridge->addExhibitor('gsf_id_organization'); @@ -171,6 +168,7 @@ $bridge->addText( 'gsf_email', array('size' => 30))->addValidator('SimpleEmail'); $bridge->addSelect('gsf_id_primary_group'); + $bridge->addCheckbox('gul_can_login', 'description', $this->_('Users can only login when this box is checked.')); $bridge->addCheckbox('gsf_logout_on_survey', 'description', $this->_('If checked the user will logoff when answering a survey.')); $bridge->addSelect('gsf_iso_lang'); @@ -227,10 +225,11 @@ if ($detailed) { $model->set('gul_user_class', 'default', $this->defaultStaffDefinition); $model->set('gsf_iso_lang', 'label', $this->_('Language'), 'multiOptions', $this->util->getLocalized()->getLanguages()); + $model->set('gul_can_login', 'label', $this->_('Can login'), 'multiOptions', $this->util->getTranslated()->getYesNo()); $model->set('gsf_logout_on_survey', 'label', $this->_('Logout on survey'), 'multiOptions', $this->util->getTranslated()->getYesNo()); } - $model->setDeleteValues('gsf_active', 0); + $model->setDeleteValues('gsf_active', 0, 'gul_can_login', 0); return $model; } Modified: trunk/library/classes/Gems/Default/TokenPlanAction.php =================================================================== --- trunk/library/classes/Gems/Default/TokenPlanAction.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/Gems/Default/TokenPlanAction.php 2011-12-06 11:07:11 UTC (rev 343) @@ -289,27 +289,28 @@ // Add track selection if ($this->escort instanceof Gems_Project_Tracks_MultiTracksInterface) { - $sql = "SELECT gtr_id_track, gtr_track_name FROM gems__tracks WHERE gtr_active=1 AND gtr_track_type='T' AND INSTR(gtr_organizations, '|$orgId|') > 0"; + $sql = "SELECT gtr_id_track, gtr_track_name FROM gems__tracks WHERE gtr_active=1 AND gtr_track_type='T' AND INSTR(gtr_organizations, '|$orgId|') > 0 ORDER BY gtr_track_name"; $elements[] = $this->_createSelectElement('gto_id_track', $sql, $this->_('(all tracks)')); } - $sql = "SELECT gro_round_description, gro_round_description + $sql = "SELECT DISTINCT gro_round_description, gro_round_description FROM gems__rounds INNER JOIN gems__tracks ON gro_id_track = gtr_id_track WHERE gro_active=1 AND LENGTH(gro_round_description) > 0 AND gtr_active=1 AND gtr_track_type='T' AND - INSTR(gtr_organizations, '|$orgId|') > 0"; + INSTR(gtr_organizations, '|$orgId|') > 0 + ORDER BY gro_round_description"; $elements[] = $this->_createSelectElement('gto_round_description', $sql, $this->_('(all rounds)')); - $sql = "SELECT gsu_id_survey, gsu_survey_name + $sql = "SELECT DISTINCT gsu_id_survey, gsu_survey_name FROM gems__surveys INNER JOIN gems__rounds ON gsu_id_survey = gro_id_survey INNER JOIN gems__tracks ON gro_id_track = gtr_id_track WHERE gsu_active=1 AND gro_active=1 AND gtr_active=1 AND - gtr_track_type='T' AND - INSTR(gtr_organizations, '|$orgId|') > 0"; + INSTR(gtr_organizations, '|$orgId|') > 0 + ORDER BY gsu_survey_name"; /* TODO: use this when we can update this list using ajax if (isset($data['gsu_id_primary_group'])) { $sql .= $this->db->quoteInto(" AND gsu_id_primary_group = ?", $data['gsu_id_primary_group']); @@ -327,7 +328,7 @@ ); $elements[] = $this->_createSelectElement('main_filter', $options); - $sql = "SELECT ggp_id_group, ggp_name + $sql = "SELECT DISTINCT ggp_id_group, ggp_name FROM gems__groups INNER JOIN gems__surveys ON ggp_id_group = gsu_id_primary_group INNER JOIN gems__rounds ON gsu_id_survey = gro_id_survey INNER JOIN gems__tracks ON gro_id_track = gtr_id_track @@ -335,7 +336,8 @@ gro_active=1 AND gtr_active=1 AND gtr_track_type='T' AND - INSTR(gtr_organizations, '|$orgId|') > 0"; + INSTR(gtr_organizations, '|$orgId|') > 0 + ORDER BY ggp_name"; $elements[] = $this->_createSelectElement('gsu_id_primary_group', $sql, $this->_('(all fillers)')); if (($this->escort instanceof Gems_Project_Organization_MultiOrganizationInterface) && @@ -345,7 +347,7 @@ $elements[] = $this->_createSelectElement('gto_id_organization', $options); } - $sql = "SELECT gsf_id_user, CONCAT( + $sql = "SELECT DISTINCT gsf_id_user, CONCAT( COALESCE(gems__staff.gsf_last_name, ''), ', ', COALESCE(gems__staff.gsf_first_name, ''), @@ -353,7 +355,8 @@ ) AS gsf_name FROM gems__staff INNER JOIN gems__respondent2track ON gsf_id_user = gr2t_created_by WHERE gr2t_id_organization = $orgId AND - gr2t_active = 1"; + gr2t_active = 1 + ORDER BY 2"; $elements[] = $this->_createSelectElement('gr2t_created_by', $sql, $this->_('(all staff)')); return $elements; Modified: trunk/library/classes/Gems/Menu/ParameterCollector.php =================================================================== --- trunk/library/classes/Gems/Menu/ParameterCollector.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/Gems/Menu/ParameterCollector.php 2011-12-06 11:07:11 UTC (rev 343) @@ -51,10 +51,19 @@ public function __construct() { - $sources = MUtil_Ra::flatten(func_get_args()); - foreach ($sources as $source) { - $this->addSource($source); + $sources = MUtil_Ra::args(func_get_args()); + $array = array(); + foreach ($sources as $key => $source) { + // Fix for array sources. + if (is_string($key)) { + $array[$key] = $source; + } else { + $this->addSource($source); + } } + if ($array) { + $this->addSource($array); + } } public function addSource($source) @@ -92,6 +101,7 @@ $this->values[$name] = $source->__get($name); } elseif (is_array($source)) { + // MUtil_Echo::track($name, $source); if (isset($source[$name])) { $this->values[$name] = $source[$name]; } Modified: trunk/library/classes/Gems/Tracker/ChangeTracker.php =================================================================== --- trunk/library/classes/Gems/Tracker/ChangeTracker.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/Gems/Tracker/ChangeTracker.php 2011-12-06 11:07:11 UTC (rev 343) @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * + * * @package Gems * @subpackage Tracker * @author Matijs de Jong <mj...@ma...> @@ -49,6 +49,7 @@ public $checkedTokens = 0; public $createdTokens = 0; public $checkedRespondentTracks = 0; + public $deletedTokens = 0; public $resultDataChanges = 0; public $roundChangeUpdates = 0; public $roundCompletionCauses = 0; @@ -82,6 +83,9 @@ if ($this->roundChangeUpdates) { $messages[] = sprintf($t->_('Round changes propagated to %d tokens.'), $this->roundChangeUpdates); } + if ($this->deletedTokens) { + $messages[] = sprintf($t->_('%d tokens deleted by round changes.'), $this->deletedTokens); + } if ($this->createdTokens) { $messages[] = sprintf($t->_('%d tokens created to by round changes.'), $this->createdTokens); } Modified: trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2011-12-06 11:07:11 UTC (rev 343) @@ -248,6 +248,7 @@ $sql = "SELECT gro_id_round, gro_id_survey, gro_id_order, gro_round_description FROM gems__rounds WHERE gro_id_track = ? AND + gro_active = 1 AND gro_id_round NOT IN (SELECT gto_id_round FROM gems__tokens WHERE gto_id_respondent_track = ?) ORDER BY gro_id_order"; @@ -389,10 +390,13 @@ //Step one: update existing tokens $changes->roundChangeUpdates += $this->checkExistingRoundsFor($respTrack, $userId); - // Step two: create lacking tokens + //Step two: deactivate inactive rounds + $changes->deletedTokens += $this->removeInactiveRounds($respTrack, $userId); + + // Step three: create lacking tokens $changes->createdTokens += $this->addNewTokens($respTrack, $userId); - // Step three: set the dates and times + // Step four: set the dates and times $changed = $this->checkTokensFromStart($respTrack, $userId); if ($changed) { $changes->tokenDateCauses++; @@ -758,6 +762,28 @@ } /** + * Remove the unanswered tokens for inactive rounds. + * + * @param Gems_Tracker_RespondentTrack $respTrack The respondent track to check + * @param int $userId Id of the user who takes the action (for logging) + * @return int The number of tokens changed by this code + */ + protected function removeInactiveRounds(Gems_Tracker_RespondentTrack $respTrack, $userId) + { + $qTrackId = $this->db->quote($this->_trackId); + $qRespTrackId = $this->db->quote($respTrack->getRespondentTrackId()); + + $where = "gto_start_time IS NULL AND + gto_id_respondent_track = $qRespTrackId AND + gto_id_round IN (SELECT gro_id_round + FROM gems__rounds + WHERE gro_active = 0 AND + gro_id_track = $qTrackId)"; + + return $this->db->delete('gems__tokens', $where); + } + + /** * Saves the field data for the respondent track id. * * @param int $respTrackId Gems respondent track id Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2011-12-06 11:07:11 UTC (rev 343) @@ -64,7 +64,20 @@ protected $_anonymizedField = 'private'; /** + * A map containing attributename => databasefieldname mappings * + * Should contain maps for respondentid, organizationid and consentcode. + * + * @var array + */ + protected $_attributeMap = array( + 'respondentid' => 'attribute_1', + 'organizationid' => 'attribute_2', + 'consentcode' => 'attribute_3', + 'resptrackid' => 'attribute_4'); + + /** + * * @var array of Gems_Tracker_Source_LimeSurvey1m9FieldMap */ private $_fieldMaps; @@ -106,6 +119,21 @@ protected $util; /** + * Returns a list of field names that should be set in a newly inserted token. + * + * @param Gems_Tracker_Token $token + */ + protected function _fillAttributeMap(Gems_Tracker_Token $token) + { + $values[$this->_attributeMap['respondentid']] = (string) $token->getRespondentId(); + $values[$this->_attributeMap['organizationid']] = (string) $token->getOrganizationId(); + $values[$this->_attributeMap['consentcode']] = (string) $token->getConsentCode(); + $values[$this->_attributeMap['resptrackid']] = (string) $token->getRespondentTrackId(); + + return $values; + } + + /** * Filters an answers array, return only those fields that where answered by the user. * * @param int $sourceSurveyId Survey ID @@ -362,10 +390,9 @@ * Insert token in table (if not there) * ****************************************/ - $values['completed'] = 'N'; // Apparently it is possible to have this value filled without a survey questionnaire. - $values['attribute_1'] = (string) $token->getRespondentId(); - $values['attribute_2'] = (string) $token->getOrganizationId(); - $values['attribute_3'] = (string) $token->getConsentCode(); + // Get the mapped values + $values = $this->_fillAttributeMap($token); + $values['completed'] = 'N'; // Apparently it is possible to have this value filled without a survey questionnaire. $result = 0; if ($oldValues = $lsDb->fetchRow("SELECT * FROM $lsTokens WHERE token = ? LIMIT 1", $tokenId)) { @@ -614,9 +641,7 @@ $quotedSurveyTable = $lsDb->quoteIdentifier($lsSurveyTable . '.token'); $select = $lsDb->select(); - $select->from($lsTokenTable, array('respondentid' => 'attribute_1', - 'organizationid' => 'attribute_2', - 'consentcode' => 'attribute_3')) + $select->from($lsTokenTable, $this->_attributeMap) ->join($lsSurveyTable, $quotedTokenTable . ' = ' . $quotedSurveyTable); //Now process the filters @@ -632,19 +657,13 @@ unset($filter['token']); } - //now map the attributes to the right fields - if (isset($filter['respondentid'])) { - $filter['attribute_1'] = $filter['respondentid']; - unset($filter['respondentid']); + // now map the attributes to the right fields + foreach ($this->_attributeMap as $name => $field) { + if (isset($filter[$name])) { + $filter[$field] = $filter[$name]; + unset($filter[$name]); + } } - if (isset($filter['organizationid'])) { - $filter['attribute_2'] = $filter['organizationid']; - unset($filter['organizationid']); - } - if (isset($filter['consentcode'])) { - $filter['attribute_3'] = $filter['consentcode']; - unset($filter['consentcode']); - } } foreach ($filter as $field => $values) { @@ -917,10 +936,10 @@ if ($surveyor_survey[$this->_anonymizedField] == 'Y') { $surveyor_status .= 'Uses anonymous answers. '; } elseif ($surveyor_survey[$this->_anonymizedField] !== 'N') { - //This is for the case that $this->_anonymizedField is empty, we show an update statement. - //The answers already in the table can only be linked to the repsonse based on the completion time - //this requires a manual action as token table only hold minuts while survey table holds seconds - //and we might have responses with the same timestamp. + // This is for the case that $this->_anonymizedField is empty, we show an update statement. + // The answers already in the table can only be linked to the repsonse based on the completion time + // this requires a manual action as token table only hold minuts while survey table holds seconds + // and we might have responses with the same timestamp. $update = "UPDATE " . $this->_getSurveysTableName() . " SET `" . $this->_anonymizedField . "` = 'N' WHERE sid = " . $sid . ';'; $update .= "ALTER TABLE " . $this->_getSurveyTableName($sid) . " ADD `token` varchar(36) default NULL;"; MUtil_Echo::r($update); @@ -977,6 +996,24 @@ $surveyor_status .= 'Token field length is too short. '; } + $missingFields = array(); + foreach ($this->_attributeMap as $name => $field) { + if (! isset($tokenTable[$field])) { + $missingFields[] = "ADD $field varchar(255) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'"; + } + } + if ($missingFields) { + $sql = "ALTER TABLE " . $this->_getTokenTableName($sid) . " " . implode(', ', $missingFields); + // MUtil_Echo::track($sql); + try { + $lsDb->query($sql); + } catch (Zend_Exception $e) { + $surveyor_status .= 'Token attributes could not be created. '; + $surveyor_status .= $e->getMessage() . ' '; + // MUtil_Echo::track($e); + } + } + /* $attrCount = 0; for ($i = 1; $i < 10; $i++) { $attrFields[$i] = isset($tokenTable['attribute_' . $i]); @@ -997,7 +1034,7 @@ $surveyor_status .= sprintf('Token attribute field %d is missing. ', $i); } } - } + } // */ } if ($updateTokens && (! $surveyor_status)) { @@ -1047,7 +1084,7 @@ if (substr($surveyor_status, 0, 127) != (string) $survey->getStatus()) { if ($surveyor_status) { $values['gsu_status'] = substr($surveyor_status, 0, 127); - $messages[] = sprintf($this->translate->_('The status of the \'%s\' survey has changed to \'%s\'.'), $survey->getName(), $data['gsu_status']); + $messages[] = sprintf($this->translate->_('The status of the \'%s\' survey has changed to \'%s\'.'), $survey->getName(), $values['gsu_status']); } else { $values['gsu_status'] = new Zend_Db_Expr('NULL'); $messages[] = sprintf($this->translate->_('The status warning for the \'%s\' survey was removed.'), $survey->getName()); @@ -1098,7 +1135,7 @@ if (null === $consentCode) { $consentCode = (string) $token->getConsentCode(); } - $values['attribute_3'] = $consentCode; + $values[$this->_attributeMap['consentcode']] = $consentCode; if ($oldValues = $lsDb->fetchRow("SELECT * FROM $lsTokens WHERE token = ? LIMIT 1", $tokenId)) { Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php 2011-12-06 11:07:11 UTC (rev 343) @@ -287,20 +287,19 @@ $row['sq_title'] = 'other'; $row['code'] = $row['title'] . '_' . $row['sq_title']; $row['sq_question'] = $this->translate->_('Other'); - if ($row['type'] === 'P') { + if ($row['type'] === 'P' || $row['type'] === 'M') { $row['type'] = 'S'; } $map[$row['sgq']] = $row; - // Removed if, this field is always added with questions - // if ($row['type'] !== 'M') { - $row['sgq'] .= 'comment'; - $row['code'] .= 'comment'; - $row['sq_title'] .= 'comment'; - $row['sq_question'] = ($rows[$i]['type'] === 'O') ? $this->translate->_('Comment') : $row['sq_question'] . $this->translate->_(' (comment)'); - $row['type'] = 'S'; - $map[$row['sgq']] = $row; - //} + if ($rows[$i]['type'] !== 'M') { + $row['sgq'] .= 'comment'; + $row['code'] .= 'comment'; + $row['sq_title'] .= 'comment'; + $row['sq_question'] = ($rows[$i]['type'] === 'O') ? $this->translate->_('Comment') : $row['sq_question'] . $this->translate->_(' (comment)'); + $row['type'] = 'S'; + $map[$row['sgq']] = $row; + } } break; @@ -613,6 +612,7 @@ // $tmpres['formatFunction'] } + // MUtil_Echo::track($field); if (! isset($oldfld) || ($oldfld['question'] !== $field['question'])) { $tmpres['label'] = MUtil_Html::raw($this->removeHtml($field['question'])); } @@ -620,7 +620,7 @@ // Juggle the labels for sub-questions etc.. if (isset($field['sq_question'])) { if (isset($field['sq_question1'])) { - $field['label'] = MUtil_Html::raw(sprintf($this->translate->_('%s: %s'), $field['sq_question'], $field['sq_question1'])); + $tmpres['label'] = MUtil_Html::raw(sprintf($this->translate->_('%s: %s'), $field['sq_question'], $field['sq_question1'])); } if (! isset($tmpres['label'])) { $tmpres['label'] = MUtil_Html::raw($this->removeHtml($field['sq_question'])); @@ -729,7 +729,6 @@ // Optional type check if ((! $forType) || ($field['type'] == $forType)) { - // Juggle the labels for sub-questions etc.. if (isset($field['sq_question1'])) { $squestion = sprintf($this->translate->_('%s: %s'), $this->removeMarkup($field['sq_question']), $this->removeMarkup($field['sq_question1'])); Modified: trunk/library/classes/Gems/Tracker.php =================================================================== --- trunk/library/classes/Gems/Tracker.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/Gems/Tracker.php 2011-12-06 11:07:11 UTC (rev 343) @@ -485,7 +485,7 @@ $surveyData['gsu_surveyor_id'] = $sourceSurveyId; $surveyData['gsu_id_source'] = $sourceId; - MUtil_Echo::track($surveyData); + // MUtil_Echo::track($surveyData); } return $this->getSurvey($surveyData); Modified: trunk/library/classes/Gems/User/Organization.php =================================================================== --- trunk/library/classes/Gems/User/Organization.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/Gems/User/Organization.php 2011-12-06 11:07:11 UTC (rev 343) @@ -144,6 +144,16 @@ } /** + * Get the email attribute. + * + * @return string + */ + public function getEmail() + { + return $this->_get('gor_contact_email'); + } + + /** * Get the organization id. * * @return int Modified: trunk/library/classes/Gems/User/User.php =================================================================== --- trunk/library/classes/Gems/User/User.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/Gems/User/User.php 2011-12-06 11:07:11 UTC (rev 343) @@ -419,7 +419,7 @@ if (! $name) { // Use obfuscated login name $name = $this->getLoginName(); - $name = subs($name, 0, 3) . str_repeat('*', strlen($name) - 2); + $name = substr($name, 0, 3) . str_repeat('*', strlen($name) - 2); } $this->_setVar('user_name', $name); @@ -779,6 +779,7 @@ public function setPassword($password) { $this->definition->setPassword($this, $password); + $this->setPasswordResetRequired(false); return $this; } Modified: trunk/library/classes/Gems/User/UserLoader.php =================================================================== --- trunk/library/classes/Gems/User/UserLoader.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/Gems/User/UserLoader.php 2011-12-06 11:07:11 UTC (rev 343) @@ -210,8 +210,8 @@ /** * Retrieve a userdefinition, so we can check it's capabilities without * instantiating a user - * - * @param type $userClassName + * + * @param string $userClassName * @return Gems_User_UserDefinitionInterface */ public function getUserDefinition($userClassName) Modified: trunk/library/classes/Gems/Versions.php =================================================================== --- trunk/library/classes/Gems/Versions.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/Gems/Versions.php 2011-12-06 11:07:11 UTC (rev 343) @@ -43,7 +43,7 @@ { public final function getBuild() { - return 42; + return 43; } public final function getGemsVersion() Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/GemsEscort.php 2011-12-06 11:07:11 UTC (rev 343) @@ -797,30 +797,31 @@ protected function _layoutOrganizationSwitcher() // Gems_Project_Organization_MultiOrganizationInterface { $user = $this->getLoader()->getCurrentUser(); - if ($orgs = $user->getAllowedOrganizations()) { - // Organization switcher - $orgSwitch = MUtil_Html::create('div', array('id' => 'organizations')); - $currentId = $user->getCurrentOrganizationId(); - $currentUri = base64_encode($this->view->url()); + if ($user->isActive() && ($orgs = $user->getAllowedOrganizations())) { + if (count($orgs) > 1) { + // Organization switcher + $orgSwitch = MUtil_Html::create('div', array('id' => 'organizations')); + $currentId = $user->getCurrentOrganizationId(); + $currentUri = base64_encode($this->view->url()); - $url = $this->view->getHelper('url')->url(array('controller' => 'organization', 'action' => 'change-ui'), null, true); + $url = $this->view->getHelper('url')->url(array('controller' => 'organization', 'action' => 'change-ui'), null, true); - $formDiv = $orgSwitch->form(array('method' => 'get', 'action' => $url))->div(); - $formDiv->input(array('type' => "hidden", 'name' => "current_uri", 'value' => $currentUri)); + $formDiv = $orgSwitch->form(array('method' => 'get', 'action' => $url))->div(); + $formDiv->input(array('type' => "hidden", 'name' => "current_uri", 'value' => $currentUri)); - $select = $formDiv->select(array('name' => "org", 'onchange' => "javascript:this.form.submit();")); - foreach ($orgs as $id => $org) { - $selected = ''; - if ($id == $currentId) { - $selected = array('selected' => "selected"); + $select = $formDiv->select(array('name' => "org", 'onchange' => "javascript:this.form.submit();")); + foreach ($orgs as $id => $org) { + $selected = ''; + if ($id == $currentId) { + $selected = array('selected' => "selected"); + } + $select->option(array('value' => $id), $org, $selected); } - $select->option(array('value' => $id), $org, $selected); + + return $orgSwitch; } - - return $orgSwitch; - } else { - return; } + return; } /** @@ -1512,13 +1513,19 @@ ); } else { // No longer logged in - if ($menuItem = $this->menu->findFirst(array('allowed' => true, 'visible' => true))) { - $this->addMessage($this->_('You are no longer logged in.')); - $this->addMessage($this->_('You must login to access this page.')); + // Throw an exception + HTTP 401 when an autofilter is called + if ($request->getActionName() == 'autofilter') { + throw new Gems_Exception("Session expired", 401); + } else if ($menuItem = $this->menu->findFirst(array('allowed' => true, 'visible' => true))) { + // Do not store previous request & show message when the intended action is logoff + if (!($request->getControllerName() == 'index' && $request->getActionName() == 'logoff')) { + $this->addMessage($this->_('You are no longer logged in.')); + $this->addMessage($this->_('You must login to access this page.')); - // save original request, we will redirect back once the user succesfully logs in - $this->session->previousRequestParameters = $request->getParams(); - $this->session->previousRequestMode = ($request->isPost() ? "POST" : "GET"); + // save original request, we will redirect back once the user succesfully logs in + $this->session->previousRequestParameters = $request->getParams(); + $this->session->previousRequestMode = ($request->isPost() ? "POST" : "GET"); + } $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $redirector->gotoRoute($menuItem->toRouteUrl($request)); Modified: trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2011-12-06 11:07:11 UTC (rev 343) @@ -244,6 +244,11 @@ return $this->_filterDataForSave($tableData, $isNew); } + /** + * + * @param string $table_name Does not test for existence + * @return array Numeric array containing the key field names. + */ protected function _getKeysFor($table_name) { $keys = array(); @@ -277,7 +282,7 @@ { $table_name = $this->_getTableName($table); - // MUtil_Echo::r($table->info('metadata')); + // MUtil_Echo::track($table->info('metadata')); foreach ($table->info('metadata') as $field) { $name = $field['COLUMN_NAME']; $finfo = array('table' => $table_name); @@ -406,15 +411,20 @@ if ($update) { // MUtil_Echo::r($filter, 'Filter'); + $adapter = $this->getAdapter(); + $wheres = array(); + foreach ($filter as $text => $value) { + $wheres[] = $adapter->quoteInto($text, $value); + } // Retrieve the record from the database - $oldValueSet = call_user_func_array(array($table, 'find'), $filter); + $oldValues = $table->fetchRow('(' . implode(' ) AND (', $wheres) . ')'); - if ($oldValueSet->count()) { - $oldValues = $oldValueSet->current()->toArray(); - } else { + if (! $oldValues) { // MUtil_Echo::r('INSERT!!', 'Old not found'); // Apparently the record does not exist in the database $update = false; + } else { + $oldValues = $oldValues->toArray(); } } @@ -441,14 +451,19 @@ // Update the row if ($changed = $table->update($returnValues, $filter)) { $this->addChanged($changed); - return $this->_updateCopyKeys($primaryKeys, $returnValues); + // Make sure the copy keys (if any) have the new values as well + $returnValues = $this->_updateCopyKeys($primaryKeys, $returnValues); + + // Add the old values as we have them and they may be of use later on. + $returnValues = $returnValues + $oldValues; + + return $returnValues; } } } } - // No changes were made, return empty array. - // The non-abstract child class should take care - // of returning the original values. + // Add the old values as we have them and they may be of use later on. + return $returnValues + $oldValues; } else { // Perform insert @@ -782,6 +797,12 @@ // abstract public function save(array $newValues); + /** + * Function to turn database insertion on or off for this model. + * + * @param boolean $value + * @return MUtil_Model_DatabaseModelAbstract (continuation pattern) + */ public function setCreate($value = true) { $this->canCreate = (bool) $value; @@ -795,7 +816,7 @@ * @param mxied $value1 * @param string $field2 * @param mixed $key2 - * @return MUtil_Model_TableModel + * @return MUtil_Model_DatabaseModelAbstract (continuation pattern) */ public function setDeleteValues($arrayOrField1 = null, $value1 = null, $field2 = null, $key2 = null) { @@ -804,6 +825,15 @@ return $this; } + /** + * When passed an array this method set the keys of this database object + * to those keys. + * When passed a string it is assumed to be a table name and the keys of + * this object are set to those of that table. + * + * @param mixed $keysOrTableName array or string + * @return MUtil_Model_DatabaseModelAbstract (continuation pattern) + */ public function setKeysToTable($keysOrTableName) { if (is_string($keysOrTableName)) { @@ -812,8 +842,17 @@ $keys = $keysOrTableName; } $this->setKeys($keys); + + return $this; } + /** + * Changes the key copy string that is used to create a new identifier + * for keys. + * + * @param string $value A sting of at least 3 characters containing %s. + * @return MUtil_Model_DatabaseModelAbstract (continuation pattern) + */ public function setKeyCopier($value = self::KEY_COPIER) { $this->keyCopier = $value; Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2011-12-06 11:07:11 UTC (rev 343) @@ -80,7 +80,7 @@ self::AUTO_OPTIONS => array('elementClass'), self::CHECK_OPTIONS => array('checkedValue', 'uncheckedValue'), self::DATE_OPTIONS => array('dateFormat', 'storageFormat'), - self::DISPLAY_OPTIONS => array('accesskey', 'class', 'disabled', 'description', 'escape', 'label', 'onclick', 'readonly', 'required', 'tabindex'), + self::DISPLAY_OPTIONS => array('accesskey', 'autoInsertNotEmptyValidator', 'class', 'disabled', 'description', 'escape', 'label', 'onclick', 'readonly', 'required', 'tabindex'), self::EXHIBIT_OPTIONS => array('formatFunction'), self::FILE_OPTIONS => array('accept', 'count', 'destination', 'valueDisabled'), self::GROUP_OPTIONS => array('elements', 'legend', 'separator'), Modified: trunk/library/classes/MUtil/Model/JoinModel.php =================================================================== --- trunk/library/classes/MUtil/Model/JoinModel.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/MUtil/Model/JoinModel.php 2011-12-06 11:07:11 UTC (rev 343) @@ -175,6 +175,7 @@ $filter = $this->_checkFilterUsed($filter); if ($this->_deleteValues) { + // MUtil_Model::$verbose = true; $changed = $this->save($this->_deleteValues + $filter, $filter, $saveTables); } else { $changed = 0; @@ -255,8 +256,7 @@ $oldChanged = $this->getChanged(); - // MUtil_Echo::r($newValues, __CLASS__ . '->' . __FUNCTION__); - // MUtil_Echo::r($saveTables, __CLASS__ . '->' . __FUNCTION__); + // MUtil_Echo::track($newValues, $filter, $saveTables, $this->_joinFields); $oldValues = $newValues; foreach ($saveTables as $table_name) { @@ -265,19 +265,33 @@ // Use is_string as $target and $target can be e.g. a Zend_Db_Expr() object if (! (is_string($target) && isset($newValues[$target]) && $newValues[$target])) { if (! (is_string($source) && isset($newValues[$source]) && $newValues[$source])) { + // MUtil_Echo::track('Missing: ' . $source . ' -> ' . $target); continue; } $newValues[$target] = $newValues[$source]; } elseif (! (is_string($source) && isset($newValues[$source]) && $newValues[$source])) { $newValues[$source] = $newValues[$target]; + + } elseif ((strlen($newValues[$target]) > 0) && (strlen($newValues[$source]) > 0) && $newValues[$target] != $newValues[$source]) { + // Join key values changed. + // + // Set the old values as the filter + $filter[$target] = $newValues[$target]; + $filter[$source] = $newValues[$source]; + + // Switch the target value to the value in the source field. + // + // JOIN FIELD ORDER IS IMPORTANT!!! + // The changed field must be stated first. + $newValues[$target] = $newValues[$source]; } } //$this->_saveTableData returns the new row values, including any automatic changes. $newValues = $this->_saveTableData($this->_tables[$table_name], $newValues, $filter) + $oldValues; + // MUtil_Echo::track($oldValues, $newValues, $filter); $oldValues = $newValues; - // MUtil_Echo::r($newValues, 'JoinModel, after: ' . $table_name); } // If anything has changed, it counts as only one item for the user. @@ -291,9 +305,40 @@ /** * * @param string $table_name Does not test for existence - * @param bool $saveable Will changes to this table be saved - * @return MUtil_Model_JoinModel + * @return MUtil_Model_JoinModel (continuation pattern) */ + public function setTableKeysToJoin($table_name) + { + $origKeys = $this->_getKeysFor($table_name); + + // First remove old keys + foreach ($origKeys as $key) { + $this->del($key, 'key'); + } + + foreach ($this->_joinFields as $left => $right) { + if (is_string($left) && $this->is($left, 'table', $table_name)) { + $this->set($left, 'key', true); + } + if (is_string($right) && $this->is($right, 'table', $table_name)) { + $this->set($right, 'key', true); + } + } + + return $this; + } + + /** + * Add the table to the default save tables. + * + * Only tables marked as save tables are saved during a save() or delete(), + * unless this is overuled by the extra parameter for those functions in + * this object. + * + * @param string $table_name Does not test for existence + * @param boolean $saveable Will changes to this table be saved + * @return MUtil_Model_JoinModel (continuation pattern) + */ public function setTableSaveable($table_name, $saveable = true) { // MUtil_Echo::r(func_get_args(), __CLASS__ . '->' . __FUNCTION__); Modified: trunk/library/classes/MUtil/Model/Type/ConcatenatedRow.php =================================================================== --- trunk/library/classes/MUtil/Model/Type/ConcatenatedRow.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/MUtil/Model/Type/ConcatenatedRow.php 2011-12-06 11:07:11 UTC (rev 343) @@ -86,7 +86,7 @@ } /** - * A ModelAbstract->setOnSave() function that concatenates the + * A ModelAbstract->setOnLoad() function that concatenates the * value if it is an array. * * @see Gems_Model_ModelAbstract Modified: trunk/library/classes/MUtil/Version.php =================================================================== --- trunk/library/classes/MUtil/Version.php 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/classes/MUtil/Version.php 2011-12-06 11:07:11 UTC (rev 343) @@ -1,40 +1,40 @@ <?php - -/** - * Copyright (c) 2011, Erasmus MC - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Erasmus MC nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - + /** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * 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 */ class MUtil_Version { const MAJOR = 1; const MINOR = 0; - const BUILD = 28; + const BUILD = 30; public static function get() { Modified: trunk/library/configs/db/patches.sql =================================================================== --- trunk/library/configs/db/patches.sql 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/configs/db/patches.sql 2011-12-06 11:07:11 UTC (rev 343) @@ -331,6 +331,8 @@ UPDATE `gems__organizations` SET gor_has_login = COALESCE((SELECT 1 FROM gems__staff WHERE gsf_id_organization = gor_id_organization GROUP BY gsf_id_organization), 0); +ALTER TABLE `gems__organizations` CHANGE `gor_has_respondents` `gor_has_respondents` TINYINT( 1 ) NOT NULL DEFAULT '0'; + -- PATCH: Log failed logins INSERT INTO `gems__log_actions` (`glac_id_action`, `glac_name`, `glac_change`, `glac_log`, `glac_created`) VALUES (NULL , 'loginFail', '0', '1', CURRENT_TIMESTAMP); Modified: trunk/library/configs/db/tables/gems__organizations.20.sql =================================================================== --- trunk/library/configs/db/tables/gems__organizations.20.sql 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/configs/db/tables/gems__organizations.20.sql 2011-12-06 11:07:11 UTC (rev 343) @@ -21,7 +21,7 @@ not null default 'en' references gems__languages (gml_iso_lang), gor_has_login boolean not null default 1, - gor_has_respondents boolean not null default 1, + gor_has_respondents boolean not null default 0, gor_add_respondents boolean not null default 1, gor_respondent_group bigint unsigned references gems__groups (ggp_id_group) null, gor_active boolean not null default 1, Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/library/languages/default-nl.po 2011-12-06 11:07:11 UTC (rev 343) @@ -3389,7 +3389,7 @@ #: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:277 #: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:300 msgid " (comment)" -msgstr "(opmerkingen)" +msgstr " (opmerkingen)" #: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:475 msgid "Free number" Modified: trunk/new_project/htdocs/gems/js/autoSubmitForm.js =================================================================== --- trunk/new_project/htdocs/gems/js/autoSubmitForm.js 2011-12-05 15:53:01 UTC (rev 342) +++ trunk/new_project/htdocs/gems/js/autoSubmitForm.js 2011-12-06 11:07:11 UTC (rev 343) @@ -50,6 +50,7 @@ this.destroy(); if (this.request == null) { + // var name = this.options.elementName ? this.options.elementName : this.element.attr('name'); var postData = this.value(); @@ -68,6 +69,7 @@ type: "POST", dataType: "html", data: postData, + error: function(request, status, error) {self.error(request, status);}, complete: function(request, status) {self.complete(request, status);}, success: function(data, status, request) {self.success(data, status, request);} }); @@ -76,6 +78,12 @@ } } }, + + error: function (request, status) { + if (request.status === 401) { + location.href = location.href; + } + }, success: function (data, status, request) { jQuery(this.options.targetId).html(data); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2011-12-13 21:00:31
|
Revision: 354 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=354&view=rev Author: michieltcs Date: 2011-12-13 21:00:25 +0000 (Tue, 13 Dec 2011) Log Message: ----------- Merge r344, r346 from branch 1.5.0-pulse Revision Links: -------------- http://gemstracker.svn.sourceforge.net/gemstracker/?rev=344&view=rev http://gemstracker.svn.sourceforge.net/gemstracker/?rev=346&view=rev Modified Paths: -------------- trunk/library/classes/Gems/Default/TrackActionAbstract.php trunk/library/classes/Gems/Tracker/RespondentTrack.php trunk/library/classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php trunk/library/configs/db/patches.sql trunk/library/snippets/DeleteInSourceTrackSnippet.php Property Changed: ---------------- trunk/ trunk/library/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse:306-342 /tags/1.5.0beta1:305 + /branches/1.5.0-pulse:306-342,344,346 /tags/1.5.0beta1:305 Property changes on: trunk/library ___________________________________________________________________ Modified: svn:mergeinfo - /branches/1.5.0-pulse/library:306-344 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 + /branches/1.5.0-pulse/library:306-344,346 /branches/newUser:113-150 /branches/newUser2:175-207 /branches/userloader:259-324 /tags/1.5.0beta1/library:305 Modified: trunk/library/classes/Gems/Default/TrackActionAbstract.php =================================================================== --- trunk/library/classes/Gems/Default/TrackActionAbstract.php 2011-12-13 13:32:54 UTC (rev 353) +++ trunk/library/classes/Gems/Default/TrackActionAbstract.php 2011-12-13 21:00:25 UTC (rev 354) @@ -211,6 +211,7 @@ 'formatFunction', $this->util->getTranslated()->formatDate, 'default', MUtil_Date::format(new Zend_date(), 'dd-MM-yyyy')); $model->set('gr2t_reception_code'); + $model->set('gr2t_comment', 'label', $this->_('Comment')); return $model; } Modified: trunk/library/classes/Gems/Tracker/RespondentTrack.php =================================================================== --- trunk/library/classes/Gems/Tracker/RespondentTrack.php 2011-12-13 13:32:54 UTC (rev 353) +++ trunk/library/classes/Gems/Tracker/RespondentTrack.php 2011-12-13 21:00:25 UTC (rev 354) @@ -674,15 +674,17 @@ // be overwritten, e.g. when cooperation is retracted. if ($code->isForTracks() || $code->isOverwriter()) { $values['gr2t_reception_code'] = $code->getCode(); + } - $changed = $this->_updateTrack($values, $userId); + $values['gr2t_comment'] = $comment; - if ($changed) { - // Reload reception code values - $this->_ensureReceptionCode($code->getAllData()); - } + $changed = $this->_updateTrack($values, $userId); + + if ($changed) { + // Reload reception code values + $this->_ensureReceptionCode($code->getAllData()); } - + // Stopcodes have a different logic. if ($code->isStopCode()) { // Cascade stop to tokens Modified: trunk/library/classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php 2011-12-13 13:32:54 UTC (rev 353) +++ trunk/library/classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php 2011-12-13 21:00:25 UTC (rev 354) @@ -154,6 +154,7 @@ 'formatFunction', $this->loader->getUtil()->getTranslated()->formatDate, 'default', MUtil_Date::format(new Zend_date(), 'dd-MM-yyyy')); $model->set('gr2t_reception_code'); + $model->set('gr2t_comment', 'label', $this->_('Comment')); return $model; } Modified: trunk/library/configs/db/patches.sql =================================================================== --- trunk/library/configs/db/patches.sql 2011-12-13 13:32:54 UTC (rev 353) +++ trunk/library/configs/db/patches.sql 2011-12-13 21:00:25 UTC (rev 354) @@ -356,4 +356,8 @@ --PATCH: Remove unique constraint for staff email ALTER TABLE `gems__staff` DROP INDEX `gsf_email` , -ADD INDEX `gsf_email` ( `gsf_email` ) \ No newline at end of file +ADD INDEX `gsf_email` ( `gsf_email` ); + +-- GEMS VERSION: 43 +-- PATCH: Add comment field to respondent tracks +ALTER TABLE `gems__respondent2track` ADD gr2t_comment varchar(250) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null default null AFTER `gr2t_reception_code`; Modified: trunk/library/snippets/DeleteInSourceTrackSnippet.php =================================================================== --- trunk/library/snippets/DeleteInSourceTrackSnippet.php 2011-12-13 13:32:54 UTC (rev 353) +++ trunk/library/snippets/DeleteInSourceTrackSnippet.php 2011-12-13 21:00:25 UTC (rev 354) @@ -89,6 +89,9 @@ // The edit element $bridge->addList('gr2t_reception_code'); + + // Comment text + $bridge->addTextarea('gr2t_comment', 'rows', 3, 'cols', 50); // Change the button $this->saveLabel = $this->getTitle(); @@ -170,7 +173,7 @@ protected function saveData() { // Use the repesondent track function as that cascades the consent code - $changed = $this->respondentTrack->setReceptionCode($this->formData['gr2t_reception_code'], $this->_('Track deleted.'), $this->session->user_id); + $changed = $this->respondentTrack->setReceptionCode($this->formData['gr2t_reception_code'], $this->formData['gr2t_comment'], $this->session->user_id); // Tell the user what happened $this->afterSave($changed); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2011-12-22 15:31:43
|
Revision: 386 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=386&view=rev Author: matijsdejong Date: 2011-12-22 15:31:37 +0000 (Thu, 22 Dec 2011) Log Message: ----------- Simplified installation and setup errors are now shown in the ErrorController Modified Paths: -------------- trunk/library/classes/Gems/Project/ProjectSettings.php trunk/library/classes/GemsEscort.php trunk/new_project/application/configs/project.ini trunk/new_project/htdocs/index.php Property Changed: ---------------- trunk/new_project/library/ Modified: trunk/library/classes/Gems/Project/ProjectSettings.php =================================================================== --- trunk/library/classes/Gems/Project/ProjectSettings.php 2011-12-22 13:14:38 UTC (rev 385) +++ trunk/library/classes/Gems/Project/ProjectSettings.php 2011-12-22 15:31:37 UTC (rev 386) @@ -97,9 +97,11 @@ parent::__construct($array, ArrayObject::ARRAY_AS_PROPS); - //@@TODO: some checks should not be done on each and every request! - // this can be a problem when testing - $this->checkRequiredValues(); + if (! ($this->offsetExists('name') && $this->offsetGet('name'))) { + $this->offsetSet('name', GEMS_PROJECT_NAME); + } + + $this->offsetSet('multiLocale', $this->offsetExists('locales') && (count($this->offsetGet('locales')) > 1)); } /** @@ -133,7 +135,7 @@ * * @return void */ - protected function checkRequiredValues() + public function checkRequiredValues() { $missing = array(); foreach ($this->requiredKeys as $key => $names) { @@ -164,6 +166,10 @@ throw new Gems_Exception_Coding($error); } + if (strpos($this->offsetGet('salt'), '%s') === false) { + throw new Gems_Exception_Coding("Required project setting 'salt' must contain '%s'."); + } + $superPassword = $this->getSuperAdminPassword(); if ((APPLICATION_ENV === 'production') && $this->getSuperAdminName() && $superPassword) { if (strlen($superPassword) < $this->minimumSuperPasswordLength) { @@ -171,12 +177,6 @@ throw new Gems_Exception_Coding($error); } } - - if (! ($this->offsetExists('name') && $this->offsetGet('name'))) { - $this->offsetSet('name', GEMS_PROJECT_NAME); - } - - $this->offsetSet('multiLocale', $this->offsetExists('locales') && (count($this->offsetGet('locales')) > 1)); } /** Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2011-12-22 13:14:38 UTC (rev 385) +++ trunk/library/classes/GemsEscort.php 2011-12-22 15:31:37 UTC (rev 386) @@ -1450,6 +1450,9 @@ */ public function routeShutdown(Zend_Controller_Request_Abstract $request) { + // Npow is a good time to check for required values + $this->project->checkRequiredValues(); + $loader = $this->getLoader(); $user = $loader->getCurrentUser(); Modified: trunk/new_project/application/configs/project.ini =================================================================== --- trunk/new_project/application/configs/project.ini 2011-12-22 13:14:38 UTC (rev 385) +++ trunk/new_project/application/configs/project.ini 2011-12-22 15:31:37 UTC (rev 386) @@ -10,16 +10,16 @@ ; Put %s somewhere within the salt to mix the value ; in the salt. ;--------------------------------------------------- -salt = +salt = ;---------------------------------------------------------- ; The non database super user ; ; On production pwd should be empty or langer than 10 chars ;---------------------------------------------------------- -admin.user = super -;admin.pwd = -;admin.ipRanges = +admin.user = superadmin +admin.pwd = superadmi +;admin.ipRanges = css.gems = gems/css/gems-fixed.css css.print.url = gems/css/gems_print.css Modified: trunk/new_project/htdocs/index.php =================================================================== --- trunk/new_project/htdocs/index.php 2011-12-22 13:14:38 UTC (rev 385) +++ trunk/new_project/htdocs/index.php 2011-12-22 15:31:37 UTC (rev 386) @@ -1,34 +1,33 @@ <?php - -/** - * Copyright (c) 2011, Erasmus MC - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Erasmus MC nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - /** + * 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. + */ + +/** * Project root file * * Gemms specific startup @@ -63,6 +62,7 @@ if (getenv('APPLICATION_ENV')) { $env = getenv('APPLICATION_ENV'); } else { + // Erasmus MC processing if (strpos($_SERVER["HTTP_HOST"], 'survey') === false) { $env = 'testing'; } else { @@ -76,7 +76,7 @@ /** * Load database login variables, Erasmus MC way. */ -require realpath(GEMS_ROOT_DIR . '/var/settings/db.inc.php'); +// require realpath(GEMS_ROOT_DIR . '/var/settings/db.inc.php'); /** * Start standard GEMS bootstrap. Property changes on: trunk/new_project/library ___________________________________________________________________ Added: svn:ignore + Gems This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-01-02 12:35:29
|
Revision: 392 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=392&view=rev Author: mennodekker Date: 2012-01-02 12:35:23 +0000 (Mon, 02 Jan 2012) Log Message: ----------- Fixed unit tests Modified Paths: -------------- trunk/library/classes/Gems/User/Organization.php trunk/library/classes/Gems/Util/AccessLogActions.php trunk/library/classes/Gems/Util/DbLookup.php trunk/test/classes/IndexControllerTest.php Modified: trunk/library/classes/Gems/User/Organization.php =================================================================== --- trunk/library/classes/Gems/User/Organization.php 2012-01-02 10:17:42 UTC (rev 391) +++ trunk/library/classes/Gems/User/Organization.php 2012-01-02 12:35:23 UTC (rev 392) @@ -201,8 +201,12 @@ */ protected function loadData($id) { - $sql = "SELECT * FROM gems__organizations WHERE gor_id_organization = ? LIMIT 1"; - $data = $this->db->fetchRow($sql, $id); + try { + $sql = "SELECT * FROM gems__organizations WHERE gor_id_organization = ? LIMIT 1"; + $data = $this->db->fetchRow($sql, $id); + } catch (Exception $e) { + $data = false; + } if ($data) { try { Modified: trunk/library/classes/Gems/Util/AccessLogActions.php =================================================================== --- trunk/library/classes/Gems/Util/AccessLogActions.php 2012-01-02 10:17:42 UTC (rev 391) +++ trunk/library/classes/Gems/Util/AccessLogActions.php 2012-01-02 12:35:23 UTC (rev 392) @@ -75,6 +75,12 @@ */ protected function loadData($id) { - return $this->db->fetchAssoc('SELECT glac_name, glac_id_action AS id, glac_log AS log FROM gems__log_actions ORDER BY glac_name'); + try { + $data = $this->db->fetchAssoc('SELECT glac_name, glac_id_action AS id, glac_log AS log FROM gems__log_actions ORDER BY glac_name'); + } catch (Exception $exc) { + $data = array(); + } + + return $data; } } Modified: trunk/library/classes/Gems/Util/DbLookup.php =================================================================== --- trunk/library/classes/Gems/Util/DbLookup.php 2012-01-02 10:17:42 UTC (rev 391) +++ trunk/library/classes/Gems/Util/DbLookup.php 2012-01-02 12:35:23 UTC (rev 392) @@ -249,7 +249,11 @@ try { $organizations = $this->db->fetchPairs('SELECT gor_id_organization, gor_name FROM gems__organizations WHERE gor_active=1 AND gor_has_login=1 ORDER BY gor_name'); } catch (Exception $e) { - $organizations = $this->db->fetchPairs('SELECT gor_id_organization, gor_name FROM gems__organizations WHERE gor_active=1 ORDER BY gor_name'); + try { + $organizations = $this->db->fetchPairs('SELECT gor_id_organization, gor_name FROM gems__organizations WHERE gor_active=1 ORDER BY gor_name'); + } catch (Exception $e) { + $organizations = array(); + } } natsort($organizations); } Modified: trunk/test/classes/IndexControllerTest.php =================================================================== --- trunk/test/classes/IndexControllerTest.php 2012-01-02 10:17:42 UTC (rev 391) +++ trunk/test/classes/IndexControllerTest.php 2012-01-02 12:35:23 UTC (rev 392) @@ -17,16 +17,40 @@ parent::setUp(); } + + /** + * Here we fix the intentional errors that are in de default setup + * + * At the moment we only set a salt in the project resource + */ + public function _fixSetup() { + $this->bootstrap->bootstrap(); + $project = $this->bootstrap->getBootstrap()->getResource('project'); + $project->salt = 'TESTCASE'; + } + + public function testSaltRequired() + { + $this->dispatch('/'); + $reponse = $this->getFrontController()->getResponse(); + $exception = $reponse->getExceptionByMessage("Missing required project setting: 'salt'."); + $this->assertTrue(count($exception) == 1); + } public function testHomeRedirectsToLogin() { + $this->_fixSetup(); $this->dispatch('/'); $this->assertRedirectTo('/index/login'); } public function testLoginPage() { + $this->_fixSetup(); $this->dispatch('/index/login'); + $reponse = $this->getFrontController()->getResponse(); + var_dump($reponse->getBody()); + $this->assertController('index'); $this->assertAction('login'); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-01-23 15:27:47
|
Revision: 416 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=416&view=rev Author: mennodekker Date: 2012-01-23 15:27:41 +0000 (Mon, 23 Jan 2012) Log Message: ----------- Fix for event calculation helper 'sumInt' and a testcase (all event calculation helper methods should be made public to be testable) Modified Paths: -------------- trunk/library/classes/Gems/Event/EventCalculations.php trunk/test/classes/Gems/Event/Gems_Event_EventCalculationsTest.php Modified: trunk/library/classes/Gems/Event/EventCalculations.php =================================================================== --- trunk/library/classes/Gems/Event/EventCalculations.php 2012-01-23 11:04:04 UTC (rev 415) +++ trunk/library/classes/Gems/Event/EventCalculations.php 2012-01-23 15:27:41 UTC (rev 416) @@ -106,7 +106,7 @@ foreach ($fieldNames as $name) { if (isset($tokenAnswers[$name]) && is_int(intval($tokenAnswers[$name]))) { $count++; - $sum += $tokenAnswers[$name]; + $sum += intval($tokenAnswers[$name]); } } return $count ? $sum / $count : null; @@ -206,7 +206,7 @@ * @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 */ - protected function sumInt(array $tokenAnswers, $fieldNames) + public function sumInt(array $tokenAnswers, $fieldNames) { if (is_string($fieldNames)) { $fieldNames = $this->_arrayFindName($tokenAnswers, $fieldNames); @@ -214,7 +214,7 @@ $sum = 0; foreach ($fieldNames as $name) { - if (isset($tokenAnswers[$name]) && is_int(intval($tokenAnswers[$name]))) { + if (isset($tokenAnswers[$name]) && intval($tokenAnswers[$name])== $tokenAnswers[$name]) { $sum += $tokenAnswers[$name]; } } Modified: trunk/test/classes/Gems/Event/Gems_Event_EventCalculationsTest.php =================================================================== --- trunk/test/classes/Gems/Event/Gems_Event_EventCalculationsTest.php 2012-01-23 11:04:04 UTC (rev 415) +++ trunk/test/classes/Gems/Event/Gems_Event_EventCalculationsTest.php 2012-01-23 15:27:41 UTC (rev 416) @@ -30,6 +30,27 @@ $this->assertEquals(0, $this->object->reverseCode(5, 0, 5)); } + public function testSumInt() { + $tokenAnswers = array( + 'fld_1'=>1, + 'fld_2'=>'2', + 'fld_3'=>1.5, //not integer + 'fld_4'=>'a', //not integer + 'fld_5'=>1.4, //not integer + 'fld_6'=>1.6 //not integer + ); + + //Initial check + $this->assertEquals(3, $this->object->sumInt($tokenAnswers, array('fld_1', 'fld_2'))); + + //Check if non-int will be left out + $this->assertEquals(3, $this->object->sumInt($tokenAnswers, array('fld_1', 'fld_2', 'fld_3'))); + $this->assertEquals(3, $this->object->sumInt($tokenAnswers, array('fld_1', 'fld_2', 'fld_4'))); + //Make sure there are no rounding issues + $this->assertEquals(3, $this->object->sumInt($tokenAnswers, array('fld_1', 'fld_2', 'fld_5'))); + $this->assertEquals(3, $this->object->sumInt($tokenAnswers, array('fld_1', 'fld_2', 'fld_6'))); + } + /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |