You can subscribe to this list here.
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(84) |
Oct
(70) |
Nov
(164) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(52) |
Feb
(77) |
Mar
(70) |
Apr
(58) |
May
(81) |
Jun
(74) |
Jul
(87) |
Aug
(30) |
Sep
(45) |
Oct
(37) |
Nov
(51) |
Dec
(31) |
2013 |
Jan
(47) |
Feb
(29) |
Mar
(40) |
Apr
(33) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <gem...@li...> - 2012-09-26 10:33:46
|
Revision: 957 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=957&view=rev Author: mennodekker Date: 2012-09-26 10:33:36 +0000 (Wed, 26 Sep 2012) Log Message: ----------- Some further optimization of excel export Modified Paths: -------------- trunk/library/classes/Gems/Controller/BrowseEditAction.php trunk/library/classes/Gems/FormattedData.php trunk/library/classes/Gems/View/Helper/Excel.php Modified: trunk/library/classes/Gems/Controller/BrowseEditAction.php =================================================================== --- trunk/library/classes/Gems/Controller/BrowseEditAction.php 2012-09-25 15:34:45 UTC (rev 956) +++ trunk/library/classes/Gems/Controller/BrowseEditAction.php 2012-09-26 10:33:36 UTC (rev 957) @@ -439,7 +439,7 @@ $this->_applySearchParameters($model, true); $this->addExcelColumns($model); // Hook to modify the model - + // Use $this->formatExcelData to switch between formatted and unformatted data $excelData = new Gems_FormattedData($this->getExcelData($model->load(), $model), $model, $this->formatExcelData); @@ -695,10 +695,7 @@ if ($headings) { if ($data) { foreach ($data as $row) { - foreach ($headings as $key => $value) { - $result[$key] = isset($row[$key]) ? $row[$key] : null; - } - $results[] = $result; + $results[] = array_intersect_key($row, $headings); } return $results; } else { @@ -997,4 +994,4 @@ $this->html[] = $table; } -} +} \ No newline at end of file Modified: trunk/library/classes/Gems/FormattedData.php =================================================================== --- trunk/library/classes/Gems/FormattedData.php 2012-09-25 15:34:45 UTC (rev 956) +++ trunk/library/classes/Gems/FormattedData.php 2012-09-26 10:33:36 UTC (rev 957) @@ -80,7 +80,7 @@ * @return array The formatted array */ static function format($row, $model) { - foreach ($row as $fieldname=>$value) { + foreach ($row as $fieldname=>$value) { $row[$fieldname] = self::_format($fieldname, $row[$fieldname], $model); } return $row; @@ -91,76 +91,113 @@ * * @param type $name * @param type $result + *@param MUtil_Model_ModelAbstract $model * @return type */ private static function _format($name, $result, $model) { - if (null === $result && $default = $model->get($name,'default')) { - $result = $default; + static $opts = array(); + static $view = null; + + if (!isset($opts[$name])) { + $opts[$name] = $model->get($name, array('default', 'multiOptions', 'formatFunction', 'dateFormat', 'storageFormat', 'itemDisplay')); } - if ($multiOptions = $model->get($name, 'multiOptions')) { - if (is_array($multiOptions)) { - /* - * Sometimes a field is an array and will be formatted later on using the - * formatFunction -> handle each element in the array. - */ - if (is_array($result)) { - foreach($result as $key => $value) { - if (array_key_exists($value, $multiOptions)) { - $result[$key] = $multiOptions[$value]; + $options = $opts[$name]; + + foreach($options as $key => $value) { + switch ($key) { + case 'default': + if (is_null($result)) { + $result = $value; + } + break; + + case 'multiOptions': + $multiOptions = $value; + if (is_array($multiOptions)) { + /* + * Sometimes a field is an array and will be formatted later on using the + * formatFunction -> handle each element in the array. + */ + if (is_array($result)) { + foreach($result as $key => $value) { + if (array_key_exists($value, $multiOptions)) { + $result[$key] = $multiOptions[$value]; + } + } + } else { + if (array_key_exists($result, $multiOptions)) { + $result = $multiOptions[$result]; + } } } - } else { - if (array_key_exists($result, $multiOptions)) { - $result = $multiOptions[$result]; + break; + + case 'formatFunction': + $callback = $value; + $result = call_user_func($callback, $result); + break; + + case 'dateFormat': + if (array_key_exists('formatFunction', $options)) { + // if there is a formatFunction skip the date formatting + continue; } - } - } - } + + $dateFormat = $value; + $storageFormat = $model->get($name, 'storageFormat'); + $result = MUtil_Date::format($result, $dateFormat, $storageFormat); + break; + case 'itemDisplay': + $function = $value; + if (is_callable($function)) { + $result = call_user_func($function, $result); + } elseif (is_object($function)) { + if (($function instanceof MUtil_Html_ElementInterface) + || method_exists($function, 'append')) { + $object = clone $function; + $result = $object->append($result); + } + } elseif (is_string($function)) { + // Assume it is a html tag when a string + $result = MUtil_Html::create($function, $result); + } - if ($callback = $model->get($name, 'formatFunction')) { - $result = call_user_func($callback, $result); - } elseif ($dateFormat = $model->get($name, 'dateFormat')) { - $storageFormat = $model->get($name, 'storageFormat'); - $result = MUtil_Date::format($result, $dateFormat, $storageFormat); + default: + break; + } } - if ($function = $model->get($name, 'itemDisplay')) { - if (is_callable($function)) { - $result = call_user_func($function, $result); - } elseif (is_object($function)) { - if (($function instanceof MUtil_Html_ElementInterface) - || method_exists($function, 'append')) { - $object = clone $function; - $result = $object->append($result); - } - } elseif (is_string($function)) { - // Assume it is a html tag when a string - $result = MUtil_Html::create($function, $result); + if (is_object($result)) { + // If it is Lazy, execute it + if ($result instanceof MUtil_Lazy_LazyInterface) { + $result = MUtil_Lazy::rise($result); } - } - // If it is Lazy, execute it - if ($result instanceof MUtil_Lazy_LazyInterface) { - $result = MUtil_Lazy::rise($result); - } + // If it is Html, render it + if ($result instanceof MUtil_Html_HtmlInterface) { - // If it is Html, render it - if ($result instanceof MUtil_Html_HtmlInterface) { + if (is_null($view)) { + $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); + if (null === $viewRenderer->view) { + $viewRenderer->initView(); + } + $view = $viewRenderer->view; + } - $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); - if (null === $viewRenderer->view) { - $viewRenderer->initView(); + $result = $result->render($view); } - $view = $viewRenderer->view; - $result = $result->render($view); } return $result; } + public function getFormatted() { + return $this->formatted; + } + public function setFormatted($bool) { - $this->formatted = $bool; + $this->formatted = (bool) $bool; } } \ No newline at end of file Modified: trunk/library/classes/Gems/View/Helper/Excel.php =================================================================== --- trunk/library/classes/Gems/View/Helper/Excel.php 2012-09-25 15:34:45 UTC (rev 956) +++ trunk/library/classes/Gems/View/Helper/Excel.php 2012-09-26 10:33:36 UTC (rev 957) @@ -50,6 +50,7 @@ } catch (Exception $e) {} $this->view->layout()->setLayout('excel'); if ($rowset instanceof Gems_FormattedData) { + $formatted = $rowset->getFormatted(); $rowset->setFormatted(false); } $rowcnt = 0; @@ -72,7 +73,7 @@ $output .= "\t</thead>\r\n"; $output .= "\t<tbody>\r\n"; if ($rowset instanceof Gems_FormattedData) { - $rowset->setFormatted(true); + $rowset->setFormatted($formatted); } } else { $output .= "\t\t<tr>\r\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-25 15:34:55
|
Revision: 956 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=956&view=rev Author: matijsdejong Date: 2012-09-25 15:34:45 +0000 (Tue, 25 Sep 2012) Log Message: ----------- snippets/Generic are no longer needed with current loader Modified Paths: -------------- trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php trunk/library/classes/Gems/Snippets/ModelFormSnippetGeneric.php trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetGeneric.php trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php trunk/library/snippets/Generic/ModelFormSnippet.php trunk/library/snippets/Generic/ModelItemYesNoDeleteSnippet.php trunk/library/snippets/Generic/ModelTabFormSnippet.php trunk/library/snippets/Generic/ModelTableSnippet.php Modified: trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php =================================================================== --- trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php 2012-09-25 14:30:28 UTC (rev 955) +++ trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php 2012-09-25 15:34:45 UTC (rev 956) @@ -64,21 +64,21 @@ * * @var mixed String or array of snippets name */ - protected $autofilterSnippets = 'Generic_ModelTableSnippet'; + protected $autofilterSnippets = 'ModelTableSnippetGeneric'; /** * The snippets used for the create and edit actions. * * @var mixed String or array of snippets name */ - protected $createEditSnippets = 'Generic_ModelFormSnippet'; + protected $createEditSnippets = 'ModelFormSnippetGeneric'; /** * The snippets used for the delete action. * * @var mixed String or array of snippets name */ - protected $deleteSnippets = 'Generic_ModelItemYesNoDeleteSnippet'; + protected $deleteSnippets = 'ModelItemYesNoDeleteSnippetGeneric'; /** * Modified: trunk/library/classes/Gems/Snippets/ModelFormSnippetGeneric.php =================================================================== --- trunk/library/classes/Gems/Snippets/ModelFormSnippetGeneric.php 2012-09-25 14:30:28 UTC (rev 955) +++ trunk/library/classes/Gems/Snippets/ModelFormSnippetGeneric.php 2012-09-25 15:34:45 UTC (rev 956) @@ -38,8 +38,6 @@ /** * Displays an edit form based on the model the model set through the $model snippet parameter. * - * If you want to use this class "as is" use the 'Generic_ModelFormSnippet' snippet. - * * This class is not in the standard snippet loading directories and does not follow * their naming conventions, but exists only to make it simple to extend this class * for a specific implementation. Modified: trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetGeneric.php =================================================================== --- trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetGeneric.php 2012-09-25 14:30:28 UTC (rev 955) +++ trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetGeneric.php 2012-09-25 15:34:45 UTC (rev 956) @@ -40,8 +40,6 @@ * * Can be used for other uses than delete by overriding performAction(). * - * If you want to use this class "as is" use the 'Generic_ModelItemYesNoDeleteSnippet' snippet. - * * This class is not in the standard snippet loading directories and does not follow * their naming conventions, but exists only to make it simple to extend this class * for a specific implementation. Modified: trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php =================================================================== --- trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php 2012-09-25 14:30:28 UTC (rev 955) +++ trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php 2012-09-25 15:34:45 UTC (rev 956) @@ -2,7 +2,7 @@ /** * Copyright (c) 2011, Erasmus MC * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -13,7 +13,7 @@ * * Neither the name of Erasmus MC nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -24,7 +24,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * @package Gems * @subpackage Snippets * @copyright Copyright (c) 2011 Erasmus MC @@ -35,8 +35,6 @@ /** * Displays an edit form using tabs based on the model the model set through the $model snippet parameter. * - * If you want to use this class "as is" use the 'Generic_ModelTabFormSnippet' snippet. - * * This class is not in the standard snippet loading directories and does not follow * their naming conventions, but exists only to make it simple to extend this class * for a specific implementation. Modified: trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php =================================================================== --- trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php 2012-09-25 14:30:28 UTC (rev 955) +++ trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php 2012-09-25 15:34:45 UTC (rev 956) @@ -39,8 +39,6 @@ * Displays multiple items from a model in a tabel by row using * the model set through the $model snippet parameter. * - * If you want to use this class "as is" use the 'Generic_ModelTableSnippet' snippet. - * * This class is not in the standard snippet loading directories and does not follow * their naming conventions, but exists only to make it simple to extend this class * for a specific implementation. Modified: trunk/library/snippets/Generic/ModelFormSnippet.php =================================================================== --- trunk/library/snippets/Generic/ModelFormSnippet.php 2012-09-25 14:30:28 UTC (rev 955) +++ trunk/library/snippets/Generic/ModelFormSnippet.php 2012-09-25 15:34:45 UTC (rev 956) @@ -38,8 +38,11 @@ /** * Displays an edit form based on the model the model set through the $model snippet parameter. * - * Usage snippet for Gems_Snippets_ModelTableSnippetGeneric + * Usage snippet for Gems_Controller_ModelSnippetActionAbstract * + * @see Gems_Controller_ModelSnippetActionAbstract + * + * @deprecated No longer needed with new snippet loader * @package Gems * @subpackage Snippets\Generic * @copyright Copyright (c) 2011 Erasmus MC Modified: trunk/library/snippets/Generic/ModelItemYesNoDeleteSnippet.php =================================================================== --- trunk/library/snippets/Generic/ModelItemYesNoDeleteSnippet.php 2012-09-25 14:30:28 UTC (rev 955) +++ trunk/library/snippets/Generic/ModelItemYesNoDeleteSnippet.php 2012-09-25 15:34:45 UTC (rev 956) @@ -39,6 +39,7 @@ * Displays each fields of a single item in a model in a row in a Html table * the model set through the $model snippet parameter. * + * @deprecated No longer needed with new snippet loader * @package Gems * @subpackage Snippets\Generic * @copyright Copyright (c) 2011 Erasmus MC Modified: trunk/library/snippets/Generic/ModelTabFormSnippet.php =================================================================== --- trunk/library/snippets/Generic/ModelTabFormSnippet.php 2012-09-25 14:30:28 UTC (rev 955) +++ trunk/library/snippets/Generic/ModelTabFormSnippet.php 2012-09-25 15:34:45 UTC (rev 956) @@ -38,6 +38,7 @@ * * Usage snippet for Gems_Snippets_ModelTabFormSnippetGeneric * + * @deprecated No longer needed with new snippet loader * @package Gems * @subpackage Snippets\Generic * @copyright Copyright (c) 2011 Erasmus MC Modified: trunk/library/snippets/Generic/ModelTableSnippet.php =================================================================== --- trunk/library/snippets/Generic/ModelTableSnippet.php 2012-09-25 14:30:28 UTC (rev 955) +++ trunk/library/snippets/Generic/ModelTableSnippet.php 2012-09-25 15:34:45 UTC (rev 956) @@ -39,8 +39,11 @@ * Displays multiple items from a model in a tabel by row using * the model set through the $model snippet parameter. * - * Usage snippet for Gems_Snippets_ModelTableSnippetGeneric + * Usage snippet for Gems_Controller_ModelSnippetActionAbstract * + * @see Gems_Controller_ModelSnippetActionAbstract + * + * @deprecated No longer needed with new snippet loader * @package MUtil * @subpackage Snippets\Generic * @copyright Copyright (c) 2011 Erasmus MC This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-25 14:30:37
|
Revision: 955 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=955&view=rev Author: mennodekker Date: 2012-09-25 14:30:28 +0000 (Tue, 25 Sep 2012) Log Message: ----------- Minor optimization for excel export + increased max_execution_time for as long as it is not yet moved to a BatchTask Modified Paths: -------------- trunk/library/classes/Gems/Controller/BrowseEditAction.php trunk/library/classes/Gems/FormattedData.php Modified: trunk/library/classes/Gems/Controller/BrowseEditAction.php =================================================================== --- trunk/library/classes/Gems/Controller/BrowseEditAction.php 2012-09-25 12:26:47 UTC (rev 954) +++ trunk/library/classes/Gems/Controller/BrowseEditAction.php 2012-09-25 14:30:28 UTC (rev 955) @@ -429,6 +429,8 @@ */ public function excelAction() { + ini_set('max_execution_time', 90); // Quickfix as long as it is not in a batchtask + // Set the request cache to use the search params from the index action $this->getCachedRequestData(true, 'index'); Modified: trunk/library/classes/Gems/FormattedData.php =================================================================== --- trunk/library/classes/Gems/FormattedData.php 2012-09-25 12:26:47 UTC (rev 954) +++ trunk/library/classes/Gems/FormattedData.php 2012-09-25 14:30:28 UTC (rev 955) @@ -86,7 +86,7 @@ return $row; } - /** + /** * This is the actual format function, copied from the Exhibitor for field * * @param type $name @@ -95,10 +95,8 @@ */ private static function _format($name, $result, $model) { - if ($default = $model->get($name,'default')) { - if (null === $result) { - $result = $default; - } + if (null === $result && $default = $model->get($name,'default')) { + $result = $default; } if ($multiOptions = $model->get($name, 'multiOptions')) { @@ -146,13 +144,11 @@ // If it is Lazy, execute it if ($result instanceof MUtil_Lazy_LazyInterface) { - if ($result instanceof MUtil_Lazy_LazyInterface) { - $result = MUtil_Lazy::rise($result); - } + $result = MUtil_Lazy::rise($result); } // If it is Html, render it - if ($result instanceof MUtil_Html_HtmlInterface || $result instanceof MUtil_Lazy_LazyInterface) { + if ($result instanceof MUtil_Html_HtmlInterface) { $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); if (null === $viewRenderer->view) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-25 12:26:58
|
Revision: 954 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=954&view=rev Author: mennodekker Date: 2012-09-25 12:26:47 +0000 (Tue, 25 Sep 2012) Log Message: ----------- Fix concatenated row on multicheckboxes when nothing checked ('' is not an option) Modified Paths: -------------- trunk/library/classes/MUtil/Model/Type/ConcatenatedRow.php Modified: trunk/library/classes/MUtil/Model/Type/ConcatenatedRow.php =================================================================== --- trunk/library/classes/MUtil/Model/Type/ConcatenatedRow.php 2012-09-24 10:00:20 UTC (rev 953) +++ trunk/library/classes/MUtil/Model/Type/ConcatenatedRow.php 2012-09-25 12:26:47 UTC (rev 954) @@ -146,6 +146,10 @@ if ($this->valuePad) { $value = trim($value, $this->seperatorChar); } + // If it was empty, return an empty array instead of array with an empty element + if(empty($value)) { + return array(); + } $value = explode($this->seperatorChar, $value); } // MUtil_Echo::track($value); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-24 10:00:32
|
Revision: 953 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=953&view=rev Author: matijsdejong Date: 2012-09-24 10:00:20 +0000 (Mon, 24 Sep 2012) Log Message: ----------- Updated translations Extended TrackData functionality Improved file names of sql creation files (to improve the order of creation) Modified Paths: -------------- trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php trunk/library/classes/Gems/Util/TrackData.php trunk/library/languages/default-en.mo trunk/library/languages/default-en.po trunk/library/languages/default-nl.mo trunk/library/languages/default-nl.po Added Paths: ----------- trunk/library/configs/db/tables/gems__respondent2track2field.50.sql trunk/library/configs/db/tables/gems__track_fields.40.sql Removed Paths: ------------- trunk/library/configs/db/tables/gems__respondent2track2field.20.sql trunk/library/configs/db/tables/gems__track_fields.20.sql Modified: trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php 2012-09-21 16:42:22 UTC (rev 952) +++ trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php 2012-09-24 10:00:20 UTC (rev 953) @@ -79,7 +79,7 @@ $model->set($fieldName, 'multiOptions', $options); if (! array_key_exists($itemData[$fieldName], $options)) { - // The value is always the only possible value + // Set the value to the first possible value reset($options); $itemData[$fieldName] = key($options); @@ -399,15 +399,7 @@ */ protected function getDateUnitsList($validAfter) { - return array( - 'N' => $this->_('Minutes'), - 'H' => $this->_('Hours'), - 'D' => $this->_('Days'), - 'W' => $this->_('Weeks'), - 'M' => $this->_('Months'), - 'Q' => $this->_('Quarters'), - 'Y' => $this->_('Years') - ); + return $this->util->getTrackData()->getDateUnitsList($validAfter); } /** Modified: trunk/library/classes/Gems/Util/TrackData.php =================================================================== --- trunk/library/classes/Gems/Util/TrackData.php 2012-09-21 16:42:22 UTC (rev 952) +++ trunk/library/classes/Gems/Util/TrackData.php 2012-09-24 10:00:20 UTC (rev 953) @@ -168,6 +168,25 @@ } /** + * Get an array of translated labels for the date units used by this engine + * + * @param boolean $validAfter True if it concenrs _valid_after_ dates + * @return array date_unit => label + */ + public function getDateUnitsList($validAfter) + { + return array( + 'N' => $this->translate->_('Minutes'), + 'H' => $this->translate->_('Hours'), + 'D' => $this->translate->_('Days'), + 'W' => $this->translate->_('Weeks'), + 'M' => $this->translate->_('Months'), + 'Q' => $this->translate->_('Quarters'), + 'Y' => $this->translate->_('Years') + ); + } + + /** * Returns array (id => name) of all ronds in a track, sorted by order * * @param int $trackId @@ -192,4 +211,42 @@ return $tracks; } + + + /** + * Returns array (id => name) of the track date fields for this track, sorted by order + * + * @param int $trackId + * @return array + */ + public function getTrackDateFields($trackId) + { + $dateFields = $this->db->fetchPairs("SELECT gtf_id_field, gtf_field_name FROM gems__track_fields WHERE gtf_id_track = ? AND gtf_field_type = 'date' ORDER BY gtf_id_order", $trackId); + + if (! $dateFields) { + $dateFields = array(); + } + + return $dateFields; + } + + /** + * Returns array (id => name) of all track date fields, sorted alphabetically + * + * @return array + */ + public function getTracksDateFields() + { + static $dateFields; + + if (! is_array($dateFields)) { + $dateFields = $this->db->fetchPairs("SELECT gtf_id_field, gtf_field_name FROM gems__track_fields WHERE gtf_field_type = 'date' ORDER BY gtf_field_name"); + + if (! $dateFields) { + $dateFields = array(); + } + } + + return $dateFields; + } } Deleted: trunk/library/configs/db/tables/gems__respondent2track2field.20.sql =================================================================== --- trunk/library/configs/db/tables/gems__respondent2track2field.20.sql 2012-09-21 16:42:22 UTC (rev 952) +++ trunk/library/configs/db/tables/gems__respondent2track2field.20.sql 2012-09-24 10:00:20 UTC (rev 953) @@ -1,17 +0,0 @@ - -CREATE TABLE if not exists gems__respondent2track2field ( - gr2t2f_id_respondent_track bigint unsigned not null references gems__respondent2track (gr2t_id_respondent_track), - gr2t2f_id_field bigint unsigned not null references gems__track_fields (gtf_id_field), - - gr2t2f_value text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, - - gr2t2f_changed timestamp not null default current_timestamp on update current_timestamp, - gr2t2f_changed_by bigint unsigned not null, - gr2t2f_created timestamp not null, - gr2t2f_created_by bigint unsigned not null, - - PRIMARY KEY(gr2t2f_id_respondent_track,gr2t2f_id_field) - ) - ENGINE=InnoDB - CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'; - Added: trunk/library/configs/db/tables/gems__respondent2track2field.50.sql =================================================================== --- trunk/library/configs/db/tables/gems__respondent2track2field.50.sql (rev 0) +++ trunk/library/configs/db/tables/gems__respondent2track2field.50.sql 2012-09-24 10:00:20 UTC (rev 953) @@ -0,0 +1,17 @@ + +CREATE TABLE if not exists gems__respondent2track2field ( + gr2t2f_id_respondent_track bigint unsigned not null references gems__respondent2track (gr2t_id_respondent_track), + gr2t2f_id_field bigint unsigned not null references gems__track_fields (gtf_id_field), + + gr2t2f_value text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, + + gr2t2f_changed timestamp not null default current_timestamp on update current_timestamp, + gr2t2f_changed_by bigint unsigned not null, + gr2t2f_created timestamp not null, + gr2t2f_created_by bigint unsigned not null, + + PRIMARY KEY(gr2t2f_id_respondent_track,gr2t2f_id_field) + ) + ENGINE=InnoDB + CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'; + Deleted: trunk/library/configs/db/tables/gems__track_fields.20.sql =================================================================== --- trunk/library/configs/db/tables/gems__track_fields.20.sql 2012-09-21 16:42:22 UTC (rev 952) +++ trunk/library/configs/db/tables/gems__track_fields.20.sql 2012-09-24 10:00:20 UTC (rev 953) @@ -1,29 +0,0 @@ - -CREATE TABLE if not exists gems__track_fields ( - gtf_id_field bigint unsigned not null auto_increment, - gtf_id_track int unsigned not null references gems__tracks (gtr_id_track), - - gtf_id_order int not null default 10, - - gtf_field_name varchar(200) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null, - gtf_field_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, - gtf_field_description varchar(200) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, - - gtf_field_values text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, - - gtf_field_type varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null, - - gtf_required boolean not null default false, - gtf_readonly boolean not null default false, - - gtf_changed timestamp not null default current_timestamp on update current_timestamp, - gtf_changed_by bigint unsigned not null, - gtf_created timestamp not null, - gtf_created_by bigint unsigned not null, - - PRIMARY KEY (gtf_id_field) - ) - ENGINE=InnoDB - AUTO_INCREMENT = 60000 - CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'; - Added: trunk/library/configs/db/tables/gems__track_fields.40.sql =================================================================== --- trunk/library/configs/db/tables/gems__track_fields.40.sql (rev 0) +++ trunk/library/configs/db/tables/gems__track_fields.40.sql 2012-09-24 10:00:20 UTC (rev 953) @@ -0,0 +1,29 @@ + +CREATE TABLE if not exists gems__track_fields ( + gtf_id_field bigint unsigned not null auto_increment, + gtf_id_track int unsigned not null references gems__tracks (gtr_id_track), + + gtf_id_order int not null default 10, + + gtf_field_name varchar(200) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null, + gtf_field_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, + gtf_field_description varchar(200) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, + + gtf_field_values text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, + + gtf_field_type varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null, + + gtf_required boolean not null default false, + gtf_readonly boolean not null default false, + + gtf_changed timestamp not null default current_timestamp on update current_timestamp, + gtf_changed_by bigint unsigned not null, + gtf_created timestamp not null, + gtf_created_by bigint unsigned not null, + + PRIMARY KEY (gtf_id_field) + ) + ENGINE=InnoDB + AUTO_INCREMENT = 60000 + CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'; + Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2012-09-21 16:42:22 UTC (rev 952) +++ trunk/library/languages/default-en.po 2012-09-24 10:00:20 UTC (rev 953) @@ -2,14 +2,14 @@ msgstr "" "Project-Id-Version: GemsTracker EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-09-06 11:29+0100\n" +"POT-Creation-Date: 2012-09-24 11:55+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" -"Language: en_GB\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: en_GB\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Poedit-SourceCharset: iso-8859-1\n" "X-Poedit-Basepath: ../\n" @@ -30,7 +30,8 @@ msgid "You are logged in as %s" msgstr "You are logged in as %s" -#: classes/GemsEscort.php:803 classes/Gems/Menu.php:263 +#: classes/GemsEscort.php:803 +#: classes/Gems/Menu.php:263 msgid "Logoff" msgstr "Logoff" @@ -48,18 +49,15 @@ msgstr "version" #: classes/GemsEscort.php:1465 -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" +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:1594 msgid "Please check back later." msgstr "Please check back later." -#: classes/GemsEscort.php:1596 classes/GemsEscort.php:1600 +#: classes/GemsEscort.php:1596 +#: classes/GemsEscort.php:1600 #: classes/GemsEscort.php:1601 msgid "System is in maintenance mode" msgstr "System is in maintenance mode" @@ -68,22 +66,22 @@ msgid "No access to site." msgstr "No access to site." -#: classes/GemsEscort.php:1613 classes/GemsEscort.php:1656 +#: classes/GemsEscort.php:1613 +#: classes/GemsEscort.php:1656 msgid "You have no access to this site." msgstr "You have no access to this site." -#: classes/GemsEscort.php:1629 classes/Gems/Default/StaffAction.php:317 +#: classes/GemsEscort.php:1629 msgid "No access to page" msgstr "No access to page" -#: classes/GemsEscort.php:1631 classes/Gems/Default/OrganizationAction.php:94 -#: classes/Gems/Default/StaffAction.php:318 -#: classes/Gems/Model/HiddenOrganizationModel.php:115 +#: classes/GemsEscort.php:1631 #, 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:1641 classes/GemsEscort.php:1654 +#: classes/GemsEscort.php:1641 +#: classes/GemsEscort.php:1654 msgid "You are no longer logged in." msgstr "You are no longer logged in." @@ -91,7 +89,8 @@ msgid "You must login to access this page." msgstr "You must login to access this page." -#: classes/GemsEscort.php:1783 classes/GemsEscort.php:1785 +#: classes/GemsEscort.php:1783 +#: classes/GemsEscort.php:1785 #, php-format msgid "%d survey" msgid_plural "%d surveys" @@ -147,7 +146,7 @@ msgid "Project setup" msgstr "Project setup" -#: classes/Gems/Menu.php:170 classes/Gems/Default/SourceAction.php:203 +#: classes/Gems/Menu.php:170 msgid "Database" msgstr "Database" @@ -155,11 +154,11 @@ msgid "Content" msgstr "Content" -#: classes/Gems/Menu.php:177 classes/Gems/Default/DatabaseAction.php:313 +#: classes/Gems/Menu.php:177 msgid "Execute" msgstr "Execute" -#: classes/Gems/Menu.php:182 classes/Gems/Default/DatabaseAction.php:289 +#: classes/Gems/Menu.php:182 msgid "Patches" msgstr "Patches" @@ -175,7 +174,7 @@ msgid "Run SQL" msgstr "Run SQL" -#: classes/Gems/Menu.php:190 classes/Gems/Default/ReceptionAction.php:132 +#: classes/Gems/Menu.php:190 msgid "Reception codes" msgstr "Reception codes" @@ -183,16 +182,16 @@ msgid "Consents" msgstr "Consents" -#: classes/Gems/Menu.php:196 classes/Gems/Default/RoleAction.php:309 +#: classes/Gems/Menu.php:196 msgid "Roles" msgstr "Roles" -#: classes/Gems/Menu.php:197 classes/Gems/Menu.php:391 +#: classes/Gems/Menu.php:197 +#: classes/Gems/Menu.php:391 msgid "Assigned" msgstr "Assigned" -#: classes/Gems/Menu.php:198 classes/Gems/Default/RoleAction.php:238 -#: classes/Gems/Default/RoleAction.php:324 +#: classes/Gems/Menu.php:198 msgid "Privileges" msgstr "Privileges" @@ -201,20 +200,14 @@ msgstr "Groups" #: classes/Gems/Menu.php:204 -#: classes/Gems/Default/SurveyMaintenanceAction.php:203 -#: classes/Gems/Default/TrackMaintenanceAction.php:131 -#: classes/Gems/Email/MailTemplateForm.php:101 -#: classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php:140 msgid "Organizations" msgstr "Organizations" -#: classes/Gems/Menu.php:207 classes/Gems/Default/GroupAction.php:93 -#: classes/Gems/Default/LogAction.php:193 -#: classes/Gems/Default/StaffAction.php:470 +#: classes/Gems/Menu.php:207 msgid "Staff" msgstr "Staff" -#: classes/Gems/Menu.php:210 classes/Gems/Default/LogAction.php:213 +#: classes/Gems/Menu.php:210 msgid "Logging" msgstr "Logging" @@ -226,15 +219,14 @@ msgid "Upgrade" msgstr "Upgrade" -#: classes/Gems/Menu.php:220 classes/Gems/Menu.php:221 -#: classes/Gems/Default/ProjectInformationAction.php:113 -#: classes/Gems/Default/ProjectInformationAction.php:118 +#: classes/Gems/Menu.php:220 +#: classes/Gems/Menu.php:221 #, php-format msgid "Changelog %s" msgstr "Changelog %s" -#: classes/Gems/Menu.php:222 classes/Gems/Menu.php:355 -#: classes/Gems/Menu/SubMenuItem.php:551 +#: classes/Gems/Menu.php:222 +#: classes/Gems/Menu.php:355 msgid "Show" msgstr "Show" @@ -263,7 +255,7 @@ msgid "Logon" msgstr "Logon" -#: classes/Gems/Menu.php:258 classes/Gems/User/Form/LoginForm.php:112 +#: classes/Gems/Menu.php:258 msgid "Lost password" msgstr "Lost password" @@ -271,72 +263,40 @@ msgid "Your account" msgstr "Your account" -#: classes/Gems/Menu.php:260 classes/Gems/Default/OptionAction.php:153 +#: classes/Gems/Menu.php:260 msgid "Activity overview" msgstr "Activity overview" -#: classes/Gems/Menu.php:261 classes/Gems/Default/OptionAction.php:78 +#: classes/Gems/Menu.php:261 msgid "Change password" msgstr "Change password" -#: classes/Gems/Menu.php:262 classes/Gems/Menu.php:315 -#: classes/Gems/Menu.php:361 classes/Gems/Default/MailLogAction.php:114 -#: classes/Gems/Default/TrackAction.php:459 -#: classes/Gems/Export/RespondentExport.php:150 -#: classes/Gems/Snippets/TokenModelSnippetAbstract.php:70 -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:490 -#: classes/Gems/Tracker/Form/AskTokenForm.php:77 -#: classes/Gems/Tracker/Model/StandardTokenModel.php:195 -#: classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php:173 -#: classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php:182 -#: snippets/BrowseSingleSurveyTokenSnippet.php:167 -#: snippets/TrackTokenOverviewSnippet.php:132 -#: snippets/Organization/OrganizationEditSnippet.php:89 -#: snippets/Track/Token/ShowAllOpenSnippet.php:88 -#: snippets/Track/Token/ShowFirstOpenSnippet.php:110 +#: classes/Gems/Menu.php:262 +#: classes/Gems/Menu.php:315 +#: classes/Gems/Menu.php:361 msgid "Token" msgstr "Token" -#: classes/Gems/Menu.php:303 classes/Gems/Export/RespondentExport.php:301 +#: classes/Gems/Menu.php:303 msgid "Export" msgstr "Export" -#: classes/Gems/Menu.php:310 classes/Gems/Default/MailJobAction.php:99 -#: classes/Gems/Default/ProjectTracksAction.php:64 -#: classes/Gems/Default/TrackAction.php:328 -#: classes/Gems/Default/TrackActionAbstract.php:199 -#: classes/Gems/Default/TrackFieldsAction.php:96 -#: classes/Gems/Email/OneMailForm.php:54 -#: classes/Gems/Export/RespondentExport.php:207 -#: classes/Gems/Export/RespondentExport.php:219 -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:492 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:734 -#: classes/Gems/Tracker/Model/StandardTokenModel.php:216 -#: classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php:149 -#: classes/Gems/Tracker/Snippets/ShowTrackUsageAbstract.php:146 -#: snippets/Track/Token/ShowAllOpenSnippet.php:148 +#: classes/Gems/Menu.php:310 msgid "Track" msgstr "Track" -#: classes/Gems/Menu.php:318 classes/Gems/Menu.php:343 +#: classes/Gems/Menu.php:318 +#: classes/Gems/Menu.php:343 #: classes/Gems/Menu.php:385 -#: classes/Gems/Default/TrackMaintenanceAction.php:367 -#: snippets/AddTracksSnippet.php:242 msgid "Add" msgstr "Add" -#: classes/Gems/Menu.php:324 classes/Gems/Menu.php:424 -#: classes/Gems/Email/EmailFormAbstract.php:280 -#: classes/Gems/Email/EmailFormAbstract.php:291 -#: classes/Gems/Menu/MenuAbstract.php:367 -#: classes/Gems/Menu/MenuAbstract.php:380 +#: classes/Gems/Menu.php:324 +#: classes/Gems/Menu.php:424 msgid "Preview" msgstr "Preview" -#: classes/Gems/Menu.php:333 classes/Gems/Default/ExportAction.php:149 -#: classes/Gems/Default/TrackMaintenanceAction.php:314 -#: classes/Gems/Menu/MenuAbstract.php:376 -#: classes/Gems/Menu/MenuAbstract.php:457 snippets/AddTracksSnippet.php:239 +#: classes/Gems/Menu.php:333 msgid "Tracks" msgstr "Tracks" @@ -344,19 +304,15 @@ msgid "Assignments" msgstr "Assignments" -#: classes/Gems/Menu.php:365 classes/Gems/Menu/SubMenuItem.php:417 +#: classes/Gems/Menu.php:365 msgid "Edit" msgstr "Edit" -#: classes/Gems/Menu.php:371 classes/Gems/Menu/SubMenuItem.php:398 +#: classes/Gems/Menu.php:371 msgid "Delete" msgstr "Delete" #: classes/Gems/Menu.php:378 -#: classes/Gems/Default/SurveyMaintenanceAction.php:563 -#: classes/Gems/Menu/MenuAbstract.php:383 -#: classes/Gems/Menu/MenuAbstract.php:445 -#: classes/Gems/Tracker/Model/TrackModel.php:100 msgid "Surveys" msgstr "Surveys" @@ -373,13 +329,10 @@ msgstr "E-Mail now!" #: classes/Gems/Menu.php:427 -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:489 msgid "Answers" msgstr "Answers" -#: classes/Gems/Menu.php:579 classes/Gems/Default/GroupAction.php:94 -#: classes/Gems/Default/OrganizationAction.php:142 -#: classes/Gems/Default/RespondentAction.php:403 +#: classes/Gems/Menu.php:579 msgid "Respondents" msgstr "Patients" @@ -387,7 +340,7 @@ msgid "Overview" msgstr "Overview" -#: classes/Gems/Menu.php:594 classes/Gems/Menu/MenuAbstract.php:340 +#: classes/Gems/Menu.php:594 msgid "Project" msgstr "Project" @@ -403,13 +356,11 @@ msgid "Mail" msgstr "Mail" -#: classes/Gems/Menu.php:609 classes/Gems/Default/RespondentAction.php:511 -#: classes/Gems/Default/RespondentExportAction.php:60 +#: classes/Gems/Menu.php:609 msgid "Export respondent" msgstr "Export respondent" -#: classes/Gems/Menu.php:615 classes/Gems/Default/ContactAction.php:101 -#: snippets/Organization/OrganizationEditSnippet.php:82 +#: classes/Gems/Menu.php:615 msgid "Contact" msgstr "Contact" @@ -418,19 +369,10 @@ msgstr "Changelog" #: classes/Gems/Model.php:206 -#: classes/Gems/Tracker/Model/StandardTokenModel.php:213 msgid "Respondent nr" msgstr "Patient nr" -#: classes/Gems/Model.php:209 classes/Gems/Default/ExportAction.php:172 -#: classes/Gems/Default/IndexAction.php:229 -#: classes/Gems/Default/LogAction.php:197 -#: classes/Gems/Default/MailJobAction.php:98 -#: classes/Gems/Default/StaffAction.php:340 -#: classes/Gems/Snippets/Export/ReportHeaderSnippet.php:63 -#: classes/Gems/User/Form/LayeredLoginForm.php:254 -#: classes/Gems/User/Form/OrganizationFormAbstract.php:166 -#: snippets/Organization/OrganizationEditSnippet.php:80 +#: classes/Gems/Model.php:209 msgid "Organization" msgstr "Organization" @@ -442,43 +384,27 @@ msgid "Consent" msgstr "Consent" -#: classes/Gems/Model.php:214 classes/Gems/Default/OptionAction.php:130 -#: classes/Gems/Default/StaffAction.php:330 +#: classes/Gems/Model.php:214 msgid "E-Mail" msgstr "E-Mail" -#: classes/Gems/Model.php:219 classes/Gems/Default/OptionAction.php:134 -#: classes/Gems/Default/StaffAction.php:343 +#: classes/Gems/Model.php:219 msgid "Gender" msgstr "Gender" -#: classes/Gems/Model.php:220 classes/Gems/Default/OptionAction.php:131 -#: classes/Gems/Default/StaffAction.php:185 +#: classes/Gems/Model.php:220 msgid "First name" msgstr "First name" -#: classes/Gems/Model.php:221 classes/Gems/Default/OptionAction.php:132 -#: classes/Gems/Default/StaffAction.php:187 +#: classes/Gems/Model.php:221 msgid "Surname prefix" msgstr "Surname prefix" -#: classes/Gems/Model.php:222 classes/Gems/Default/OptionAction.php:133 -#: classes/Gems/Default/StaffAction.php:188 +#: classes/Gems/Model.php:222 msgid "Last name" msgstr "Last name" -#: classes/Gems/Model.php:224 classes/Gems/Default/DatabaseAction.php:135 -#: classes/Gems/Default/DatabaseAction.php:335 -#: classes/Gems/Default/GroupAction.php:87 -#: classes/Gems/Default/OrganizationAction.php:114 -#: classes/Gems/Default/RoleAction.php:231 -#: classes/Gems/Default/SourceAction.php:195 -#: classes/Gems/Default/StaffAction.php:328 -#: classes/Gems/Default/SurveyMaintenanceAction.php:412 -#: classes/Gems/Default/TokenPlanAction.php:121 -#: classes/Gems/Default/TrackFieldsAction.php:98 -#: classes/Gems/Default/TrackMaintenanceAction.php:227 -#: classes/Gems/Tracker/Model/TrackModel.php:98 +#: classes/Gems/Model.php:224 msgid "Name" msgstr "Name" @@ -491,7 +417,6 @@ msgstr "Zipcode" #: classes/Gems/Model.php:229 -#: classes/Gems/Default/RespondentPlanAction.php:134 msgid "City" msgstr "City" @@ -500,7 +425,6 @@ msgstr "Phone" #: classes/Gems/Model.php:233 -#: classes/Gems/Default/RespondentPlanAction.php:133 msgid "Birthday" msgstr "Birthday" @@ -546,164 +470,100 @@ msgid "Trying upgrade for %s to level %s: %s" msgstr "Trying upgrade for %s to level %s: %s" -#: classes/Gems/Controller/BrowseEditAction.php:358 -#: classes/Gems/Controller/ModelSnippetActionAbstract.php:239 -#: classes/Gems/Default/StaffAction.php:228 -#: classes/Gems/Snippets/ModelFormSnippetAbstract.php:186 +#: classes/Gems/Controller/BrowseEditAction.php:357 #, php-format msgid "New %s..." msgstr "New %s..." -#: classes/Gems/Controller/BrowseEditAction.php:391 -#: classes/Gems/Controller/ModelSnippetActionAbstract.php:259 -#: classes/Gems/Default/TrackFieldsAction.php:130 -#: classes/Gems/Default/TrackRoundsAction.php:171 +#: classes/Gems/Controller/BrowseEditAction.php:390 #, php-format msgid "Delete %s" msgstr "Delete %s" -#: classes/Gems/Controller/BrowseEditAction.php:395 -#: classes/Gems/Default/TrackFieldsAction.php:137 -#: classes/Gems/Default/TrackRoundsAction.php:186 -#: snippets/DeleteSingleSurveyInSourceTokenSnippet.php:134 -#: snippets/DeleteTrackTokenSnippet.php:152 +#: classes/Gems/Controller/BrowseEditAction.php:394 #, php-format msgid "%2$u %1$s deleted" msgstr "%2$u %1$s deleted" -#: classes/Gems/Controller/BrowseEditAction.php:412 -#: classes/Gems/Default/OrganizationAction.php:200 +#: classes/Gems/Controller/BrowseEditAction.php:411 #, php-format msgid "Edit %s %s" msgstr "Edit %s %s" -#: classes/Gems/Controller/BrowseEditAction.php:414 -#: classes/Gems/Controller/ModelSnippetActionAbstract.php:269 -#: classes/Gems/Snippets/ModelFormSnippetAbstract.php:188 +#: classes/Gems/Controller/BrowseEditAction.php:413 #, php-format msgid "Edit %s" msgstr "Edit %s" -#: classes/Gems/Controller/BrowseEditAction.php:515 -#: snippets/Generic/AutosearchFormSnippet.php:134 +#: classes/Gems/Controller/BrowseEditAction.php:514 msgid "Free search text" msgstr "Free search text" -#: classes/Gems/Controller/BrowseEditAction.php:586 -#: snippets/Generic/AutosearchFormSnippet.php:209 +#: classes/Gems/Controller/BrowseEditAction.php:585 msgid "Search" msgstr "Search" -#: classes/Gems/Controller/BrowseEditAction.php:602 -#: classes/Gems/Default/TrackMaintenanceAction.php:361 +#: classes/Gems/Controller/BrowseEditAction.php:601 #, php-format msgid "No %s found" msgstr "No %s found" -#: classes/Gems/Controller/BrowseEditAction.php:686 -#: classes/Gems/Default/ExportAction.php:245 +#: classes/Gems/Controller/BrowseEditAction.php:685 #, php-format msgid "No %s found." msgstr "No %s found." -#: classes/Gems/Controller/BrowseEditAction.php:804 -#: classes/Gems/Default/TrackRoundsAction.php:244 -#: snippets/DeleteSingleSurveyNotUsedTokenSnippet.php:94 +#: classes/Gems/Controller/BrowseEditAction.php:803 msgid "Are you sure?" msgstr "Are you sure?" -#: classes/Gems/Controller/BrowseEditAction.php:820 -#: classes/Gems/Default/DatabaseAction.php:187 -#: classes/Gems/Default/DatabaseAction.php:499 -#: classes/Gems/Default/StaffAction.php:276 -#: classes/Gems/Default/TrackAction.php:419 -#: classes/Gems/Default/TrackRoundsAction.php:264 -#: classes/Gems/Snippets/ModelItemYesNoDeleteSnippetAbstract.php:181 -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:143 -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:147 -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:166 -#: classes/Gems/Util/Translated.php:263 -#: classes/MUtil/Snippets/ModelYesNoDeleteSnippetAbstract.php:192 -#: snippets/DeleteSingleSurveyNotUsedTokenSnippet.php:124 +#: classes/Gems/Controller/BrowseEditAction.php:819 msgid "Yes" msgstr "Yes" -#: classes/Gems/Controller/BrowseEditAction.php:821 -#: classes/Gems/Default/DatabaseAction.php:188 -#: classes/Gems/Default/DatabaseAction.php:500 -#: classes/Gems/Default/StaffAction.php:277 -#: classes/Gems/Default/TrackAction.php:420 -#: classes/Gems/Default/TrackRoundsAction.php:265 -#: classes/Gems/Snippets/ModelItemYesNoDeleteSnippetAbstract.php:183 -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:144 -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:148 -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:167 -#: classes/Gems/Util/ReceptionCodeLibrary.php:99 -#: classes/Gems/Util/ReceptionCodeLibrary.php:123 -#: classes/Gems/Util/Translated.php:263 -#: classes/MUtil/Snippets/ModelYesNoDeleteSnippetAbstract.php:194 -#: snippets/DeleteSingleSurveyNotUsedTokenSnippet.php:125 +#: classes/Gems/Controller/BrowseEditAction.php:820 msgid "No" msgstr "No" -#: classes/Gems/Controller/BrowseEditAction.php:874 -#: classes/Gems/Default/RespondentAction.php:246 -#: classes/Gems/Default/RespondentAction.php:456 -#: classes/Gems/Default/RespondentAction.php:494 -#: classes/Gems/Default/TrackAction.php:547 +#: classes/Gems/Controller/BrowseEditAction.php:873 #, php-format msgid "Unknown %s requested" msgstr "Unknown %s requested" -#: classes/Gems/Controller/BrowseEditAction.php:897 +#: classes/Gems/Controller/BrowseEditAction.php:896 #, php-format msgid "New %1$s..." msgstr "New %1$s..." -#: classes/Gems/Controller/BrowseEditAction.php:905 -#: classes/Gems/Email/MailTemplateForm.php:108 -#: classes/Gems/User/Form/ChangePasswordForm.php:341 -#: classes/MUtil/Snippets/ModelFormSnippetAbstract.php:245 +#: classes/Gems/Controller/BrowseEditAction.php:904 msgid "Save" msgstr "Save" -#: classes/Gems/Controller/BrowseEditAction.php:941 -#: classes/Gems/Default/MailTemplateAction.php:116 -#: classes/MUtil/Snippets/ModelFormSnippetAbstract.php:209 +#: classes/Gems/Controller/BrowseEditAction.php:940 #, php-format msgid "%2$u %1$s saved" msgstr "%2$u %1$s saved" -#: classes/Gems/Controller/BrowseEditAction.php:944 +#: classes/Gems/Controller/BrowseEditAction.php:943 msgid "No changes to save." msgstr "No changes to save." -#: classes/Gems/Controller/BrowseEditAction.php:953 -#: classes/Gems/Default/RespondentAction.php:307 +#: classes/Gems/Controller/BrowseEditAction.php:952 msgid "Input error! No changes saved!" msgstr "Input error! No changes saved!" -#: classes/Gems/Controller/BrowseEditAction.php:981 -#: classes/Gems/Default/SurveyMaintenanceAction.php:592 +#: classes/Gems/Controller/BrowseEditAction.php:980 #, php-format msgid "Show %s" msgstr "Show %s" -#: classes/Gems/Controller/BrowseEditAction.php:988 -#: classes/Gems/Default/SurveyMaintenanceAction.php:601 +#: classes/Gems/Controller/BrowseEditAction.php:987 #, php-format msgid "Unknown %s." msgstr "Unknown %s." #: classes/Gems/Controller/ModelActionAbstract.php:97 #: classes/Gems/Default/DatabaseAction.php:503 -#: classes/Gems/Default/SourceAction.php:292 -#: classes/Gems/Default/UpgradeAction.php:184 -#: classes/Gems/Snippets/ModelFormSnippetAbstract.php:171 -#: classes/Gems/Snippets/ModelItemTableSnippetAbstract.php:180 -#: classes/Gems/Tracker/Snippets/ShowRoundSnippetAbstract.php:193 -#: snippets/Generic/CurrentButtonRowSnippet.php:77 -#: snippets/Track/Token/ShowFirstOpenSnippet.php:133 msgid "Cancel" msgstr "Cancel" @@ -727,8 +587,6 @@ msgstr "Showing %s" #: classes/Gems/Controller/ModelSnippetActionAbstract.php:390 -#: classes/Gems/Default/OptionAction.php:181 -#: classes/MUtil/Snippets/ModelFormSnippetAbstract.php:341 msgid "item" msgid_plural "items" msgstr[0] "item" @@ -765,36 +623,22 @@ msgstr "After answering the survey you will be logged off automatically." #: classes/Gems/Default/AskAction.php:100 -msgid "" -"A token consists of two groups of four letters and numbers, separated by an " -"optional hyphen. Tokens are case insensitive." -msgstr "" -"A token consists of two groups of four letters and numbers, separated by an " -"optional hyphen. Tokens are case insensitive." +msgid "A token consists of two groups of four letters and numbers, separated by an optional hyphen. Tokens are case insensitive." +msgstr "A token consists of two groups of four letters and numbers, separated by an optional hyphen. Tokens are case insensitive." #: classes/Gems/Default/AskAction.php:101 -msgid "" -"The number zero and the letter O are treated as the same; the same goes for " -"the number one and the letter L." -msgstr "" -"The number zero and the letter O are treated as the same; the same goes for " -"the number one and the letter L." +msgid "The number zero and the letter O are treated as the same; the same goes for the number one and the letter L." +msgstr "The number zero and the letter O are treated as the same; the same goes for the number one and the letter L." #: classes/Gems/Default/AskAction.php:136 #, php-format -msgid "" -"Thank you for answering. At the moment we have no further surveys for you to " -"take." -msgstr "" -"Thank you for answering. At the moment we have no further surveys for you to " -"take." +msgid "Thank you for answering. At the moment we have no further surveys for you to take." +msgstr "Thank you for answering. At the moment we have no further surveys for you to take." #: classes/Gems/Default/AskAction.php:138 #, php-format -msgid "" -"The survey for token %s has been answered and no further surveys are open." -msgstr "" -"The survey for token %s has been answered and no further surveys are open." +msgid "The survey for token %s has been answered and no further surveys are open." +msgstr "The survey for token %s has been answered and no further surveys are open." #: classes/Gems/Default/AskAction.php:145 #, php-format @@ -808,26 +652,11 @@ #: classes/Gems/Default/ConsentAction.php:68 #: classes/Gems/Default/GroupAction.php:88 -#: classes/Gems/Default/ReceptionAction.php:81 -#: classes/Gems/Default/RoleAction.php:232 -#: classes/Gems/Default/SurveyMaintenanceAction.php:199 -#: classes/Gems/Default/SurveyMaintenanceAction.php:413 -#: classes/Gems/Default/TrackActionAbstract.php:200 -#: classes/Gems/Default/TrackFieldsAction.php:101 -#: classes/Gems/Default/UpgradeAction.php:176 -#: classes/Gems/Export/RespondentExport.php:208 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:740 -#: classes/Gems/Tracker/Model/StandardTokenModel.php:214 -#: classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php:150 -#: classes/Gems/Tracker/Snippets/ShowTrackUsageAbstract.php:147 -#: snippets/TrackSurveyOverviewSnippet.php:115 msgid "Description" msgstr "Description" #: classes/Gems/Default/ConsentAction.php:70 #: classes/Gems/Default/DatabaseAction.php:139 -#: classes/Gems/Default/TrackFieldsAction.php:97 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:739 msgid "Order" msgstr "Order" @@ -840,12 +669,8 @@ msgstr "Consent code" #: classes/Gems/Default/ConsentAction.php:75 -msgid "" -"Internal code, not visible to users, copied with the token information to " -"the source." -msgstr "" -"Internal code, not visible to users, copied with the token information to " -"the source." +msgid "Internal code, not visible to users, copied with the token information to the source." +msgstr "Internal code, not visible to users, copied with the token information to the source." #: classes/Gems/Default/ConsentAction.php:92 msgid "respondent consent" @@ -894,14 +719,10 @@ msgstr "No mails sent." #: classes/Gems/Default/CronAction.php:226 -#: classes/Gems/Email/MultiMailForm.php:49 -#: classes/Gems/Email/OneMailForm.php:47 msgid "On this test system all mail will be delivered to the from address." msgstr "On this test system all mail will be delivered to the from address." #: classes/Gems/Default/DatabaseAction.php:75 -#: classes/Gems/Default/ProjectInformationAction.php:192 -#: classes/Gems/Task/CleanCache.php:58 msgid "Cache cleaned" msgstr "Cache cleaned" @@ -911,25 +732,18 @@ msgstr "No rows in %s." #: classes/Gems/Default/DatabaseAction.php:134 -#: classes/Gems/Default/TrackFieldsAction.php:104 -#: classes/Gems/Default/TrackMaintenanceAction.php:229 msgid "Type" msgstr "Type" #: classes/Gems/Default/DatabaseAction.php:138 -#: classes/Gems/Default/SurveyMaintenanceAction.php:434 msgid "Group" msgstr "Group" #: classes/Gems/Default/DatabaseAction.php:140 -#: classes/Gems/Default/OrganizationAction.php:115 msgid "Location" msgstr "Location" #: classes/Gems/Default/DatabaseAction.php:143 -#: classes/Gems/Default/SourceAction.php:210 -#: classes/Gems/Export/RespondentExport.php:151 -#: classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php:149 msgid "Status" msgstr "Status" @@ -940,7 +754,6 @@ #: classes/Gems/Default/DatabaseAction.php:148 #: classes/Gems/Default/DatabaseAction.php:293 #: classes/Gems/Default/DatabaseAction.php:340 -#: classes/Gems/Tracker/Model/StandardTokenModel.php:204 msgid "Changed on" msgstr "Changed on" @@ -1011,9 +824,6 @@ #: classes/Gems/Default/DatabaseAction.php:287 #: classes/Gems/Default/DatabaseAction.php:333 -#: classes/Gems/Default/UpgradeAction.php:126 -#: classes/Gems/Default/UpgradeAction.php:153 -#: classes/Gems/Default/UpgradeAction.php:175 msgid "Level" msgstr "Level" @@ -1046,7 +856,6 @@ msgstr "%d new or changed patch(es)." #: classes/Gems/Default/DatabaseAction.php:303 -#: classes/Gems/Default/ProjectInformationAction.php:137 msgid "Gems build" msgstr "Gems build" @@ -1071,7 +880,6 @@ msgstr "Show patches" #: classes/Gems/Default/DatabaseAction.php:326 -#: classes/Gems/Task/Db/ExecutePatch.php:68 #, php-format msgid "%d patch(es) executed." msgstr "%d patch(es) executed." @@ -1115,7 +923,6 @@ msgstr "Starting %d object creation scripts." #: classes/Gems/Default/DatabaseAction.php:474 -#: classes/Gems/Task/Db/CreateNewTable.php:73 #, php-format msgid "Finished %s creation script for object %d of %d" msgstr "Finished %s creation script for object %d of %d" @@ -1150,7 +957,6 @@ msgstr "Separate multiple commands with semicolons (;)." #: classes/Gems/Default/DatabaseAction.php:522 -#: classes/Gems/Menu/MenuAbstract.php:275 msgid "Run" msgstr "Run" @@ -1194,14 +1000,6 @@ msgstr "Not patient nr, but respondent id as exported here." #: classes/Gems/Default/ExportAction.php:154 -#: classes/Gems/Default/MailJobAction.php:100 -#: classes/Gems/Default/ProjectSurveysAction.php:67 -#: classes/Gems/Default/SurveyAction.php:191 -#: classes/Gems/Email/OneMailForm.php:57 -#: classes/Gems/Export/RespondentExport.php:148 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:737 -#: classes/Gems/Tracker/Model/StandardTokenModel.php:215 -#: snippets/TrackSurveyOverviewSnippet.php:111 msgid "Survey" msgstr "Survey" @@ -1224,34 +1022,20 @@ #: classes/Gems/Default/GroupAction.php:89 #: classes/Gems/Default/LogAction.php:201 -#: classes/Gems/Default/RoleAction.php:298 msgid "Role" msgstr "Role" #: classes/Gems/Default/GroupAction.php:92 -#: classes/Gems/Default/MailJobAction.php:82 -#: classes/Gems/Default/OrganizationAction.php:139 -#: classes/Gems/Default/ReceptionAction.php:88 -#: classes/Gems/Default/SourceAction.php:101 -#: classes/Gems/Default/SurveyMaintenanceAction.php:425 -#: classes/Gems/Default/SurveyMaintenanceAction.php:480 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:742 -#: classes/Gems/Tracker/Model/TrackModel.php:102 -#: classes/Gems/Util/TrackData.php:147 msgid "Active" msgstr "Active" #: classes/Gems/Default/GroupAction.php:97 -#: classes/Gems/Default/OrganizationAction.php:163 msgid "Allowed IP Ranges" msgstr "Allowed IP Ranges" #: classes/Gems/Default/GroupAction.php:98 -#: classes/Gems/Default/OrganizationAction.php:164 -msgid "" -"Separate with | example: 10.0.0.0-10.0.0.255 (subnet masks are not supported)" -msgstr "" -"Separate with | example: 10.0.0.0-10.0.0.255 (subnet masks are not supported)" +msgid "Separate with | example: 10.0.0.0-10.0.0.255 (subnet masks are not supported)" +msgstr "Separate with | example: 10.0.0.0-10.0.0.255 (subnet masks are not supported)" #: classes/Gems/Default/GroupAction.php:108 msgid "group" @@ -1276,12 +1060,8 @@ msgstr "Please enter your username or e-mail address. " #: classes/Gems/Default/IndexAction.php:182 -msgid "" -"We will then send you an e-mail with a link. The link will bring you to a " -"page where you can set a new password of your choice." -msgstr "" -"We will then send you an e-mail with a link. The link will bring you to a " -"page where you can set a new password of your choice." +msgid "We will then send you an e-mail with a link. The link will bring you to a page where you can set a new password of your choice." +msgstr "We will then send you an e-mail with a link. The link will bring you to a page where you can set a new password of your choice." #: classes/Gems/Default/IndexAction.php:188 msgid "Execute password reset" @@ -1305,7 +1085,6 @@ msgstr "Please enter your password of choice twice." #: classes/Gems/Default/IndexAction.php:218 -#: classes/Gems/User/Form/LayeredLoginForm.php:258 msgid "Department" msgstr "Department" @@ -1324,26 +1103,18 @@ msgstr "Good bye: %s." #: classes/Gems/Default/IndexAction.php:339 -msgid "" -"Your password reset request is no longer valid, please request a new link." -msgstr "" -"Your password reset request is no longer valid, please request a new link." +msgid "Your password reset request is no longer valid, please request a new link." +msgstr "Your password reset request is no longer valid, please request a new link." #: classes/Gems/Default/IndexAction.php:341 -msgid "" -"Your password input request is no longer valid, please request a new link." -msgstr "" -"Your password input request is no longer valid, please request a new link." +msgid "Your password input request is no longer valid, please request a new link." +msgstr "Your password input request is no longer valid, please request a new link." #: classes/Gems/Default/IndexAction.php:360 -msgid "" -"We sent you an e-mail with a reset link. Click on the link in the e-mail." -msgstr "" -"We sent you an e-mail with a reset link. Click on the link in the e-mail." +msgid "We sent you an e-mail with a reset link. Click on the link in the e-mail." +msgstr "We sent you an e-mail with a reset link. Click on the link in the e-mail." #: classes/Gems/Default/IndexAction.php:369 -#: classes/Gems/Default/OptionAction.php:94 -#: classes/Gems/Default/StaffAction.php:510 msgid "New password is active." msgstr "New password is active." @@ -1356,9 +1127,7 @@ "Dear {greeting},\n" "\n" "\n" -"A new password was requested for your [b]{organization}[/b] account on the " -"[b]{project}[/b] site, please click within {reset_in_hours} hours on [url=" -"{reset_url}]this link[/url] to enter the password of your choice.\n" +"A new password was requested for your [b]{organization}[/b] account on the [b]{project}[/b] site, please click within {reset_in_hours} hours on [url={reset_url}]this link[/url] to enter the password of your choice.\n" "\n" "\n" "{organization_signature}\n" @@ -1368,9 +1137,7 @@ "Dear {greeting},\n" "\n" "\n" -"A new password was requested for your [b]{organization}[/b] account on the " -"[b]{project}[/b] site, please click within {reset_in_hours} hours on [url=" -"{reset_url}]this link[/url] to enter the password of your choice.\n" +"A new password was requested for your [b]{organization}[/b] account on the [b]{project}[/b] site, please click within {reset_in_hours} hours on [url={reset_url}]this link[/url] to enter the password of your choice.\n" "\n" "\n" "{organization_signature}\n" @@ -1390,32 +1157,26 @@ msgstr "Invalid language setting." #: classes/Gems/Default/LogAction.php:78 -#: classes/Gems/Default/TokenPlanAction.php:243 msgid "from" msgstr "from" #: classes/Gems/Default/LogAction.php:83 -#: classes/Gems/Default/TokenPlanAction.php:248 msgid "until" msgstr "until" #: classes/Gems/Default/LogAction.php:89 -#: classes/Gems/Default/TokenPlanAction.php:254 msgid "days" msgstr "days" #: classes/Gems/Default/LogAction.php:90 -#: classes/Gems/Default/TokenPlanAction.php:255 msgid "weeks" msgstr "weeks" #: classes/Gems/Default/LogAction.php:91 -#: classes/Gems/Default/TokenPlanAction.php:256 msgid "months" msgstr "months" #: classes/Gems/Default/LogAction.php:92 -#: classes/Gems/Default/TokenPlanAction.php:257 msgid "years" msgstr "years" @@ -1452,33 +1213,23 @@ msgstr "All actions" #: classes/Gems/Default/LogAction.php:190 -#: classes/Gems/Default/TrackFieldsAction.php:92 -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:472 msgid "Date" msgstr "Date" #: classes/Gems/Default/LogAction.php:191 #: classes/Gems/Default/LogMaintenanceAction.php:52 -#: classes/Gems/Default/UpgradeAction.php:177 msgid "Action" msgstr "Action" #: classes/Gems/Default/LogAction.php:192 -#: classes/Gems/Default/MailTemplateAction.php:66 -#: classes/Gems/Email/EmailFormAbstract.php:168 msgid "Message" msgstr "Message" #: classes/Gems/Default/LogAction.php:198 -#: classes/Gems/Default/TokenPlanAction.php:116 -#: snippets/RespondentDetailsSnippet.php:74 -#: snippets/RespondentDetailsWithAssignmentsSnippet.php:148 msgid "Respondent" msgstr "Patient" #: classes/Gems/Default/LogAction.php:202 -#: classes/Gems/Default/OptionAction.php:175 -#: classes/Gems/User/RadiusUserDefinition.php:163 msgid "IP address" msgstr "IP address" @@ -1492,7 +1243,6 @@ msgstr "Log:" #: classes/Gems/Default/LogMaintenanceAction.php:72 -#: snippets/RespondentTokenTabsSnippet.php:69 msgid "All" msgstr "All" @@ -1506,7 +1256,6 @@ #: classes/Gems/Default/MailJobAction.php:78 #: classes/Gems/Default/MailLogAction.php:118 -#: classes/Gems/Email/EmailFormAbstract.php:308 msgid "Template" msgstr "Template" @@ -1573,10 +1322,6 @@ msgstr "Use the 'By staff member' address" #: classes/Gems/Default/MailJobAction.php:133 -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:290 -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:338 -#: snippets/Organization/OrganizationEditSnippet.php:85 -#: snippets/Organization/OrganizationEditSnippet.php:131 msgid "Other" msgstr "Other" @@ -1600,12 +1345,8 @@ msgstr "Turn Automatic Mail Jobs ON" #: classes/Gems/Default/MailJobAction.php:176 -msgid "" -"With automatic mail jobs and a cron job on the server, mails can be sent " -"without manual user action." -msgstr "" -"With automatic mail jobs and a cron job on the server, mails can be sent " -"without manual user action." +msgid "With automatic mail jobs and a cron job on the server, mails can be sent without manual user action." +msgstr "With automatic mail jobs and a cron job on the server, mails can be sent without manual user action." #: classes/Gems/Default/MailLogAction.php:109 msgid "Date sent" @@ -1629,7 +1370,6 @@ #: classes/Gems/Default/MailLogAction.php:115 #: classes/Gems/Default/MailTemplateAction.php:62 -#: classes/Gems/Email/EmailFormAbstract.php:349 msgid "Subject" msgstr "Subject" @@ -1672,7 +1412,6 @@ msgstr "TLS" #: classes/Gems/Default/MailServerAction.php:80 -#: classes/Gems/User/RadiusUserDefinition.php:164 msgid "Port" msgstr "Port" @@ -1685,20 +1424,16 @@ msgstr "User ID" #: classes/Gems/Default/MailServerAction.php:88 -#: classes/Gems/User/Form/LoginForm.php:127 msgid "Password" msgstr "Password" #: classes/Gems/Default/MailServerAction.php:90 #: classes/Gems/Default/SourceAction.php:95 -#: classes/Gems/User/Form/ChangePasswordForm.php:241 -#: classes/Gems/User/Form/ChangePasswordForm.php:287 msgid "Repeat password" msgstr "Repeat password" #: classes/Gems/Default/MailServerAction.php:91 #: classes/Gems/Default/SourceAction.php:74 -#: classes/Gems/User/RadiusUserDefinition.php:169 msgid "Enter only when changing" msgstr "Enter only when changing the password" @@ -1714,8 +1449,6 @@ #: classes/Gems/Default/MailTemplateAction.php:76 #: classes/Gems/Default/RespondentAction.php:349 -#: classes/Gems/Default/StaffAction.php:335 -#: classes/Gems/Default/StaffAction.php:405 msgid "(all organizations)" msgstr "(all organizations)" @@ -1740,7 +1473,6 @@ #: classes/Gems/Default/OptionAction.php:136 #: classes/Gems/Default/OrganizationAction.php:135 #: classes/Gems/Default/RespondentAction.php:195 -#: classes/Gems/Default/StaffAction.php:351 msgid "Language" msgstr "Language" @@ -1750,12 +1482,8 @@ msgstr "Options" #: classes/Gems/Default/OptionAction.php:155 -msgid "" -"This overview provides information about the last login activity on your " -"account." -msgstr "" -"This overview provides information about the last login activity on your " -"account." +msgid "This overview provides information about the last login activity on your account." +msgstr "This overview provides information about the last login activity on your account." #: classes/Gems/Default/OptionAction.php:175 msgid "Date / time" @@ -1766,7 +1494,6 @@ msgstr "Item" #: classes/Gems/Default/OrganizationAction.php:92 -#: classes/Gems/Model/HiddenOrganizationModel.php:113 msgid "Inaccessible or unknown organization" msgstr "Inaccessible or unknown organization" @@ -1796,19 +1523,14 @@ #: classes/Gems/Default/OrganizationAction.php:129 #, php-format -msgid "" -"Always switch to this organization when %s is accessed from one of these " -"space separated url's. The first is used for mails." -msgstr "" -"Always switch to this organization when %s is accessed from one of these " -"space separated url's. The first is used for mails." +msgid "Always switch to this organization when %s is accessed from one of these space separated url's. The first is used for mails." +msgstr "Always switch to this organization when %s is accessed from one of these space separated url's. The first is used for mails." #: classes/Gems/Default/OrganizationAction.php:139 msgid "Can the organization be used?" msgstr "Can the organization be used?" #: classes/Gems/Default/OrganizationAction.php:140 -#: classes/Gems/User/Form/LoginForm.php:151 msgid "Login" msgstr "Login" @@ -1858,12 +1580,10 @@ msgstr "Checked organizations see this organizations patients." #: classes/Gems/Default/OrganizationAction.php:160 -#: classes/Gems/Default/SurveyMaintenanceAction.php:442 msgid "Code name" msgstr "Code name" #: classes/Gems/Default/OrganizationAction.php:160 -#: classes/Gems/Default/SurveyMaintenanceAction.php:442 msgid "Only for programmers." msgstr "Only for programmers." @@ -1872,7 +1592,6 @@ msgstr "This can not be changed yet" #: classes/Gems/Default/OrganizationAction.php:180 -#: classes/Gems/Default/StaffAction.php:158 msgid "User Definition" msgstr "User Definition" @@ -1888,9 +1607,6 @@ #: classes/Gems/Default/OverviewPlanAction.php:115 #: classes/Gems/Default/ProjectSurveysAction.php:88 -#: classes/Gems/Default/SurveyAction.php:207 -#: classes/Gems/Default/SurveyMaintenanceAction.php:558 -#: classes/Gems/Tracker/Snippets/EditSingleSurveyTokenSnippetAbstract.php:157 msgid "survey" msgid_plural "surveys" msgstr[0] "survey" @@ -2009,31 +1725,20 @@ msgstr "Session content" #: classes/Gems/Default/ProjectInformationAction.php:225 -#: classes/Gems/Menu/MenuAbstract.php:341 msgid "Session" msgstr "Session" #: classes/Gems/Default/ProjectSurveysAction.php:68 -#: classes/Gems/Default/SurveyAction.php:192 -#: snippets/TrackSurveyOverviewSnippet.php:113 msgid "By" msgstr "By" #: classes/Gems/Default/ProjectSurveysAction.php:69 #: classes/Gems/Default/ProjectTracksAction.php:67 -#: classes/Gems/Default/SurveyAction.php:193 -#: classes/Gems/Default/TrackAction.php:330 -#: classes/Gems/Email/EmailFormAbstract.php:193 -#: classes/Gems/Email/EmailFormAbstract.php:251 -#: classes/Gems/Email/MailTemplateForm.php:81 -#: classes/Gems/Tracker/Model/TrackModel.php:103 msgid "From" msgstr "From" #: classes/Gems/Default/ProjectSurveysAction.php:70 #: classes/Gems/Default/ProjectTracksAction.php:68 -#: classes/Gems/Default/SurveyAction.php:197 -#: classes/Gems/Default/TrackAction.php:332 msgid "Until" msgstr "Until" @@ -2042,15 +1747,10 @@ msgstr "Active surveys" #: classes/Gems/Default/ProjectTracksAction.php:65 -#: classes/Gems/Default/TrackAction.php:329 msgid "Survey #" msgstr "Survey #" #: classes/Gems/Default/ProjectTracksAction.php:85 -#: classes/Gems/Default/TrackAction.php:452 -#: classes/Gems/Default/TrackMaintenanceAction.php:309 -#: classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php:191 -#: classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php:170 msgid "track" msgid_plural "tracks" msgstr[0] "track" @@ -2066,7 +1766,6 @@ 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." @@ -2076,7 +1775,6 @@ msgstr "Survey not specified." #: classes/Gems/Default/ProjectTracksAction.php:132 -#: classes/Gems/Default/TrackActionAbstract.php:492 #, php-format msgid "Track %s does not exist." msgstr "Track %s does not exist." @@ -2205,7 +1903,6 @@ msgstr "Has the patient signed the informed consent letter?" #: classes/Gems/Default/RespondentAction.php:228 -#: classes/Gems/Tracker/Model/StandardTokenModel.php:203 msgid "Comments" msgstr "Comments" @@ -2214,11 +1911,6 @@ msgstr "Treatment" #: classes/Gems/Default/RespondentAction.php:257 -#: classes/Gems/Default/TrackAction.php:132 -#: classes/Gems/Default/TrackAction.php:479 -#: classes/Gems/Tracker/Model/StandardTokenModel.php:212 -#: snippets/DeleteInSourceTrackSnippet.php:112 -#: snippets/EditTrackSnippet.php:94 msgid "Rejection code" msgstr "Rejection code" @@ -2235,7 +1927,6 @@ msgstr "Patient tracks stopped." #: classes/Gems/Default/RespondentAction.php:304 -#: classes/Gems/Default/TrackAction.php:405 msgid "Choose a reception code to delete." msgstr "Choose a reception code to delete." @@ -2250,8 +1941,6 @@ msgstr "Please settle the informed consent form for this patient." #: classes/Gems/Default/RespondentExportAction.php:54 -#: classes/Gems/Default/TrackAction.php:121 -#: snippets/DeleteInSourceTrackSnippet.php:82 snippets/EditTrackSnippet.php:72 msgid "Respondent number" msgstr "Patient number" @@ -2260,37 +1949,18 @@ msgstr "Separate multiple respondents with a comma (,)" #: classes/Gems/Default/RespondentPlanAction.php:67 -#: classes/Gems/Default/SurveyAction.php:171 -#: classes/Gems/Default/TrackAction.php:297 -#: snippets/DeleteInSourceTrackSnippet.php:132 -#: snippets/DeleteSingleSurveyInSourceTokenSnippet.php:174 -#: snippets/DeleteSingleSurveyNotUsedTokenSnippet.php:145 -#: snippets/DeleteTrackTokenSnippet.php:195 -#: snippets/EditSingleSurveyTokenSnippet.php:134 -#: snippets/EditTrackSnippet.php:109 snippets/EditTrackTokenSnippet.php:144 -#: snippets/ShowSingleSurveyTokenSnippet.php:140 -#: snippets/ShowTrackTokenSnippet.php:146 msgid "Show respondent" msgstr "Show patient" #: classes/Gems/Default/RespondentPlanAction.php:73 -#: classes/Gems/Default/TrackAction.php:266 -#: classes/Gems/Default/TrackAction.php:285 -#: snippets/DeleteInSourceTrackSnippet.php:129 -#: snippets/EditTrackSnippet.php:107 snippets/EditTrackTokenSnippet.php:142 -#: snippets/ShowTrackTokenSnippet.php:145 msgid "Show track" msgstr "Show track" #: classes/Gems/Default/RespondentPlanAction.php:136 -#: classes/Gems/Default/TrackAction.php:317 -#: snippets/ShowTrackUsageSnippet.php:103 msgid " of " msgstr " of " #: classes/Gems/Default/RespondentPlanAction.php:137 -#: classes/Gems/Default/TrackAction.php:318 -#: snippets/ShowTrackUsageSnippet.php:104 msgid "Progress" msgstr "Progress" @@ -2389,40 +2059,20 @@ msgstr "Database Password" #: classes/Gems/Default/SourceAction.php:115 -msgid "" -"Check tokens for being answered or not, reruns survey and round event code " -"on completed tokens and recalculates the start and end times of all tokens " -"in tracks that have completed tokens." -msgstr "" -"Check tokens for being answered or not, reruns survey and round event code " -"on completed tokens and recalculates the start and end times of all tokens " -"in tracks that have completed tokens." +msgid "Check tokens for being answered or not, reruns survey and round event code on completed tokens and recalculates the start and end times of all tokens in tracks that have completed tokens." +msgstr "Check tokens for being answered or not, reruns survey and round event code on completed tokens and recalculates the start and end times of all tokens in tracks that have completed tokens." #: classes/Gems/Default/SourceAction.php:116 -msgid "" -"Run this code when survey result fields, survey or round events or the event " -"code has changed or after bulk changes in a survey source." -msgstr "" -"Run this code when survey result fields, survey or round events or the event " -"code has changed or after bulk changes in a survey source." +msgid "Run this code when survey result fields, survey or round events or the event code has changed or after bulk changes in a survey source." +msgstr "Run this code when survey result fields, survey or round events or the event code has changed or after bulk changes in a survey source." #: classes/Gems/Default/SourceAction.php:126 -msgid "" -"Check source for new surveys, changes in survey status and survey deletion. " -"Can also perform maintenance on some sources, e.g. by changing the number of " -"attributes." -msgstr "" -"Check source for new surveys, changes in survey status and survey deletion. " -"Can also perform maintenance on some sources, e.g. by changing the number of " -"attributes." +msgid "Check source for new surveys, changes in survey status and survey deletion. Can also perform maintenance on some sources, e.g. by changing the number of attributes." +msgstr "Check source for new surveys, changes in survey status and survey deletion. Can also perform maintenance on some sources, e.g. by changing the number of attributes." #: classes/Gems/Default/SourceAction.php:127 -msgid "" -"Run this code when the status of a survey in a source has changed or when " -"the code has changed and the source must be adapted." -msgstr "" -"Run this code when the status of a survey in a source has changed or when " -"the code has changed and the source must be adapted." +msgid "Run this code when the status of a survey in a source has changed or when the code has changed and the source must be adapted." +msgstr "Run this code when the status of a survey in a source has changed or when the code has changed and the source must be adapted." #: classes/Gems/Default/SourceAction.php:140 #, php-format @@ -2434,12 +2084,8 @@ msgstr "Refreshes the attributes for a token as stored in the source." #: classes/Gems/Default/SourceAction.php:146 -msgid "" -"Run this code when the number of attributes has changed or when you suspect " -"the attributes have been corrupted somehow." -msgstr "" -"Run this code when the number of attributes has changed or when you suspect " -"the attributes have been corrupted somehow." +msgid "Run this code when the number of attributes has changed or when you suspect the attributes have been corrupted somehow." +msgstr "Run this code when the number of attributes has changed or when you suspect the attributes have been corrupted somehow." #: classes/Gems/Default/SourceAction.php:159 #, php-format @@ -2493,7 +2139,6 @@ msgstr[1] "sources" #: classes/Gems/Default/SourceAction.php:249 -#: classes/Gems/Menu/MenuAbstract.php:436 msgid "Survey Sources" msgstr "Survey Sources" @@ -2536,15 +2181,10 @@ #: classes/Gems/Default/StaffAction.php:268 #, php-format -msgid "" -"User with id %s already exists but is deleted, do you want to reactivate the " -"account?" -msgstr "" -"User with id %s already exists but is deleted, do you want to reactivate the " -"account?" +msgid "User with id %s already exists but is deleted, do you want to reactivate the account?" +msgstr "User with id %s already exists but is deleted, do you want to reactivate the account?" -#: classes/Gems/Default/StaffAction.php:327 classes/Gems/User/User.php:1181 -#: classes/Gems/User/Form/OrganizationFormAbstract.php:232 +#: classes/Gems/Default/StaffAction.php:327 msgid "Username" msgstr "Username" @@ -2576,7 +2216,6 @@ msgstr "You are not allowed to change this password." #: classes/Gems/Default/SurveyAction.php:64 -#: classes/Gems/Tracker/Snippets/EditSingleSurveyTokenSnippetAbstract.php:179 msgid "Add survey" msgstr "Add survey" @@ -2613,15 +2252,10 @@ msgstr "Assignments of this survey to %s" #: classes/Gems/Default/SurveyAction.php:165 -#: snippets/DeleteSingleSurveyInSourceTokenSnippet.php:173 -#: snippets/DeleteSingleSurveyNotUsedTokenSnippet.php:144 -#: snippets/EditSingleSurveyTokenSnippet.php:133 -#: snippets/ShowSingleSurveyTokenSnippet.php:139 msgid "Show surveys" msgstr "Show surveys" #: classes/Gems/Default/SurveyAction.php:212 -#: snippets/RespondentDetailsWithAssignmentsSnippet.php:77 msgid "Assigned surveys" msgstr "Assigned surveys" @@ -2658,12 +2292,8 @@ msgstr "Create Single Survey" #: classes/Gems/Default/SurveyMaintenanceAction.php:211 -msgid "" -"At the moment this survey can only be assigned to respondents as part ... [truncated message content] |
From: <gem...@li...> - 2012-09-21 16:42:28
|
Revision: 952 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=952&view=rev Author: matijsdejong Date: 2012-09-21 16:42:22 +0000 (Fri, 21 Sep 2012) Log Message: ----------- Fix for pulse bugs #556 and #551: user cannot be changed when in an inactive group Modified Paths: -------------- trunk/library/classes/Gems/Default/StaffAction.php trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php trunk/library/classes/Gems/User/User.php Modified: trunk/library/classes/Gems/Default/StaffAction.php =================================================================== --- trunk/library/classes/Gems/Default/StaffAction.php 2012-09-21 08:20:22 UTC (rev 951) +++ trunk/library/classes/Gems/Default/StaffAction.php 2012-09-21 16:42:22 UTC (rev 952) @@ -392,7 +392,7 @@ } } - return parent::getAfterSaveRoute($data, $isNew); + return parent::getAfterSaveRoute($data); } protected function getAutoSearchElements(MUtil_Model_ModelAbstract $model, array $data) Modified: trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php =================================================================== --- trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php 2012-09-21 08:20:22 UTC (rev 951) +++ trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php 2012-09-21 16:42:22 UTC (rev 952) @@ -102,6 +102,7 @@ // MUtil_Echo::track($name, $model->get($name, 'thClass'), $model->get($name, 'label')); } } + // MUtil_Echo::track($names); return $names; } Modified: trunk/library/classes/Gems/User/User.php =================================================================== --- trunk/library/classes/Gems/User/User.php 2012-09-21 08:20:22 UTC (rev 951) +++ trunk/library/classes/Gems/User/User.php 2012-09-21 16:42:22 UTC (rev 952) @@ -990,10 +990,25 @@ */ public function hasAllowedRole() { - if ($allowedGroups = $this->util->getDbLookup()->getAllowedStaffGroups()) { - return isset($allowedGroups[$this->getGroup()]) ? 1 : 0; + if (! $this->isStaff()) { + // Always allow editing of non-staff user + // for the time being + return true; + } + + $dbLookup = $this->util->getDbLookup(); + $groups = $dbLookup->getActiveStaffGroups(); + $group = $this->getGroup(); + + if (! isset($groups[$group])) { + // Allow editing when the group does not exist or is no longer active. + return true; + } + + if ($allowedGroups = $dbLookup->getAllowedStaffGroups()) { + return (boolean) isset($allowedGroups[$this->getGroup()]); } else { - return 0; + return false; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-21 08:20:33
|
Revision: 951 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=951&view=rev Author: mennodekker Date: 2012-09-21 08:20:22 +0000 (Fri, 21 Sep 2012) Log Message: ----------- Used create-lite script for tokenTest Modified Paths: -------------- trunk/test/classes/Gems/Test/DbTestAbstract.php trunk/test/classes/Gems/Tracker/TokenTest.php trunk/test/data/sqllite/create-lite.sql Removed Paths: ------------- trunk/test/data/gems__consents.sql trunk/test/data/gems__reception_codes.sql trunk/test/data/gems__respondent2org.sql trunk/test/data/gems__respondents.sql trunk/test/data/gems__tokens.sql Modified: trunk/test/classes/Gems/Test/DbTestAbstract.php =================================================================== --- trunk/test/classes/Gems/Test/DbTestAbstract.php 2012-09-21 07:54:32 UTC (rev 950) +++ trunk/test/classes/Gems/Test/DbTestAbstract.php 2012-09-21 08:20:22 UTC (rev 951) @@ -95,7 +95,12 @@ if ($sqlFiles = $this->getInitSql()) { foreach ($sqlFiles as $file) { $sql = file_get_contents($file); - $stmt = $connection->query($sql); + $statements = explode(';', $sql); + foreach($statements as $sql) { + if (!strpos(strtoupper($sql), 'INSERT INTO') && !strpos(strtoupper($sql), 'INSERT IGNORE')) { + $stmt = $connection->query($sql); + } + } } } $this->_connectionMock = $this->createZendDbConnection( @@ -107,8 +112,11 @@ return $this->_connectionMock; } - /** - * Return an array of files to run on init - */ - abstract protected function getInitSql(); + protected function getInitSql() + { + $path = GEMS_WEB_DIR . '/data/'; + + // For successful testing of the complete tokens class, we need more tables + return array($path . 'sqllite/create-lite.sql'); + } } \ No newline at end of file Modified: trunk/test/classes/Gems/Tracker/TokenTest.php =================================================================== --- trunk/test/classes/Gems/Tracker/TokenTest.php 2012-09-21 07:54:32 UTC (rev 950) +++ trunk/test/classes/Gems/Tracker/TokenTest.php 2012-09-21 08:20:22 UTC (rev 951) @@ -81,20 +81,6 @@ parent::tearDown(); } - protected function getInitSql() - { - $path = GEMS_WEB_DIR . '/data/'; - - // For successful testing of the complete tokens class, we need more tables - return array( - $path . 'gems__tokens.sql', - $path . 'gems__reception_codes.sql', - $path . 'gems__respondents.sql', - $path . 'gems__respondent2org.sql', - $path . 'gems__consents.sql' - ); - } - /** * Returns the test dataset. * Deleted: trunk/test/data/gems__consents.sql =================================================================== --- trunk/test/data/gems__consents.sql 2012-09-21 07:54:32 UTC (rev 950) +++ trunk/test/data/gems__consents.sql 2012-09-21 08:20:22 UTC (rev 951) @@ -1,12 +0,0 @@ -CREATE TABLE gems__consents ( - gco_description varchar(20) not null, - gco_order smallint not null default 10, - gco_code varchar(20) not null default 'do not use', - - gco_changed timestamp not null default current_timestamp, - gco_changed_by bigint unsigned not null, - gco_created timestamp not null, - gco_created_by bigint unsigned not null, - - PRIMARY KEY (gco_description) - ); \ No newline at end of file Deleted: trunk/test/data/gems__reception_codes.sql =================================================================== --- trunk/test/data/gems__reception_codes.sql 2012-09-21 07:54:32 UTC (rev 950) +++ trunk/test/data/gems__reception_codes.sql 2012-09-21 08:20:22 UTC (rev 951) @@ -1,20 +0,0 @@ -CREATE TABLE gems__reception_codes ( - grc_id_reception_code varchar(20) not null, - grc_description varchar(40) not null, - - grc_success boolean not null default 0, - - grc_for_surveys tinyint not null default 0, - grc_redo_survey tinyint not null default 0, - grc_for_tracks boolean not null default 0, - grc_for_respondents boolean not null default 0, - grc_overwrite_answers boolean not null default 0, - grc_active boolean not null default 1, - - grc_changed timestamp not null default current_timestamp, - grc_changed_by bigint unsigned not null, - grc_created timestamp not null, - grc_created_by bigint unsigned not null, - - PRIMARY KEY (grc_id_reception_code) - ); \ No newline at end of file Deleted: trunk/test/data/gems__respondent2org.sql =================================================================== --- trunk/test/data/gems__respondent2org.sql 2012-09-21 07:54:32 UTC (rev 950) +++ trunk/test/data/gems__respondent2org.sql 2012-09-21 08:20:22 UTC (rev 951) @@ -1,22 +0,0 @@ -CREATE TABLE gems__respondent2org ( - gr2o_patient_nr varchar(7) not null, - gr2o_id_organization bigint unsigned not null - references gems__organizations (gor_id_organization), - - gr2o_id_user bigint unsigned not null - references gems__respondents (grs_id_user), - - gr2o_consent varchar(20) not null default 'Unknown' - references gems__consents (gco_description), - gr2o_reception_code varchar(20) default 'OK' not null - references gems__reception_codes (grc_id_reception_code), - - gr2o_opened timestamp not null default current_timestamp, - gr2o_opened_by bigint unsigned not null, - gr2o_changed timestamp not null, - gr2o_changed_by bigint unsigned not null, - gr2o_created timestamp not null, - gr2o_created_by bigint unsigned not null, - - PRIMARY KEY (gr2o_patient_nr, gr2o_id_organization) - ); \ No newline at end of file Deleted: trunk/test/data/gems__respondents.sql =================================================================== --- trunk/test/data/gems__respondents.sql 2012-09-21 07:54:32 UTC (rev 950) +++ trunk/test/data/gems__respondents.sql 2012-09-21 08:20:22 UTC (rev 951) @@ -1,31 +0,0 @@ -CREATE TABLE gems__respondents ( - grs_id_user bigint unsigned not null, - - grs_ssn varchar(32) - null unique, - - grs_iso_lang char(2) not null default 'en', - - grs_email varchar(100) null, - - grs_first_name varchar(30) , - grs_surname_prefix varchar(10) , - grs_last_name varchar(50) , - grs_gender char(1) - not null default 'U', - grs_birthday date, - - grs_address_1 varchar(80) , - grs_address_2 varchar(80) , - grs_zipcode varchar(10) , - grs_city varchar(40) , - grs_iso_country char(2) not null default 'NL', - grs_phone_1 varchar(25) , - - grs_changed timestamp not null default current_timestamp, - grs_changed_by bigint unsigned not null, - grs_created timestamp not null, - grs_created_by bigint unsigned not null, - - PRIMARY KEY(grs_id_user) - ); \ No newline at end of file Deleted: trunk/test/data/gems__tokens.sql =================================================================== --- trunk/test/data/gems__tokens.sql 2012-09-21 07:54:32 UTC (rev 950) +++ trunk/test/data/gems__tokens.sql 2012-09-21 08:20:22 UTC (rev 951) @@ -1,45 +0,0 @@ -CREATE TABLE gems__tokens ( - gto_id_token varchar(9) not null, - - gto_id_respondent_track bigint not null, - gto_id_round bigint not null, - - -- non-changing fields calculated from previous two: - gto_id_respondent bigint not null, - gto_id_organization bigint not null, - gto_id_track bigint not null, - - -- values initially filled from gems__rounds, but that may get different values later on - gto_id_survey bigint, - - -- values initially filled from gems__rounds, but that might get different values later on, but but not now - gto_round_order int not null default 10, - gto_round_description varchar(100) null, - - -- real data - gto_valid_from datetime, - gto_valid_until datetime, - gto_mail_sent_date date, - gto_mail_sent_num int(11) not null default 0, - gto_next_mail_date date, - - gto_start_time datetime, - gto_in_source boolean not null default 0, - gto_by bigint(20) NULL, - - gto_completion_time datetime, - gto_duration_in_sec bigint(20) NULL, - gto_result varchar(20) , - - gto_comment varchar(250) null default null, - gto_reception_code varchar(20) default 'OK' not null, - - gto_return_url varchar(250) null default null, - - gto_changed timestamp not null default current_timestamp, - gto_changed_by bigint not null, - gto_created timestamp not null, - gto_created_by bigint not null, - - PRIMARY KEY (gto_id_token) - ); \ No newline at end of file Modified: trunk/test/data/sqllite/create-lite.sql =================================================================== --- trunk/test/data/sqllite/create-lite.sql 2012-09-21 07:54:32 UTC (rev 950) +++ trunk/test/data/sqllite/create-lite.sql 2012-09-21 08:20:22 UTC (rev 951) @@ -14,44 +14,44 @@ ; -INSERT INTO gems__consents - (gco_description, gco_order, gco_code, gco_changed, gco_changed_by, gco_created, gco_created_by) +INSERT INTO gems__consents + (gco_description, gco_order, gco_code, gco_changed, gco_changed_by, gco_created, gco_created_by) VALUES ('Yes', 10, 'consent given', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), ('No', 20, 'do not use', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), ('Unknown', 30, 'do not use', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1); CREATE TABLE gems__groups ( - ggp_id_group bigint not null AUTOINCREMENT, + ggp_id_group bigint not null , ggp_name varchar(30) not null, ggp_description varchar(50) not null, - + ggp_role varchar(150) not null default 'respondent', -- The ggp_role value(s) determines someones roles as not null default 1, ggp_staff_members TINYINT(1) not null default 0, ggp_respondent_members TINYINT(1) not null default 1, ggp_allowed_ip_ranges text, - + ggp_changed TEXT not null default current_timestamp, ggp_changed_by bigint not null, ggp_created TEXT not null, ggp_created_by bigint not null, - + PRIMARY KEY(ggp_id_group) ) ; -- Default group -INSERT ignore INTO gems__groups +INSERT ignore INTO gems__groups (ggp_id_group, ggp_name, ggp_description, ggp_role, ggp_group_active, ggp_staff_members, ggp_respondent_members, ggp_changed_by, ggp_created, ggp_created_by) - VALUES + VALUES (800, 'Super Administrators', 'Super administrators with access to the whole site', 'super', 1, 1, 0, 0, current_timestamp, 0); -- ggp_group_rights = '*' gives access to all pages. CREATE TABLE gems__log_respondent_communications ( - grco_id_action bigint not null AUTOINCREMENT, + grco_id_action bigint not null , grco_id_to bigint not null, grco_id_by bigint default 0, @@ -78,7 +78,7 @@ CREATE TABLE gems__mail_jobs ( - gmj_id_job bigint not null AUTOINCREMENT, + gmj_id_job bigint not null , gmj_id_message bigint not null, @@ -137,7 +137,7 @@ CREATE TABLE gems__mail_templates ( - gmt_id_message bigint not null AUTOINCREMENT, + gmt_id_message bigint not null , gmt_subject varchar(100) not null, gmt_body text not null, @@ -173,7 +173,7 @@ {organization_signature}', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1); CREATE TABLE gems__organizations ( - gor_id_organization bigint not null AUTOINCREMENT, + gor_id_organization bigint not null , gor_name varchar(50) not null, gor_code varchar(20), @@ -206,8 +206,7 @@ gor_created TEXT not null, gor_created_by bigint not null, - PRIMARY KEY(gor_id_organization), - KEY (gor_code) + PRIMARY KEY(gor_id_organization) ) ; @@ -216,7 +215,7 @@ (70, 'New organization', CURRENT_TIMESTAMP, 0, CURRENT_TIMESTAMP, 0); CREATE TABLE gems__patches ( - gpa_id_patch int not null AUTOINCREMENT, + gpa_id_patch int not null , gpa_level int not null default 0, gpa_location varchar(100) not null, @@ -225,14 +224,14 @@ gpa_sql text not null, - gpa_executed TINYINT(1) not null default 0, - gpa_completed TINYINT(1) not null default 0, + gpa_executed TINYINT(1) not null default 0, + gpa_completed TINYINT(1) not null default 0, gpa_result varchar(255), gpa_changed TEXT not null default current_timestamp, gpa_created TEXT, - + PRIMARY KEY (gpa_id_patch), UNIQUE (gpa_level, gpa_location, gpa_name, gpa_order) ) @@ -253,7 +252,7 @@ (48, CURRENT_TIMESTAMP); CREATE TABLE gems__radius_config ( - grcfg_id bigint(11) NOT NULL AUTOINCREMENT, + grcfg_id bigint(11) NOT NULL , grcfg_id_organization bigint(11) NOT NULL, grcfg_ip varchar(39), grcfg_port int(5), @@ -315,13 +314,13 @@ gr2o_created_by bigint not null, PRIMARY KEY (gr2o_patient_nr, gr2o_id_organization), - UNIQUE (gr2o_id_user, gr2o_id_organization) + UNIQUE (gr2o_id_user, gr2o_id_organization) ) ; CREATE TABLE gems__respondent2track ( - gr2t_id_respondent_track bigint not null AUTOINCREMENT, + gr2t_id_respondent_track bigint not null , gr2t_id_user bigint not null, gr2t_id_track int not null, @@ -366,7 +365,7 @@ CREATE TABLE gems__respondents ( - grs_id_user bigint not null AUTOINCREMENT, + grs_id_user bigint not null, -- grs_login varchar(20) -- unique, -- grs_password varchar(64) not null, @@ -428,7 +427,7 @@ CREATE TABLE gems__roles ( - grl_id_role bigint not null AUTOINCREMENT, + grl_id_role bigint not null , grl_name varchar(30) not null, grl_description varchar(50) not null, @@ -462,7 +461,7 @@ ('super','super','pr.consent.delete,pr.country,pr.country.create,pr.country.delete,pr.country.edit,pr.database,pr.database.create,pr.database.delete,pr.database.edit,pr.database.execute,pr.database.patches,pr.group.create,pr.group.edit,pr.language,pr.mail.server,pr.mail.server.create,pr.mail.server.delete,pr.mail.server.edit,pr.organization.create,pr.organization.edit,pr.plan.choose-org,pr.plan.mail-as-application,pr.reception.delete,pr.respondent.multiorg,pr.role.create,pr.role.edit,pr.source.create,pr.source.edit,pr.source.synchronize,pr.source.synchronize-all,pr.staff.edit.all,pr.survey-maintenance.edit,pr.track-maintenance.create,pr.track-maintenance.edit,pr.maintenance','admin', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1); CREATE TABLE gems__rounds ( - gro_id_round bigint not null AUTOINCREMENT, + gro_id_round bigint not null , gro_id_track bigint not null, gro_id_order int not null default 10, @@ -622,7 +621,7 @@ ORDER BY r1.gro_id_round; CREATE TABLE "gems__sources" ( - "gso_id_source" int(10) NOT NULL AUTOINCREMENT, + "gso_id_source" int(10) NOT NULL , "gso_source_name" varchar(40) NOT NULL, "gso_ls_url" varchar(255) NOT NULL, @@ -633,7 +632,7 @@ "gso_ls_table_prefix" varchar(127), "gso_ls_username" varchar(64), "gso_ls_password" varchar(255), - "gso_ls_varchar(8), + "gso_ls_charset" varchar(8), "gso_active" tinyint(1) NOT NULL default '1', @@ -702,8 +701,7 @@ PRIMARY KEY (gsf_id_user), UNIQUE (gsf_login, gsf_id_organization), - UNIQUE (gsf_reset_key), - KEY (gsf_email) + UNIQUE (gsf_reset_key) ) ; @@ -726,7 +724,7 @@ CREATE TABLE gems__surveys ( - gsu_id_survey int not null AUTOINCREMENT, + gsu_id_survey int not null , gsu_survey_name varchar(100) not null, gsu_survey_description varchar(100) , @@ -824,7 +822,7 @@ CREATE TABLE gems__token_attempts ( - gta_id_attempt bigint not null AUTOINCREMENT, + gta_id_attempt bigint not null , gta_id_token varchar(9) not null, gta_ip_address varchar(64) not null, gta_datetime TEXT not null default current_timestamp, @@ -835,7 +833,7 @@ CREATE TABLE gems__tracks ( - gtr_id_track int not null AUTOINCREMENT, + gtr_id_track int not null , gtr_track_name varchar(40) not null unique, gtr_track_info varchar(250) , @@ -868,7 +866,7 @@ CREATE TABLE gems__track_fields ( - gtf_id_field bigint not null AUTOINCREMENT, + gtf_id_field bigint not null , gtf_id_track int not null, gtf_id_order int not null default 10, @@ -908,7 +906,7 @@ -- Table containing the users that are allowed to login -- CREATE TABLE gems__user_logins ( - gul_id_user bigint not null AUTOINCREMENT, + gul_id_user bigint not null , gul_login varchar(30) not null, gul_id_organization bigint not null, @@ -926,22 +924,8 @@ ) ; -/* --- Code to restore login codes after failed update. You just never know when we might need it again. -UPDATE gems__user_logins - THEN - CASE - WHEN EXISTS(SELECT gup_id_user FROM gems__user_passwords WHERE gup_id_user = gul_id_user) THEN 'StaffUser' - ELSE 'OldStaffUser' - END - WHEN EXISTS(SELECT gr2o_id_user FROM gems__respondent2org WHERE gr2o_patient_nr = gul_login AND gr2o_id_organization = gul_id_organization) THEN 'RespondentUser' - ELSE 'NoLogin' - END - WHERE gul_user_class = 'StaffUser'; - -*/ --- Table for keeping track of fail;ed login attempts +-- Table for keeping track of failed login attempts -- CREATE TABLE gems__user_login_attempts ( gula_login varchar(30) not null, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-21 07:54:42
|
Revision: 950 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=950&view=rev Author: mennodekker Date: 2012-09-21 07:54:32 +0000 (Fri, 21 Sep 2012) Log Message: ----------- Fixes for sql-lite script generator: charset is also a fieldname, key and autoincrement are not allowed Fix for ; in gems__user_login_attempts table description Modified Paths: -------------- trunk/library/configs/db/tables/gems__user_login_attempts.10.sql trunk/scripts/build.xml Modified: trunk/library/configs/db/tables/gems__user_login_attempts.10.sql =================================================================== --- trunk/library/configs/db/tables/gems__user_login_attempts.10.sql 2012-09-20 13:42:35 UTC (rev 949) +++ trunk/library/configs/db/tables/gems__user_login_attempts.10.sql 2012-09-21 07:54:32 UTC (rev 950) @@ -1,5 +1,5 @@ --- Table for keeping track of fail;ed login attempts +-- Table for keeping track of failed login attempts -- CREATE TABLE if not exists gems__user_login_attempts ( gula_login varchar(30) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null, Modified: trunk/scripts/build.xml =================================================================== --- trunk/scripts/build.xml 2012-09-20 13:42:35 UTC (rev 949) +++ trunk/scripts/build.xml 2012-09-21 07:54:32 UTC (rev 950) @@ -53,15 +53,18 @@ <regexp pattern="CREATE\s+TABLE\s+if\s+not\s+exists\s+" replace="CREATE TABLE " ignoreCase="true"/> <regexp pattern="AUTO_INCREMENT\s*=\s*\d+\s*" replace="" ignoreCase="true"/> <regexp pattern="AUTO_INCREMENT" replace="AUTOINCREMENT" ignoreCase="true"/> + <regexp pattern="AUTOINCREMENT" replace="" ignoreCase="true"/> <regexp pattern="(\sUNIQUE)\s+KEY(\s+|,|\()" replace="\1\2" ignoreCase="true"/> <regexp pattern="(\sUNIQUE\s)\s*[^\s(]+\s+\(" replace="\1(" ignoreCase="true"/> <regexp pattern=",\s*INDEX\s*\([^)]+\)" replace="" ignoreCase="true"/> + <regexp pattern=",\s*[^PRIMARY]\sKEY\s*\([^)]+\)" replace="" multiline="true" ignoreCase="true"/> + <regexp pattern="/\*.*\*/" replace="" multiline="true" ignoreCase="true"/> <regexp pattern="(\s)BOOLEAN(\s)" replace="\1TINYINT(1)\2" ignoreCase="true"/> <regexp pattern="ENGINE=[^\s,;]+\s*" replace="" ignoreCase="true"/> <regexp pattern="DEFAULT\s+CHARACTER\s+SET\s*" replace="CHARACTER SET " ignoreCase="true"/> <regexp pattern="DEFAULT\s+CHARSET\s*" replace="CHARACTER SET " ignoreCase="true"/> <regexp pattern="CHARACTER\s+SET\s*[^\s,;]+\s*" replace="" ignoreCase="true"/> - <regexp pattern="CHARSET\s*[^\s,;]+\s*" replace="" ignoreCase="true"/> + <regexp pattern="CHARSET\s+[^\s,;]+\s*" replace="" ignoreCase="true"/> <regexp pattern="COLLATE\s*[^\s,;]+\s*" replace="" ignoreCase="true"/> <regexp pattern="ENUM\s[^)]+\)\s*" replace="" ignoreCase="true"/> <regexp pattern="SET\s[^)]+\)\s*" replace="" ignoreCase="true"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-20 13:42:45
|
Revision: 949 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=949&view=rev Author: mennodekker Date: 2012-09-20 13:42:35 +0000 (Thu, 20 Sep 2012) Log Message: ----------- Fixed notice missing gr2o_id_organization in respondent-plan Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentPlanAction.php Modified: trunk/library/classes/Gems/Default/RespondentPlanAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentPlanAction.php 2012-09-20 09:52:05 UTC (rev 948) +++ trunk/library/classes/Gems/Default/RespondentPlanAction.php 2012-09-20 13:42:35 UTC (rev 949) @@ -58,8 +58,8 @@ { $bridge->gtr_track_type; // Data needed for edit button $bridge->gr2t_id_respondent_track; // Data needed for edit button + $bridge->gr2o_id_organization; // Data needed for edit button - $HTML = MUtil_Html::create(); // Get the buttons This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-20 09:52:12
|
Revision: 948 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=948&view=rev Author: mennodekker Date: 2012-09-20 09:52:05 +0000 (Thu, 20 Sep 2012) Log Message: ----------- Fixed notice on user edit Removed no longer functional micro-optimization from formbridge Modified Paths: -------------- trunk/library/classes/Gems/User/User.php trunk/library/classes/MUtil/Model/FormBridge.php Modified: trunk/library/classes/Gems/User/User.php =================================================================== --- trunk/library/classes/Gems/User/User.php 2012-09-20 09:18:22 UTC (rev 947) +++ trunk/library/classes/Gems/User/User.php 2012-09-20 09:52:05 UTC (rev 948) @@ -229,7 +229,9 @@ if ($store instanceof Zend_Session_Namespace) { $store->__unset($name); } else { - $store->offsetUnset($name, $value); + if ($store->offsetExists($name)) { + $store->offsetUnset($name); + } } } Modified: trunk/library/classes/MUtil/Model/FormBridge.php =================================================================== --- trunk/library/classes/MUtil/Model/FormBridge.php 2012-09-20 09:18:22 UTC (rev 947) +++ trunk/library/classes/MUtil/Model/FormBridge.php 2012-09-20 09:52:05 UTC (rev 948) @@ -252,9 +252,8 @@ } $options = array_intersect_key($options, $allowedOptionsFlipped); - // Now get all options from the model, and extract only the allowed ones - $modelOptions = $this->model->get($name); - $modelOptions = array_intersect_key($modelOptions, $allowedOptionsFlipped); + // Now get allowed options from the model + $modelOptions = $this->model->get($name, $allowedOptions); // Merge them: first use supplied $options, and add missing values from model return (array) $options + (array) $modelOptions; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-20 09:18:32
|
Revision: 947 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=947&view=rev Author: mennodekker Date: 2012-09-20 09:18:22 +0000 (Thu, 20 Sep 2012) Log Message: ----------- Micro-optimization: rise only once Modified Paths: -------------- trunk/library/classes/MUtil/Model/ModelAbstract.php Modified: trunk/library/classes/MUtil/Model/ModelAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/ModelAbstract.php 2012-09-19 13:08:21 UTC (rev 946) +++ trunk/library/classes/MUtil/Model/ModelAbstract.php 2012-09-20 09:18:22 UTC (rev 947) @@ -463,12 +463,11 @@ switch (count($args)) { case 0: if (isset($this->_model[$name])) { + $result = MUtil_Lazy::rise($this->_model[$name]); if ($alias = $this->getAlias($name)) { - $result = $this->_model[$name] + $this->get($alias); - } else { - $result = $this->_model[$name]; + $result = $result + $this->get($alias); } - return MUtil_Lazy::rise($result); + return $result; } else { return array(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-19 13:08:27
|
Revision: 946 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=946&view=rev Author: mennodekker Date: 2012-09-19 13:08:21 +0000 (Wed, 19 Sep 2012) Log Message: ----------- Allow export to work with new display event Modified Paths: -------------- trunk/library/classes/Gems/Export/RespondentExport.php trunk/library/snippets/TrackAnswersModelSnippet.php Modified: trunk/library/classes/Gems/Export/RespondentExport.php =================================================================== --- trunk/library/classes/Gems/Export/RespondentExport.php 2012-09-19 12:02:57 UTC (rev 945) +++ trunk/library/classes/Gems/Export/RespondentExport.php 2012-09-19 13:08:21 UTC (rev 946) @@ -47,16 +47,13 @@ protected $_reportHeader = 'Export_ReportHeaderSnippet'; protected $_respondentSnippet = 'Export_RespondentSnippet'; - protected $_groupedSurveySnippet = 'TrackAnswersModelSnippet'; - protected $_singleSurveySnippet = 'AnswerModelSnippet'; - /** * * @var GemsEscort */ public $escort; - private $html; + protected $html; /** * @@ -169,22 +166,42 @@ continue; } + $showToken = false; if ($engine->getTrackType() == 'S' || !$groupSurveys) { - $this->html->snippet('Export_SurveyHeaderSnippet', 'token', $token); - $this->html->snippet($this->_singleSurveySnippet, 'token', $token, 'tokenId', $token->getTokenId(), - 'showHeaders', false, 'showButtons', false, 'showSelected', false, 'showTakeButton', false); - - $this->html->br(); + // For single survey tracks or when $groupSurvey === false we show all tokens + $showToken = true; } else { + // For multi survey tracks and $groupSurveys === true, we show only the first token + // as the snippet takes care of showing the other tokens if (!isset($surveys[$token->getSurveyId()])) { - $surveys[$token->getSurveyId()] = true; + $showToken = true; + } + } - $this->html->snippet('Export_SurveyHeaderSnippet', 'token', $token); - $this->html->snippet($this->_groupedSurveySnippet, 'token', $token, 'tokenId', $token->getTokenId(), - 'showHeaders', false, 'showButtons', false, 'showSelected', false, 'showTakeButton', false); + if ($showToken) { + $params = array( + 'token' => $token, + 'tokenId' => $token->getTokenId(), + 'showHeaders' => false, + 'showButtons' => false, + 'showSelected' => false, + 'showTakeButton' => false, + 'grouped' => $groupSurveys); + + $snippets = $token->getAnswerSnippetNames(); + + if (is_array($snippets)) { + list($snippets, $snippetParams) = MUtil_Ra::keySplit($snippets); + $params = $params + $snippetParams; + } + + $this->html->snippet('Export_SurveyHeaderSnippet', 'token', $token); + + foreach($snippets as $snippet) { + $this->html->snippet($snippet, $params); + } - $this->html->br(); - } + $this->html->br(); } $token = $token->getNextToken(); Modified: trunk/library/snippets/TrackAnswersModelSnippet.php =================================================================== --- trunk/library/snippets/TrackAnswersModelSnippet.php 2012-09-19 12:02:57 UTC (rev 945) +++ trunk/library/snippets/TrackAnswersModelSnippet.php 2012-09-19 13:08:21 UTC (rev 946) @@ -48,6 +48,14 @@ class TrackAnswersModelSnippet extends Gems_Tracker_Snippets_AnswerModelSnippetGeneric { /** + * Use compact view and show all tokens of the same surveyId in + * one view. Property used by respondent export + * + * @var boolean + */ + public $grouped = true; + + /** * Overrule to implement snippet specific filtering and sorting. * * @param MUtil_Model_ModelAbstract $model @@ -57,8 +65,12 @@ if ($this->request) { $this->processSortOnly($model); - $filter['gto_id_respondent_track'] = $this->token->getRespondentTrackId(); - $filter['gto_id_survey'] = $this->token->getSurveyId(); + if ($this->grouped) { + $filter['gto_id_respondent_track'] = $this->token->getRespondentTrackId(); + $filter['gto_id_survey'] = $this->token->getSurveyId(); + } else { + $filter['gto_id_token'] = $this->token->getTokenId(); + } $model->setFilter($filter); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-19 12:03:08
|
Revision: 945 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=945&view=rev Author: mennodekker Date: 2012-09-19 12:02:57 +0000 (Wed, 19 Sep 2012) Log Message: ----------- Undid changes to Gems_Snippets_SnippetLoader from revision #939 Revision Links: -------------- http://gemstracker.svn.sourceforge.net/gemstracker/?rev=939&view=rev Modified Paths: -------------- trunk/library/classes/Gems/Snippets/SnippetLoader.php Modified: trunk/library/classes/Gems/Snippets/SnippetLoader.php =================================================================== --- trunk/library/classes/Gems/Snippets/SnippetLoader.php 2012-09-18 17:14:15 UTC (rev 944) +++ trunk/library/classes/Gems/Snippets/SnippetLoader.php 2012-09-19 12:02:57 UTC (rev 945) @@ -2,7 +2,7 @@ /** * Copyright (c) 2011, Erasmus MC * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -13,7 +13,7 @@ * * Neither the name of Erasmus MC nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -24,7 +24,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * Gems specific version of the snippet loader * * @package Gems @@ -47,21 +47,120 @@ * @license New BSD License * @since Class available since version 1.5.5 */ -class Gems_Snippets_SnippetLoader extends MUtil_Snippets_SnippetLoader +class Gems_Snippets_SnippetLoader extends Gems_Loader_TargetLoaderAbstract implements MUtil_Snippets_SnippetLoaderInterface { + protected $cascade = 'Snippets'; + + protected $loader; + /** - * Sets the source of variables and the first directory for snippets + * @var MUtil_Snippets_SnippetLoader + */ + protected $backup; + + /** + * Initialize the snippetloader (Gems style) * - * @param mixed $source Something that is or can be made into MUtil_Registry_SourceInterface, otheriwse Zend_Registry is used. + * @param mixed $container A container acting as source for MUtil_Registry_Source + * @param array $dirs The directories where to look for requested classes */ - public function __construct($source = null) + public function __construct($container = null, $dirs = array()) { + parent::__construct($container, $dirs); + $this->backup = new MUtil_Snippets_SnippetLoader($this); + $this->addDirectory(GEMS_LIBRARY_DIR . '/classes/MUtil/Snippets/Standard'); + } + + + /** + * Add a directory to the front of the list of places where snippets are loaded from. + * + * @param string $dir + * @return MUtil_Snippets_SnippetLoader + */ + public function addDirectory($dir) { - global $GEMS_DIRS; + if (!array_key_exists('', $this->_dirs)) { + $this->_dirs[''] = array(); + } + array_unshift($this->_dirs[''], $dir); - parent::__construct($source); + return $this->backup->addDirectory($dir); + } - foreach ($GEMS_DIRS as $key => $path) { - $this->addDirectory($path . '/' . $key); + /** + * Add parameter values to the source for snippets. + * + * @param mixed $container_or_pairs This function can be called with either a single container or a list of name/value pairs. + * @return MUtil_Snippets_SnippetLoader + */ + public function addSource($container_or_pairs) + { + return $this->backup->addSource($container_or_pairs); + } + + /** + * Returns the directories where snippets are loaded from. + * + * @param array $dirs + * @return array + */ + public function getDirectories() + { + return $this->backup->getDirectories(); + } + + /** + * Searches and loads a .php snippet file. + * + * @param string $filename The name of the snippet + * @param array $extraSourceParameters name/value pairs to add to the source for this snippet + * @return MUtil_Snippets_SnippetInterface The snippet + */ + public function getSnippet($filename, array $extraSourceParameters = null) + { + try { + $this->addRegistryContainer($extraSourceParameters, 'tmpContainer'); + $snippet = $this->_loadClass($filename, true); + $this->removeRegistryContainer('tmpContainer'); + } catch (Exception $exc) { + MUtil_Echo::track($exc->getMessage()); + throw $exc; + //Class loading failed, now defer + //$snippet = $this->backup->getSnippet($filename, $extraSourceParameters); } + + return $snippet; } + + /** + * Returns a source of values for snippets. + * + * @return MUtil_Registry_SourceInterface + */ + public function getSource() + { + return $this->backup->getSource(); + } + + /** + * Set the directories where snippets are loaded from. + * + * @param array $dirs + * @return MUtil_Snippets_SnippetLoader (continuation pattern) + */ + public function setDirectories(array $dirs) + { + return $this->backup->setDirectories($dirs); + } + + /** + * Sets the source of variables for snippets + * + * @param MUtil_Registry_SourceInterface $source + * @return MUtil_Snippets_SnippetLoader (continuation pattern) + */ + public function setSource(MUtil_Registry_SourceInterface $source) + { + return $this->backup->setSource($source); + } } \ 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-09-18 17:14:21
|
Revision: 944 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=944&view=rev Author: matijsdejong Date: 2012-09-18 17:14:15 +0000 (Tue, 18 Sep 2012) Log Message: ----------- Fix in ModelFormSnippetAbstract.php where menu item was not found so reroute went to index, not show Extra cache clean for new organizations Modified Paths: -------------- trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php trunk/library/classes/Gems/User/User.php Modified: trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php =================================================================== --- trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php 2012-09-18 15:19:39 UTC (rev 943) +++ trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php 2012-09-18 17:14:15 UTC (rev 944) @@ -217,8 +217,12 @@ $this->afterSaveRouteUrl['controller'] = $this->request->getControllerName(); } + // Search array for menu item + $find['controller'] = $this->afterSaveRouteUrl['controller']; + $find['action'] = $this->afterSaveRouteUrl['action']; + // If not allowed, redirect to index - if (null == $this->menu->find($this->afterSaveRouteUrl)) { + if (null == $this->menu->find($find)) { $this->afterSaveRouteUrl['action'] = 'index'; $this->resetRoute = true; } Modified: trunk/library/classes/Gems/User/User.php =================================================================== --- trunk/library/classes/Gems/User/User.php 2012-09-18 15:19:39 UTC (rev 943) +++ trunk/library/classes/Gems/User/User.php 2012-09-18 17:14:15 UTC (rev 944) @@ -1221,6 +1221,9 @@ $this->_setVar('__allowedOrgs', $orgs); + // Clean this cache + $this->_unsetVar('__allowedRespOrgs'); + return $this; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-18 15:19:48
|
Revision: 943 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=943&view=rev Author: matijsdejong Date: 2012-09-18 15:19:39 +0000 (Tue, 18 Sep 2012) Log Message: ----------- Bugfix: $model->get did not rise the return array when all names are requested. Cused pulse bug #560 Modified Paths: -------------- trunk/library/classes/MUtil/Model/ModelAbstract.php Modified: trunk/library/classes/MUtil/Model/ModelAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/ModelAbstract.php 2012-09-13 14:09:24 UTC (rev 942) +++ trunk/library/classes/MUtil/Model/ModelAbstract.php 2012-09-18 15:19:39 UTC (rev 943) @@ -464,10 +464,11 @@ case 0: if (isset($this->_model[$name])) { if ($alias = $this->getAlias($name)) { - return $this->_model[$name] + $this->get($alias); + $result = $this->_model[$name] + $this->get($alias); } else { - return $this->_model[$name]; + $result = $this->_model[$name]; } + return MUtil_Lazy::rise($result); } else { return array(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-13 14:09:35
|
Revision: 942 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=942&view=rev Author: matijsdejong Date: 2012-09-13 14:09:24 +0000 (Thu, 13 Sep 2012) Log Message: ----------- Some more small fixes for database Made workbench file for DB Modified Paths: -------------- trunk/library/configs/db/tables/gems__radius_config.999.sql trunk/library/configs/db/tables/gems__staff.20.sql trunk/library/docs/Gems_MySQL_WorkBench.mwb trunk/scripts/build.xml trunk/test/data/sqllite/create-lite.sql Modified: trunk/library/configs/db/tables/gems__radius_config.999.sql =================================================================== --- trunk/library/configs/db/tables/gems__radius_config.999.sql 2012-09-13 13:08:17 UTC (rev 941) +++ trunk/library/configs/db/tables/gems__radius_config.999.sql 2012-09-13 14:09:24 UTC (rev 942) @@ -1,9 +1,13 @@ -CREATE TABLE IF NOT EXISTS `gems__radius_config` ( - `grcfg_id` bigint(11) NOT NULL auto_increment, - `grcfg_id_organization` bigint(11) NOT NULL, - `grcfg_ip` varchar(39) collate utf8_unicode_ci default NULL, - `grcfg_port` int(5) default NULL, - `grcfg_secret` varchar(32) collate utf8_unicode_ci default NULL, - PRIMARY KEY (`grcfg_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; \ No newline at end of file +CREATE TABLE if not exists gems__radius_config ( + grcfg_id bigint(11) NOT NULL auto_increment, + grcfg_id_organization bigint(11) NOT NULL references gems__organizations (gor_id_organization), + grcfg_ip varchar(39) collate utf8_unicode_ci default NULL, + grcfg_port int(5) default NULL, + grcfg_secret varchar(32) collate utf8_unicode_ci default NULL, + + PRIMARY KEY (grcfg_id) + ) +ENGINE=MyISAM +DEFAULT CHARSET=utf8 +COLLATE=utf8_unicode_ci; \ No newline at end of file Modified: trunk/library/configs/db/tables/gems__staff.20.sql =================================================================== --- trunk/library/configs/db/tables/gems__staff.20.sql 2012-09-13 13:08:17 UTC (rev 941) +++ trunk/library/configs/db/tables/gems__staff.20.sql 2012-09-13 14:09:24 UTC (rev 942) @@ -54,7 +54,7 @@ PRIMARY KEY (gsf_id_user), UNIQUE KEY (gsf_login, gsf_id_organization), - UNIQUE KEY (gsf_reset_key) + UNIQUE KEY (gsf_reset_key), KEY (gsf_email) ) ENGINE=InnoDB Modified: trunk/library/docs/Gems_MySQL_WorkBench.mwb =================================================================== (Binary files differ) Modified: trunk/scripts/build.xml =================================================================== --- trunk/scripts/build.xml 2012-09-13 13:08:17 UTC (rev 941) +++ trunk/scripts/build.xml 2012-09-13 14:09:24 UTC (rev 942) @@ -58,8 +58,11 @@ <regexp pattern=",\s*INDEX\s*\([^)]+\)" replace="" ignoreCase="true"/> <regexp pattern="(\s)BOOLEAN(\s)" replace="\1TINYINT(1)\2" ignoreCase="true"/> <regexp pattern="ENGINE=[^\s,;]+\s*" replace="" ignoreCase="true"/> - <regexp pattern="CHARACTER\s+SET\s+[^\s,;]+\s*" replace="" ignoreCase="true"/> - <regexp pattern="COLLATE\s+[^\s,;]+\s*" replace="" ignoreCase="true"/> + <regexp pattern="DEFAULT\s+CHARACTER\s+SET\s*" replace="CHARACTER SET " ignoreCase="true"/> + <regexp pattern="DEFAULT\s+CHARSET\s*" replace="CHARACTER SET " ignoreCase="true"/> + <regexp pattern="CHARACTER\s+SET\s*[^\s,;]+\s*" replace="" ignoreCase="true"/> + <regexp pattern="CHARSET\s*[^\s,;]+\s*" replace="" ignoreCase="true"/> + <regexp pattern="COLLATE\s*[^\s,;]+\s*" replace="" ignoreCase="true"/> <regexp pattern="ENUM\s[^)]+\)\s*" replace="" ignoreCase="true"/> <regexp pattern="SET\s[^)]+\)\s*" replace="" ignoreCase="true"/> <regexp pattern="UNSIGNED\s*" replace="" ignoreCase="true"/> Modified: trunk/test/data/sqllite/create-lite.sql =================================================================== --- trunk/test/data/sqllite/create-lite.sql 2012-09-13 13:08:17 UTC (rev 941) +++ trunk/test/data/sqllite/create-lite.sql 2012-09-13 14:09:24 UTC (rev 942) @@ -207,11 +207,11 @@ gor_created_by bigint not null, PRIMARY KEY(gor_id_organization), - UNIQUE (gor_code) + KEY (gor_code) ) ; -INSERT ignore INTO "gems__organizations" ("gor_id_organization", "gor_name", gor_changed, gor_changed_by, gor_created, gor_created_by) +INSERT ignore INTO gems__organizations (gor_id_organization, gor_name, gor_changed, gor_changed_by, gor_created, gor_created_by) VALUES (70, 'New organization', CURRENT_TIMESTAMP, 0, CURRENT_TIMESTAMP, 0); @@ -252,14 +252,16 @@ VALUES (48, CURRENT_TIMESTAMP); -CREATE TABLE "gems__radius_config" ( - "grcfg_id" bigint(11) NOT NULL AUTOINCREMENT, - "grcfg_id_organization" bigint(11) NOT NULL, - "grcfg_ip" varchar(39), - "grcfg_port" int(5), - "grcfg_secret" varchar(32), - PRIMARY KEY ("grcfg_id") -) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TABLE gems__radius_config ( + grcfg_id bigint(11) NOT NULL AUTOINCREMENT, + grcfg_id_organization bigint(11) NOT NULL, + grcfg_ip varchar(39), + grcfg_port int(5), + grcfg_secret varchar(32), + + PRIMARY KEY (grcfg_id) + ) +; CREATE TABLE gems__reception_codes ( grc_id_reception_code varchar(20) not null, grc_description varchar(40) not null, @@ -320,7 +322,7 @@ CREATE TABLE gems__respondent2track ( gr2t_id_respondent_track bigint not null AUTOINCREMENT, - + gr2t_id_user bigint not null, gr2t_id_track int not null, @@ -333,8 +335,9 @@ gr2t_active TINYINT(1) not null default 1, gr2t_count int not null default 0, gr2t_completed int not null default 0, - + gr2t_reception_code varchar(20) default 'OK' not null, + gr2t_comment varchar(250), gr2t_changed TEXT not null default current_timestamp, gr2t_changed_by bigint not null, @@ -456,7 +459,7 @@ ('physician','physician','','staff', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), ('researcher','researcher','pr.project-information.changelog,pr.contact,pr.export,pr.plan.token,pr.plan.respondent,pr.plan.overview,pr.option.password,pr.option.edit,pr.organization-switch,pr.islogin','guest', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), ('admin','admin','pr.consent,pr.consent.create,pr.consent.edit,pr.group,pr.role,pr.mail,pr.mail.create,pr.mail.delete,pr.mail.edit,pr.mail.log,pr.organization,pr.organization-switch,pr.plan.overview.excel,pr.plan.respondent,pr.plan.respondent.excel,pr.plan.token.excel,pr.project-information,pr.reception,pr.reception.create,pr.reception.edit,pr.respondent.choose-org,pr.respondent.delete,pr.respondent.result,pr.source,pr.staff.create,pr.staff.delete,pr.staff.edit,pr.staff.see.all,pr.survey-maintenance,pr.track-maintenance,pr.token.mail.freetext','staff,researcher,security', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), - ('super','super','pr.consent.delete,pr.country,pr.country.create,pr.country.delete,pr.country.edit,pr.database,pr.database.create,pr.database.delete,pr.database.edit,pr.database.execute,pr.database.patches,pr.group.create,pr.group.edit,pr.language,pr.mail.server,pr.mail.server.create,pr.mail.server.delete,pr.mail.server.edit,pr.organization.create,pr.organization.edit,pr.plan.choose-org,pr.plan.mail-as-application,pr.reception.delete,pr.role.create,pr.role.edit,pr.source.create,pr.source.edit,pr.source.synchronize,pr.source.synchronize-all,pr.staff.edit.all,pr.survey-maintenance.edit,pr.track-maintenance.create,pr.track-maintenance.edit,pr.maintenance','admin', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1); + ('super','super','pr.consent.delete,pr.country,pr.country.create,pr.country.delete,pr.country.edit,pr.database,pr.database.create,pr.database.delete,pr.database.edit,pr.database.execute,pr.database.patches,pr.group.create,pr.group.edit,pr.language,pr.mail.server,pr.mail.server.create,pr.mail.server.delete,pr.mail.server.edit,pr.organization.create,pr.organization.edit,pr.plan.choose-org,pr.plan.mail-as-application,pr.reception.delete,pr.respondent.multiorg,pr.role.create,pr.role.edit,pr.source.create,pr.source.edit,pr.source.synchronize,pr.source.synchronize-all,pr.staff.edit.all,pr.survey-maintenance.edit,pr.track-maintenance.create,pr.track-maintenance.edit,pr.maintenance','admin', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1); CREATE TABLE gems__rounds ( gro_id_round bigint not null AUTOINCREMENT, @@ -630,7 +633,7 @@ "gso_ls_table_prefix" varchar(127), "gso_ls_username" varchar(64), "gso_ls_password" varchar(255), - "gso_ls_charset" varchar(8), + "gso_ls_varchar(8), "gso_active" tinyint(1) NOT NULL default '1', @@ -646,7 +649,7 @@ UNIQUE ("gso_source_name"), UNIQUE ("gso_ls_url") ) -DEFAULT CHARSET=utf8; +; -- Table containing the project staff -- CREATE TABLE gems__staff ( @@ -668,7 +671,7 @@ gsf_iso_lang char(2) not null default 'en', gsf_logout_on_survey TINYINT(1) not null default 0, - gsf_email varchar(100) unique, + gsf_email varchar(100) , gsf_first_name varchar(30) , gsf_surname_prefix varchar(10) , @@ -697,9 +700,10 @@ gsf_created TEXT not null, gsf_created_by bigint not null, - PRIMARY KEY(gsf_id_user), - UNIQUE(gsf_login, gsf_id_organization), - UNIQUE(gsf_reset_key) + PRIMARY KEY (gsf_id_user), + UNIQUE (gsf_login, gsf_id_organization), + UNIQUE (gsf_reset_key), + KEY (gsf_email) ) ; @@ -966,6 +970,7 @@ gup_created TEXT not null, gup_created_by bigint not null, - PRIMARY KEY (gup_id_user) + PRIMARY KEY (gup_id_user), + UNIQUE (gup_reset_key) ) ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-13 13:08:29
|
Revision: 941 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=941&view=rev Author: matijsdejong Date: 2012-09-13 13:08:17 +0000 (Thu, 13 Sep 2012) Log Message: ----------- Fixed #563; database patches now work correctly Removed obsolete references to gems__languages Corrected references to gems__track to gems__tracks Phing now outputs two SQL while database creation scripts: one for tests using sql lite and one for ER diagramming tools Modified Paths: -------------- trunk/library/configs/db/tables/gems__organizations.20.sql trunk/library/configs/db/tables/gems__radius_config.999.sql trunk/library/configs/db/tables/gems__respondent2track.40.sql trunk/library/configs/db/tables/gems__respondents.30.sql trunk/library/configs/db/tables/gems__roles.20.sql trunk/library/configs/db/tables/gems__round_periods.50.sql trunk/library/configs/db/tables/gems__rounds.40.sql trunk/library/configs/db/tables/gems__staff.20.sql trunk/library/configs/db/tables/gems__tokens.200.sql trunk/library/configs/db/tables/gems__user_logins.10.sql trunk/library/configs/db/tables/gems__user_passwords.50.sql trunk/scripts/build.xml trunk/test/data/gems__respondents.sql Added Paths: ----------- trunk/test/data/sqllite/ trunk/test/data/sqllite/create-lite.sql Property Changed: ---------------- trunk/scripts/ Modified: trunk/library/configs/db/tables/gems__organizations.20.sql =================================================================== --- trunk/library/configs/db/tables/gems__organizations.20.sql 2012-09-12 18:45:41 UTC (rev 940) +++ trunk/library/configs/db/tables/gems__organizations.20.sql 2012-09-13 13:08:17 UTC (rev 941) @@ -1,3 +1,4 @@ + CREATE TABLE if not exists gems__organizations ( gor_id_organization bigint unsigned not null auto_increment, @@ -18,8 +19,7 @@ gor_signature text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, gor_style varchar(15) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'gems', - gor_iso_lang char(2) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' - not null default 'en' references gems__languages (gml_iso_lang), + gor_iso_lang char(2) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'en', gor_has_login boolean not null default 1, gor_has_respondents boolean not null default 0, @@ -34,12 +34,12 @@ gor_created_by bigint unsigned not null, PRIMARY KEY(gor_id_organization), - UNIQUE (gor_code) + KEY (gor_code) ) ENGINE=InnoDB AUTO_INCREMENT = 70 CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'; -INSERT ignore INTO `gems__organizations` (`gor_id_organization`, `gor_name`, gor_changed, gor_changed_by, gor_created, gor_created_by) +INSERT ignore INTO gems__organizations (gor_id_organization, gor_name, gor_changed, gor_changed_by, gor_created, gor_created_by) VALUES (70, 'New organization', CURRENT_TIMESTAMP, 0, CURRENT_TIMESTAMP, 0); Modified: trunk/library/configs/db/tables/gems__radius_config.999.sql =================================================================== --- trunk/library/configs/db/tables/gems__radius_config.999.sql 2012-09-12 18:45:41 UTC (rev 940) +++ trunk/library/configs/db/tables/gems__radius_config.999.sql 2012-09-13 13:08:17 UTC (rev 941) @@ -1,3 +1,4 @@ + CREATE TABLE IF NOT EXISTS `gems__radius_config` ( `grcfg_id` bigint(11) NOT NULL auto_increment, `grcfg_id_organization` bigint(11) NOT NULL, Modified: trunk/library/configs/db/tables/gems__respondent2track.40.sql =================================================================== --- trunk/library/configs/db/tables/gems__respondent2track.40.sql 2012-09-12 18:45:41 UTC (rev 940) +++ trunk/library/configs/db/tables/gems__respondent2track.40.sql 2012-09-13 13:08:17 UTC (rev 941) @@ -1,7 +1,7 @@ CREATE TABLE if not exists gems__respondent2track ( gr2t_id_respondent_track bigint unsigned not null auto_increment, - + gr2t_id_user bigint unsigned not null references gems__respondents (grs_id_user), gr2t_id_track int unsigned not null references gems__tracks (gtr_id_track), @@ -9,15 +9,16 @@ gr2t_start_date datetime null, gr2t_end_date datetime null, - gr2t_id_organization bigint unsigned not null + gr2t_id_organization bigint unsigned not null references gems__organizations (gor_id_organization), gr2t_active boolean not null default 1, gr2t_count int unsigned not null default 0, gr2t_completed int unsigned not null default 0, - + gr2t_reception_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' default 'OK' not null references gems__reception_codes (grc_id_reception_code), + gr2t_comment varchar(250) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, gr2t_changed timestamp not null default current_timestamp on update current_timestamp, gr2t_changed_by bigint unsigned not null, Modified: trunk/library/configs/db/tables/gems__respondents.30.sql =================================================================== --- trunk/library/configs/db/tables/gems__respondents.30.sql 2012-09-12 18:45:41 UTC (rev 940) +++ trunk/library/configs/db/tables/gems__respondents.30.sql 2012-09-13 13:08:17 UTC (rev 941) @@ -1,6 +1,6 @@ CREATE TABLE if not exists gems__respondents ( - grs_id_user bigint unsigned not null auto_increment, + grs_id_user bigint unsigned not null auto_increment references gems__user_ids (gui_id_user), -- grs_login varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' -- null unique key, @@ -29,8 +29,7 @@ -- references gems_staff (grs_id_user), -- grs_id_primary_group bigint unsigned -- references gems__groups (umg_id_group), - grs_iso_lang char(2) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' - not null default 'en' references gems__languages (gml_iso_lang), + grs_iso_lang char(2) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'en', grs_email varchar(100) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, Modified: trunk/library/configs/db/tables/gems__roles.20.sql =================================================================== --- trunk/library/configs/db/tables/gems__roles.20.sql 2012-09-12 18:45:41 UTC (rev 940) +++ trunk/library/configs/db/tables/gems__roles.20.sql 2012-09-13 13:08:17 UTC (rev 941) @@ -33,4 +33,4 @@ ('physician','physician','','staff', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), ('researcher','researcher','pr.project-information.changelog,pr.contact,pr.export,pr.plan.token,pr.plan.respondent,pr.plan.overview,pr.option.password,pr.option.edit,pr.organization-switch,pr.islogin','guest', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), ('admin','admin','pr.consent,pr.consent.create,pr.consent.edit,pr.group,pr.role,pr.mail,pr.mail.create,pr.mail.delete,pr.mail.edit,pr.mail.log,pr.organization,pr.organization-switch,pr.plan.overview.excel,pr.plan.respondent,pr.plan.respondent.excel,pr.plan.token.excel,pr.project-information,pr.reception,pr.reception.create,pr.reception.edit,pr.respondent.choose-org,pr.respondent.delete,pr.respondent.result,pr.source,pr.staff.create,pr.staff.delete,pr.staff.edit,pr.staff.see.all,pr.survey-maintenance,pr.track-maintenance,pr.token.mail.freetext','staff,researcher,security', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), - ('super','super','pr.consent.delete,pr.country,pr.country.create,pr.country.delete,pr.country.edit,pr.database,pr.database.create,pr.database.delete,pr.database.edit,pr.database.execute,pr.database.patches,pr.group.create,pr.group.edit,pr.language,pr.mail.server,pr.mail.server.create,pr.mail.server.delete,pr.mail.server.edit,pr.organization.create,pr.organization.edit,pr.plan.choose-org,pr.plan.mail-as-application,pr.reception.delete,pr.role.create,pr.role.edit,pr.source.create,pr.source.edit,pr.source.synchronize,pr.source.synchronize-all,pr.staff.edit.all,pr.survey-maintenance.edit,pr.track-maintenance.create,pr.track-maintenance.edit,pr.maintenance','admin', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1); + ('super','super','pr.consent.delete,pr.country,pr.country.create,pr.country.delete,pr.country.edit,pr.database,pr.database.create,pr.database.delete,pr.database.edit,pr.database.execute,pr.database.patches,pr.group.create,pr.group.edit,pr.language,pr.mail.server,pr.mail.server.create,pr.mail.server.delete,pr.mail.server.edit,pr.organization.create,pr.organization.edit,pr.plan.choose-org,pr.plan.mail-as-application,pr.reception.delete,pr.respondent.multiorg,pr.role.create,pr.role.edit,pr.source.create,pr.source.edit,pr.source.synchronize,pr.source.synchronize-all,pr.staff.edit.all,pr.survey-maintenance.edit,pr.track-maintenance.create,pr.track-maintenance.edit,pr.maintenance','admin', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1); Modified: trunk/library/configs/db/tables/gems__round_periods.50.sql =================================================================== --- trunk/library/configs/db/tables/gems__round_periods.50.sql 2012-09-12 18:45:41 UTC (rev 940) +++ trunk/library/configs/db/tables/gems__round_periods.50.sql 2012-09-13 13:08:17 UTC (rev 941) @@ -2,14 +2,14 @@ CREATE TABLE if not exists gems__round_periods ( grp_id_round bigint unsigned not null references gems__rounds (gro_id_round), - grp_valid_after_id bigint unsigned null + grp_valid_after_id bigint unsigned null references gems__rounds (gro_id_round), grp_valid_after_source varchar(12) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'tok', grp_valid_after_field varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'gto_valid_from', grp_valid_after_unit char(1) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'M', grp_valid_after_length int not null default 0, - grp_valid_for_id bigint unsigned null + grp_valid_for_id bigint unsigned null references gems__rounds (gro_id_round), grp_valid_for_source varchar(12) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'nul', grp_valid_for_field varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null default null, @@ -26,10 +26,10 @@ ENGINE=InnoDB auto_increment = 40000 CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'; - -INSERT INTO gems__round_periods - (grp_id_round, +INSERT INTO gems__round_periods + (grp_id_round, + grp_valid_after_id, grp_valid_after_source, grp_valid_after_field, grp_valid_after_unit, grp_valid_after_length, grp_valid_for_id, grp_valid_for_source, grp_valid_for_field, grp_valid_for_unit, grp_valid_for_length, @@ -38,48 +38,48 @@ SELECT r1.gro_id_round AS grp_id_round, r2.gro_id_round AS grp_valid_after_id, - CASE + CASE WHEN r2.gro_id_round IS NULL THEN 'rtr' WHEN r1.gro_used_date = 'A' THEN 'tok' WHEN r1.gro_used_date = 'C' THEN 'tok' WHEN r1.gro_used_date = 'F' AND (gsu_followup_field IS NULL OR gsu_followup_field = 'submitdate') THEN 'tok' ELSE 'ans' - END as grp_valid_after_source, - CASE + END as grp_valid_after_source, + CASE WHEN r2.gro_id_round IS NULL THEN 'gr2t_start_date' WHEN r1.gro_used_date = 'A' THEN 'gto_valid_from' WHEN r1.gro_used_date = 'C' THEN 'gto_completion_time' WHEN r1.gro_used_date = 'F' AND (gsu_followup_field IS NULL OR gsu_followup_field = 'submitdate') THEN 'gto_completion_time' ELSE gsu_followup_field - END as grp_valid_after_field, - coalesce(substring(r1.gro_valid_after, 1, 1), 'M') AS grp_valid_after_unit, + END as grp_valid_after_field, + coalesce(substring(r1.gro_valid_after, 1, 1), 'M') AS grp_valid_after_unit, coalesce(convert(substring(r1.gro_valid_after, 2), signed), 0) AS grp_valid_after_length, r1.gro_id_round AS grp_valid_for_id, - CASE - WHEN coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) = 0 THEN 'nul' - ELSE 'tok' - END AS grp_valid_for_source, - CASE - WHEN coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) = 0 THEN null - ELSE 'gto_valid_from' - END AS grp_valid_for_field, - coalesce(substring(r1.gro_valid_for, 1, 1), 'M') AS grp_valid_for_unit, + CASE + WHEN coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) = 0 THEN 'nul' + ELSE 'tok' + END AS grp_valid_for_source, + CASE + WHEN coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) = 0 THEN null + ELSE 'gto_valid_from' + END AS grp_valid_for_field, + coalesce(substring(r1.gro_valid_for, 1, 1), 'M') AS grp_valid_for_unit, coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) AS grp_valid_for_length, r1.gro_changed, r1.gro_changed_by, r1.gro_created, r1.gro_created_by FROM gems__rounds AS r1 INNER JOIN gems__tracks ON r1.gro_id_track = gtr_id_track - LEFT JOIN (gems__rounds AS r2 + LEFT JOIN (gems__rounds AS r2 INNER JOIN gems__surveys ON r2.gro_id_survey = gsu_id_survey) - ON r1.gro_id_track = r2.gro_id_track AND r1.gro_id_order > r2.gro_id_order - AND r2.gro_id_order = + ON r1.gro_id_track = r2.gro_id_track AND r1.gro_id_order > r2.gro_id_order + AND r2.gro_id_order = (SELECT MAX(r3.gro_id_order) FROM gems__rounds AS r3 WHERE r1.gro_id_track = r3.gro_id_track AND r1.gro_id_order > r3.gro_id_order) WHERE gtr_track_type = 'T' AND gtr_track_model = 'TrackModel' ORDER BY r1.gro_id_round; -INSERT INTO gems__round_periods - (grp_id_round, +INSERT INTO gems__round_periods + (grp_id_round, grp_valid_after_id, grp_valid_after_source, grp_valid_after_field, grp_valid_after_unit, grp_valid_after_length, @@ -88,40 +88,40 @@ SELECT r1.gro_id_round AS grp_id_round, r2.gro_id_round AS grp_valid_after_id, - CASE + CASE WHEN r2.gro_id_round IS NULL THEN 'rtr' WHEN r1.gro_used_date = 'A' THEN 'tok' WHEN r1.gro_used_date = 'C' THEN 'tok' WHEN r1.gro_used_date = 'F' AND (gsu_followup_field IS NULL OR gsu_followup_field = 'submitdate') THEN 'tok' ELSE 'ans' - END as grp_valid_after_source, - CASE + END as grp_valid_after_source, + CASE WHEN r2.gro_id_round IS NULL THEN 'gr2t_start_date' WHEN r1.gro_used_date = 'A' THEN 'gto_valid_from' WHEN r1.gro_used_date = 'C' THEN 'gto_completion_time' WHEN r1.gro_used_date = 'F' AND (gsu_followup_field IS NULL OR gsu_followup_field = 'submitdate') THEN 'gto_completion_time' ELSE gsu_followup_field - END as grp_valid_after_field, - coalesce(substring(r1.gro_valid_after, 1, 1), 'M') AS grp_valid_after_unit, + END as grp_valid_after_field, + coalesce(substring(r1.gro_valid_after, 1, 1), 'M') AS grp_valid_after_unit, coalesce(convert(substring(r1.gro_valid_after, 2), signed), 0) AS grp_valid_after_length, r1.gro_id_round AS grp_valid_for_id, - CASE - WHEN coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) = 0 THEN 'nul' - ELSE 'tok' - END AS grp_valid_for_source, - CASE - WHEN coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) = 0 THEN null - ELSE 'gto_valid_from' - END AS grp_valid_for_field, - coalesce(substring(r1.gro_valid_for, 1, 1), 'M') AS grp_valid_for_unit, + CASE + WHEN coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) = 0 THEN 'nul' + ELSE 'tok' + END AS grp_valid_for_source, + CASE + WHEN coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) = 0 THEN null + ELSE 'gto_valid_from' + END AS grp_valid_for_field, + coalesce(substring(r1.gro_valid_for, 1, 1), 'M') AS grp_valid_for_unit, coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) AS grp_valid_for_length, r1.gro_changed, r1.gro_changed_by, r1.gro_created, r1.gro_created_by FROM gems__rounds AS r1 INNER JOIN gems__tracks ON r1.gro_id_track = gtr_id_track - LEFT JOIN (gems__rounds AS r2 + LEFT JOIN (gems__rounds AS r2 INNER JOIN gems__surveys ON r2.gro_id_survey = gsu_id_survey) - ON r1.gro_id_track = r2.gro_id_track AND r1.gro_used_date_order = r2.gro_id_order + ON r1.gro_id_track = r2.gro_id_track AND r1.gro_used_date_order = r2.gro_id_order WHERE gtr_track_type = 'T' AND gtr_track_model = 'NewTrackModel' ORDER BY r1.gro_id_round; Modified: trunk/library/configs/db/tables/gems__rounds.40.sql =================================================================== --- trunk/library/configs/db/tables/gems__rounds.40.sql 2012-09-12 18:45:41 UTC (rev 940) +++ trunk/library/configs/db/tables/gems__rounds.40.sql 2012-09-13 13:08:17 UTC (rev 941) @@ -2,7 +2,7 @@ CREATE TABLE if not exists gems__rounds ( gro_id_round bigint unsigned not null auto_increment, - gro_id_track bigint unsigned not null references gems__track (gtr_id_track), + gro_id_track bigint unsigned not null references gems__tracks (gtr_id_track), gro_id_order int not null default 10, gro_id_survey bigint unsigned not null references gems__surveys (gsu_id_survey), Modified: trunk/library/configs/db/tables/gems__staff.20.sql =================================================================== --- trunk/library/configs/db/tables/gems__staff.20.sql 2012-09-12 18:45:41 UTC (rev 940) +++ trunk/library/configs/db/tables/gems__staff.20.sql 2012-09-13 13:08:17 UTC (rev 941) @@ -18,12 +18,10 @@ gsf_id_primary_group bigint unsigned references gems__groups (ggp_id_group), - gsf_iso_lang char(2) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' - not null default 'nl' references gems__languages (gml_iso_lang), + gsf_iso_lang char(2) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'en', gsf_logout_on_survey boolean not null default 0, - gsf_email varchar(100) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' - unique key, + gsf_email varchar(100) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', gsf_first_name varchar(30) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', gsf_surname_prefix varchar(10) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', @@ -54,9 +52,10 @@ gsf_created timestamp not null, gsf_created_by bigint unsigned not null, - PRIMARY KEY(gsf_id_user), - UNIQUE KEY(gsf_login, gsf_id_organization), - UNIQUE KEY(gsf_reset_key) + PRIMARY KEY (gsf_id_user), + UNIQUE KEY (gsf_login, gsf_id_organization), + UNIQUE KEY (gsf_reset_key) + KEY (gsf_email) ) ENGINE=InnoDB AUTO_INCREMENT = 2001 Modified: trunk/library/configs/db/tables/gems__tokens.200.sql =================================================================== --- trunk/library/configs/db/tables/gems__tokens.200.sql 2012-09-12 18:45:41 UTC (rev 940) +++ trunk/library/configs/db/tables/gems__tokens.200.sql 2012-09-13 13:08:17 UTC (rev 941) @@ -13,7 +13,7 @@ gto_id_organization bigint unsigned not null references gems__organizations (gor_id_organization), gto_id_track bigint unsigned not null - references gems__track (gtr_id_track), + references gems__tracks (gtr_id_track), -- values initially filled from gems__rounds, but that may get different values later on gto_id_survey bigint unsigned not null references gems__surveys (gsu_id_survey), @@ -54,6 +54,7 @@ INDEX (gto_id_track), INDEX (gto_id_round), INDEX (gto_in_source), + INDEX (gto_reception_code), INDEX (gto_id_respondent_track, gto_round_order), INDEX (gto_valid_from, gto_valid_until), INDEX (gto_completion_time) Modified: trunk/library/configs/db/tables/gems__user_logins.10.sql =================================================================== --- trunk/library/configs/db/tables/gems__user_logins.10.sql 2012-09-12 18:45:41 UTC (rev 940) +++ trunk/library/configs/db/tables/gems__user_logins.10.sql 2012-09-13 13:08:17 UTC (rev 941) @@ -4,7 +4,7 @@ CREATE TABLE if not exists gems__user_logins ( gul_id_user bigint unsigned not null auto_increment, - gul_login varchar(30) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null, + gul_login varchar(30) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null references gems__staff (gsf_login), gul_id_organization bigint not null references gems__organizations (gor_id_organization), gul_user_class varchar(30) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'NoLogin', Modified: trunk/library/configs/db/tables/gems__user_passwords.50.sql =================================================================== --- trunk/library/configs/db/tables/gems__user_passwords.50.sql 2012-09-12 18:45:41 UTC (rev 940) +++ trunk/library/configs/db/tables/gems__user_passwords.50.sql 2012-09-13 13:08:17 UTC (rev 941) @@ -14,7 +14,8 @@ gup_created timestamp not null, gup_created_by bigint unsigned not null, - PRIMARY KEY (gup_id_user) + PRIMARY KEY (gup_id_user), + UNIQUE KEY (gup_reset_key) ) ENGINE=InnoDB CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'; Property changes on: trunk/scripts ___________________________________________________________________ Modified: svn:ignore - depend-chart_map.shtml depend-overview_map.shtml docs gems.lint reports tmp + depend-chart_map.shtml depend-overview_map.shtml docs gems.lint reports sql tmp Modified: trunk/scripts/build.xml =================================================================== --- trunk/scripts/build.xml 2012-09-12 18:45:41 UTC (rev 940) +++ trunk/scripts/build.xml 2012-09-13 13:08:17 UTC (rev 941) @@ -5,20 +5,75 @@ <include name="MUtil/**/*.php"/> <include name="GemsEscort.php"/> </fileset> - + + <fileset id="sql-creation-scripts" dir="../library/configs/db/tables"> + <include name="*.sql"/> + </fileset> + <!-- Clean up generated files --> <target name="clean"> <delete file="gems.lint"/> <delete dir="docs"/> <delete dir="reports"/> + <delete dir="sql"/> </target> - - <!-- Prepare workspace --> + + <!-- Prepare workspace --> <target name="prepare"> <mkdir dir="reports"/> <mkdir dir="docs"/> + <mkdir dir="sql"/> </target> - + + <!-- Merge SQL creation scripts --> + <target name="sql-merge"> + <delete file="sql/create-all.sql"/> + <append destFile="sql/create-all.sql"> + <fileset refid="sql-creation-scripts"/> + <filterchain> + <iconvfilter inputencoding="ISO-8859-1" outputencoding="UTF-8" /> + <replaceregexp> + <!-- MySQL Workbench does not know the BOOLEAN type --> + <regexp pattern="(\s)BOOLEAN(\s)" replace="\1TINYINT(1)\2" ignoreCase="true"/> + </replaceregexp> + </filterchain> + </append> + </target> + + <!-- Merge SQL creation scripts --> + <target name="sql-lite"> + <mkdir dir="../test/data/sqllite/"/> + <delete file="../test/data/sqllite/create-lite.sql"/> + <append destFile="../test/data/sqllite/create-lite.sql"> + <fileset refid="sql-creation-scripts"/> + <filterchain> + <replaceregexp> + <!-- MySQL Workbench does not know the BOOLEAN type --> + <regexp pattern="\`([^\`]*)\`" replace='"\1"' ignoreCase="false"/> + <regexp pattern="CREATE\s+TABLE\s+if\s+not\s+exists\s+" replace="CREATE TABLE " ignoreCase="true"/> + <regexp pattern="AUTO_INCREMENT\s*=\s*\d+\s*" replace="" ignoreCase="true"/> + <regexp pattern="AUTO_INCREMENT" replace="AUTOINCREMENT" ignoreCase="true"/> + <regexp pattern="(\sUNIQUE)\s+KEY(\s+|,|\()" replace="\1\2" ignoreCase="true"/> + <regexp pattern="(\sUNIQUE\s)\s*[^\s(]+\s+\(" replace="\1(" ignoreCase="true"/> + <regexp pattern=",\s*INDEX\s*\([^)]+\)" replace="" ignoreCase="true"/> + <regexp pattern="(\s)BOOLEAN(\s)" replace="\1TINYINT(1)\2" ignoreCase="true"/> + <regexp pattern="ENGINE=[^\s,;]+\s*" replace="" ignoreCase="true"/> + <regexp pattern="CHARACTER\s+SET\s+[^\s,;]+\s*" replace="" ignoreCase="true"/> + <regexp pattern="COLLATE\s+[^\s,;]+\s*" replace="" ignoreCase="true"/> + <regexp pattern="ENUM\s[^)]+\)\s*" replace="" ignoreCase="true"/> + <regexp pattern="SET\s[^)]+\)\s*" replace="" ignoreCase="true"/> + <regexp pattern="UNSIGNED\s*" replace="" ignoreCase="true"/> + <regexp pattern="(\s)(DATETIME|DATE|TIMESTAMP)(\s|,)" replace="\1TEXT\3" ignoreCase="true"/> + <regexp pattern="\s+DEFAULT\s+NULL(\s+|,)" replace="\1" ignoreCase="true"/> + <regexp pattern="(?:(\s+NOT\s+NULL)|\s+NULL)([\s,])" replace="\1\2" ignoreCase="true"/> + <regexp pattern="\s+ON\s+UPDATE\s+CURRENT_TIMESTAMP" replace="" ignoreCase="true"/> + <regexp pattern="\s+REFERENCES\s+[^\s]+\s+\([^)]+\)\s*" replace="" ignoreCase="true"/> + <!-- regexp pattern="\s+REFERENCES\s+[^\s,]+\s*" replace="" ignoreCase="true"/ --> + </replaceregexp> + </filterchain> + </append> + </target> + <!-- Run lint --> <target name="lint"> <phplint haltonfailure="true" cachefile="gems.lint"> @@ -34,14 +89,14 @@ <fileset refid="library"/> </docblox> </target> - + <!-- Gather metrics --> <target name="build-metrics"> <phpmd> <formatter type="html" outfile="reports/pmd.html"/> <fileset refid="library"/> </phpmd> - + <phpdepend> <logger type="jdepend-chart" outfile="reports/depend-chart.html"/> @@ -52,7 +107,7 @@ <fileset refid="library"/> </phpdepend> </target> - + <!-- Run PHP CodeSniffer --> <target name="build-phpcs"> <phpcodesniffer standard="gems.xml"> @@ -62,7 +117,7 @@ <formatter type="summary" outfile="reports/phpcs-summary.txt"/> </phpcodesniffer> - + <copy file="reports/checkstyle.xml" tofile="reports/checkstyle.html"> <filterchain> @@ -70,7 +125,7 @@ </filterchain> </copy> </target> - + <!-- Main target --> - <target name="build" depends="lint,prepare,build-phpcs,build-docs,build-metrics"/> + <target name="build" depends="lint,prepare,sql-merge,sql-lite,build-phpcs,build-docs,build-metrics"/> </project> \ No newline at end of file Modified: trunk/test/data/gems__respondents.sql =================================================================== --- trunk/test/data/gems__respondents.sql 2012-09-12 18:45:41 UTC (rev 940) +++ trunk/test/data/gems__respondents.sql 2012-09-13 13:08:17 UTC (rev 941) @@ -1,18 +1,17 @@ CREATE TABLE gems__respondents ( grs_id_user bigint unsigned not null, - grs_ssn varchar(32) + grs_ssn varchar(32) null unique, - grs_iso_lang char(2) - not null default 'en' references gems__languages (gml_iso_lang), + grs_iso_lang char(2) not null default 'en', grs_email varchar(100) null, grs_first_name varchar(30) , grs_surname_prefix varchar(10) , grs_last_name varchar(50) , - grs_gender char(1) + grs_gender char(1) not null default 'U', grs_birthday date, Added: trunk/test/data/sqllite/create-lite.sql =================================================================== --- trunk/test/data/sqllite/create-lite.sql (rev 0) +++ trunk/test/data/sqllite/create-lite.sql 2012-09-13 13:08:17 UTC (rev 941) @@ -0,0 +1,971 @@ + +CREATE TABLE gems__consents ( + gco_description varchar(20) not null, + gco_order smallint not null default 10, + gco_code varchar(20) not null default 'do not use', + + gco_changed TEXT not null default current_timestamp, + gco_changed_by bigint not null, + gco_created TEXT not null, + gco_created_by bigint not null, + + PRIMARY KEY (gco_description) + ) + ; + + +INSERT INTO gems__consents + (gco_description, gco_order, gco_code, gco_changed, gco_changed_by, gco_created, gco_created_by) + VALUES + ('Yes', 10, 'consent given', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), + ('No', 20, 'do not use', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), + ('Unknown', 30, 'do not use', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1); + +CREATE TABLE gems__groups ( + ggp_id_group bigint not null AUTOINCREMENT, + ggp_name varchar(30) not null, + ggp_description varchar(50) not null, + + ggp_role varchar(150) not null default 'respondent', + -- The ggp_role value(s) determines someones roles as not null default 1, + ggp_staff_members TINYINT(1) not null default 0, + ggp_respondent_members TINYINT(1) not null default 1, + ggp_allowed_ip_ranges text, + + ggp_changed TEXT not null default current_timestamp, + ggp_changed_by bigint not null, + ggp_created TEXT not null, + ggp_created_by bigint not null, + + PRIMARY KEY(ggp_id_group) + ) + ; + +-- Default group +INSERT ignore INTO gems__groups + (ggp_id_group, ggp_name, ggp_description, ggp_role, ggp_group_active, ggp_staff_members, ggp_respondent_members, ggp_changed_by, ggp_created, ggp_created_by) + VALUES + (800, 'Super Administrators', 'Super administrators with access to the whole site', 'super', 1, 1, 0, 0, current_timestamp, 0); + + -- ggp_group_rights = '*' gives access to all pages. + + +CREATE TABLE gems__log_respondent_communications ( + grco_id_action bigint not null AUTOINCREMENT, + + grco_id_to bigint not null, + grco_id_by bigint default 0, + grco_organization bigint not null, + + grco_id_token varchar(9), + + grco_method varchar(12) not null, + grco_topic varchar(120) not null, + grco_address varchar(120), + grco_sender varchar(120), + grco_comments varchar(120), + + grco_id_message bigint, + + grco_changed TEXT not null default current_timestamp, + grco_changed_by bigint not null, + grco_created TEXT not null, + grco_created_by bigint not null, + + PRIMARY KEY (grco_id_action) + ) + ; + + +CREATE TABLE gems__mail_jobs ( + gmj_id_job bigint not null AUTOINCREMENT, + + gmj_id_message bigint not null, + + gmj_id_user_as bigint not null, + + gmj_active TINYINT(1) not null default 1, + + -- O Use organization from address + -- S Use site from address + -- U Use gmj_id_user_as from address + -- F Fixed gmj_from_fixed + gmj_from_method varchar(1) not null, + gmj_from_fixed varchar(254), + + -- M => multiple per respondent, one for each token + -- O => One per respondent, mark all tokens as send + -- A => Send only one token, do not mark + gmj_process_method varchar(1) not null, + + -- N => notmailed + -- R => reminder + gmj_filter_mode varchar(1) not null, + gmj_filter_days_between int not null default 7, + + -- Optional filters + gmj_id_organization bigint, + gmj_id_track int, + gmj_id_survey int, + + gmj_changed TEXT not null default current_timestamp, + gmj_changed_by bigint not null, + gmj_created TEXT not null default '0000-00-00 00:00:00', + gmj_created_by bigint not null, + + PRIMARY KEY (gmj_id_job) + ) + ; + +CREATE TABLE gems__mail_servers ( + gms_from varchar(100) not null, + + gms_server varchar(100) not null, + gms_port smallint not null default 25, + gms_ssl tinyint not null default 0, + gms_user varchar(100), + gms_password varchar(100), + + gms_changed TEXT not null default current_timestamp, + gms_changed_by bigint not null, + gms_created TEXT not null default '0000-00-00 00:00:00', + gms_created_by bigint not null, + + PRIMARY KEY (gms_from) + ) + ; + + +CREATE TABLE gems__mail_templates ( + gmt_id_message bigint not null AUTOINCREMENT, + + gmt_subject varchar(100) not null, + gmt_body text not null, + + -- Yes, quick and dirty, will correct later (probably) + gmt_organizations varchar(250) , + + gmt_changed TEXT not null default current_timestamp, + gmt_changed_by bigint not null, + gmt_created TEXT not null default '0000-00-00 00:00:00', + gmt_created_by bigint not null, + + PRIMARY KEY (gmt_id_message), + UNIQUE (gmt_subject) + ) + ; + +INSERT INTO gems__mail_templates (gmt_subject, gmt_body, gmt_changed, gmt_changed_by, gmt_created, gmt_created_by) + VALUES + ('Questions for your treatement at {organization}', 'Dear {greeting}, + +Recently you visited [b]{organization}[/b] for treatment. For your proper treatment you are required to answer some questions. + +Click on [url={token_url}]this link[/url] to start or go to [url]{site_ask_url}[/url] and enter your token "{token}". + +{organization_signature}', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), + ('Reminder: your treatement at {organization}', 'Dear {greeting}, + +We remind you that for your proper treatment at [b]{organization}[/b] you are required to answer some questions. + +Click on [url={token_url}]this link[/url] to start or go to [url]{site_ask_url}[/url] and enter your token "{token}". + +{organization_signature}', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1); + +CREATE TABLE gems__organizations ( + gor_id_organization bigint not null AUTOINCREMENT, + + gor_name varchar(50) not null, + gor_code varchar(20), + gor_user_class varchar(30) not null default 'StaffUser', + gor_location varchar(50), + gor_url varchar(127), + gor_url_base varchar(1270), + gor_task varchar(50), + + -- A commy separated list of organization numbers that can look at respondents in this organization + gor_accessible_by text, + + gor_contact_name varchar(50), + gor_contact_email varchar(127), + gor_welcome text, + gor_signature text, + + gor_style varchar(15) not null default 'gems', + gor_iso_lang char(2) not null default 'en', + + gor_has_login TINYINT(1) not null default 1, + gor_has_respondents TINYINT(1) not null default 0, + gor_add_respondents TINYINT(1) not null default 1, + gor_respondent_group bigint, + gor_allowed_ip_ranges text, + gor_active TINYINT(1) not null default 1, + + gor_changed TEXT not null default current_timestamp, + gor_changed_by bigint not null, + gor_created TEXT not null, + gor_created_by bigint not null, + + PRIMARY KEY(gor_id_organization), + UNIQUE (gor_code) + ) + ; + +INSERT ignore INTO "gems__organizations" ("gor_id_organization", "gor_name", gor_changed, gor_changed_by, gor_created, gor_created_by) + VALUES + (70, 'New organization', CURRENT_TIMESTAMP, 0, CURRENT_TIMESTAMP, 0); + +CREATE TABLE gems__patches ( + gpa_id_patch int not null AUTOINCREMENT, + + gpa_level int not null default 0, + gpa_location varchar(100) not null, + gpa_name varchar(30) not null, + gpa_order int not null default 0, + + gpa_sql text not null, + + gpa_executed TINYINT(1) not null default 0, + gpa_completed TINYINT(1) not null default 0, + + gpa_result varchar(255), + + gpa_changed TEXT not null default current_timestamp, + gpa_created TEXT, + + PRIMARY KEY (gpa_id_patch), + UNIQUE (gpa_level, gpa_location, gpa_name, gpa_order) + ) + ; + + +CREATE TABLE gems__patch_levels ( + gpl_level int not null unique, + + gpl_created TEXT not null default current_timestamp, + + PRIMARY KEY (gpl_level) + ) + ; + +INSERT INTO gems__patch_levels (gpl_level, gpl_created) + VALUES + (48, CURRENT_TIMESTAMP); + +CREATE TABLE "gems__radius_config" ( + "grcfg_id" bigint(11) NOT NULL AUTOINCREMENT, + "grcfg_id_organization" bigint(11) NOT NULL, + "grcfg_ip" varchar(39), + "grcfg_port" int(5), + "grcfg_secret" varchar(32), + PRIMARY KEY ("grcfg_id") +) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TABLE gems__reception_codes ( + grc_id_reception_code varchar(20) not null, + grc_description varchar(40) not null, + + grc_success TINYINT(1) not null default 0, + + grc_for_surveys tinyint not null default 0, + grc_redo_survey tinyint not null default 0, + grc_for_tracks TINYINT(1) not null default 0, + grc_for_respondents TINYINT(1) not null default 0, + grc_overwrite_answers TINYINT(1) not null default 0, + grc_active TINYINT(1) not null default 1, + + grc_changed TEXT not null default current_timestamp, + grc_changed_by bigint not null, + grc_created TEXT not null, + grc_created_by bigint not null, + + PRIMARY KEY (grc_id_reception_code) + ) + ; + +INSERT INTO gems__reception_codes (grc_id_reception_code, grc_description, grc_success, + grc_for_surveys, grc_redo_survey, grc_for_tracks, grc_for_respondents, grc_overwrite_answers, grc_active, + grc_changed, grc_changed_by, grc_created, grc_created_by) + VALUES + ('OK', '', 1, 1, 0, 1, 1, 0, 1, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), + ('skip', 'Skipped by calculation', 0, 1, 0, 0, 0, 1, 0, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), + ('stop', 'Stop surveys', 0, 2, 0, 0, 0, 0, 1, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1); + +CREATE TABLE gems__respondent2org ( + gr2o_patient_nr varchar(7) not null, + gr2o_id_organization bigint not null, + + gr2o_id_user bigint not null, + + -- gr2o_id_physician bigint + --, + + -- gr2o_treatment varchar(200), + -- gr2o_comments text, + + gr2o_consent varchar(20) not null default 'Unknown', + gr2o_reception_code varchar(20) default 'OK' not null, + + gr2o_opened TEXT not null default current_timestamp, + gr2o_opened_by bigint not null, + gr2o_changed TEXT not null, + gr2o_changed_by bigint not null, + gr2o_created TEXT not null, + gr2o_created_by bigint not null, + + PRIMARY KEY (gr2o_patient_nr, gr2o_id_organization), + UNIQUE (gr2o_id_user, gr2o_id_organization) + ) + ; + + +CREATE TABLE gems__respondent2track ( + gr2t_id_respondent_track bigint not null AUTOINCREMENT, + + gr2t_id_user bigint not null, + gr2t_id_track int not null, + + gr2t_track_info varchar(250) , + gr2t_start_date TEXT, + gr2t_end_date TEXT, + + gr2t_id_organization bigint not null, + + gr2t_active TINYINT(1) not null default 1, + gr2t_count int not null default 0, + gr2t_completed int not null default 0, + + gr2t_reception_code varchar(20) default 'OK' not null, + + gr2t_changed TEXT not null default current_timestamp, + gr2t_changed_by bigint not null, + gr2t_created TEXT not null, + gr2t_created_by bigint not null, + + PRIMARY KEY (gr2t_id_respondent_track) + ) + ; + + +CREATE TABLE gems__respondent2track2field ( + gr2t2f_id_respondent_track bigint not null, + gr2t2f_id_field bigint not null, + + gr2t2f_value text, + + gr2t2f_changed TEXT not null default current_timestamp, + gr2t2f_changed_by bigint not null, + gr2t2f_created TEXT not null, + gr2t2f_created_by bigint not null, + + PRIMARY KEY(gr2t2f_id_respondent_track,gr2t2f_id_field) + ) + ; + + +CREATE TABLE gems__respondents ( + grs_id_user bigint not null AUTOINCREMENT, + + -- grs_login varchar(20) -- unique, + -- grs_password varchar(64) not null, + + grs_ssn varchar(32) unique, + +-- Naam +-- Adres +-- Woonplaats +-- Tel. nr +-- geb. datum +-- aandoening (code bijv: ICD9, DBC etc) +-- aangedaan lichaamsdeel +-- uitgevoerde behandeling +-- hand dominantie +-- behandelend arts +-- beroep/ hobby's +-- OK/ behandel datum +-- email + -- grs_staff TINYINT(1) not null default 0, + -- grs_respondent TINYINT(1) not null default 1, + -- grs_active TINYINT(1) not null default 1, + -- grs_id_supervisor bigint default 1 + --, + -- grs_id_primary_group bigint --, + grs_iso_lang char(2) not null default 'en', + + grs_email varchar(100), + + grs_first_name varchar(30) , + grs_surname_prefix varchar(10) , + grs_last_name varchar(50) , + grs_gender char(1) not null default 'U', + -- grs_dexterity char(1) -- not null default 'U', + grs_birthday TEXT, + -- grs_function varchar(40) , + + grs_address_1 varchar(80) , + grs_address_2 varchar(80) , + grs_zipcode varchar(10) , + grs_city varchar(40) , + -- grs_region varchar(40) , + grs_iso_country char(2) not null default 'NL', + grs_phone_1 varchar(25) , + -- grs_phone_2 varchar(25) , + -- grs_phone_3 varchar(25) , + + -- grs_id_reception_code bigint not null default 1 + --, + + grs_changed TEXT not null default current_timestamp, + grs_changed_by bigint not null, + grs_created TEXT not null, + grs_created_by bigint not null, + + PRIMARY KEY(grs_id_user) + ) + ; + + +CREATE TABLE gems__roles ( + grl_id_role bigint not null AUTOINCREMENT, + grl_name varchar(30) not null, + grl_description varchar(50) not null, + + grl_parents text, + -- The grl_parents is a comma-separated list of parents for this role + + grl_privileges text, + -- The grl_privilege is a comma-separated list of privileges for this role + + grl_changed TEXT not null default current_timestamp, + grl_changed_by bigint not null, + grl_created TEXT not null, + grl_created_by bigint not null, + + PRIMARY KEY(grl_id_role) + ) + ; + +-- default roles/privileges + +INSERT INTO gems__roles (grl_name, grl_description, grl_privileges, grl_parents, grl_changed, grl_changed_by, grl_created, grl_created_by) + VALUES + ('nologin','nologin','pr.contact.bugs,pr.contact.support,pr.nologin','', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), + ('guest','guest','pr.ask,pr.contact.bugs,pr.contact.support,pr.islogin,pr.respondent','', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), + ('respondent','respondent','','guest', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), + ('security','security','','guest', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), + ('staff','staff','pr.option.edit,pr.option.password,pr.plan,pr.plan.overview,pr.plan.token,pr.project,pr.project.questions,pr.respondent.create,pr.respondent.edit,pr.respondent.who,pr.setup,pr.staff,pr.survey,pr.survey.create,pr.token,pr.token.answers,pr.token.delete,pr.token.edit,pr.token.mail,pr.token.print,pr.track,pr.track.create,pr.track.delete,pr.track.edit,pr.respondent.reportdeath','guest', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), + ('physician','physician','','staff', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), + ('researcher','researcher','pr.project-information.changelog,pr.contact,pr.export,pr.plan.token,pr.plan.respondent,pr.plan.overview,pr.option.password,pr.option.edit,pr.organization-switch,pr.islogin','guest', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), + ('admin','admin','pr.consent,pr.consent.create,pr.consent.edit,pr.group,pr.role,pr.mail,pr.mail.create,pr.mail.delete,pr.mail.edit,pr.mail.log,pr.organization,pr.organization-switch,pr.plan.overview.excel,pr.plan.respondent,pr.plan.respondent.excel,pr.plan.token.excel,pr.project-information,pr.reception,pr.reception.create,pr.reception.edit,pr.respondent.choose-org,pr.respondent.delete,pr.respondent.result,pr.source,pr.staff.create,pr.staff.delete,pr.staff.edit,pr.staff.see.all,pr.survey-maintenance,pr.track-maintenance,pr.token.mail.freetext','staff,researcher,security', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), + ('super','super','pr.consent.delete,pr.country,pr.country.create,pr.country.delete,pr.country.edit,pr.database,pr.database.create,pr.database.delete,pr.database.edit,pr.database.execute,pr.database.patches,pr.group.create,pr.group.edit,pr.language,pr.mail.server,pr.mail.server.create,pr.mail.server.delete,pr.mail.server.edit,pr.organization.create,pr.organization.edit,pr.plan.choose-org,pr.plan.mail-as-application,pr.reception.delete,pr.role.create,pr.role.edit,pr.source.create,pr.source.edit,pr.source.synchronize,pr.source.synchronize-all,pr.staff.edit.all,pr.survey-maintenance.edit,pr.track-maintenance.create,pr.track-maintenance.edit,pr.maintenance','admin', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1); + +CREATE TABLE gems__rounds ( + gro_id_round bigint not null AUTOINCREMENT, + + gro_id_track bigint not null, + gro_id_order int not null default 10, + + gro_id_survey bigint not null, + + -- Survey_name is a temp copy from __surveys, needed by me to keep an overview as + -- long as no track editor exists. + gro_survey_name varchar(100) not null, + + gro_round_description varchar(100), + gro_icon_file VARCHAR(100), + gro_changed_event varchar(128), + gro_display_event varchar(128), + + -- depreciated + gro_valid_after char(6) , + gro_valid_for char(6) , + gro_used_date char(1) not null default 'A', + gro_used_date_order int(4) default 10, + gro_used_date_field varchar(16), + -- end of depreciated + + gro_active TINYINT(1) not null default 1, + + gro_changed TEXT not null default current_timestamp, + gro_changed_by bigint not null, + gro_created TEXT not null, + gro_created_by bigint not null, + + PRIMARY KEY (gro_id_round) + ) + ; + + +CREATE TABLE gems__round_periods ( + grp_id_round bigint not null, + + grp_valid_after_id bigint, + grp_valid_after_source varchar(12) not null default 'tok', + grp_valid_after_field varchar(64) not null default 'gto_valid_from', + grp_valid_after_unit char(1) not null default 'M', + grp_valid_after_length int not null default 0, + + grp_valid_for_id bigint, + grp_valid_for_source varchar(12) not null default 'nul', + grp_valid_for_field varchar(64), + grp_valid_for_unit char(1) not null default 'M', + grp_valid_for_length int not null default 0, + + grp_changed TEXT not null default current_timestamp, + grp_changed_by bigint not null, + grp_created TEXT not null, + grp_created_by bigint not null, + + PRIMARY KEY (grp_id_round) + ) + ; + +INSERT INTO gems__round_periods + (grp_id_round, + + grp_valid_after_id, grp_valid_after_source, grp_valid_after_field, grp_valid_after_unit, grp_valid_after_length, + + grp_valid_for_id, grp_valid_for_source, grp_valid_for_field, grp_valid_for_unit, grp_valid_for_length, + + grp_changed, grp_changed_by, grp_created, grp_created_by) + SELECT r1.gro_id_round AS grp_id_round, + + r2.gro_id_round AS grp_valid_after_id, + CASE + WHEN r2.gro_id_round IS THEN 'rtr' + WHEN r1.gro_used_date = 'A' THEN 'tok' + WHEN r1.gro_used_date = 'C' THEN 'tok' + WHEN r1.gro_used_date = 'F' AND (gsu_followup_field IS OR gsu_followup_field = 'submitdate') THEN 'tok' + ELSE 'ans' + END as grp_valid_after_source, + CASE + WHEN r2.gro_id_round IS THEN 'gr2t_start_date' + WHEN r1.gro_used_date = 'A' THEN 'gto_valid_from' + WHEN r1.gro_used_date = 'C' THEN 'gto_completion_time' + WHEN r1.gro_used_date = 'F' AND (gsu_followup_field IS OR gsu_followup_field = 'submitdate') THEN 'gto_completion_time' + ELSE gsu_followup_field + END as grp_valid_after_field, + coalesce(substring(r1.gro_valid_after, 1, 1), 'M') AS grp_valid_after_unit, + coalesce(convert(substring(r1.gro_valid_after, 2), signed), 0) AS grp_valid_after_length, + + r1.gro_id_round AS grp_valid_for_id, + CASE + WHEN coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) = 0 THEN 'nul' + ELSE 'tok' + END AS grp_valid_for_source, + CASE + WHEN coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) = 0 THEN + ELSE 'gto_valid_from' + END AS grp_valid_for_field, + coalesce(substring(r1.gro_valid_for, 1, 1), 'M') AS grp_valid_for_unit, + coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) AS grp_valid_for_length, + + r1.gro_changed, r1.gro_changed_by, r1.gro_created, r1.gro_created_by + FROM gems__rounds AS r1 + INNER JOIN gems__tracks ON r1.gro_id_track = gtr_id_track + LEFT JOIN (gems__rounds AS r2 + INNER JOIN gems__surveys ON r2.gro_id_survey = gsu_id_survey) + ON r1.gro_id_track = r2.gro_id_track AND r1.gro_id_order > r2.gro_id_order + AND r2.gro_id_order = + (SELECT MAX(r3.gro_id_order) FROM gems__rounds AS r3 WHERE r1.gro_id_track = r3.gro_id_track AND r1.gro_id_order > r3.gro_id_order) + WHERE gtr_track_type = 'T' AND gtr_track_model = 'TrackModel' + ORDER BY r1.gro_id_round; + +INSERT INTO gems__round_periods + (grp_id_round, + + grp_valid_after_id, grp_valid_after_source, grp_valid_after_field, grp_valid_after_unit, grp_valid_after_length, + + grp_valid_for_id, grp_valid_for_source, grp_valid_for_field, grp_valid_for_unit, grp_valid_for_length, + grp_changed, grp_changed_by, grp_created, grp_created_by) + SELECT r1.gro_id_round AS grp_id_round, + + r2.gro_id_round AS grp_valid_after_id, + CASE + WHEN r2.gro_id_round IS THEN 'rtr' + WHEN r1.gro_used_date = 'A' THEN 'tok' + WHEN r1.gro_used_date = 'C' THEN 'tok' + WHEN r1.gro_used_date = 'F' AND (gsu_followup_field IS OR gsu_followup_field = 'submitdate') THEN 'tok' + ELSE 'ans' + END as grp_valid_after_source, + CASE + WHEN r2.gro_id_round IS THEN 'gr2t_start_date' + WHEN r1.gro_used_date = 'A' THEN 'gto_valid_from' + WHEN r1.gro_used_date = 'C' THEN 'gto_completion_time' + WHEN r1.gro_used_date = 'F' AND (gsu_followup_field IS OR gsu_followup_field = 'submitdate') THEN 'gto_completion_time' + ELSE gsu_followup_field + END as grp_valid_after_field, + coalesce(substring(r1.gro_valid_after, 1, 1), 'M') AS grp_valid_after_unit, + coalesce(convert(substring(r1.gro_valid_after, 2), signed), 0) AS grp_valid_after_length, + + r1.gro_id_round AS grp_valid_for_id, + CASE + WHEN coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) = 0 THEN 'nul' + ELSE 'tok' + END AS grp_valid_for_source, + CASE + WHEN coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) = 0 THEN + ELSE 'gto_valid_from' + END AS grp_valid_for_field, + coalesce(substring(r1.gro_valid_for, 1, 1), 'M') AS grp_valid_for_unit, + coalesce(convert(substring(r1.gro_valid_for, 2), signed), 0) AS grp_valid_for_length, + + r1.gro_changed, r1.gro_changed_by, r1.gro_created, r1.gro_created_by + FROM gems__rounds AS r1 + INNER JOIN gems__tracks ON r1.gro_id_track = gtr_id_track + LEFT JOIN (gems__rounds AS r2 + INNER JOIN gems__surveys ON r2.gro_id_survey = gsu_id_survey) + ON r1.gro_id_track = r2.gro_id_track AND r1.gro_used_date_order = r2.gro_id_order + WHERE gtr_track_type = 'T' AND gtr_track_model = 'NewTrackModel' + ORDER BY r1.gro_id_round; + +CREATE TABLE "gems__sources" ( + "gso_id_source" int(10) NOT NULL AUTOINCREMENT, + "gso_source_name" varchar(40) NOT NULL, + + "gso_ls_url" varchar(255) NOT NULL, + "gso_ls_class" varchar(60) NOT NULL default 'Gems_Source_LimeSurvey1m9Database', + "gso_ls_adapter" varchar(20), + "gso_ls_dbhost" varchar(127), + "gso_ls_database" varchar(127), + "gso_ls_table_prefix" varchar(127), + "gso_ls_username" varchar(64), + "gso_ls_password" varchar(255), + "gso_ls_charset" varchar(8), + + "gso_active" tinyint(1) NOT NULL default '1', + + "gso_status" varchar(20), + "gso_last_synch" TEXT, + + "gso_changed" TEXT NOT NULL default CURRENT_TIMESTAMP, + "gso_changed_by" bigint(20) NOT NULL, + "gso_created" TEXT NOT NULL default '0000-00-00 00:00:00', + "gso_created_by" bigint(20) NOT NULL, + + PRIMARY KEY ("gso_id_source"), + UNIQUE ("gso_source_name"), + UNIQUE ("gso_ls_url") +) +DEFAULT CHARSET=utf8; +-- Table containing the project staff +-- +CREATE TABLE gems__staff ( + gsf_id_user bigint not null, + + gsf_login varchar(20) not null, + gsf_id_organization bigint not null, + + gsf_active TINYINT(1) default 1, + + -- depreciated + gsf_password varchar(32), + gsf_failed_logins int(11) default 0, + gsf_last_failed TEXT, + -- end depreciated + + + gsf_id_primary_group bigint, + gsf_iso_lang char(2) not null default 'en', + gsf_logout_on_survey TINYINT(1) not null default 0, + + gsf_email varchar(100) unique, + + gsf_first_name varchar(30) , + gsf_surname_prefix varchar(10) , + gsf_last_name varchar(30) , + gsf_gender char(1) not null default 'U', + -- gsf_birthday TEXT, + -- gsf_function varchar(40) , + + -- gsf_address_1 varchar(80) , + -- gsf_address_2 varchar(80) , + -- gsf_zipcode varchar(10) , + -- gsf_city varchar(40) , + -- gsf_region varchar(40) , + -- gsf_iso_country char(2) --, + gsf_phone_1 varchar(25) , + -- gsf_phone_2 varchar(25) , + -- gsf_phone_3 varchar(25) , + + -- depreciated + gsf_reset_key varchar(64), + gsf_reset_req TEXT, + -- end depreciated + + gsf_changed TEXT not null default current_timestamp, + gsf_changed_by bigint not null, + gsf_created TEXT not null, + gsf_created_by bigint not null, + + PRIMARY KEY(gsf_id_user), + UNIQUE(gsf_login, gsf_id_organization), + UNIQUE(gsf_reset_key) + ) + ; + + +CREATE TABLE gems__staff2groups ( + gs2g_id_user bigint not null, + gs2g_id_group bigint not null, + + gs2g_active TINYINT(1) not null default 1, + + gs2g_changed TEXT not null default current_timestamp, + gs2g_changed_by bigint not null, + gs2g_created TEXT not null, + gs2g_created_by bigint not null, + + PRIMARY KEY (gs2g_id_user, gs2g_id_group) + ) + ; + + + +CREATE TABLE gems__surveys ( + gsu_id_survey int not null AUTOINCREMENT, + gsu_survey_name varchar(100) not null, + gsu_survey_description varchar(100) , + + gsu_surveyor_id int(11), + gsu_surveyor_active TINYINT(1) not null default 1, + + -- depreciated + gsu_survey_table varchar(64) , + gsu_token_table varchar(64) , + -- end depreciated + + gsu_survey_pdf varchar(128) , + gsu_beforeanswering_event varchar(128) , + gsu_completed_event varchar(128) , + gsu_display_event varchar(128) , + + gsu_id_source int not null, + gsu_active TINYINT(1) not null default 0, + gsu_status varchar(127) , + + -- depreciated + gsu_staff TINYINT(1) not null default 0, + -- end depreciated + + gsu_id_primary_group bigint, + + -- depreciated + gsu_id_user_field varchar(20) , + gsu_completion_field varchar(20) not null default 'submitdate', + gsu_followup_field varchar(20) not null default 'submitdate', + -- end depreciated + + gsu_result_field varchar(20) , + gsu_duration varchar(50) , + + gsu_code varchar(64), + + gsu_changed TEXT not null default current_timestamp, + gsu_changed_by bigint not null, + gsu_created TEXT not null, + gsu_created_by bigint not null, + + PRIMARY KEY(gsu_id_survey) + ) + ; + + +CREATE TABLE gems__tokens ( + gto_id_token varchar(9) not null, + + gto_id_respondent_track bigint not null, + gto_id_round bigint not null, + + -- non-changing fields calculated from previous two: + gto_id_respondent bigint not null, + gto_id_organization bigint not null, + gto_id_track bigint not null, + + -- values initially filled from gems__rounds, but that may get different values later on + gto_id_survey bigint not null, + + -- values initially filled from gems__rounds, but that might get different values later on, but but not now + gto_round_order int not null default 10, + gto_round_description varchar(100), + + -- real data + gto_valid_from TEXT, + gto_valid_until TEXT, + gto_mail_sent_date TEXT, + gto_mail_sent_num int(11) not null default 0, + gto_next_mail_date TEXT, + + gto_start_time TEXT, + gto_in_source TINYINT(1) not null default 0, + gto_by bigint(20), + + gto_completion_time TEXT, + gto_duration_in_sec bigint(20), + gto_followup_date TEXT, -- depreciated + gto_result varchar(20) , + + gto_comment varchar(250), + gto_reception_code varchar(20) default 'OK' not null, + + gto_return_url varchar(250), + + gto_changed TEXT not null default current_timestamp, + gto_changed_by bigint not null, + gto_created TEXT not null, + gto_created_by bigint not null, + + PRIMARY KEY (gto_id_token) + ) + ; + + +CREATE TABLE gems__token_attempts ( + gta_id_attempt bigint not null AUTOINCREMENT, + gta_id_token varchar(9) not null, + gta_ip... [truncated message content] |
From: <gem...@li...> - 2012-09-12 18:45:47
|
Revision: 940 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=940&view=rev Author: matijsdejong Date: 2012-09-12 18:45:41 +0000 (Wed, 12 Sep 2012) Log Message: ----------- First version database scheme Added Paths: ----------- trunk/library/docs/Gems_MySQL_WorkBench.mwb Property Changed: ---------------- trunk/library/docs/ Property changes on: trunk/library/docs ___________________________________________________________________ Added: svn:ignore + *.bak Added: trunk/library/docs/Gems_MySQL_WorkBench.mwb =================================================================== (Binary files differ) Property changes on: trunk/library/docs/Gems_MySQL_WorkBench.mwb ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-12 15:50:04
|
Revision: 939 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=939&view=rev Author: matijsdejong Date: 2012-09-12 15:49:52 +0000 (Wed, 12 Sep 2012) Log Message: ----------- #566: Finished: surveys and rounds can change / adapt the display of the answer data Found and fixed multi organization bugs in Track and SingleSurvey screens Snippet 'names' arrays can now contain parameters as well LimeSurvey1m9FieldMap.php now includes knowledge of parent question in sub question Found and fixed bug in JoinModel workings Modified Paths: -------------- trunk/library/classes/Gems/Controller/BrowseEditAction.php trunk/library/classes/Gems/Default/TrackAction.php trunk/library/classes/Gems/Default/TrackActionAbstract.php trunk/library/classes/Gems/Default/TrackRoundsAction.php trunk/library/classes/Gems/Event/SurveyDisplayEventInterface.php trunk/library/classes/Gems/Events.php trunk/library/classes/Gems/Loader.php trunk/library/classes/Gems/Snippets/SnippetLoader.php trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php trunk/library/classes/Gems/Tracker/Engine/TrackEngineInterface.php trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php trunk/library/classes/Gems/Tracker/Survey.php trunk/library/classes/Gems/Tracker/Token.php trunk/library/classes/MUtil/Controller/Action.php trunk/library/classes/MUtil/Html.php trunk/library/classes/MUtil/Model/JoinModel.php trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php Added Paths: ----------- trunk/library/classes/Gems/Event/Survey/Display/ByValue.php trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php trunk/library/classes/Gems/Event/Survey/Display/Reverse.php trunk/library/classes/Gems/Event/SurveyAnswerFilterAbstract.php trunk/library/classes/Gems/Tracker/Snippets/AnswerNameFilterInterface.php Modified: trunk/library/classes/Gems/Controller/BrowseEditAction.php =================================================================== --- trunk/library/classes/Gems/Controller/BrowseEditAction.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/Gems/Controller/BrowseEditAction.php 2012-09-12 15:49:52 UTC (rev 939) @@ -160,10 +160,9 @@ } // */ if ($this->tableSnippets) { + $snippets = $this->getSnippets($this->tableSnippets, $params); $sequence = new MUtil_Html_Sequence(); - foreach ((array) $this->tableSnippets as $snippetName) { - $snippet = $this->getSnippet($snippetName, $params); - + foreach ($snippets as $snippet) { if ($snippet->hasHtmlOutput()) { $sequence[] = $snippet; } Modified: trunk/library/classes/Gems/Default/TrackAction.php =================================================================== --- trunk/library/classes/Gems/Default/TrackAction.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/Gems/Default/TrackAction.php 2012-09-12 15:49:52 UTC (rev 939) @@ -483,7 +483,7 @@ $this->_setParam(Gems_Model::RESPONDENT_TRACK, $data['gr2t_id_respondent_track']); - $this->html->h2(sprintf($this->_('%s track for respondent nr %s'), $data['gtr_track_name'], $this->_getParam(MUtil_Model::REQUEST_ID))); + $this->html->h2(sprintf($this->_('%s track for respondent nr %s'), $data['gtr_track_name'], $this->_getParam(MUtil_Model::REQUEST_ID1))); if (! $this->escort instanceof Gems_Project_Tracks_SingleTrackInterface) { $table = parent::getShowTable(); @@ -515,7 +515,8 @@ $this->addSnippet('TrackUsageTextDetailsSnippet', 'trackData', $data); } - $baseUrl[MUtil_Model::REQUEST_ID] = $this->_getIdParam(); + $baseUrl[MUtil_Model::REQUEST_ID1] = $this->_getParam(MUtil_Model::REQUEST_ID1); + $baseUrl[MUtil_Model::REQUEST_ID2] = $this->_getParam(MUtil_Model::REQUEST_ID2); $baseUrl[Gems_Model::RESPONDENT_TRACK] = $this->_getParam(Gems_Model::RESPONDENT_TRACK); $this->addSnippet('TrackTokenOverviewSnippet', 'trackData', $data, 'baseUrl', $baseUrl); Modified: trunk/library/classes/Gems/Default/TrackActionAbstract.php =================================================================== --- trunk/library/classes/Gems/Default/TrackActionAbstract.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/Gems/Default/TrackActionAbstract.php 2012-09-12 15:49:52 UTC (rev 939) @@ -70,11 +70,10 @@ $result[] = parent::_createTable(); if ($this->trackType) { - $id = $this->_getParam(MUtil_Model::REQUEST_ID); + $orgId = trim($this->db->quote($this->_getParam(MUtil_Model::REQUEST_ID2)), "'"); $model = $this->createTrackModel(false, 'index'); $request = $this->getRequest(); - $organisation_id = $this->escort->getCurrentOrganization(); $searchText = $this->_getParam($model->getTextFilter()); $model->applyPostRequest($request); @@ -93,19 +92,24 @@ $filter['gtr_track_type'] = $this->trackType; $filter['gtr_active'] = 1; $filter[] = '(gtr_date_until IS NULL OR gtr_date_until >= CURRENT_DATE) AND gtr_date_start <= CURRENT_DATE'; - $filter[] = "gtr_organizations LIKE '%|$organisation_id|%'"; + $filter[] = "gtr_organizations LIKE '%|$orgId|%'"; - $baseurl = array('action' => 'index', 'gr2o_patient_nr' => $id, MUtil_Model::TEXT_FILTER => $searchText); + $menuParams = array( + 'gr2o_patient_nr' => $this->_getParam(MUtil_Model::REQUEST_ID1), + 'gr2o_id_organization' => $orgId); + $baseUrl = $menuParams + array( + 'action' => 'index', + MUtil_Model::TEXT_FILTER => $searchText); $bridge = new MUtil_Model_TableBridge($model, array('class' => 'browser')); - $bridge->setBaseUrl($baseurl); + $bridge->setBaseUrl($baseUrl); $bridge->setOnEmpty($this->_('No tracks found')); $bridge->getOnEmpty()->class = 'centerAlign'; $bridge->setRepeater($model->loadRepeatable($filter, $this->availableSort)); // Add view button if ($menuItem = $this->findAllowedMenuItem('view')) { - $bridge->addItemLink($menuItem->toActionLinkLower($request, $bridge, array('gr2o_patient_nr' => $id))); + $bridge->addItemLink($menuItem->toActionLinkLower($request, $bridge, $menuParams)); } foreach($model->getItemsOrdered() as $name) { @@ -116,7 +120,7 @@ // Add create button if ($menuItem = $this->findAllowedMenuItem('create')) { - $bridge->addItemLink($menuItem->toActionLinkLower($request, $bridge, array('gr2o_patient_nr' => $id))); + $bridge->addItemLink($menuItem->toActionLinkLower($request, $bridge, $menuParams)); } $result[] = MUtil_Html::create()->h3($this->_('Available tracks')); @@ -141,7 +145,7 @@ $patientId = $this->_getParam(MUtil_Model::REQUEST_ID1); $orgId = $this->_getParam(MUtil_Model::REQUEST_ID2); - return array ($patientId, $orgId); + return array($patientId, $orgId); } abstract protected function addTrackUsage($respId, $orgId, $trackId, $baseUrl); @@ -298,7 +302,7 @@ } else { - $this->addMessage(sprintf($this->_('%s %s not found.'), $this->getTopic(1), $this->_getParam(MUtil_Model::REQUEST_ID))); + $this->addMessage(sprintf($this->_('%s %s not found.'), $this->getTopic(1), $this->_getParam(MUtil_Model::REQUEST_ID1))); } } @@ -322,10 +326,7 @@ $data = $this->getRequest()->getParams(); } - if (isset($data[MUtil_Model::REQUEST_ID])) { - $keys[] = MUtil_Model::REQUEST_ID; - - } elseif (isset($data[MUtil_Model::REQUEST_ID1])) { + if (isset($data[MUtil_Model::REQUEST_ID1])) { $i = 1; while (isset($data[MUtil_Model::REQUEST_ID . $i])) { $keys[] = MUtil_Model::REQUEST_ID . $i; Modified: trunk/library/classes/Gems/Default/TrackRoundsAction.php =================================================================== --- trunk/library/classes/Gems/Default/TrackRoundsAction.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/Gems/Default/TrackRoundsAction.php 2012-09-12 15:49:52 UTC (rev 939) @@ -256,8 +256,9 @@ $menuSource->setRequestId($trackId); // Tell the menu we're using track id as request id $this->html->p($question); - foreach ($trackEngine->getRoundShowSnippetNames() as $snippet) { - $this->html->append($this->getSnippet($snippet, 'roundId', $roundId, 'trackEngine', $trackEngine, 'trackId', $trackId, 'showMenu', false, 'showTitle', false)); + $snippets = $this->getSnippets($trackEngine->getRoundShowSnippetNames(), 'roundId', $roundId, 'trackEngine', $trackEngine, 'trackId', $trackId, 'showMenu', false, 'showTitle', false); + foreach ($snippets as $snippet) { + $this->html->append($snippet); } $footer = $this->html->p($question, ' ', array('class' => 'centerAlign')); Added: trunk/library/classes/Gems/Event/Survey/Display/ByValue.php =================================================================== --- trunk/library/classes/Gems/Event/Survey/Display/ByValue.php (rev 0) +++ trunk/library/classes/Gems/Event/Survey/Display/ByValue.php 2012-09-12 15:49:52 UTC (rev 939) @@ -0,0 +1,123 @@ +<?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 Events + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: OnlyAnswered.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * Put the highest value first + * + * @package Gems + * @subpackage Events + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.6 + */ +class Gems_Event_Survey_Display_ByValue extends Gems_Event_SurveyAnswerFilterAbstract +{ + /** + * Contains the values of the current token + * + * @var array + */ + private $_values; + + /** + * This function is called in addBrowseTableColumns() to filter the names displayed + * by AnswerModelSnippetGeneric. + * + * @see Gems_Tracker_Snippets_AnswerModelSnippetGeneric + * + * @param MUtil_Model_TableBridge $bridge + * @param MUtil_Model_ModelAbstract $model + * @param array $currentNames The current names in use (allows chaining) + * @return array Of the names of labels that should be shown + */ + public function filterAnswers(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model, array $currentNames) + { + $currentNames = array_combine($currentNames, $currentNames); + $newOrder = array(); + + foreach ($this->_values as $key => $value) { + if (isset($currentNames[$key])) { + if ($parent = $model->get($key, 'parent_question')) { + $count = 0; + foreach ($model->getCol('parent_question') as $name => $currentParent) { + if (isset($currentNames[$name]) && ($currentParent === $parent)) { + $count++; + } + } + // Last occurence of this parent question + if ($count < 2) { + unset($currentNames[$parent]); + } + $newOrder[] = $parent; + + // MUtil_Echo::track($key, $parent); + } + + unset($currentNames[$key]); + $newOrder[] = $key; + } + } + + // MUtil_Echo::track($this->_values, $newOrder + $currentNames); + + return $newOrder + $currentNames; + } + + /** + * Function that returns the snippets to use for this display. + * + * @param Gems_Tracker_Token $token The token to get the snippets for + * @return array of Snippet names or nothing + */ + public function getAnswerDisplaySnippets(Gems_Tracker_Token $token) + { + $this->_values = array_filter($token->getRawAnswers(), 'is_numeric'); + arsort($this->_values); + + return parent::getAnswerDisplaySnippets($token); + } + + /** + * A pretty name for use in dropdown selection boxes. + * + * @return string Name + */ + public function getEventName() + { + return $this->translate->_('Show the highest answer first.'); + } +} Added: trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php =================================================================== --- trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php (rev 0) +++ trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php 2012-09-12 15:49:52 UTC (rev 939) @@ -0,0 +1,118 @@ +<?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 Events + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: OnlyAnswered.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * Display only those questions that have an answer + * + * @package Gems + * @subpackage Events + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.6 + */ +class Gems_Event_Survey_Display_OnlyAnswered extends Gems_Event_SurveyAnswerFilterAbstract +{ + /** + * This function is called in addBrowseTableColumns() to filter the names displayed + * by AnswerModelSnippetGeneric. + * + * @see Gems_Tracker_Snippets_AnswerModelSnippetGeneric + * + * @param MUtil_Model_TableBridge $bridge + * @param MUtil_Model_ModelAbstract $model + * @param array $currentNames The current names in use (allows chaining) + * @return array Of the names of labels that should be shown + */ + public function filterAnswers(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model, array $currentNames) + { + $repeater = $model->loadRepeatable(); + $table = $bridge->getTable(); + $table->setRepeater($repeater); + + if (! $repeater->__start()) { + return $currentNames; + } + + $keys = array(); + while ($row = $repeater->__next()) { + // Add the keys that contain values. + // We don't care about the values in the array. + $keys += array_filter($row->getArrayCopy()); + } + + $lastMain = null; + $names = array(); + foreach ($currentNames as $name) { + $exists = isset($keys[$name]); + + // Keep track of should a main question be displayed. + // The question or a sub question should be answered + if ($model->get($name, 'thClass') === 'question') { + if ($lastMain) { + unset($names[$lastMain]); + } + + if ($exists) { + $lastMain = null; // Has value, display + } else { + $exists = true; // Add to list for the moment + $lastMain = $name; // But keep track for possible removal + } + } elseif ($exists) { + $lastMain = null; // Must display last main question + } + + + if ($exists) { + $names[$name] = $name; + // MUtil_Echo::track($name, $model->get($name, 'thClass'), $model->get($name, 'label')); + } + } + + return $names; + } + + /** + * A pretty name for use in dropdown selection boxes. + * + * @return string Name + */ + public function getEventName() + { + return $this->translate->_('Display only the questions with an answer.'); + } +} Added: trunk/library/classes/Gems/Event/Survey/Display/Reverse.php =================================================================== --- trunk/library/classes/Gems/Event/Survey/Display/Reverse.php (rev 0) +++ trunk/library/classes/Gems/Event/Survey/Display/Reverse.php 2012-09-12 15:49:52 UTC (rev 939) @@ -0,0 +1,74 @@ +<?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 Events + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: OnlyAnswered.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * Put the last question first + * + * @package Gems + * @subpackage Events + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.6 + */ +class Gems_Event_Survey_Display_Reverse extends Gems_Event_SurveyAnswerFilterAbstract +{ + /** + * This function is called in addBrowseTableColumns() to filter the names displayed + * by AnswerModelSnippetGeneric. + * + * @see Gems_Tracker_Snippets_AnswerModelSnippetGeneric + * + * @param MUtil_Model_TableBridge $bridge + * @param MUtil_Model_ModelAbstract $model + * @param array $currentNames The current names in use (allows chaining) + * @return array Of the names of labels that should be shown + */ + public function filterAnswers(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model, array $currentNames) + { + return array_reverse($currentNames); + } + + /** + * A pretty name for use in dropdown selection boxes. + * + * @return string Name + */ + public function getEventName() + { + return $this->translate->_('Reverse the question order.'); + } +} Added: trunk/library/classes/Gems/Event/SurveyAnswerFilterAbstract.php =================================================================== --- trunk/library/classes/Gems/Event/SurveyAnswerFilterAbstract.php (rev 0) +++ trunk/library/classes/Gems/Event/SurveyAnswerFilterAbstract.php 2012-09-12 15:49:52 UTC (rev 939) @@ -0,0 +1,74 @@ +<?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 Events + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: OnlyAnswered.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * Abstract class for defining filters on answer displays + * + * @package Gems + * @subpackage Events + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.6 + */ +abstract class Gems_Event_SurveyAnswerFilterAbstract extends Gems_Registry_TargetAbstract + implements Gems_Event_SurveyDisplayEventInterface, Gems_Tracker_Snippets_AnswerNameFilterInterface +{ + /** + * + * @var Zend_Translate + */ + protected $translate; + + // public function filterAnswers(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model, array $currentNames); + + /** + * Function that returns the snippets to use for this display. + * + * @param Gems_Tracker_Token $token The token to get the snippets for + * @return array of Snippet names or nothing + */ + public function getAnswerDisplaySnippets(Gems_Tracker_Token $token) + { + $snippets = (array) $token->getTrackEngine()->getAnswerSnippetNames(); + + $snippets['answerFilter'] = $this; + + return $snippets; + } + + // public function getEventName() +} Modified: trunk/library/classes/Gems/Event/SurveyDisplayEventInterface.php =================================================================== --- trunk/library/classes/Gems/Event/SurveyDisplayEventInterface.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/Gems/Event/SurveyDisplayEventInterface.php 2012-09-12 15:49:52 UTC (rev 939) @@ -51,8 +51,8 @@ /** * Function that returns the snippets to use for this display. * - * @param boolean $group Should answers be grouped - * @return array of Snippet names + * @param Gems_Tracker_Token $token The token to get the snippets for + * @return array of Snippet names or nothing */ - public function getSnippets($group); + public function getAnswerDisplaySnippets(Gems_Tracker_Token $token); } Modified: trunk/library/classes/Gems/Events.php =================================================================== --- trunk/library/classes/Gems/Events.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/Gems/Events.php 2012-09-12 15:49:52 UTC (rev 939) @@ -280,9 +280,20 @@ return $this->_loadEvent($eventName, self::SURVEY_COMPLETION_EVENT); } + /** * * @param string $eventName + * @return Gems_Event_SurveyDisplayEventInterface + */ + public function loadSurveyDisplayEvent($eventName) + { + return $this->_loadEvent($eventName, self::SURVEY_DISPLAY_EVENT); + } + + /** + * + * @param string $eventName * @return Gems_Event_TrackCompletedEventInterface */ public function loadTrackCompletionEvent($eventName) Modified: trunk/library/classes/Gems/Loader.php =================================================================== --- trunk/library/classes/Gems/Loader.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/Gems/Loader.php 2012-09-12 15:49:52 UTC (rev 939) @@ -227,7 +227,7 @@ } /** - * + * * @return Gems_Snippets_SnippetLoader */ public function getSnippetLoader($container) @@ -235,7 +235,7 @@ $class = $this->_getClass('snippetLoader', 'Snippets_SnippetLoader'); //now add the calling class as a container - $class->addRegistryContainer($container); + $class->getSource()->addRegistryContainer($container); return $class; } Modified: trunk/library/classes/Gems/Snippets/SnippetLoader.php =================================================================== --- trunk/library/classes/Gems/Snippets/SnippetLoader.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/Gems/Snippets/SnippetLoader.php 2012-09-12 15:49:52 UTC (rev 939) @@ -2,7 +2,7 @@ /** * Copyright (c) 2011, Erasmus MC * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -13,7 +13,7 @@ * * Neither the name of Erasmus MC nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -24,7 +24,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * Gems specific version of the snippet loader * * @package Gems @@ -47,120 +47,21 @@ * @license New BSD License * @since Class available since version 1.5.5 */ -class Gems_Snippets_SnippetLoader extends Gems_Loader_TargetLoaderAbstract implements MUtil_Snippets_SnippetLoaderInterface +class Gems_Snippets_SnippetLoader extends MUtil_Snippets_SnippetLoader { - protected $cascade = 'Snippets'; - - protected $loader; - /** - * @var MUtil_Snippets_SnippetLoader - */ - protected $backup; - - /** - * Initialize the snippetloader (Gems style) + * Sets the source of variables and the first directory for snippets * - * @param mixed $container A container acting as source for MUtil_Registry_Source - * @param array $dirs The directories where to look for requested classes + * @param mixed $source Something that is or can be made into MUtil_Registry_SourceInterface, otheriwse Zend_Registry is used. */ - public function __construct($container = null, $dirs = array()) { - parent::__construct($container, $dirs); - $this->backup = new MUtil_Snippets_SnippetLoader($this); - $this->addDirectory(GEMS_LIBRARY_DIR . '/classes/MUtil/Snippets/Standard'); - } - - - /** - * Add a directory to the front of the list of places where snippets are loaded from. - * - * @param string $dir - * @return MUtil_Snippets_SnippetLoader - */ - public function addDirectory($dir) + public function __construct($source = null) { - if (!array_key_exists('', $this->_dirs)) { - $this->_dirs[''] = array(); - } - array_unshift($this->_dirs[''], $dir); + global $GEMS_DIRS; - return $this->backup->addDirectory($dir); - } + parent::__construct($source); - /** - * Add parameter values to the source for snippets. - * - * @param mixed $container_or_pairs This function can be called with either a single container or a list of name/value pairs. - * @return MUtil_Snippets_SnippetLoader - */ - public function addSource($container_or_pairs) - { - return $this->backup->addSource($container_or_pairs); - } - - /** - * Returns the directories where snippets are loaded from. - * - * @param array $dirs - * @return array - */ - public function getDirectories() - { - return $this->backup->getDirectories(); - } - - /** - * Searches and loads a .php snippet file. - * - * @param string $filename The name of the snippet - * @param array $extraSourceParameters name/value pairs to add to the source for this snippet - * @return MUtil_Snippets_SnippetInterface The snippet - */ - public function getSnippet($filename, array $extraSourceParameters = null) - { - try { - $this->addRegistryContainer($extraSourceParameters, 'tmpContainer'); - $snippet = $this->_loadClass($filename, true); - $this->removeRegistryContainer('tmpContainer'); - } catch (Exception $exc) { - MUtil_Echo::track($exc->getMessage()); - throw $exc; - //Class loading failed, now defer - //$snippet = $this->backup->getSnippet($filename, $extraSourceParameters); + foreach ($GEMS_DIRS as $key => $path) { + $this->addDirectory($path . '/' . $key); } - - return $snippet; } - - /** - * Returns a source of values for snippets. - * - * @return MUtil_Registry_SourceInterface - */ - public function getSource() - { - return $this->backup->getSource(); - } - - /** - * Set the directories where snippets are loaded from. - * - * @param array $dirs - * @return MUtil_Snippets_SnippetLoader (continuation pattern) - */ - public function setDirectories(array $dirs) - { - return $this->backup->setDirectories($dirs); - } - - /** - * Sets the source of variables for snippets - * - * @param MUtil_Registry_SourceInterface $source - * @return MUtil_Snippets_SnippetLoader (continuation pattern) - */ - public function setSource(MUtil_Registry_SourceInterface $source) - { - return $this->backup->setSource($source); - } } \ No newline at end of file Modified: trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2012-09-12 15:49:52 UTC (rev 939) @@ -657,6 +657,24 @@ } /** + * Returns a snippet name that can be used to display the answers to the token or nothing. + * + * @param Gems_Tracker_Token $token + * @return array Of snippet names + */ + public function getRoundAnswerSnippets(Gems_Tracker_Token $token) + { + $this->_ensureRounds(); + $roundId = $token->getRoundId(); + + if (isset($this->_rounds[$roundId]['gro_display_event']) && $this->_rounds[$roundId]['gro_display_event']) { + $event = $this->events->loadSurveyDisplayEvent($this->_rounds[$roundId]['gro_display_event']); + + return $event->getAnswerDisplaySnippets($token); + } + } + + /** * Return the Round Changed event name for this round * * @param int $roundId Modified: trunk/library/classes/Gems/Tracker/Engine/TrackEngineInterface.php =================================================================== --- trunk/library/classes/Gems/Tracker/Engine/TrackEngineInterface.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/Gems/Tracker/Engine/TrackEngineInterface.php 2012-09-12 15:49:52 UTC (rev 939) @@ -188,6 +188,14 @@ public function getPreviousRoundId($roundId, $roundOrder = null); /** + * Returns a snippet name that can be used to display the answers to the token or nothing. + * + * @param Gems_Tracker_Token $token + * @return array Of snippet names + */ + public function getRoundAnswerSnippets(Gems_Tracker_Token $token); + + /** * Return the Round Changed event name for this round * * @param int $roundId Modified: trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php =================================================================== --- trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php 2012-09-12 15:49:52 UTC (rev 939) @@ -56,6 +56,14 @@ protected $_fixedSort = array('grc_success' => SORT_DESC, 'gto_round_order' => SORT_ASC, 'gto_valid_from' => SORT_ASC); /** + * Empty or a Gems_Tracker_Snippets_AnswerNameFilterInterface object that is + * used to filter the answers that are displayed. + * + * @var Gems_Tracker_Snippets_AnswerNameFilterInterface + */ + protected $answerFilter; + + /** * Shortfix to add class attribute * * @var string @@ -83,7 +91,7 @@ protected $locale; /** - * Switch to put the display of the cancel and pritn buttons. + * Switch to put the display of the cancel and print buttons. * * @var boolean */ @@ -91,12 +99,12 @@ /** * Switch to enable/disable the 'take' button underneath each - * open token. + * open token. * * @var boolean */ protected $showTakeButton = true; - + /** * Switch to put the display of the headers on or off * @@ -159,8 +167,15 @@ $td->appendAttrib('class', $selectedClass); $td->appendAttrib('class', $bridge->row_class); - foreach($model->getItemsOrdered() as $name) { - if ($label = $model->get($name, 'label')) { + // Apply filter on the answers displayed + $answerNames = $model->getItemsOrdered(); + if ($this->answerFilter instanceof Gems_Tracker_Snippets_AnswerNameFilterInterface) { + $answerNames = $this->answerFilter->filterAnswers($bridge, $model, $answerNames); + } + + foreach($answerNames as $name) { + $label = $model->get($name, 'label'); + if (strlen($label)) { $bridge->thd($label, array('class' => $model->get($name, 'thClass'))); $td = $bridge->td($bridge->$name); Added: trunk/library/classes/Gems/Tracker/Snippets/AnswerNameFilterInterface.php =================================================================== --- trunk/library/classes/Gems/Tracker/Snippets/AnswerNameFilterInterface.php (rev 0) +++ trunk/library/classes/Gems/Tracker/Snippets/AnswerNameFilterInterface.php 2012-09-12 15:49:52 UTC (rev 939) @@ -0,0 +1,61 @@ +<?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: AnswerNameFilterInterface.php 203 2012-01-01 12:51:32Z matijs $ + */ + +/** + * Defines filters for answer display + * + * @package Gems + * @subpackage Tracker + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.5 + */ +interface Gems_Tracker_Snippets_AnswerNameFilterInterface +{ + /** + * This function is called in addBrowseTableColumns() to filter the names displayed + * by AnswerModelSnippetGeneric. + * + * @see Gems_Tracker_Snippets_AnswerModelSnippetGeneric + * + * @param MUtil_Model_TableBridge $bridge + * @param MUtil_Model_ModelAbstract $model + * @param array $currentNames The current names in use (allows chaining) + * @return array Of the names of labels that should be shown + */ + public function filterAnswers(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model, array $currentNames); +} Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php 2012-09-12 15:49:52 UTC (rev 939) @@ -599,6 +599,7 @@ public function applyToModel(MUtil_Model_ModelAbstract $model) { $map = $this->_getMap(); + $parent = null; foreach ($map as $name => $field) { @@ -621,8 +622,9 @@ // Juggle the labels for sub-questions etc.. if (isset($field['sq_question'])) { if (isset($tmpres['label'])) { - // Add non answered question for grouping - $model->set('_' . $name . '_', $tmpres); + // Add non answered question for grouping and make it the current parent + $parent = '_' . $name . '_'; + $model->set($parent, $tmpres); } if (isset($field['sq_question1'])) { $tmpres['label'] = MUtil_Html::raw(sprintf($this->translate->_('%s: %s'), $this->removeHtml($field['sq_question']), $this->removeHtml($field['sq_question1']))); @@ -639,6 +641,15 @@ if (isset($field['code']) && (! $model->has($field['code']))) { $name = $field['code']; } + + // Parent storage + if ('question' === $tmpres['thClass']) { + $parent = $name; + } elseif ($parent) { + // Add the name of the parent item + $tmpres['parent_question'] = $parent; + } + $model->set($name, $tmpres); $oldfld = $field; Modified: trunk/library/classes/Gems/Tracker/Survey.php =================================================================== --- trunk/library/classes/Gems/Tracker/Survey.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/Gems/Tracker/Survey.php 2012-09-12 15:49:52 UTC (rev 939) @@ -241,6 +241,21 @@ } /** + * Returns a snippet name that can be used to display the answers to the token or nothing. + * + * @param Gems_Tracker_Token $token + * @return array Of snippet names + */ + public function getAnswerSnippetNames(Gems_Tracker_Token $token) + { + if (isset($this->_gemsSurvey['gsu_display_event'])) { + $event = $this->events->loadSurveyDisplayEvent($this->_gemsSurvey['gsu_display_event']); + + return $event->getAnswerDisplaySnippets($token); + } + } + + /** * Returns a model for diaplying the answers to this survey in the requested language. * * @param string $language (ISO) language string Modified: trunk/library/classes/Gems/Tracker/Token.php =================================================================== --- trunk/library/classes/Gems/Tracker/Token.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/Gems/Tracker/Token.php 2012-09-12 15:49:52 UTC (rev 939) @@ -63,7 +63,14 @@ protected $_gemsData = array(); /** + * Helper var for preventing infinite loops * + * @var boolean + */ + protected $_loopCheck = false; + + /** + * * @var Gems_Tracker_Token */ private $_nextToken = null; @@ -555,6 +562,24 @@ public function getAnswerSnippetNames() { if ($this->exists) { + if (! $this->_loopCheck) { + // Events should not call $this->getAnswerSnippetNames() but + // $this->getTrackEngine()->getAnswerSnippetNames(). Just in + // case the code writer made a mistake we have a guard here. + $this->_loopCheck = true; + + $snippets = $this->getTrackEngine()->getRoundAnswerSnippets($this); + + if (! $snippets) { + $snippets = $this->getSurvey()->getAnswerSnippetNames($this); + } + + if ($snippets) { + $this->_loopCheck = false; + return $snippets; + } + } + return $this->getTrackEngine()->getAnswerSnippetNames(); } else { return 'TokenNotFoundSnippet'; @@ -1093,7 +1118,7 @@ $values['gto_return_url'] = $this->calculateReturnUrl(); // MUtil_Echo::track($values); - + $this->_updateToken($values, $userId); $this->handleBeforeAnswering(); Modified: trunk/library/classes/MUtil/Controller/Action.php =================================================================== --- trunk/library/classes/MUtil/Controller/Action.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/MUtil/Controller/Action.php 2012-09-12 15:49:52 UTC (rev 939) @@ -187,20 +187,13 @@ public function addSnippet($filename, $parameter_value_pairs = null) { $extraSource = MUtil_Ra::pairs(func_get_args(), 1); - $snippet = $this->getSnippet($filename, $extraSource); - - if ($snippet->hasHtmlOutput()) { - $this->html[] = $snippet; - return $snippet; - } elseif ($url = $snippet->getRedirectRoute()) { - $snippet->redirectRoute(); - } - - return false; + $results = $this->addSnippets($filename, $extraSource); + return $results ? reset($results) : false; } /** - * Searches and loads a .php snippet file. + * Searches and loads multiple .php snippet files and adds them to this->html using the filename as + * content key, unless that key already exists. * * @param array $filenames Names of snippets * @param MUtil_Ra::pairs $parameter_value_pairs name/value pairs ot add to the source for this snippet @@ -211,13 +204,17 @@ if ($filenames) { $extraSource = MUtil_Ra::pairs(func_get_args(), 1); - $results = array(); - foreach ((array) $filenames as $filename) { - $snippet = $this->getSnippet($filename, $extraSource); + $results = array(); + $snippets = $this->getSnippets($filenames, $extraSource); + foreach ($snippets as $filename => $snippet) { if ($snippet->hasHtmlOutput()) { - $this->html[] = $snippet; - $results[$filename] = $snippet; + if (isset($this->html[$filename])) { + $this->html[] = $snippet; + } else { + $this->html[$filename] = $snippet; + } + $results[$filename] = $snippet; } elseif ($snippet->getRedirectRoute()) { $snippet->redirectRoute(); @@ -288,19 +285,47 @@ */ public function getSnippet($filename, $parameter_value_pairs = null) { - if (! $this->html) { - $this->initHtml(); - } + $extraSource = MUtil_Ra::pairs(func_get_args(), 1); + $results = $this->getSnippets($filename, $extraSource); + return reset($results); + } + /** + * Searches and loads multiple .php snippet file. + * + * @param string $filenames Array of snippet names with optionally extra parameters included + * @param MUtil_Ra::pairs $parameter_value_pairs name/value pairs ot add to the source for this snippet + * @return array Of filename => MUtil_Snippets_SnippetInterface snippets + */ + public function getSnippets($filenames, $parameter_value_pairs = null) + { if (func_num_args() > 1) { $extraSourceParameters = MUtil_Ra::pairs(func_get_args(), 1); } else { $extraSourceParameters = array(); } - $loader = $this->getSnippetLoader(); + if (is_array($filenames)) { + list($filenames, $params) = MUtil_Ra::keySplit($filenames); - return $loader->getSnippet($filename, $extraSourceParameters); + if ($params) { + $extraSourceParameters = $params + $extraSourceParameters; + } + } else { + $filenames = array($filenames); + } + + $results = array(); + + if ($filenames) { + $loader = $this->getSnippetLoader(); + + foreach ($filenames as $filename) { + $results[$filename] = $loader->getSnippet($filename, $extraSourceParameters); + } + } + + return $results; } /** Modified: trunk/library/classes/MUtil/Html.php =================================================================== --- trunk/library/classes/MUtil/Html.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/MUtil/Html.php 2012-09-12 15:49:52 UTC (rev 939) @@ -305,6 +305,19 @@ $extraSourceParameters = array(); } + if (is_array($name)) { + list($names, $params) = MUtil_Ra::keySplit($name); + + if ($params) { + $extraSourceParameters = $params + $extraSourceParameters; + } + if (isset($names[0])) { + $name = $names[0]; + } else { + throw new MUtil_Html_HtmlException('Missing snippet name in call to create snippet.'); + } + } + $loader = self::getSnippetLoader(); $snippet = $loader->getSnippet($name, $extraSourceParameters); Modified: trunk/library/classes/MUtil/Model/JoinModel.php =================================================================== --- trunk/library/classes/MUtil/Model/JoinModel.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/MUtil/Model/JoinModel.php 2012-09-12 15:49:52 UTC (rev 939) @@ -266,28 +266,35 @@ // Gotta repeat this every time, as keys may be set later foreach ($this->_joinFields as $source => $target) { // Use is_string as $target and $target can be e.g. a Zend_Db_Expr() object - 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]; + // as $source is an index keys it must be a string + if (is_string($target)) { + if (! (isset($newValues[$target]) && $newValues[$target])) { + if (! (isset($newValues[$source]) && $newValues[$source])) { + if (MUtil_Model::$verbose) { + MUtil_Echo::r('Missing: ' . $source . ' -> ' . $target, 'ERROR!'); + } + continue; + } + $newValues[$target] = $newValues[$source]; - } elseif (! (is_string($source) && isset($newValues[$source]) && $newValues[$source])) { - $newValues[$source] = $newValues[$target]; + } elseif (! (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]; + } 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]; + // Switch the target value to the value in the source field. + // + // JOIN FIELD ORDER IS IMPORTANT!!! + // The changing field must be stated first in the join statement. + $newValues[$target] = $newValues[$source]; + } + } elseif ($target instanceof Zend_Db_Expr && (! (isset($newValues[$source]) && $newValues[$source]))) { + $newValues[$source] = $target; } } Modified: trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php =================================================================== --- trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php 2012-09-11 14:00:57 UTC (rev 938) +++ trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php 2012-09-12 15:49:52 UTC (rev 939) @@ -184,12 +184,14 @@ $model->trackUsage(); $table = $this->getBrowseTable($model); - if ($this->browse) { - $paginator = $model->loadPaginator(); - $table->setRepeater($paginator); - $this->addPaginator($table, $paginator); - } else { - $table->setRepeater($model->loadRepeatable()); + if (! $table->getRepeater()) { + if ($this->browse) { + $paginator = $model->loadPaginator(); + $table->setRepeater($paginator); + $this->addPaginator($table, $paginator); + } else { + $table->setRepeater($model->loadRepeatable()); + } } return $table; 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-09-11 13:10:42
|
Revision: 937 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=937&view=rev Author: matijsdejong Date: 2012-09-11 13:10:36 +0000 (Tue, 11 Sep 2012) Log Message: ----------- #566: added rounds fields and updated field length Modified Paths: -------------- trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php trunk/library/configs/db/patches.sql trunk/library/configs/db/tables/gems__rounds.40.sql trunk/library/configs/db/tables/gems__surveys.30.sql trunk/library/configs/db/tables/gems__tracks.30.sql Modified: trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2012-09-07 11:29:53 UTC (rev 936) +++ trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2012-09-11 13:10:36 UTC (rev 937) @@ -734,12 +734,13 @@ $model->set('gro_id_track', 'label', $this->_('Track'), 'elementClass', 'exhibitor', 'multiOptions', MUtil_Lazy::call($this->util->getTrackData()->getAllTracks)); } - $model->set('gro_id_survey', 'label', $this->_('Survey'), 'multiOptions', $this->util->getTrackData()->getAllSurveysAndDescriptions()); + $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'); + $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_display_event', 'label', $this->_('Answer display'), 'multiOptions', $this->events->listSurveyDisplayEvents()); + $model->set('gro_active', 'label', $this->_('Active'), 'multiOptions', $this->util->getTranslated()->getYesNo(), 'elementClass', 'checkbox'); $model->addColumn( "CASE WHEN gro_active = 1 THEN '' ELSE 'deleted' END", Modified: trunk/library/configs/db/patches.sql =================================================================== --- trunk/library/configs/db/patches.sql 2012-09-07 11:29:53 UTC (rev 936) +++ trunk/library/configs/db/patches.sql 2012-09-11 13:10:36 UTC (rev 937) @@ -429,5 +429,13 @@ ALTER TABLE `gems__tokens` ADD INDEX ( `gto_completion_time` ); ALTER TABLE `gems__tracks` ADD INDEX ( `gtr_track_name` ); --- PATCH: Add snippet class to gems -ALTER TABLE `gems__surveys` ADD gsu_display_event varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' AFTER gsu_completed_event; +-- PATCH: Add answer display snippets to gems, lengthen class name space +ALTER TABLE `gems__surveys` CHANGE gsu_survey_pdf gsu_survey_pdf varchar(128) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null; +ALTER TABLE `gems__surveys` CHANGE gsu_beforeanswering_event gsu_beforeanswering_event varchar(128) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null; +ALTER TABLE `gems__surveys` CHANGE gsu_completed_event gsu_completed_event varchar(128) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null; +ALTER TABLE `gems__surveys` ADD gsu_display_event varchar(128) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NULL AFTER gsu_completed_event; + +ALTER TABLE `gems__rounds` CHANGE gro_changed_event gro_changed_event varchar(128) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null; +ALTER TABLE `gems__rounds` ADD gro_display_event varchar(128) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NULL AFTER gro_changed_event; + +ALTER TABLE `gems__tracks` CHANGE gtr_completed_event gtr_completed_event varchar(128) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null; Modified: trunk/library/configs/db/tables/gems__rounds.40.sql =================================================================== --- trunk/library/configs/db/tables/gems__rounds.40.sql 2012-09-07 11:29:53 UTC (rev 936) +++ trunk/library/configs/db/tables/gems__rounds.40.sql 2012-09-11 13:10:36 UTC (rev 937) @@ -13,7 +13,8 @@ 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, + gro_changed_event varchar(128) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, + gro_display_event varchar(128) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null, -- depreciated gro_valid_after char(6) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', Modified: trunk/library/configs/db/tables/gems__surveys.30.sql =================================================================== --- trunk/library/configs/db/tables/gems__surveys.30.sql 2012-09-07 11:29:53 UTC (rev 936) +++ trunk/library/configs/db/tables/gems__surveys.30.sql 2012-09-11 13:10:36 UTC (rev 937) @@ -12,10 +12,10 @@ gsu_token_table varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', -- end depreciated - gsu_survey_pdf varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', - gsu_beforeanswering_event varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', - gsu_completed_event varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', - gsu_display_event varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', + gsu_survey_pdf varchar(128) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', + gsu_beforeanswering_event varchar(128) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', + gsu_completed_event varchar(128) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', + gsu_display_event varchar(128) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', gsu_id_source int unsigned not null references gems__sources (gso_id_source), Modified: trunk/library/configs/db/tables/gems__tracks.30.sql =================================================================== --- trunk/library/configs/db/tables/gems__tracks.30.sql 2012-09-07 11:29:53 UTC (rev 936) +++ trunk/library/configs/db/tables/gems__tracks.30.sql 2012-09-11 13:10:36 UTC (rev 937) @@ -17,7 +17,8 @@ gtr_track_model varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'TrackModel', -- end depreciated - gtr_track_class varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null, + gtr_track_class varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null, + gtr_completed_event varchar(128) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', -- Yes, quick and dirty, will correct later (probably) gtr_organizations varchar(250) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-07 11:30:02
|
Revision: 936 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=936&view=rev Author: mennodekker Date: 2012-09-07 11:29:53 +0000 (Fri, 07 Sep 2012) Log Message: ----------- fixes coming from new unit tests Modified Paths: -------------- trunk/library/classes/Gems/Tracker/Token.php trunk/library/configs/db/tables/gems__tokens.200.sql Modified: trunk/library/classes/Gems/Tracker/Token.php =================================================================== --- trunk/library/classes/Gems/Tracker/Token.php 2012-09-07 11:28:40 UTC (rev 935) +++ trunk/library/classes/Gems/Tracker/Token.php 2012-09-07 11:29:53 UTC (rev 936) @@ -1289,7 +1289,10 @@ ->forTokenId($this->_tokenId); $this->_gemsData = $tokenSelect->fetchRow(); - + if (false == $this->_gemsData) { + // on failure, reset to empty array + $this->_gemsData = array(); + } } $this->exists = isset($this->_gemsData['gto_id_token']); Modified: trunk/library/configs/db/tables/gems__tokens.200.sql =================================================================== --- trunk/library/configs/db/tables/gems__tokens.200.sql 2012-09-07 11:28:40 UTC (rev 935) +++ trunk/library/configs/db/tables/gems__tokens.200.sql 2012-09-07 11:29:53 UTC (rev 936) @@ -26,6 +26,7 @@ gto_valid_from datetime, gto_valid_until datetime, gto_mail_sent_date date, + gto_mail_sent_num int(11) unsigned not null default 0, gto_next_mail_date date, gto_start_time datetime, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-07 11:28:50
|
Revision: 935 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=935&view=rev Author: mennodekker Date: 2012-09-07 11:28:40 +0000 (Fri, 07 Sep 2012) Log Message: ----------- forgot that dbtests need the parent teardown to resetdb Modified Paths: -------------- trunk/test/classes/Gems/Tracker/TokenTest.php Modified: trunk/test/classes/Gems/Tracker/TokenTest.php =================================================================== --- trunk/test/classes/Gems/Tracker/TokenTest.php 2012-09-07 11:11:06 UTC (rev 934) +++ trunk/test/classes/Gems/Tracker/TokenTest.php 2012-09-07 11:28:40 UTC (rev 935) @@ -78,6 +78,7 @@ */ protected function tearDown() { + parent::tearDown(); } protected function getInitSql() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-09-07 11:11:16
|
Revision: 934 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=934&view=rev Author: mennodekker Date: 2012-09-07 11:11:06 +0000 (Fri, 07 Sep 2012) Log Message: ----------- Database test for Token object created, using multiple (reusable) tabledefs but separate dataset for each test class to keep data private to the test. Modified Paths: -------------- trunk/test/classes/Gems/Tracker/TokenTest.php Added Paths: ----------- trunk/test/classes/Gems/Test/DbTestAbstract.php trunk/test/classes/Gems/Tracker/TokenTest.xml trunk/test/data/gems__consents.sql trunk/test/data/gems__reception_codes.sql trunk/test/data/gems__respondent2org.sql trunk/test/data/gems__respondents.sql trunk/test/data/gems__tokens.sql Added: trunk/test/classes/Gems/Test/DbTestAbstract.php =================================================================== --- trunk/test/classes/Gems/Test/DbTestAbstract.php (rev 0) +++ trunk/test/classes/Gems/Test/DbTestAbstract.php 2012-09-07 11:11:06 UTC (rev 934) @@ -0,0 +1,114 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * Base test class for Gems object test cases + * + * @package Gems + * @subpackage Test + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $Id: TestAbstract.php 925 2012-09-05 09:59:13Z mennodekker $ + */ + +/** + * Base test class for Gems object test cases that involve a database test + * + * @package Gems + * @subpackage Test + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $Id: TestAbstract.php 925 2012-09-05 09:59:13Z mennodekker $ + */ +abstract class Gems_Test_DbTestAbstract extends Zend_Test_PHPUnit_DatabaseTestCase +{ + /** + * @var Gems_Loader + */ + protected $loader = null; + + /** + * @var Zend_Db + */ + protected $db = null; + + /** + * + * @var PHPUnit_Extensions_Database_DB_IDatabaseConnection + */ + protected $_connectionMock; + + /** + * Sets up the fixture, for example, opens a network connection. + * This method is called before a test is executed. + */ + protected function setUp() + { + parent::setUp(); + + global $GEMS_DIRS; + + $this->db = $this->getConnection()->getConnection(); + + Zend_Registry::set('db', $this->db); + + $this->loader = new Gems_Loader(Zend_Registry::getInstance(), $GEMS_DIRS); + + Zend_Registry::set('loader', $this->loader); + } + + /** + * Returns the test database connection. + * + * @return PHPUnit_Extensions_Database_DB_IDatabaseConnection + */ + protected function getConnection() + { + if($this->_connectionMock == null) { + $connection = Zend_Db::factory('Pdo_Sqlite', array('dbname' => ':memory:', 'username' => 'test')); + + if ($sqlFiles = $this->getInitSql()) { + foreach ($sqlFiles as $file) { + $sql = file_get_contents($file); + $stmt = $connection->query($sql); + } + } + $this->_connectionMock = $this->createZendDbConnection( + $connection, 'zfunittests' + ); + Zend_Db_Table_Abstract::setDefaultAdapter($connection); + } + + return $this->_connectionMock; + } + + /** + * Return an array of files to run on init + */ + abstract protected function getInitSql(); +} \ No newline at end of file Modified: trunk/test/classes/Gems/Tracker/TokenTest.php =================================================================== --- trunk/test/classes/Gems/Tracker/TokenTest.php 2012-09-07 07:25:28 UTC (rev 933) +++ trunk/test/classes/Gems/Tracker/TokenTest.php 2012-09-07 11:11:06 UTC (rev 934) @@ -47,7 +47,7 @@ * @license New BSD License * @version $Id$ */ -class Gems_Tracker_TokenTest extends Gems_Test_TestAbstract +class Gems_Tracker_TokenTest extends Gems_Test_DbTestAbstract { /** * @var Gems_Tracker_Token @@ -55,12 +55,19 @@ protected $token; /** + * @var Gems_Tracker + */ + protected $tracker; + + /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { parent::setUp(); + + $this->tracker = $this->loader->getTracker(); $this->token = $this->tracker->getToken(array('gto_id_token' => 500)); } @@ -73,7 +80,33 @@ { } + protected function getInitSql() + { + $path = GEMS_WEB_DIR . '/data/'; + + // For successful testing of the complete tokens class, we need more tables + return array( + $path . 'gems__tokens.sql', + $path . 'gems__reception_codes.sql', + $path . 'gems__respondents.sql', + $path . 'gems__respondent2org.sql', + $path . 'gems__consents.sql' + ); + } + /** + * Returns the test dataset. + * + * @return PHPUnit_Extensions_Database_DataSet_IDataSet + */ + protected function getDataSet() + { + //Dataset TokenTest.xml has the minimal data we need to perform our tests + $classFile = str_replace('.php', '.xml', __FILE__); + return $this->createFlatXMLDataSet($classFile); + } + + /** * @covers Gems_Tracker_Token::applyToMenuSource * @todo Implement testApplyToMenuSource(). */ @@ -395,7 +428,13 @@ */ public function testGetRespondentId() { - $this->assertNotEmpty($this->token->getRespondentId(), 'Any token should have a respondentId'); + $this->assertNotEmpty($this->tracker->getToken('1')->getRespondentId(), 'Any token should have a respondentId'); + + try { + // This one does not exists and should throw an error + $this->tracker->getToken('2')->getRespondentId(); + } catch (Exception $e) {} + $this->assertInstanceOf('Gems_Exception', $e, 'Token not loaded correctly'); } /** @@ -817,4 +856,30 @@ 'This test has not been implemented yet.' ); } + + /** + * This tests if the public property exists is set correctly + * + * @dataProvider providerTokenData + */ + public function testTokenExists($tokenData, $exists) + { + $token = $this->tracker->getToken($tokenData); + $this->assertEquals($exists, $token->exists); + } + + public function providerTokenData() + { + return array( + array( + '1', + true), // Is in the table + array( + '2', + false), // Is not in the table + array( + array('gto_id_token' => '111'), // Array provided so not checked and accepted as is + true) + ); + } } Added: trunk/test/classes/Gems/Tracker/TokenTest.xml =================================================================== --- trunk/test/classes/Gems/Tracker/TokenTest.xml (rev 0) +++ trunk/test/classes/Gems/Tracker/TokenTest.xml 2012-09-07 11:11:06 UTC (rev 934) @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<dataset> + <gems__tokens gto_id_token="1" gto_id_respondent_track="1" gto_id_round="0" gto_id_respondent="1234" gto_id_organization="1" gto_id_track="1" gto_id_survey="1" gto_round_order="1" gto_round_description="" gto_valid_from="NULL" gto_valid_until="NULL" gto_mail_sent_date="NULL" gto_mail_sent_num="0" gto_next_mail_date="NULL" gto_start_time="NULL" gto_completion_time="NULL" gto_duration_in_sec="NULL" gto_result="NULL" gto_comment="NULL" gto_reception_code="OK" gto_return_url="NULL" gto_in_source="1" gto_by="1" gto_changed="2012-03-29 13:50:22" gto_changed_by="1" gto_created="2012-03-29 10:55:55" gto_created_by="1" /> + <gems__reception_codes grc_id_reception_code="OK" grc_description="Ok code" grc_changed_by="1" grc_created="2012-09-07" grc_created_by="1"/> + <gems__respondents grs_id_user="1234" grs_changed_by="1" grs_created="2012-09-07" grs_created_by="1"/> + <gems__respondent2org gr2o_id_user="1234" gr2o_id_organization="1" gr2o_consent="ok" gr2o_patient_nr="abc" gr2o_opened_by="1" gr2o_changed="2012-09-07" gr2o_changed_by="1" gr2o_created="2012-09-07" gr2o_created_by="1"/> + <gems__consents gco_description="informed" gco_changed_by="1" gco_created="2012-09-07" gco_created_by="1"/> +</dataset> \ No newline at end of file Added: trunk/test/data/gems__consents.sql =================================================================== --- trunk/test/data/gems__consents.sql (rev 0) +++ trunk/test/data/gems__consents.sql 2012-09-07 11:11:06 UTC (rev 934) @@ -0,0 +1,12 @@ +CREATE TABLE gems__consents ( + gco_description varchar(20) not null, + gco_order smallint not null default 10, + gco_code varchar(20) not null default 'do not use', + + gco_changed timestamp not null default current_timestamp, + gco_changed_by bigint unsigned not null, + gco_created timestamp not null, + gco_created_by bigint unsigned not null, + + PRIMARY KEY (gco_description) + ); \ No newline at end of file Added: trunk/test/data/gems__reception_codes.sql =================================================================== --- trunk/test/data/gems__reception_codes.sql (rev 0) +++ trunk/test/data/gems__reception_codes.sql 2012-09-07 11:11:06 UTC (rev 934) @@ -0,0 +1,20 @@ +CREATE TABLE gems__reception_codes ( + grc_id_reception_code varchar(20) not null, + grc_description varchar(40) not null, + + grc_success boolean not null default 0, + + grc_for_surveys tinyint not null default 0, + grc_redo_survey tinyint not null default 0, + grc_for_tracks boolean not null default 0, + grc_for_respondents boolean not null default 0, + grc_overwrite_answers boolean not null default 0, + grc_active boolean not null default 1, + + grc_changed timestamp not null default current_timestamp, + grc_changed_by bigint unsigned not null, + grc_created timestamp not null, + grc_created_by bigint unsigned not null, + + PRIMARY KEY (grc_id_reception_code) + ); \ No newline at end of file Added: trunk/test/data/gems__respondent2org.sql =================================================================== --- trunk/test/data/gems__respondent2org.sql (rev 0) +++ trunk/test/data/gems__respondent2org.sql 2012-09-07 11:11:06 UTC (rev 934) @@ -0,0 +1,22 @@ +CREATE TABLE gems__respondent2org ( + gr2o_patient_nr varchar(7) not null, + gr2o_id_organization bigint unsigned not null + references gems__organizations (gor_id_organization), + + gr2o_id_user bigint unsigned not null + references gems__respondents (grs_id_user), + + gr2o_consent varchar(20) not null default 'Unknown' + references gems__consents (gco_description), + gr2o_reception_code varchar(20) default 'OK' not null + references gems__reception_codes (grc_id_reception_code), + + gr2o_opened timestamp not null default current_timestamp, + gr2o_opened_by bigint unsigned not null, + gr2o_changed timestamp not null, + gr2o_changed_by bigint unsigned not null, + gr2o_created timestamp not null, + gr2o_created_by bigint unsigned not null, + + PRIMARY KEY (gr2o_patient_nr, gr2o_id_organization) + ); \ No newline at end of file Added: trunk/test/data/gems__respondents.sql =================================================================== --- trunk/test/data/gems__respondents.sql (rev 0) +++ trunk/test/data/gems__respondents.sql 2012-09-07 11:11:06 UTC (rev 934) @@ -0,0 +1,32 @@ +CREATE TABLE gems__respondents ( + grs_id_user bigint unsigned not null, + + grs_ssn varchar(32) + null unique, + + grs_iso_lang char(2) + not null default 'en' references gems__languages (gml_iso_lang), + + grs_email varchar(100) null, + + grs_first_name varchar(30) , + grs_surname_prefix varchar(10) , + grs_last_name varchar(50) , + grs_gender char(1) + not null default 'U', + grs_birthday date, + + grs_address_1 varchar(80) , + grs_address_2 varchar(80) , + grs_zipcode varchar(10) , + grs_city varchar(40) , + grs_iso_country char(2) not null default 'NL', + grs_phone_1 varchar(25) , + + grs_changed timestamp not null default current_timestamp, + grs_changed_by bigint unsigned not null, + grs_created timestamp not null, + grs_created_by bigint unsigned not null, + + PRIMARY KEY(grs_id_user) + ); \ No newline at end of file Added: trunk/test/data/gems__tokens.sql =================================================================== --- trunk/test/data/gems__tokens.sql (rev 0) +++ trunk/test/data/gems__tokens.sql 2012-09-07 11:11:06 UTC (rev 934) @@ -0,0 +1,45 @@ +CREATE TABLE gems__tokens ( + gto_id_token varchar(9) not null, + + gto_id_respondent_track bigint not null, + gto_id_round bigint not null, + + -- non-changing fields calculated from previous two: + gto_id_respondent bigint not null, + gto_id_organization bigint not null, + gto_id_track bigint not null, + + -- values initially filled from gems__rounds, but that may get different values later on + gto_id_survey bigint, + + -- values initially filled from gems__rounds, but that might get different values later on, but but not now + gto_round_order int not null default 10, + gto_round_description varchar(100) null, + + -- real data + gto_valid_from datetime, + gto_valid_until datetime, + gto_mail_sent_date date, + gto_mail_sent_num int(11) not null default 0, + gto_next_mail_date date, + + gto_start_time datetime, + gto_in_source boolean not null default 0, + gto_by bigint(20) NULL, + + gto_completion_time datetime, + gto_duration_in_sec bigint(20) NULL, + gto_result varchar(20) , + + gto_comment varchar(250) null default null, + gto_reception_code varchar(20) default 'OK' not null, + + gto_return_url varchar(250) null default null, + + gto_changed timestamp not null default current_timestamp, + gto_changed_by bigint not null, + gto_created timestamp not null, + gto_created_by bigint not null, + + PRIMARY KEY (gto_id_token) + ); \ 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-09-07 07:25:39
|
Revision: 933 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=933&view=rev Author: mennodekker Date: 2012-09-07 07:25:28 +0000 (Fri, 07 Sep 2012) Log Message: ----------- Fallback EventLoader should use lowercased path Modified Paths: -------------- trunk/library/classes/Gems/Events.php Modified: trunk/library/classes/Gems/Events.php =================================================================== --- trunk/library/classes/Gems/Events.php 2012-09-06 14:26:23 UTC (rev 932) +++ trunk/library/classes/Gems/Events.php 2012-09-07 07:25:28 UTC (rev 933) @@ -182,7 +182,7 @@ if (! class_exists($eventName, true)) { // Autoload is used for Zend standard defined classnames, // so if the class is not autoloaded, define the path here. - $filename = APPLICATION_PATH . '/' . self::EVENTS_DIR . 's/' . $eventType . '/' . $eventName . '.php'; + $filename = APPLICATION_PATH . '/' . strtolower(self::EVENTS_DIR . 's/' . $eventType) . '/' . $eventName . '.php'; if (! file_exists($filename)) { throw new Gems_Exception_Coding("The event '$eventName' of type '$eventType' does not exist at location: $filename."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |