|
From: <gem...@li...> - 2013-03-14 15:44:57
|
Revision: 1186
http://sourceforge.net/p/gemstracker/code/1186
Author: matijsdejong
Date: 2013-03-14 15:44:54 +0000 (Thu, 14 Mar 2013)
Log Message:
-----------
Enable 128 bit hashes for ssn
Gems_Snippets_ModelFormSnippetAbstract can now switch between tabbed and non-tabbed mode
New JavascriptArrayAttribute simplifies common javascript attribute commands
Added onblur to text elements
Allow algorithms in the project valueHash function
Modified Paths:
--------------
trunk/library/classes/Gems/Default/RespondentNewAction.php
trunk/library/classes/Gems/Model/RespondentModel.php
trunk/library/classes/Gems/Model/RespondentNlModel.php
trunk/library/classes/Gems/Project/ProjectSettings.php
trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php
trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php
trunk/library/classes/MUtil/Html/OnClickArrayAttribute.php
trunk/library/classes/MUtil/Model/FormBridge.php
trunk/library/classes/MUtil/Validate/Db/UniqueValue.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__respondents.30.sql
Added Paths:
-----------
trunk/library/classes/Gems/Snippets/RespondentFormSnippet.php
trunk/library/classes/MUtil/Html/JavascriptArrayAttribute.php
Modified: trunk/library/classes/Gems/Default/RespondentNewAction.php
===================================================================
--- trunk/library/classes/Gems/Default/RespondentNewAction.php 2013-03-14 13:44:56 UTC (rev 1185)
+++ trunk/library/classes/Gems/Default/RespondentNewAction.php 2013-03-14 15:44:54 UTC (rev 1186)
@@ -56,14 +56,14 @@
*
* @var array Mixed key => value array for snippet initialization
*/
- protected $createEditParameters = array('resetRoute' => true);
+ protected $createEditParameters = array('resetRoute' => true, 'useTabbedForm' => true);
/**
* The snippets used for the create and edit actions.
*
* @var mixed String or array of snippets name
*/
- protected $createEditSnippets = 'ModelTabFormSnippetGeneric';
+ protected $createEditSnippets = 'RespondentFormSnippet';
/**
* The snippets used for the delete action.
Modified: trunk/library/classes/Gems/Model/RespondentModel.php
===================================================================
--- trunk/library/classes/Gems/Model/RespondentModel.php 2013-03-14 13:44:56 UTC (rev 1185)
+++ trunk/library/classes/Gems/Model/RespondentModel.php 2013-03-14 15:44:54 UTC (rev 1186)
@@ -55,6 +55,15 @@
const SSN_OPEN = 2;
/**
+ * Determines the algorithm used to hash the social security number
+ *
+ * Can be changed is derived classes, set to null to use old md5() method
+ *
+ * @var int One of the SSN_ constants
+ */
+ public $hashAlgorithm = 'sha512';
+
+ /**
* Determines how the social security number is stored.
*
* Can be changed is derived classes.
@@ -75,6 +84,12 @@
protected $util;
/**
+ *
+ * @var Zend_View
+ */
+ public $view;
+
+ /**
* Self constructor
*/
public function __construct()
@@ -314,7 +329,13 @@
$ucfirst = new Zend_Filter_Callback('ucfirst');
if ($this->hashSsn !== Gems_Model_RespondentModel::SSN_HIDE) {
- $this->set('grs_ssn', 'validator[]', $this->createUniqueValidator('grs_ssn'));
+ $onblur = new MUtil_Html_JavascriptArrayAttribute('onblur');
+ $onblur->addSumbitOnChange('this.value');
+
+ $this->set('grs_ssn',
+ 'onblur', $onblur->render($this->view), // Render needed as element does not know HtmlInterface
+ 'validator[]', $this->createUniqueValidator('grs_ssn')
+ );
}
$this->setIfExists('gr2o_patient_nr',
@@ -394,7 +415,7 @@
public function applyHash(&$filterValue, $filterKey)
{
if ('grs_ssn' === $filterKey) {
- $filterValue = $this->project->getValueHash($filterValue);
+ $filterValue = $this->project->getValueHash($filterValue, $this->hashAlgorithm);
}
}
@@ -457,7 +478,7 @@
public function saveSSN($value, $isNew = false, $name = null, array $context = array())
{
if ($value) {
- return $this->project->getValueHash($value);
+ return $this->project->getValueHash($value, $this->hashAlgorithm);
}
}
Modified: trunk/library/classes/Gems/Model/RespondentNlModel.php
===================================================================
--- trunk/library/classes/Gems/Model/RespondentNlModel.php 2013-03-14 13:44:56 UTC (rev 1185)
+++ trunk/library/classes/Gems/Model/RespondentNlModel.php 2013-03-14 15:44:54 UTC (rev 1186)
@@ -103,10 +103,16 @@
{
$bsn = new MUtil_Validate_Dutch_Burgerservicenummer();
+ $match = '/[^0-9\*]/';
+ /*
+ $m = preg_quote($model->hideSSN(true));
+ $match = '/(?>(?(?=' . $m . ')(?!' . $m . ').|[^0-9]))/';
+ MUtil_Echo::track($match);
+ // */
$model->set($fieldName,
'size', 10,
'maxlength', 12,
- 'filter', 'Digits',
+ 'filter', new Zend_Filter_PregReplace(array('match' => $match)),
'validator[]', $bsn);
if (APPLICATION_ENV !== 'production') {
Modified: trunk/library/classes/Gems/Project/ProjectSettings.php
===================================================================
--- trunk/library/classes/Gems/Project/ProjectSettings.php 2013-03-14 13:44:56 UTC (rev 1185)
+++ trunk/library/classes/Gems/Project/ProjectSettings.php 2013-03-14 15:44:54 UTC (rev 1186)
@@ -94,10 +94,10 @@
} elseif (! is_array($array)) {
$array = (array) $array;
}
-
+
// Now load default values for (new) keys and merge them with the ones provided by project.ini
$projectValues = $array + $this->_getDefaultValues();
-
+
parent::__construct($projectValues, ArrayObject::ARRAY_AS_PROPS);
if (! ($this->offsetExists('name') && $this->offsetGet('name'))) {
@@ -106,35 +106,35 @@
$this->offsetSet('multiLocale', $this->offsetExists('locales') && (count($this->offsetGet('locales')) > 1));
}
-
+
/**
* Set the default values for all keys.
- *
- * By doing this, we make sure the settings show up in the project information
+ *
+ * By doing this, we make sure the settings show up in the project information
* with the defaults even if the settings was not present in the project.ini
*/
public function _getDefaultValues()
{
-
+
return array(
'>>> defaults <<<' => '>>> Below are default settings, since they were not found in your project.ini <<<',
-
+
// What to do when user is going to or has answered a survey
'askNextDelay' => -1, // No auto advance
'askDelay' => -1, // No auto advance
-
+
// How to react to false token attempts
'askThrottle' => array(
'period' => 15 * 60, // Detection window: 15 minutes
'threshold' => 15 * 20, // Threshold: 20 requests per minute
'delay' => 10 // Delay: 10 seconds
),
-
+
'cache' => 'apc', // Use apc cache as default
-
+
'organization' => array(
'default' => -1 // No default organization
- )
+ )
);
}
@@ -309,8 +309,8 @@
return -1;
}
-
+
/**
* Returns the public description of this project.
*
@@ -591,12 +591,13 @@
}
/**
- * Returns a salted hash on the
+ * Returns a salted hash optionally using the specified hash algorithm
*
* @param string $value The value to hash
- * @return string The salted hash as a 32-character hexadecimal number.
+ * @param string $algoritm Optional, hash() algorithm; uses md5() otherwise
+ * @return string The salted hexadecimal hash, length depending on the algorithm (32 for md5, 128 for sha512.
*/
- public function getValueHash($value)
+ public function getValueHash($value, $algorithm = null)
{
$salt = $this->offsetExists('salt') ? $this->offsetGet('salt') : '';
@@ -607,8 +608,11 @@
}
// MUtil_Echo::track($value, md5($salted));
+ if (null == $algorithm) {
+ return md5($salted, false);
+ }
- return md5($salted, false);
+ return hash($algorithm, $value, false);
}
/**
Modified: trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php 2013-03-14 13:44:56 UTC (rev 1185)
+++ trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php 2013-03-14 15:44:54 UTC (rev 1186)
@@ -92,6 +92,98 @@
protected $routeAction = 'show';
/**
+ * When true a tabbed form is used.
+ *
+ * @var boolean
+ */
+ protected $useTabbedForm = false;
+
+ /**
+ * Adds elements from the model to the bridge that creates the form.
+ *
+ * Overrule this function to add different elements to the browse table, without
+ * having to recode the core table building code.
+ *
+ * @param MUtil_Model_FormBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ */
+ protected function addFormElements(MUtil_Model_FormBridge $bridge, MUtil_Model_ModelAbstract $model)
+ {
+ if (! $this->_form instanceof Gems_TabForm) {
+ parent::addFormElements($bridge, $model);
+ return;
+ }
+
+ //Get all elements in the model if not already done
+ $this->initItems();
+
+ // Add 'tooltip' to the allowed displayoptions
+ $displayOptions = $bridge->getAllowedOptions(MUtil_Model_FormBridge::DISPLAY_OPTIONS);
+ if (!array_search('tooltip', $displayOptions)) {
+ $displayOptions[] = 'tooltip';
+ }
+ $bridge->setAllowedOptions(MUtil_Model_FormBridge::DISPLAY_OPTIONS, $displayOptions);
+
+ $tab = 0;
+ $group = 0;
+ $oldTab = null;
+ // MUtil_Echo::track($model->getItemsOrdered());
+ foreach ($model->getItemsOrdered() as $name) {
+ // Get all options at once
+ $modelOptions = $model->get($name);
+ $tabName = $model->get($name, 'tab');
+ if ($tabName && ($tabName !== $oldTab)) {
+ $bridge->addTab('tab' . $tab, 'value', $tabName);
+ $oldTab = $tabName;
+ $tab++;
+ }
+
+ if ($model->has($name, 'label')) {
+ $bridge->add($name);
+
+ if ($theName = $model->get($name, 'startGroup')) {
+ //We start a new group here!
+ $groupElements = array();
+ $groupElements[] = $name;
+ $groupName = $theName;
+ } elseif ($theName = $model->get($name, 'endGroup')) {
+ //Ok, last element define the group
+ $groupElements[] = $name;
+ $bridge->addDisplayGroup('grp_' . $groupElements[0], $groupElements,
+ 'description', $groupName,
+ 'showLabels', ($theName == 'showLabels'),
+ 'class', 'grp' . $group);
+ $group++;
+ unset($groupElements);
+ unset($groupName);
+ } else {
+ //If we are in a group, add the elements to the group
+ if (isset($groupElements)) {
+ $groupElements[] = $name;
+ }
+ }
+ } else {
+ $bridge->addHidden($name);
+ }
+ unset($this->_items[$name]);
+ }
+ }
+
+ /**
+ * Simple default function for making sure there is a $this->_saveButton.
+ *
+ * As the save button is not part of the model - but of the interface - it
+ * does deserve it's own function.
+ */
+ protected function addSaveButton()
+ {
+ if ($this->_form instanceof Gems_TabForm) {
+ $this->_form->resetContext();
+ }
+ parent::addSaveButton();
+ }
+
+ /**
* Perform some actions on the form, right before it is displayed but already populated
*
* Here we add the table display to the form.
@@ -100,15 +192,36 @@
*/
public function beforeDisplay()
{
- $table = new MUtil_Html_TableElement(array('class' => $this->class));
- $table->setAsFormLayout($this->_form, true, true);
+ if ($this->_form instanceof Gems_TabForm) {
+ if ($links = $this->getMenuList()) {
+ $element = new MUtil_Form_Element_Html('formLinks');
+ $element->setValue($links)
+ ->setOrder(999)
+ ->removeDecorator('HtmlTag')
+ ->removeDecorator('Label')
+ ->removeDecorator('DtDdWrapper');
+;
- // There is only one row with formLayout, so all in output fields get class.
- $table['tbody'][0][0]->appendAttrib('class', $this->labelClass);
+ $this->_form->resetContext();
+ $this->_form->addElement($element);
- if ($links = $this->getMenuList()) {
- $table->tf(); // Add empty cell, no label
- $table->tf($links);
+ if (is_null($this->_form->getDisplayGroup(Gems_TabForm::GROUP_OTHER))) {
+ $this->_form->addDisplayGroup(array($element), Gems_TabForm::GROUP_OTHER);
+ } else {
+ $this->_form->getDisplayGroup(Gems_TabForm::GROUP_OTHER)->addElement($element);
+ }
+ }
+ } else {
+ $table = new MUtil_Html_TableElement(array('class' => $this->class));
+ $table->setAsFormLayout($this->_form, true, true);
+
+ // There is only one row with formLayout, so all in output fields get class.
+ $table['tbody'][0][0]->appendAttrib('class', $this->labelClass);
+
+ if ($links = $this->getMenuList()) {
+ $table->tf(); // Add empty cell, no label
+ $table->tf($links);
+ }
}
}
@@ -131,9 +244,17 @@
*/
protected function createForm($options = null)
{
- // $form = new Zend_Form($options);
- $form = new Gems_Form($options);
+ if ($this->useTabbedForm) {
+ $form = new Gems_TabForm($options);
+ $this->_form = $form;
+ //Now first add the saveButton as it needs to be outside the tabs
+ $this->addSaveButton();
+ } else {
+ // $form = new Zend_Form($options);
+ $form = new Gems_Form($options);
+ }
+
return $form;
}
Modified: trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php 2013-03-14 13:44:56 UTC (rev 1185)
+++ trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php 2013-03-14 15:44:54 UTC (rev 1186)
@@ -48,134 +48,9 @@
class Gems_Snippets_ModelTabFormSnippetGeneric extends Gems_Snippets_ModelFormSnippetGeneric
{
/**
+ * When true a tabbed form is used.
*
- * @var Gems_TabForm
+ * @var boolean
*/
- protected $_form;
-
- /**
- * Adds elements from the model to the bridge that creates the form.
- *
- * Overrule this function to add different elements to the browse table, without
- * having to recode the core table building code.
- *
- * @param MUtil_Model_FormBridge $bridge
- * @param MUtil_Model_ModelAbstract $model
- */
- protected function addFormElements(MUtil_Model_FormBridge $bridge, MUtil_Model_ModelAbstract $model)
- {
- //Get all elements in the model if not already done
- $this->initItems();
-
- // Add 'tooltip' to the allowed displayoptions
- $displayOptions = $bridge->getAllowedOptions(MUtil_Model_FormBridge::DISPLAY_OPTIONS);
- if (!array_search('tooltip', $displayOptions)) {
- $displayOptions[] = 'tooltip';
- }
- $bridge->setAllowedOptions(MUtil_Model_FormBridge::DISPLAY_OPTIONS, $displayOptions);
-
- $tab = 0;
- $group = 0;
- $oldTab = null;
- // MUtil_Echo::track($model->getItemsOrdered());
- foreach ($model->getItemsOrdered() as $name) {
- // Get all options at once
- $modelOptions = $model->get($name);
- $tabName = $model->get($name, 'tab');
- if ($tabName && ($tabName !== $oldTab)) {
- $bridge->addTab('tab' . $tab, 'value', $tabName);
- $oldTab = $tabName;
- $tab++;
- }
-
- if ($model->has($name, 'label')) {
- $bridge->add($name);
-
- if ($theName = $model->get($name, 'startGroup')) {
- //We start a new group here!
- $groupElements = array();
- $groupElements[] = $name;
- $groupName = $theName;
- } elseif ($theName = $model->get($name, 'endGroup')) {
- //Ok, last element define the group
- $groupElements[] = $name;
- $bridge->addDisplayGroup('grp_' . $groupElements[0], $groupElements,
- 'description', $groupName,
- 'showLabels', ($theName == 'showLabels'),
- 'class', 'grp' . $group);
- $group++;
- unset($groupElements);
- unset($groupName);
- } else {
- //If we are in a group, add the elements to the group
- if (isset($groupElements)) {
- $groupElements[] = $name;
- }
- }
- } else {
- $bridge->addHidden($name);
- }
- unset($this->_items[$name]);
- }
- }
-
- /**
- * Simple default function for making sure there is a $this->_saveButton.
- *
- * As the save button is not part of the model - but of the interface - it
- * does deserve it's own function.
- */
- protected function addSaveButton()
- {
- $this->_form->resetContext();
- parent::addSaveButton();
- }
-
-
- /**
- * Perform some actions on the form, right before it is displayed but already populated
- *
- * Here we add the table display to the form.
- *
- * @return Zend_Form
- */
- public function beforeDisplay()
- {
- //If needed, add a row of link buttons to the bottom of the form
- $form = $this->_form;
- if ($links = $this->getMenuList()) {
- $element = new MUtil_Form_Element_Html('formLinks');
- $element->setValue($links);
- $element->setOrder(999);
- if ($form instanceof Gems_TabForm) {
- $form->resetContext();
- }
- $form->addElement($element);
- $element->removeDecorator('HtmlTag');
- $element->removeDecorator('Label');
-
- if (is_null($form->getDisplayGroup(Gems_TabForm::GROUP_OTHER))) {
- $form->addDisplayGroup(array($element), Gems_TabForm::GROUP_OTHER);
- } else {
- $form->getDisplayGroup(Gems_TabForm::GROUP_OTHER)->addElement($element);
- }
- }
- }
-
- /**
- * Creates an empty form. Allows overruling in sub-classes.
- *
- * @param mixed $options
- * @return Gems_TabForm
- */
- protected function createForm($options = null)
- {
- $form = new Gems_TabForm($options);
- $this->_form = $form;
-
- //Now first add the saveButton as it needs to be outside the tabs
- $this->addSaveButton();
-
- return $form;
- }
+ protected $useTabbedForm = true;
}
\ No newline at end of file
Added: trunk/library/classes/Gems/Snippets/RespondentFormSnippet.php
===================================================================
--- trunk/library/classes/Gems/Snippets/RespondentFormSnippet.php (rev 0)
+++ trunk/library/classes/Gems/Snippets/RespondentFormSnippet.php 2013-03-14 15:44:54 UTC (rev 1186)
@@ -0,0 +1,73 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: RespondentFormSnippet.php$
+ */
+
+/**
+ *
+ *
+ * @package Gems
+ * @subpackage
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class Gems_Snippets_RespondentFormSnippet extends Gems_Snippets_ModelFormSnippetGeneric
+{
+ /**
+ * When true a tabbed form is used.
+ *
+ * @var boolean
+ */
+ protected $useTabbedForm = true;
+
+ /**
+ * Hook that loads the form data from $_POST or the model
+ *
+ * Or from whatever other source you specify here.
+ */
+ protected function loadFormData()
+ {
+ parent::loadFormData();
+
+ if ($this->createData && $this->request->isPost()) {
+ if ((! $this->_saveButton) || (! $this->_saveButton->isChecked())) {
+ if ($this->formData['grs_ssn']) {
+ // $this->formData['grs_first_name'] = 'Jan';
+ }
+ }
+ }
+ }
+}
Copied: trunk/library/classes/MUtil/Html/JavascriptArrayAttribute.php (from rev 1184, trunk/library/classes/MUtil/Html/OnClickArrayAttribute.php)
===================================================================
--- trunk/library/classes/MUtil/Html/JavascriptArrayAttribute.php (rev 0)
+++ trunk/library/classes/MUtil/Html/JavascriptArrayAttribute.php 2013-03-14 15:44:54 UTC (rev 1186)
@@ -0,0 +1,167 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Html
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Default attribute for javascript attributes with extra functions for common tasks
+ *
+ * @package MUtil
+ * @subpackage Html
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version MUtil 1.2
+ */
+class MUtil_Html_JavascriptArrayAttribute extends MUtil_Html_ArrayAttribute
+{
+ /**
+ * String used to glue items together
+ *
+ * Empty string as not each array element corresponds to a single command.
+ *
+ * @var string
+ */
+ protected $_separator = '';
+
+ /**
+ * Specially treated types for a specific subclass
+ *
+ * @var array function name => class
+ */
+ protected $_specialTypes = array(
+ 'addUrl' => 'MUtil_Html_UrlArrayAttribute',
+ );
+
+ /**
+ *
+ * @param string $type
+ * @param mixed $arg_array MUtil_Ra::args
+ */
+ public function __construct($type, $arg_array = null)
+ {
+ $args = MUtil_Ra::args(func_get_args(), 1);
+ parent::__construct($type, 'javascript:', $args);
+ }
+
+ /**
+ * Add a cancel bubble command
+ *
+ * @param boolean $cancelBubble
+ * @return MUtil_Html_JavascriptArrayAttribute (continuation pattern)
+ */
+ public function addCancelBubble($cancelBubble = true)
+ {
+ if ($cancelBubble) {
+ $this->add("event.cancelBubble = true;");
+ } else {
+ $this->add("event.cancelBubble = false;");
+ }
+ return $this;
+ }
+
+ /**
+ * Add single code line
+ *
+ * @param mixed $line
+ * @return MUtil_Html_JavascriptArrayAttribute (continuation pattern)
+ */
+ public function addLine($line_args)
+ {
+ $lines = MUtil_Ra::flatten(func_get_args());
+
+ foreach ($lines as $line) {
+ $this->add($line);
+ }
+ if (! (isset($line) && (';' == substr($line, -1)))) {
+ $this->add(';');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Add a form submit
+ *
+ * @param string $condition Optional condition for submit
+ * @return \MUtil_Html_JavascriptArrayAttribute
+ */
+ public function addSumbit($condition = null)
+ {
+ if ($condition) {
+ $this->add("if ($condition) {this.form.submit();}");
+ } else {
+ $this->add('this.form.submit();');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Add a form submit when a value has changed
+ *
+ * @param string $condition Optional extra condition for submit
+ * @return \MUtil_Html_JavascriptArrayAttribute
+ */
+ public function addSumbitOnChange($condition = null)
+ {
+ if ($condition) {
+ $this->add("if (($condition) && (this.getAttribute('value') != this.value)) {this.form.submit();}");
+ } else {
+ $this->add("if (this.getAttribute('value') != this.value) {this.form.submit();}");
+ }
+
+ return $this;
+ }
+
+ /**
+ * Add a url open command by specifying only the link
+ *
+ * @param mixed $href Anything, e.g. a MUtil_Html_UrlArrayAttribute that the code will transform to an url
+ * @return MUtil_Html_JavascriptArrayAttribute (continuation pattern)
+ */
+ public function addUrl($href)
+ {
+ $last = is_array($this->_values) ? end($this->_values) : null;
+ if (false === strpos($last, 'location.href')) {
+ $this->_values[] = "location.href='";
+ $this->_values[] = $href;
+ $this->_values[] = "';";
+ } else {
+ $this->_values[] = $href;
+ }
+
+ return $this;
+ }
+}
\ No newline at end of file
Modified: trunk/library/classes/MUtil/Html/OnClickArrayAttribute.php
===================================================================
--- trunk/library/classes/MUtil/Html/OnClickArrayAttribute.php 2013-03-14 13:44:56 UTC (rev 1185)
+++ trunk/library/classes/MUtil/Html/OnClickArrayAttribute.php 2013-03-14 15:44:54 UTC (rev 1186)
@@ -1,6 +1,5 @@
<?php
-
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
@@ -43,28 +42,14 @@
* @subpackage Html
* @copyright Copyright (c) 2011 Erasmus MC
* @license New BSD License
- * @since Class available since version 1.0
+ * @since Class available since MUtil version 1.0
*/
-class MUtil_Html_OnClickArrayAttribute extends MUtil_Html_Ar...
[truncated message content] |
|
From: <gem...@li...> - 2013-03-19 13:08:08
|
Revision: 1195
http://sourceforge.net/p/gemstracker/code/1195
Author: matijsdejong
Date: 2013-03-19 13:08:04 +0000 (Tue, 19 Mar 2013)
Log Message:
-----------
Removed empty shell snippets (should not cause any trouble)
requestCache has better handling of reset clause
setSurveyReturn has some intelligence to prevent autofilter action returns and to shorten the return url's
autosearchform uses _ and - instead of > and < in period determination (as <> cause trouble in html)
Modified Paths:
--------------
trunk/library/classes/Gems/Controller/BrowseEditAction.php
trunk/library/classes/Gems/Default/TokenPlanAction.php
trunk/library/classes/Gems/Snippets/AutosearchFormSnippet.php
trunk/library/classes/Gems/User/User.php
trunk/library/classes/Gems/Util/RequestCache.php
Removed Paths:
-------------
trunk/library/snippets/AnswerModelSnippet.php
trunk/library/snippets/EditRoundSnippet.php
trunk/library/snippets/EditTrackEngineSnippet.php
trunk/library/snippets/Generic/AutosearchFormSnippet.php
trunk/library/snippets/Generic/ModelFormSnippet.php
trunk/library/snippets/Generic/ModelItemTableSnippet.php
trunk/library/snippets/Generic/ModelItemYesNoDeleteSnippet.php
trunk/library/snippets/Generic/ModelTabFormSnippet.php
trunk/library/snippets/Generic/ModelTableSnippet.php
trunk/library/snippets/ShowRoundSnippet.php
trunk/library/snippets/TrackAnswersModelSnippet.php
Modified: trunk/library/classes/Gems/Controller/BrowseEditAction.php
===================================================================
--- trunk/library/classes/Gems/Controller/BrowseEditAction.php 2013-03-19 11:08:57 UTC (rev 1194)
+++ trunk/library/classes/Gems/Controller/BrowseEditAction.php 2013-03-19 13:08:04 UTC (rev 1195)
@@ -101,6 +101,7 @@
if ($filter = $this->getDataFilter($data)) {
$model->addFilter($filter);
+ // MUtil_Echo::track($filter, $data, $model->getFilter());
}
if ($this->sortKey) {
Modified: trunk/library/classes/Gems/Default/TokenPlanAction.php
===================================================================
--- trunk/library/classes/Gems/Default/TokenPlanAction.php 2013-03-19 11:08:57 UTC (rev 1194)
+++ trunk/library/classes/Gems/Default/TokenPlanAction.php 2013-03-19 13:08:04 UTC (rev 1195)
@@ -220,9 +220,9 @@
}
$dates = array(
- '<gto_valid_from gto_valid_until'
+ '_gto_valid_from gto_valid_until'
=> $this->_('Is valid during'),
- '>gto_valid_from gto_valid_until'
+ '-gto_valid_from gto_valid_until'
=> $this->_('Is valid within'),
'gto_valid_from' => $this->_('Valid from'),
'gto_valid_until' => $this->_('Valid until'),
@@ -446,7 +446,7 @@
return array(
'datefrom' => $now->toString($inFormat),
- 'dateused' => '<gto_valid_from gto_valid_until',
+ 'dateused' => '_gto_valid_from gto_valid_until',
'dateuntil' => $now->toString($inFormat),
'gto_id_organization' => $this->escort->getCurrentOrganization(),
'main_filter' => 'all',
Modified: trunk/library/classes/Gems/Snippets/AutosearchFormSnippet.php
===================================================================
--- trunk/library/classes/Gems/Snippets/AutosearchFormSnippet.php 2013-03-19 11:08:57 UTC (rev 1194)
+++ trunk/library/classes/Gems/Snippets/AutosearchFormSnippet.php 2013-03-19 13:08:04 UTC (rev 1195)
@@ -364,7 +364,7 @@
switch ($data['dateused'][0]) {
- case '<':
+ case '_':
// overlaps
$periods = explode(' ', substr($data['dateused'], 1));
@@ -396,7 +396,7 @@
}
return;
- case '>':
+ case '-':
// within
$periods = explode(' ', substr($data['dateused'], 1));
Modified: trunk/library/classes/Gems/User/User.php
===================================================================
--- trunk/library/classes/Gems/User/User.php 2013-03-19 11:08:57 UTC (rev 1194)
+++ trunk/library/classes/Gems/User/User.php 2013-03-19 13:08:04 UTC (rev 1195)
@@ -1452,7 +1452,13 @@
} elseif (! is_array($return)) {
$return = MUtil_Ra::to($return);
}
+ if ('autofilter' == $return['action']) {
+ $return['action'] = 'index';
+ }
+ $return = array_filter($return);
+ // MUtil_Echo::track($return);
+
$this->_setVar('surveyReturn', $return);
return $this;
Modified: trunk/library/classes/Gems/Util/RequestCache.php
===================================================================
--- trunk/library/classes/Gems/Util/RequestCache.php 2013-03-19 11:08:57 UTC (rev 1194)
+++ trunk/library/classes/Gems/Util/RequestCache.php 2013-03-19 13:08:04 UTC (rev 1195)
@@ -187,8 +187,8 @@
$programParams = array_diff($request->getParams(), $this->getRequestKey());
if (isset($programParams[self::RESET_PARAM]) && $programParams[self::RESET_PARAM]) {
- unset($programParams[self::RESET_PARAM]);
unset($this->session->requestCache[$this->_storageKey]);
+ $request->setParam(self::RESET_PARAM, null);
} else {
// Add cache
$programParams = $programParams + $this->getCachedRequest();
@@ -196,8 +196,9 @@
// Set menu up for reset
$menu->getCurrent()->addParameters(self::RESET_PARAM);
// Means this
- $request->setParam(self::RESET_PARAM, 1);
+ $menu->getParameterSource()->offsetSet(self::RESET_PARAM, 1);
}
+ unset($programParams[self::RESET_PARAM]);
$this->setProgramParams($programParams);
Deleted: trunk/library/snippets/AnswerModelSnippet.php
===================================================================
--- trunk/library/snippets/AnswerModelSnippet.php 2013-03-19 11:08:57 UTC (rev 1194)
+++ trunk/library/snippets/AnswerModelSnippet.php 2013-03-19 13:08:04 UTC (rev 1195)
@@ -1,50 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @package Gems
- * @subpackage Tracker
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id$
- */
-
-/**
- * Displays answers to a survey.
- *
- * @deprecated
- * @package Gems
- * @subpackage Tracker
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @since Class available since version 1.4
- */
-class AnswerModelSnippet extends Gems_Snippets_Tracker_Answers_SingleTokenAnswerModelSnippet
-{
-}
Deleted: trunk/library/snippets/EditRoundSnippet.php
===================================================================
--- trunk/library/snippets/EditRoundSnippet.php 2013-03-19 11:08:57 UTC (rev 1194)
+++ trunk/library/snippets/EditRoundSnippet.php 2013-03-19 13:08:04 UTC (rev 1195)
@@ -1,48 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @package Gems
- * @subpackage Tracker
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id$
- */
-
-/**
- *
- * @package Gems
- * @subpackage Tracker
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @since Class available since version 1.4
- */
-class EditRoundSnippet extends Gems_Tracker_Snippets_EditRoundSnippetAbstract
-{
-}
Deleted: trunk/library/snippets/EditTrackEngineSnippet.php
===================================================================
--- trunk/library/snippets/EditTrackEngineSnippet.php 2013-03-19 11:08:57 UTC (rev 1194)
+++ trunk/library/snippets/EditTrackEngineSnippet.php 2013-03-19 13:08:04 UTC (rev 1195)
@@ -1,49 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @package Gems
- * @subpackage Snippets
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id$
- */
-
-/**
- * Default snippet for editing track engines instances
- *
- * @package Gems
- * @subpackage Snippets
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @since Class available since version 1.4
- */
-class EditTrackEngineSnippet extends Gems_Tracker_Snippets_EditTrackEngineSnippetGeneric
-{
-}
Deleted: trunk/library/snippets/Generic/AutosearchFormSnippet.php
===================================================================
--- trunk/library/snippets/Generic/AutosearchFormSnippet.php 2013-03-19 11:08:57 UTC (rev 1194)
+++ trunk/library/snippets/Generic/AutosearchFormSnippet.php 2013-03-19 13:08:04 UTC (rev 1195)
@@ -1,52 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Short description of file
- *
- * @package Gems
- * @subpackage Snippets\Generic
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
- */
-
-/**
- * Short description for class
- *
- * Long description for class (if any)...
- *
- * @deprecated No longer needed with new snippet loader
- * @package Gems
- * @subpackage Snippets\Generic
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @since Class available since version 1.4.2
- */
-class Generic_AutosearchFormSnippet extends Gems_Snippets_AutosearchFormSnippet
-{ }
Deleted: trunk/library/snippets/Generic/ModelFormSnippet.php
===================================================================
--- trunk/library/snippets/Generic/ModelFormSnippet.php 2013-03-19 11:08:57 UTC (rev 1194)
+++ trunk/library/snippets/Generic/ModelFormSnippet.php 2013-03-19 13:08:04 UTC (rev 1195)
@@ -1,53 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @package Gems
- * @subpackage Snippets\Generic
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id$
- */
-
-/**
- * Displays an edit form based on the model the model set through the $model snippet parameter.
- *
- * 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
- * @license New BSD License
- * @since Class available since version 1.4
- */
-class Generic_ModelFormSnippet extends Gems_Snippets_ModelFormSnippetGeneric
-{ }
Deleted: trunk/library/snippets/Generic/ModelItemTableSnippet.php
===================================================================
--- trunk/library/snippets/Generic/ModelItemTableSnippet.php 2013-03-19 11:08:57 UTC (rev 1194)
+++ trunk/library/snippets/Generic/ModelItemTableSnippet.php 2013-03-19 13:08:04 UTC (rev 1195)
@@ -1,50 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @package Gems
- * @subpackage Snippets\Generic
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id$
- */
-
-/**
- * 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
- * @license New BSD License
- * @since Class available since version 1.4.4
- */
-class Generic_ModelItemTableSnippet extends Gems_Snippets_ModelItemTableSnippetGeneric
-{ }
Deleted: trunk/library/snippets/Generic/ModelItemYesNoDeleteSnippet.php
===================================================================
--- trunk/library/snippets/Generic/ModelItemYesNoDeleteSnippet.php 2013-03-19 11:08:57 UTC (rev 1194)
+++ trunk/library/snippets/Generic/ModelItemYesNoDeleteSnippet.php 2013-03-19 13:08:04 UTC (rev 1195)
@@ -1,50 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @package Gems
- * @subpackage Snippets\Generic
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id$
- */
-
-/**
- * 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
- * @license New BSD License
- * @since Class available since version 1.4.4
- */
-class Generic_ModelItemYesNoDeleteSnippet extends Gems_Snippets_ModelItemYesNoDeleteSnippetGeneric
-{ }
Deleted: trunk/library/snippets/Generic/ModelTabFormSnippet.php
===================================================================
--- trunk/library/snippets/Generic/ModelTabFormSnippet.php 2013-03-19 11:08:57 UTC (rev 1194)
+++ trunk/library/snippets/Generic/ModelTabFormSnippet.php 2013-03-19 13:08:04 UTC (rev 1195)
@@ -1,49 +0,0 @@
-<?php
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @package Gems
- * @subpackage Snippets\Generic
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id$
- */
-
-/**
- * Displays an edit form using tabs based on the model the model set through the $model snippet parameter.
- *
- * 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
- * @license New BSD License
- * @since Class available since version 1.5
- */
-class Generic_ModelTabFormSnippet extends Gems_Snippets_ModelTabFormSnippetGeneric
-{ }
Deleted: trunk/library/snippets/Generic/ModelTableSnippet.php
===================================================================
--- trunk/library/snippets/Generic/ModelTableSnippet.php 2013-03-19 11:08:57 UTC (rev 1194)
+++ trunk/library/snippets/Generic/ModelTableSnippet.php 2013-03-19 13:08:04 UTC (rev 1195)
@@ -1,54 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @package MUtil
- * @subpackage Snippets\Generic
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id$
- */
-
-/**
- * Displays multiple items from a model in a tabel by row using
- * the model set through the $model snippet parameter.
- *
- * 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
- * @license New BSD License
- * @since Class available since version 1.4
- */
-class Generic_ModelTableSnippet extends Gems_Snippets_ModelTableSnippetGeneric
-{ }
Deleted: trunk/library/snippets/ShowRoundSnippet.php
===================================================================
--- trunk/library/snippets/ShowRoundSnippet.php 2013-03-19 11:08:57 UTC (rev 1194)
+++ trunk/library/snippets/ShowRoundSnippet.php 2013-03-19 13:08:04 UTC (rev 1195)
@@ -1,48 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials pr...
[truncated message content] |
|
From: <gem...@li...> - 2013-03-19 15:15:56
|
Revision: 1196
http://sourceforge.net/p/gemstracker/code/1196
Author: matijsdejong
Date: 2013-03-19 15:14:49 +0000 (Tue, 19 Mar 2013)
Log Message:
-----------
Extended mail log details shown and search capabilities
Modified Paths:
--------------
trunk/library/classes/Gems/Default/ComplianceAction.php
trunk/library/classes/Gems/Default/MailLogAction.php
trunk/library/classes/Gems/Util/TokenData.php
Added Paths:
-----------
trunk/library/classes/Gems/Snippets/Mail/
trunk/library/classes/Gems/Snippets/Mail/Log/
trunk/library/classes/Gems/Snippets/Mail/Log/MailLogBrowseSnippet.php
trunk/library/classes/Gems/Snippets/Mail/Log/MailLogSearchSnippet.php
Removed Paths:
-------------
trunk/library/snippets/Mail/
Modified: trunk/library/classes/Gems/Default/ComplianceAction.php
===================================================================
--- trunk/library/classes/Gems/Default/ComplianceAction.php 2013-03-19 13:08:04 UTC (rev 1195)
+++ trunk/library/classes/Gems/Default/ComplianceAction.php 2013-03-19 15:14:49 UTC (rev 1196)
@@ -122,16 +122,7 @@
return $model;
}
- $status = new Zend_Db_Expr("
- CASE
- WHEN grc_success = 0 THEN 'D'
- WHEN gto_completion_time IS NOT NULL THEN 'A'
- WHEN gto_valid_from IS NULL THEN 'U'
- WHEN gto_valid_from > CURRENT_TIMESTAMP THEN 'W'
- WHEN gto_valid_until < CURRENT_TIMESTAMP THEN 'M'
- ELSE 'O'
- END
- ");
+ $status = $this->util->getTokenData()->getStatusExpression();
$select = $this->db->select();
$select->from('gems__tokens', array(
Modified: trunk/library/classes/Gems/Default/MailLogAction.php
===================================================================
--- trunk/library/classes/Gems/Default/MailLogAction.php 2013-03-19 13:08:04 UTC (rev 1195)
+++ trunk/library/classes/Gems/Default/MailLogAction.php 2013-03-19 15:14:49 UTC (rev 1196)
@@ -58,7 +58,6 @@
* @var array Mixed key => value array for snippet initialization
*/
protected $autofilterParameters = array(
- 'extraFilter' => 'getExtraFilter',
'extraSort' => array('grco_created' => SORT_DESC),
);
@@ -70,6 +69,13 @@
protected $autofilterSnippets = 'Mail_Log_MailLogBrowseSnippet';
/**
+ * The snippets used for the index action, before those in autofilter
+ *
+ * @var mixed String or array of snippets name
+ */
+ protected $indexStartSnippets = array('Generic_ContentTitleSnippet', 'Mail_Log_MailLogSearchSnippet');
+
+ /**
* Creates a model for getModel(). Called only for each new $action.
*
* The parameters allow you to easily adapt the model to the current action. The $detailed
@@ -88,6 +94,11 @@
$model->addLeftTable('gems__staff', array('grco_id_by' => 'gsf_id_user'));
$model->addLeftTable('gems__mail_templates', array('grco_id_message' => 'gmt_id_message'));
+ $model->addLeftTable('gems__tokens', array('grco_id_token' => 'gto_id_token'));
+ $model->addLeftTable('gems__reception_codes', array('gto_reception_code' => 'grc_id_reception_code'));
+ $model->addLeftTable('gems__tracks', array('gto_id_track' => 'gtr_id_track'));
+ $model->addLeftTable('gems__surveys', array('gto_id_survey' => 'gsu_id_survey'));
+
$model->addColumn(
"TRIM(CONCAT(COALESCE(CONCAT(grs_last_name, ', '), '-, '), COALESCE(CONCAT(grs_first_name, ' '), ''), COALESCE(grs_surname_prefix, '')))",
'respondent_name');
@@ -103,6 +114,7 @@
)
END",
'assigned_by');
+ $model->addColumn($this->util->getTokenData()->getStatusExpression(), 'status');
$model->resetOrder();
@@ -113,6 +125,10 @@
$model->set('grco_sender', 'label', $this->_('From address'), 'itemDisplay', 'MUtil_Html_AElement::ifmail');
$model->set('grco_id_token', 'label', $this->_('Token'));
$model->set('grco_topic', 'label', $this->_('Subject'));
+ $model->set('gtr_track_name', 'label', $this->_('Track'));
+ $model->set('gsu_survey_name', 'label', $this->_('Survey'));
+ $model->set('status', 'label', $this->_('Status'),
+ 'formatFunction', array($this->util->getTokenData(), 'getStatusDescription'));
if ($detailed) {
$model->set('gmt_subject', 'label', $this->_('Template'));
@@ -120,20 +136,17 @@
$model->set('grco_created', 'formatFunction', $this->util->getTranslated()->formatDate);
}
+ $filter = $this->util->getRequestCache('index', $detailed)->getProgramParams();
+
+ // Add the period filter - if any
+ if ($where = Gems_Snippets_AutosearchFormSnippet::getPeriodFilter($filter, $this->db)) {
+ $model->addFilter(array($where));
+ }
+
return $model;
}
/**
- * Returns an extra filter for this action
- *
- * @return array
- */
- protected function getExtraFilter()
- {
- return array('grco_organization' => $this->escort->getCurrentOrganization());
- }
-
- /**
* Helper function to get the title for the index action.
*
* @return $string
Copied: trunk/library/classes/Gems/Snippets/Mail/Log/MailLogBrowseSnippet.php (from rev 1194, trunk/library/snippets/Mail/Log/MailLogBrowseSnippet.php)
===================================================================
--- trunk/library/classes/Gems/Snippets/Mail/Log/MailLogBrowseSnippet.php (rev 0)
+++ trunk/library/classes/Gems/Snippets/Mail/Log/MailLogBrowseSnippet.php 2013-03-19 15:14:49 UTC (rev 1196)
@@ -0,0 +1,115 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Snippets\Mail\Log
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Add complex column layout to display.
+ *
+ *
+ * @package Gems
+ * @subpackage Snippets\Mail\Log
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.4
+ */
+class Gems_Snippets_Mail_Log_MailLogBrowseSnippet extends Gems_Snippets_ModelTableSnippetGeneric
+{
+ /**
+ *
+ * @var Gems_Util
+ */
+ protected $util;
+
+ /**
+ * Adds columns from the model to the bridge that creates the browse table.
+ *
+ * Overrule this function to add different columns to the browse table, without
+ * having to recode the core table building code.
+ *
+ * @param MUtil_Model_TableBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @return void
+ */
+ protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model)
+ {
+ if ($menuItem = $this->getShowMenuItem()) {
+ $bridge->addItemLink($menuItem->toActionLinkLower($this->request, $bridge));
+ }
+
+ // Newline placeholder
+ $br = MUtil_Html::create('br');
+
+ // make sure search results are highlighted
+ $this->applyTextMarker();
+
+ $bridge->addMultiSort('grco_created', $br, 'respondent_name', $br, 'grco_address', $br, 'gtr_track_name');
+ $bridge->addMultiSort('grco_id_token', $br, 'assigned_by', $br, 'grco_sender', $br, 'gsu_survey_name');
+ $bridge->addMultiSort('status', $br, 'grco_topic');
+
+ $title = MUtil_Html::create()->strong($this->_('+'));
+ $params = array(
+ 'gto_id_token' => $bridge->gto_id_token,
+ 'gtr_track_type' => $bridge->gtr_track_type,
+ 'grc_success' => 1,
+ Gems_Model::ID_TYPE => 'token',
+ );
+
+ $showLinks[] = $this->createMenuLink($params, 'track', 'show', $title);
+ $showLinks[] = $this->createMenuLink($params, 'survey', 'show', $title);
+
+ // Remove nulls
+ $showLinks = array_filter($showLinks);
+
+ if ($showLinks) {
+ foreach ($showLinks as $showLink) {
+ if ($showLink) {
+ $showLink->title = array($this->_('Token'), $bridge->gto_id_token->strtoupper());
+ }
+ }
+ }
+ $bridge->getTable()->appendAttrib('class', 'compliance');
+
+ $tbody = $bridge->tbody();
+ $td = $tbody[0][0];
+ /* // Does not repeat for some reason
+ $td->appendAttrib('class', MUtil_Lazy::method($this->util->getTokenData(), 'getStatusClass', $bridge->status));
+ $td->append($br);
+ $td->append($br); // */
+ $td->append($br);
+ $td->append($showLinks);
+ // $bridge->addItemLink($showLinks);
+ }
+}
Added: trunk/library/classes/Gems/Snippets/Mail/Log/MailLogSearchSnippet.php
===================================================================
--- trunk/library/classes/Gems/Snippets/Mail/Log/MailLogSearchSnippet.php (rev 0)
+++ trunk/library/classes/Gems/Snippets/Mail/Log/MailLogSearchSnippet.php 2013-03-19 15:14:49 UTC (rev 1196)
@@ -0,0 +1,125 @@
+<?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 Pulse
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @version $id: MailLogSearchSnippet.php 203 2012-01-01t 12:51:32Z matijs $
+ */
+
+/**
+ *
+ *
+ * @package Gems
+ * @subpackage Pulse
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.6
+ */
+class Gems_Snippets_Mail_Log_MailLogSearchSnippet extends Gems_Snippets_AutosearchFormSnippet
+{
+ /**
+ *
+ * @var Gems_Loader
+ */
+ public $loader;
+
+ /**
+ * Creates the form itself
+ *
+ * @param array $options
+ * @return Gems_Form
+ */
+ protected function createForm($options = null)
+ {
+ $form = parent::createForm($options);
+
+ $form->activateJQuery();
+
+ return $form;
+ }
+
+ /**
+ * Returns a text element for autosearch. Can be overruled.
+ *
+ * The form / html elements to search on. Elements can be grouped by inserting null's between them.
+ * That creates a distinct group of elements
+ *
+ * @param array $data The $form field values (can be usefull, but no need to set them)
+ * @return array Of Zend_Form_Element's or static tekst to add to the html or null for group breaks.
+ */
+ protected function getAutoSearchElements(array $data)
+ {
+ // Search text
+ $elements = parent::getAutoSearchElements($data);
+
+ $this->_addPeriodSelectors($elements, array('grco_created' => $this->_('Date sent')));
+
+ $br = MUtil_Html::create()->br();
+
+ $elements[] = null;
+
+ $dbLookup = $this->util->getDbLookup();
+
+ $elements[] = $this->_createSelectElement(
+ 'gto_id_track',
+ $this->util->getTrackData()->getSteppedTracks(),
+ $this->_('(select a track)')
+ );
+
+ $elements[] = $this->_createSelectElement('gto_id_survey',
+ $this->util->getTrackData()->getAllSurveys(),
+ $this->_('(all surveys)'));
+
+ $elements[] = $this->_createSelectElement(
+ 'grco_organization',
+ $this->loader->getCurrentUser()->getRespondentOrganizations(),
+ $this->_('(all organizations)')
+ );
+
+ return $elements;
+ }
+
+ /**
+ *
+ * @return array The data to fill the form with
+ */
+ protected function getSearchData()
+ {
+ $data = parent::getSearchData();
+
+ if (!array_key_exists('grco_organization', $data)) {
+ $data['grco_organization'] = $this->loader->getOrganization()->getId();
+ }
+
+ return $data;
+ }
+}
Modified: trunk/library/classes/Gems/Util/TokenData.php
===================================================================
--- trunk/library/classes/Gems/Util/TokenData.php 2013-03-19 13:08:04 UTC (rev 1195)
+++ trunk/library/classes/Gems/Util/TokenData.php 2013-03-19 15:14:49 UTC (rev 1196)
@@ -112,4 +112,23 @@
return $status['D'];
}
+
+ /**
+ * An expression for calculating the token status
+ *
+ * @return Zend_Db_Expr
+ */
+ public function getStatusExpression()
+ {
+ return new Zend_Db_Expr("
+ CASE
+ WHEN gto_id_token IS NULL OR grc_success = 0 THEN 'D'
+ WHEN gto_completion_time IS NOT NULL THEN 'A'
+ WHEN gto_valid_from IS NULL THEN 'U'
+ WHEN gto_valid_from > CURRENT_TIMESTAMP THEN 'W'
+ WHEN gto_valid_until < CURRENT_TIMESTAMP THEN 'M'
+ ELSE 'O'
+ END
+ ");
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2013-03-22 14:27:36
|
Revision: 1204
http://sourceforge.net/p/gemstracker/code/1204
Author: mennodekker
Date: 2013-03-22 14:27:33 +0000 (Fri, 22 Mar 2013)
Log Message:
-----------
First fixes to get it all going
Modified Paths:
--------------
trunk/library/classes/Gems/Loader/LoaderAbstract.php
trunk/library/classes/Gems/Menu.php
trunk/library/classes/Gems/Snippets/SnippetLoader.php
trunk/library/classes/GemsEscort.php
trunk/library/classes/MUtil/Snippets/SnippetLoader.php
trunk/library/classes/OpenRosa/Model/OpenRosaFormModel.php
Added Paths:
-----------
trunk/library/configs/db/tables/gems__openrosaforms.10.sql.sql
Modified: trunk/library/classes/Gems/Loader/LoaderAbstract.php
===================================================================
--- trunk/library/classes/Gems/Loader/LoaderAbstract.php 2013-03-22 14:02:16 UTC (rev 1203)
+++ trunk/library/classes/Gems/Loader/LoaderAbstract.php 2013-03-22 14:27:33 UTC (rev 1204)
@@ -183,4 +183,26 @@
return $obj;
}
+
+ public function addPrefixPath($prefix, $path, $prepend = true) {
+ if ($this->cascade) {
+ $newPrefix = $prefix . '_' . $this->cascade;
+ $newPath = $path . '/' . strtr($this->cascade, '_', '/');
+ } else {
+ $newPrefix = $prefix;
+ $newPath = $path;
+ }
+
+ if ($prepend) {
+ $this->_dirs = array($newPrefix => $newPath) + $this->_dirs;
+ } else {
+ $this->_dirs[$newPrefix] = $newPath;
+ }
+
+ $this->_loader->addPrefixPath($newPrefix, $newPath, $prepend);
+
+ if (MUtil_Registry_Source::$verbose) {
+ MUtil_Echo::r($this->_dirs, '$this->_dirs in ' . get_class($this) . '->' . __FUNCTION__ . '():');
+ }
+ }
}
\ No newline at end of file
Modified: trunk/library/classes/Gems/Menu.php
===================================================================
--- trunk/library/classes/Gems/Menu.php 2013-03-22 14:02:16 UTC (rev 1203)
+++ trunk/library/classes/Gems/Menu.php 2013-03-22 14:27:33 UTC (rev 1204)
@@ -226,7 +226,7 @@
$logMaint->addEditAction('pr.log.maintenance');
// OpenRosa
- $this->addOpenRosaContainer($this->_('OpenRosa'));
+ $this->addOpenRosaContainer($this->_('OpenRosa'), $setup);
return $setup;
}
@@ -285,10 +285,13 @@
*
* @param string $label Label for the container
*/
- public function addOpenRosaContainer($label)
+ public function addOpenRosaContainer($label, $parent = null)
{
if ($this->escort->getOption('useOpenRosa')) {
- $page = $this->addBrowsePage($label, 'pr.openrosa','openrosa');
+ if (is_null($parent)) {
+ $parent = $this;
+ }
+ $page = $parent->addBrowsePage($label, 'pr.openrosa','openrosa');
$page->addButtonOnly($this->_('Scan FormDefs'), 'pr.openrosa.scan', 'openrosa', 'scan');
$page->addButtonOnly($this->_('Scan Responses'), 'pr.openrosa.scan', 'openrosa', 'scanresponses');
$this->addPage(null, null, 'openrosa', 'submission');
Modified: trunk/library/classes/Gems/Snippets/SnippetLoader.php
===================================================================
--- trunk/library/classes/Gems/Snippets/SnippetLoader.php 2013-03-22 14:02:16 UTC (rev 1203)
+++ trunk/library/classes/Gems/Snippets/SnippetLoader.php 2013-03-22 14:27:33 UTC (rev 1204)
@@ -83,9 +83,9 @@
* @param string $path
* @return MUtil_Snippets_SnippetLoaderInterface
*/
- public function addPrefixPath($prefix, $path)
+ public function addPrefixPath($prefix, $path, $prepend = true)
{
- $this->_loader->addPrefixPath($prefix, $path);
+ $this->_loader->addPrefixPath($prefix, $path, $prepend);
return $this;
}
Modified: trunk/library/classes/GemsEscort.php
===================================================================
--- trunk/library/classes/GemsEscort.php 2013-03-22 14:02:16 UTC (rev 1203)
+++ trunk/library/classes/GemsEscort.php 2013-03-22 14:27:33 UTC (rev 1204)
@@ -442,6 +442,8 @@
// First handle dependencies
$this->bootstrap(array('db', 'loader', 'util'));
+ $this->getLoader()->addPrefixPath('OpenRosa', GEMS_LIBRARY_DIR . '/classes/OpenRosa', true);
+
/**
* Add Source for OpenRosa
*/
Modified: trunk/library/classes/MUtil/Snippets/SnippetLoader.php
===================================================================
--- trunk/library/classes/MUtil/Snippets/SnippetLoader.php 2013-03-22 14:02:16 UTC (rev 1203)
+++ trunk/library/classes/MUtil/Snippets/SnippetLoader.php 2013-03-22 14:27:33 UTC (rev 1204)
@@ -92,9 +92,9 @@
* @param string $path
* @return MUtil_Snippets_SnippetLoaderInterface
*/
- public function addPrefixPath($prefix, $path)
+ public function addPrefixPath($prefix, $path, $prepend = true)
{
- $this->loader->addPrefixPath($prefix, $path);
+ $this->loader->addPrefixPath($prefix, $path, $prepend);
return $this;
}
Modified: trunk/library/classes/OpenRosa/Model/OpenRosaFormModel.php
===================================================================
--- trunk/library/classes/OpenRosa/Model/OpenRosaFormModel.php 2013-03-22 14:02:16 UTC (rev 1203)
+++ trunk/library/classes/OpenRosa/Model/OpenRosaFormModel.php 2013-03-22 14:27:33 UTC (rev 1204)
@@ -80,7 +80,7 @@
* @param array $sort
* @return Zend_Db_Table_Select
*/
- public function _createSelect($filter = null, $sort = null)
+ public function _createSelect(array $filter, array $sort)
{
$select = parent::_createSelect($filter, $sort);
Added: trunk/library/configs/db/tables/gems__openrosaforms.10.sql.sql
===================================================================
--- trunk/library/configs/db/tables/gems__openrosaforms.10.sql.sql (rev 0)
+++ trunk/library/configs/db/tables/gems__openrosaforms.10.sql.sql 2013-03-22 14:27:33 UTC (rev 1204)
@@ -0,0 +1,13 @@
+CREATE TABLE IF NOT EXISTS `gems__openrosaforms` (
+ `gof_id` bigint(20) NOT NULL auto_increment,
+ `gof_form_id` varchar(249) collate utf8_unicode_ci NOT NULL,
+ `gof_form_version` varchar(249) collate utf8_unicode_ci NOT NULL,
+ `gof_form_active` int(1) NOT NULL default '1',
+ `gof_form_title` text collate utf8_unicode_ci NOT NULL,
+ `gof_form_xml` varchar(64) collate utf8_unicode_ci NOT NULL,
+ `gof_changed` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ `gof_changed_by` bigint(20) NOT NULL,
+ `gof_created` timestamp NOT NULL default '0000-00-00 00:00:00',
+ `gof_createf_by` bigint(20) NOT NULL,
+ PRIMARY KEY (`gof_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
\ 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...> - 2013-04-11 09:58:23
|
Revision: 1222
http://sourceforge.net/p/gemstracker/code/1222
Author: matijsdejong
Date: 2013-04-11 09:58:19 +0000 (Thu, 11 Apr 2013)
Log Message:
-----------
GEMS_PROJECT_NAME_UC and other constants can now be used as keys for application.ini loaderDirs
Modified Paths:
--------------
trunk/library/changelog.txt
trunk/library/classes/GemsEscort.php
Modified: trunk/library/changelog.txt
===================================================================
--- trunk/library/changelog.txt 2013-04-11 09:51:25 UTC (rev 1221)
+++ trunk/library/changelog.txt 2013-04-11 09:58:19 UTC (rev 1222)
@@ -22,8 +22,8 @@
contact.forumUrl = "" ; The path to the forum if available
contact.gemsUrl = "http://gemstracker.org/"
-New application.ini settings (add before the first resource and change NewProject to your own project prefix):
-loaderDirs.NewProject = APPLICATION_PATH "/classes/NewProject"
+New application.ini settings:
+loaderDirs.GEMS_PROJECT_NAME_UC = APPLICATION_PATH "/classes/" GEMS_PROJECT_NAME_UC
loaderDirs.Gems = GEMS_LIBRARY_DIR "/classes/Gems"
Numerous small bugs solved
Modified: trunk/library/classes/GemsEscort.php
===================================================================
--- trunk/library/classes/GemsEscort.php 2013-04-11 09:51:25 UTC (rev 1221)
+++ trunk/library/classes/GemsEscort.php 2013-04-11 09:58:19 UTC (rev 1222)
@@ -112,7 +112,17 @@
// DIRECTORIES USED BY LOADER
$dirs = $this->getOption('loaderDirs');
- if (! $dirs) {
+ if ($dirs) {
+ $newDirs = array();
+ foreach ($dirs as $key => $path) {
+ if (defined($key)) {
+ $newDirs[constant($key)] = $path;
+ } else {
+ $newDirs[$key] = $path;
+ }
+ }
+ $dirs = $newDirs;
+ } else {
global $GEMS_DIRS;
// Use $GEMS_DIRS if defined
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2013-04-11 14:28:56
|
Revision: 1224
http://sourceforge.net/p/gemstracker/code/1224
Author: matijsdejong
Date: 2013-04-11 14:28:21 +0000 (Thu, 11 Apr 2013)
Log Message:
-----------
Added example applicaiton.ini and project.ini with extended documentation
Modified Paths:
--------------
trunk/library/classes/Gems/Project/ProjectSettings.php
Added Paths:
-----------
trunk/library/configs/application.example.ini
trunk/library/configs/project.example.ini
Modified: trunk/library/classes/Gems/Project/ProjectSettings.php
===================================================================
--- trunk/library/classes/Gems/Project/ProjectSettings.php 2013-04-11 09:59:26 UTC (rev 1223)
+++ trunk/library/classes/Gems/Project/ProjectSettings.php 2013-04-11 14:28:21 UTC (rev 1224)
@@ -567,7 +567,7 @@
}
/**
- * Returns the super admin password, if it exists
+ * Returns the super admin ip range, if it exists
*
* @return string
*/
Added: trunk/library/configs/application.example.ini
===================================================================
--- trunk/library/configs/application.example.ini (rev 0)
+++ trunk/library/configs/application.example.ini 2013-04-11 14:28:21 UTC (rev 1224)
@@ -0,0 +1,43 @@
+
+[production]
+phpSettings.display_startup_errors = 0
+phpSettings.display_errors = 0
+
+bootstrap.path = GEMS_PROJECT_NAME_UC "/Escort.php"
+bootstrap.class = GEMS_PROJECT_NAME_UC "_Escort"
+; Uncomment this line if the project uses it's own code classes
+; loaderDirs.GEMS_PROJECT_NAME_UC = APPLICATION_PATH "/classes/" GEMS_PROJECT_NAME_UC
+loaderDirs.Gems = GEMS_LIBRARY_DIR "/classes/Gems"
+; resources.db.adapter = PDO_MYSQL
+resources.db.adapter = Mysqli
+resources.db.params.charset = utf8
+; Either replace HOST, DATABASE, USER, PASSWD with the correct strings,
+; or define() these strings as constants.
+resources.db.params.host = HOST
+resources.db.params.dbname = DATABASE
+resources.db.params.username = USER
+resources.db.params.password = PASSWD
+resources.db.isDefaultTableAdapter = true
+resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
+resources.layout.layout = "gems-fluid"
+resources.layout.layoutPath = GEMS_LIBRARY_DIR "/layouts/scripts"
+
+firebug.log = 0
+
+; Set to 0 to disable using OpenRosa survey source
+useOpenRosa = 1
+
+[staging : production]
+
+[testing : production]
+phpSettings.display_startup_errors = 1
+phpSettings.display_errors = 1
+
+[demo : production]
+
+[development : production]
+phpSettings.display_startup_errors = 1
+phpSettings.display_errors = 1
+firebug.log = 1
+; Set to 1 if you want to enable zfdebug output
+zfdebug.activate = 0
Added: trunk/library/configs/project.example.ini
===================================================================
--- trunk/library/configs/project.example.ini (rev 0)
+++ trunk/library/configs/project.example.ini 2013-04-11 14:28:21 UTC (rev 1224)
@@ -0,0 +1,350 @@
+[production]
+name = GEMS_PROJECT_NAME_UC
+description = GEMS_PROJECT_NAME_UC
+;longDescr = ""
+;longDescrNl = ""
+
+;---------------------------------------------------
+; Hash encryption salt. REQUIRED!
+;
+; Use e.g. http://www.random.org/strings/ to create.
+;
+; Put %s somewhere within the salt to mix the value
+; in the salt.
+;---------------------------------------------------
+salt =
+
+;----------------------------------------------------------
+; The non database super user
+;
+; On production pwd should be empty or longer than 10 chars
+; and quoted if it contains special characters.
+;----------------------------------------------------------
+admin.user = superadmin
+admin.pwd = PASSWD
+;admin.ipRanges = 10.0.0.0-10.255.255.255;192.168.0.0-192.168.255.255
+
+css.gems = gems/css/gems-fluid.css
+css.print.url = gems/css/gems_print.css
+css.print.media = print
+imagedir = gems/images
+imagedir = gems/images
+css.local = basic/basic.css
+favicon = basic/basic.ico
+jquerycss = basic/jquery-basic.css
+
+contact.bugsUrl = http://gemstracker.org/mantis
+contact.docsUrl = http://gemstracker.org/wiki/doku.php
+;contact.forumUrl = http://gemstracker.org/wiki/doku.php
+contact.gemsUrl = http://gemstracker.org/
+contact.manualUrl = "http://gemstracker.org/wiki/doku.php?id=userzone:userdoc:start"
+;contact.supportUrl = http://gemstracker.org/wiki/doku.php
+
+databaseFileEncoding = ISO-8859-1
+
+;-------------------------------------------------------
+; SESSION SECTION
+;
+; idleTimeout
+;
+; Lifetime of the session (determines the expiration of
+; the session namespace(s)).
+; If not set, defaults to 1800 seconds = 30 minutes.
+;
+;-------------------------------------------------------
+
+session.idleTimeout = 1800
+
+;-------------------------------------------------------
+; ASK THROTTLE SECTION
+;
+; Sets values that control the throttling (slowdowns to
+; combat brute-force attacks) of the ask / token
+; controller.
+;
+; askThrottle.period
+;
+; Look for failed token attempts in from now to
+; X seconds ago.
+;
+; askThrottle.threshold
+;
+; If the number of failed token attempts exceeds this
+; number, starting throttling.
+;
+; askThrottle.delay
+;
+; Throttle by delaying each request by X seconds.
+;
+;-------------------------------------------------------
+
+askThrottle.period = 900
+askThrottle.threshold = 300
+askThrottle.delay = 10
+
+;-------------------------------------------------------
+; ASK DELAY SECTION
+;
+; askDelay
+;
+; When no askDelay is specified or is -1 the user will see
+; greeting screen were he or she will a have to click
+; on a button to fill in a survey.
+;
+; With the askDelay is > 0 then greeting screen will
+; be shown (with the button) but after the specified
+; number of seconds the survey will load automatically.
+;
+; With an askDelay of 0 seconds the survey will load
+; automatically.
+;
+; askNextDelay
+;
+; askNextDelay works the same but applies to the wait
+; after the user completed a survey while another survey
+; is available.
+;-------------------------------------------------------
+
+; askDelay = 10
+; askNextDelay = 0
+
+;-------------------------------------------------------
+; E-MAIL SECTION
+;
+; USE
+;
+; Here you can set three global e-mail settings:
+;
+; bcc = BCC every sent mail to this address.
+; block = Block any sending of mail.
+; bounce = When set to 1 all mails are not sent to the
+; suplied TO address, but redirects them to
+; the FROM not respondent address. This allows
+; testing without altering respondent e-mail
+; addresses.
+; site = Supply a general site FROM address.
+;-------------------------------------------------------
+
+; email.bcc =
+email.block = 0
+email.bounce = 0
+; email.site =
+
+;-------------------------------------------------------
+; LAYOUT SECTION
+;
+; USE
+;
+; For each layout item with a value other than 0 there
+; must exist a _layout{Item}() method in GemsEscort or
+; the {Project}Escort.php class specified in
+; {Project}Application.ini file.
+;
+; Items are loaded in the order specified below. Order
+; may be important, e.g. navigation should be called
+; before crumbs.
+;
+; INPUT
+;
+; This method is called with layoutPrepareArgs.{Item}
+; in an array.
+;
+; Both layoutPrepare and layoutPrepareArgs can be
+; changed at runtime before GemsEscort.postDispatch()
+; is called.
+;
+; OUTPUT:
+;
+; The result (if any) is stored as a $view property.
+; When the item value is a number, the name will be
+; the item name.
+; When the item value is a string, then it is stored
+; in a MUtil_Html_Sequence view property with that
+; string as name. The sequence is created on demand.
+;-------------------------------------------------------
+
+layoutPrepare.title = 1
+layoutPrepare.projectName = header
+layoutPrepare.login = header_bar
+layoutPrepare.contact = 0
+layoutPrepare.localeSet = header_bar
+layoutPrepare.organizationSwitcher = header_bar
+layoutPrepare.version = footer
+layoutPrepare.user = footer
+layoutPrepare.time = 0
+layoutPrepare.menuHtml = 1
+layoutPrepare.navigation = 0
+layoutPrepare.crumbs = main
+layoutPrepare.messages = main
+layoutPrepare.css = 1
+layoutPrepare.favicon = 1
+layoutPrepare.dojo = 0
+layoutPrepare.jQuery = 1
+
+layoutPrepareArgs.login.class = rightFloat
+;layoutPrepareArgs.contact.class = rightFloat
+layoutPrepareArgs.time.class = rightFloat
+layoutPrepareArgs.user.class = rightFloat
+layoutPrepareArgs.version.class = leftFloat
+layoutPrepareArgs.localeSet.class = leftFloat
+
+;-------------------------------------------------------
+; LOCALE SECTION
+;
+; Specify a default locale and locales for each of the
+; supported languages.
+;-------------------------------------------------------
+
+locale.default = "en"
+locales.en = "en"
+locales.nl = "nl"
+
+;-------------------------------------------------------
+; ORGANIZATION SECTION
+;
+; Specify a default organization for a project. Allows
+; all user to login when this organization is choosen.
+;-------------------------------------------------------
+
+; organization.default = 70
+
+;----------------------------------------------------------------------
+; PASSWORD SECTION
+;
+; Allows default setting of initial password for new users:
+; password.firstPassword = sesame
+;----------------------------------------------------------------------
+
+;password.initialPassword = sesame
+
+;----------------------------------------------------------------------
+; PASSWORDS SECTION
+;
+; The last key must be a function name in your PasswordChecker class.
+; That function must accept as parameters the array value and the
+; password.
+;
+; In between keys can contain case insensitive organization codes, user
+; roles and user definition names in any order and can overrule previous
+; defined values.
+; BEWARE keep keys in fixed array order:
+; passwords.staff.mgz.capsCount = 1
+; passwords.mgz.staff.lowerCount = 1
+; passwords.staff.mgz.lowerCount = 2
+; will be processed as:
+; passwords.staff.mgz.capsCount = 1
+; passwords.staff.mgz.lowerCount = 2
+; passwords.mgz.staff.lowerCount = 1
+;----------------------------------------------------------------------
+
+passwords.notTheName = 1
+passwords.guest.minLength = 6
+passwords.staff.capsCount = 1
+passwords.staff.lowerCount = 1
+passwords.staff.minLength = 8
+passwords.staff.numCount = 0
+passwords.staff.notAlphaCount = 1
+passwords.staff.notAlphaNumCount = 0
+
+;-------------------------------------------------------
+; TOKEN SECTION
+;
+; chars: characters allowed in a token.
+; format: format string to show to user for input of
+; token. The \ backslash is used as escape
+; character for characters that are fixed.
+; from: commonly mistaken input characters to correct.
+; to: characters to translate from characters to.
+; case: optional: 1|0. If the token should be
+; treated case sensitive. If missing the token
+; is case sensitive when chars contains
+; uppercase characters.
+; reuse: days tokens can be used:
+; -1 = not at all
+; 0 = only today (default and required for looping)
+; 1 = only up to yesterdays tokens
+;-------------------------------------------------------
+
+tokens.chars = 23456789abcdefghijklmnopqrstuvwxyz
+tokens.format = XXXX\-XXXX;
+tokens.from = 01;
+tokens.to = ol;
+
+;---------------------------------------------------------
+; CONSENT SECTION
+;---------------------------------------------------------
+consentRejected = 'do not use'
+consentTypes = 'do not use|consent given'
+consentDefault = 'Unknown' ;Default setup makes this 'do not use'
+
+;---------------------------------------------------------
+; LOGLEVEL SECTION
+;---------------------------------------------------------
+; Use the loglevels as defined in Zend_Log to define the highest level of errors to log
+;
+; 0 Emergency: system is unusable
+; 1 Alert: action must be taken immediately
+; 2 Critical: critical conditions
+; 3 Error: error conditions
+; 4 Warning: warning conditions
+; 5 Notice: normal but significant condition
+; 6 Informational: informational messages
+; 7 Debug: debug messages
+;
+; Defaults for production are 3 (error) and 7 (debug) for testing and development, uncomment the
+; line below to use a custom setting
+;logLevel = 6;
+
+;---------------------------------------------------------
+; EXPORT SECTION
+;---------------------------------------------------------
+; Command line to the pdf export binary (such as
+; wkhtmltopdf, Phantom.js or similar)
+;
+; Use as follows:
+; export.pdfExportCommand = '/bin/wkhtmltopdf %s %s'
+;
+; where %s %s is respecitively the input (url) and
+; the output (file)
+export.pdfExportCommand =
+
+;---------------------------------------------------------
+; PERFORMANCE
+; Define what kind of cache to use. Choose from:
+; apc (shared) memory cache, can sometimes be slow due to limited available
+; memory in shared environments
+; file When filesystem is fast enough or apc is not available
+; none No cache - good for development
+;---------------------------------------------------------
+cache = "apc"
+
+[testing : production]
+cache = "file"
+admin.user = superadmin
+admin.pwd = superadmin
+
+email.bounce = 1
+
+passwords.notTheName = 0
+passwords.staff.minLength = 6
+
+[demo : production]
+admin.user = superadmin
+admin.pwd = superadmin
+
+email.bounce = 1
+
+[development : production]
+cache = "none"
+admin.user = superadmin
+admin.pwd = superadmin
+
+email.bounce = 1
+
+passwords.notTheName = 0
+passwords.staff.capsCount = 0
+passwords.staff.lowerCount = 0
+passwords.staff.minLength = 6
+passwords.staff.numCount = 0
+passwords.staff.notAlphaCount = 0
+passwords.staff.notAlphaNumCount = 0
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2013-04-11 15:42:29
|
Revision: 1226
http://sourceforge.net/p/gemstracker/code/1226
Author: matijsdejong
Date: 2013-04-11 15:42:23 +0000 (Thu, 11 Apr 2013)
Log Message:
-----------
Split field names on last underscore
Deleted 2 snippets that should not be deleted
Modified Paths:
--------------
trunk/library/classes/Gems/Event/Survey/Display/YesOnTop.php
Added Paths:
-----------
trunk/library/snippets/EditRoundSnippet.php
trunk/library/snippets/ShowRoundSnippet.php
Modified: trunk/library/classes/Gems/Event/Survey/Display/YesOnTop.php
===================================================================
--- trunk/library/classes/Gems/Event/Survey/Display/YesOnTop.php 2013-04-11 14:33:30 UTC (rev 1225)
+++ trunk/library/classes/Gems/Event/Survey/Display/YesOnTop.php 2013-04-11 15:42:23 UTC (rev 1226)
@@ -76,10 +76,9 @@
if ($value === 'Y') {
$onTop[$name] = $name;
} else {
- $nameParts = explode('_', $name);
-
- if (count($nameParts) > 1) {
- if (isset($onTop[$nameParts[0]])) {
+ // Split on last underscore instead of first
+ if ($i = strrpos($name, '_')) {
+ if (isset($onTop[substr($name, 0, $i)])) {
$onTop[$name] = $name;
}
}
Copied: trunk/library/snippets/EditRoundSnippet.php (from rev 1223, trunk/library/snippets/EditRoundStepSnippet.php)
===================================================================
--- trunk/library/snippets/EditRoundSnippet.php (rev 0)
+++ trunk/library/snippets/EditRoundSnippet.php 2013-04-11 15:42:23 UTC (rev 1226)
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Tracker
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ *
+ * @package Gems
+ * @subpackage Tracker
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4
+ */
+class EditRoundSnippet extends Gems_Tracker_Snippets_EditRoundSnippetAbstract
+{
+}
Copied: trunk/library/snippets/ShowRoundSnippet.php (from rev 1223, trunk/library/snippets/ShowRoundStepSnippet.php)
===================================================================
--- trunk/library/snippets/ShowRoundSnippet.php (rev 0)
+++ trunk/library/snippets/ShowRoundSnippet.php 2013-04-11 15:42:23 UTC (rev 1226)
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Tracker
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ *
+ * @package Gems
+ * @subpackage Tracker
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4
+ */
+class ShowRoundSnippet extends Gems_Tracker_Snippets_ShowRoundSnippetAbstract
+{
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-09-15 15:08:29
|
Revision: 25
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=25&view=rev
Author: matijsdejong
Date: 2011-09-15 15:08:23 +0000 (Thu, 15 Sep 2011)
Log Message:
-----------
- #4 seeing staff from other organizations is now a separate privilege
- minor bug: autoupdate right was not set for project view in SingleTrack projects
Modified Paths:
--------------
trunk/library/classes/Gems/Default/StaffAction.php
trunk/library/classes/Gems/Menu/MenuAbstract.php
trunk/library/classes/Gems/Menu.php
trunk/library/configs/db/tables/gems__roles.20.sql
Modified: trunk/library/classes/Gems/Default/StaffAction.php
===================================================================
--- trunk/library/classes/Gems/Default/StaffAction.php 2011-09-15 14:54:38 UTC (rev 24)
+++ trunk/library/classes/Gems/Default/StaffAction.php 2011-09-15 15:08:23 UTC (rev 25)
@@ -150,7 +150,7 @@
$groups = $this->db->fetchPairs($sql);
if (($this->session->user_role == 'admin' && isset($groups) && $groups[$data['gsf_id_primary_group']] == 'super')
- || (!$this->escort->hasPrivilege('pr.staff.edit.all') &&
+ || (! $this->escort->hasPrivilege('pr.staff.edit.all') &&
$data['gsf_id_organization'] != $this->escort->getCurrentOrganization())) {
throw new Zend_Exception($this->_('You are not allowed to edit this staff member.'));
}
@@ -179,10 +179,12 @@
'column_expression', "CONCAT(COALESCE(CONCAT(gsf_last_name, ', '), '-, '), COALESCE(CONCAT(gsf_first_name, ' '), ''), COALESCE(gsf_surname_prefix, ''))");
$model->set('gsf_email', 'label', $this->_('E-Mail'), 'itemDisplay', 'MUtil_Html_AElement::ifmail');
- $model->set('gsf_id_organization', 'label', $this->_('Organization'),
- 'multiOptions', $this->util->getDbLookup()->getOrganizations(),
- 'default', $this->escort->getCurrentOrganization());
-
+ if ($this->escort->hasPrivilege('pr.staff.see.all')) {
+ $model->set('gsf_id_organization', 'label', $this->_('Organization'),
+ 'multiOptions', $this->util->getDbLookup()->getOrganizations(),
+ 'default', $this->escort->getCurrentOrganization());
+ }
+
$model->set('gsf_id_primary_group', 'label', $this->_('Primary function'), 'multiOptions', MUtil_Lazy::call($this->util->getDbLookup()->getStaffGroups));
$model->set('gsf_gender', 'label', $this->_('Gender'), 'multiOptions', $this->util->getTranslated()->getGenders());
@@ -202,9 +204,14 @@
{
$elements = parent::getAutoSearchElements($model, $data);
- // Select organization
- $options = array('' => $this->_('(all organizations)')) + $this->getModel()->get('gsf_id_organization', 'multiOptions');
- $select = new Zend_Form_Element_Select('gsf_id_organization', array('multiOptions' => $options));
+ if ($this->escort->hasPrivilege('pr.staff.see.all')) {
+ // Select organization
+ $options = array('' => $this->_('(all organizations)')) + $this->getModel()->get('gsf_id_organization', 'multiOptions');
+ $select = new Zend_Form_Element_Select('gsf_id_organization', array('multiOptions' => $options));
+ } else {
+ $select = new Zend_Form_Element_Hidden('gsf_id_organization',
+ array('value' => $this->escort->getCurrentOrganization()));
+ }
// Position as second element
$search = array_shift($elements);
Modified: trunk/library/classes/Gems/Menu/MenuAbstract.php
===================================================================
--- trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-09-15 14:54:38 UTC (rev 24)
+++ trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-09-15 15:08:23 UTC (rev 25)
@@ -253,6 +253,8 @@
$trackSurveys->addAction($this->_('Preview'), 'pr.project.questions', 'questions')
->addNamedParameters(MUtil_Model::REQUEST_ID, 'gro_id_track', Gems_Model::SURVEY_ID, 'gsu_id_survey');
+ $infoPage->addAutofilterAction();
+
// MUtil_Echo::track($infoPage->_toNavigationArray(array($this->escort->request)));
} else {
if ($this->escort instanceof Gems_Project_Tracks_StandAloneSurveysInterface) {
Modified: trunk/library/classes/Gems/Menu.php
===================================================================
--- trunk/library/classes/Gems/Menu.php 2011-09-15 14:54:38 UTC (rev 24)
+++ trunk/library/classes/Gems/Menu.php 2011-09-15 15:08:23 UTC (rev 25)
@@ -606,6 +606,7 @@
$this->addHiddenPrivilige('pr.respondent.result');
$this->addHiddenPrivilige('pr.respondent.who');
$this->addHiddenPrivilige('pr.staff.edit.all');
+ $this->addHiddenPrivilige('pr.staff.see.all');
$this->addHiddenPrivilige('pr.token.mail.freetext');
Modified: trunk/library/configs/db/tables/gems__roles.20.sql
===================================================================
--- trunk/library/configs/db/tables/gems__roles.20.sql 2011-09-15 14:54:38 UTC (rev 24)
+++ trunk/library/configs/db/tables/gems__roles.20.sql 2011-09-15 15:08:23 UTC (rev 25)
@@ -32,5 +32,5 @@
('staff','staff','pr.option.edit,pr.option.password,pr.plan,pr.plan.overview,pr.plan.token,pr.project,pr.project.questions,pr.respondent.create,pr.respondent.edit,pr.respondent.who,pr.setup,pr.staff,pr.survey,pr.survey.create,pr.token,pr.token.answers,pr.token.delete,pr.token.edit,pr.token.mail,pr.token.print,pr.track,pr.track.create,pr.track.delete,pr.track.edit,pr.respondent.reportdeath','guest', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
('physician','physician','','staff', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
('researcher','researcher','pr.invitation,pr.result,pr.islogin','', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('admin','admin','pr.consent,pr.consent.create,pr.consent.edit,pr.group,pr.role,pr.mail,pr.mail.create,pr.mail.delete,pr.mail.edit,pr.organization,pr.organization-switch,pr.plan.overview.excel,pr.plan.respondent,pr.plan.respondent.excel,pr.plan.token.excel,pr.project-information,pr.reception,pr.reception.create,pr.reception.edit,pr.respondent.choose-org,pr.respondent.delete,pr.respondent.result,pr.source,pr.staff.create,pr.staff.delete,pr.staff.edit,pr.survey-maintenance,pr.track-maintenance,pr.token.mail.freetext','staff,researcher,security', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
+ ('admin','admin','pr.consent,pr.consent.create,pr.consent.edit,pr.group,pr.role,pr.mail,pr.mail.create,pr.mail.delete,pr.mail.edit,pr.organization,pr.organization-switch,pr.plan.overview.excel,pr.plan.respondent,pr.plan.respondent.excel,pr.plan.token.excel,pr.project-information,pr.reception,pr.reception.create,pr.reception.edit,pr.respondent.choose-org,pr.respondent.delete,pr.respondent.result,pr.source,pr.staff.create,pr.staff.delete,pr.staff.edit,pr.staff.see.all,pr.survey-maintenance,pr.track-maintenance,pr.token.mail.freetext','staff,researcher,security', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
('super','super','pr.consent.delete,pr.country,pr.country.create,pr.country.delete,pr.country.edit,pr.database,pr.database.create,pr.database.delete,pr.database.edit,pr.database.execute,pr.database.patches,pr.group.create,pr.group.edit,pr.role.create,pr.role.edit,pr.language,pr.organization.create,pr.organization.edit,pr.plan.choose-org,pr.plan.mail-as-application,pr.reception.delete,pr.source.create,pr.source.edit,pr.source.synchronize,pr.source.synchronize-all,pr.staff.edit.all,pr.survey-maintenance.edit,pr.track-maintenance.create,pr.track-maintenance.edit','admin', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-09-15 16:00:21
|
Revision: 26
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=26&view=rev
Author: matijsdejong
Date: 2011-09-15 16:00:09 +0000 (Thu, 15 Sep 2011)
Log Message:
-----------
- moved privilege based views to Roles instead of project for #5 Reorganize menu
- added default templates to mail tempplates
Modified Paths:
--------------
trunk/library/classes/Gems/Default/ProjectInformationAction.php
trunk/library/classes/Gems/Default/RoleAction.php
trunk/library/classes/Gems/Default/StaffAction.php
trunk/library/classes/Gems/Menu.php
trunk/library/configs/db/tables/gems__mail_templates.200.sql
Modified: trunk/library/classes/Gems/Default/ProjectInformationAction.php
===================================================================
--- trunk/library/classes/Gems/Default/ProjectInformationAction.php 2011-09-15 15:08:23 UTC (rev 25)
+++ trunk/library/classes/Gems/Default/ProjectInformationAction.php 2011-09-15 16:00:09 UTC (rev 26)
@@ -1,47 +1,47 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
/**
- *
- * @author Matijs de Jong
- * @since 1.0
- * @version 1.1
- * @package Gems
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
* @subpackage Default
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: StaffAction.php 460 2011-08-31 16:17:26Z mjong $
*/
/**
- *
- * @author Matijs de Jong
- * @package Gems
+ *
+ * @package Gems
* @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
*/
class Gems_Default_ProjectInformationAction extends Gems_Controller_Action
{
@@ -54,12 +54,6 @@
$this->html[] = $table;
}
- public function aclAction()
- {
- $this->html->h2($this->_('Access Control Lists'));
- $this->_showTable($this->_('ACL\'s'), $this->acl->getRoles());
- }
-
public function changelogAction()
{
$this->html->h2($this->_('Changelog'));
@@ -107,7 +101,7 @@
$this->html->h2($this->_('Project information'));
$versions = $this->loader->getVersions();
-
+
$data[$this->_('Project name')] = $this->project->name;
$data[$this->_('Project version')] = $versions->getProjectVersion();
$data[$this->_('Gems version')] = $versions->getGemsVersion();
@@ -139,23 +133,6 @@
$this->html->raw($php->getInfo());
}
- public function privilegeAction()
- {
- $privileges = array();
-
- foreach ($this->acl->getPrivilegeRoles() as $privilege => $roles) {
- $privileges[$privilege][$this->_('Privilege')] = $privilege;
- $privileges[$privilege][$this->_('Allowed')] = $roles[Zend_Acl::TYPE_ALLOW] ? implode(', ', $roles[Zend_Acl::TYPE_ALLOW]) : null;
- $privileges[$privilege][$this->_('Denied')] = $roles[Zend_Acl::TYPE_DENY] ? implode(', ', $roles[Zend_Acl::TYPE_DENY]) : null;
- }
- ksort($privileges);
-
- $this->html->h2($this->_('Project privileges'));
- $this->_showTable($this->_('Privileges'), $privileges, true);
-
- // $this->acl->echoRules();
- }
-
public function projectAction()
{
$project = $this->project;
@@ -166,24 +143,6 @@
}
- public function roleAction()
- {
- $roles = array();
-
- foreach ($this->acl->getRolePrivileges() as $role => $privileges) {
- $roles[$role][$this->_('Role')] = $role;
- $roles[$role][$this->_('Parents')] = $privileges[MUtil_Acl::PARENTS] ? implode(', ', $privileges[MUtil_Acl::PARENTS]) : null;
- $roles[$role][$this->_('Allowed')] = $privileges[Zend_Acl::TYPE_ALLOW] ? implode(', ', $privileges[Zend_Acl::TYPE_ALLOW]) : null;
- $roles[$role][$this->_('Denied')] = $privileges[Zend_Acl::TYPE_DENY] ? implode(', ', $privileges[Zend_Acl::TYPE_DENY]) : null;
- }
- ksort($roles);
-
- $this->html->h2($this->_('Project roles'));
- $this->_showTable($this->_('Roles'), $roles, true);
-
- // $this->acl->echoRules();
- }
-
public function sessionAction()
{
$this->html->h2($this->_('Session content'));
Modified: trunk/library/classes/Gems/Default/RoleAction.php
===================================================================
--- trunk/library/classes/Gems/Default/RoleAction.php 2011-09-15 15:08:23 UTC (rev 25)
+++ trunk/library/classes/Gems/Default/RoleAction.php 2011-09-15 16:00:09 UTC (rev 26)
@@ -1,10 +1,9 @@
<?php
-
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@@ -15,7 +14,7 @@
* * Neither the name of Erasmus MC nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -26,78 +25,38 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- *
- * @author Michiel Rook
- * @since 1.0
- * @version 1.3
- * @package Gems
+ *
+ *
+ * @package Gems
* @subpackage Default
+ * @author Michiel Rook
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: StaffAction.php 460 2011-08-31 16:17:26Z mjong $
*/
/**
- *
+ *
* @author Michiel Rook
- * @package Gems
+ * @package Gems
* @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.3
*/
class Gems_Default_RoleAction extends Gems_Controller_BrowseEditAction
{
-
- /**
- * Check the disabled (=inherited) privileges
- *
- * @param Gems_Form $form
- * @param boolean $isNew
- * @return Gems_Form
- */
- public function beforeFormDisplay($form, $isNew) {
- $form = parent::beforeFormDisplay($form, $isNew);
- $checkbox = $form->getElement('grl_privileges');
- $values = $checkbox->getValue();
- $disabled = $checkbox->getAttrib('disable');
-
- $values = array_merge($values, $disabled);
- $checkbox->setValue($values);
- return $form;
+ protected function _showTable($caption, $data, $nested = false)
+ {
+ $table = MUtil_Html_TableElement::createArray($data, $caption, $nested);
+ $table->class = 'browser';
+ $this->html[] = $table;
}
-
- /**
- *
- * @param array $data The data that will be saved.
- * @param boolean $isNew
- * $param Zend_Form $form
- * @return array|null Returns null if save was already handled, the data otherwise.
- */
- public function beforeSave(array &$data, $isNew, Zend_Form $form = null)
- {
- if (isset($data['grl_parents'])) {
- $data['grl_parents'] = implode(',', $data['grl_parents']);
- }
- if (isset($data['grl_privileges'])) {
- $data['grl_privileges'] = implode(',', $data['grl_privileges']);
- }
-
- return true;
- }
-
- /**
- * @param array $data
- * @param bool $isNew
- * @return array
- */
- public function afterFormLoad(array &$data, $isNew)
+ public function aclAction()
{
- if (isset($data['grl_parents']) && (! is_array($data['grl_parents']))) {
- $data['grl_parents'] = explode(',', $data['grl_parents']);
- }
-
- if (isset($data['grl_privileges']) && (! is_array($data['grl_privileges']))) {
- $data['grl_privileges'] = explode(',', $data['grl_privileges']);
- }
+ $this->html->h2($this->_('Access Control Lists'));
+ $this->_showTable($this->_('ACL\'s'), $this->acl->getRoles());
}
/**
@@ -128,14 +87,68 @@
$disable = array();
foreach($result[$data['grl_name']][MUtil_Acl::INHERITED][Zend_Acl::TYPE_ALLOW] as $key=>$value) {
$disable[] = $value;
- }
+ }
$checkbox->setAttrib('disable', $disable);
//Don't use escaping, so the line breaks work
$checkbox->setAttrib('escape', false);
}
-
+
/**
+ * @param array $data
+ * @param bool $isNew
+ * @return array
+ */
+ public function afterFormLoad(array &$data, $isNew)
+ {
+ if (isset($data['grl_parents']) && (! is_array($data['grl_parents']))) {
+ $data['grl_parents'] = explode(',', $data['grl_parents']);
+ }
+
+ if (isset($data['grl_privileges']) && (! is_array($data['grl_privileges']))) {
+ $data['grl_privileges'] = explode(',', $data['grl_privileges']);
+ }
+ }
+
+ /**
+ * Check the disabled (=inherited) privileges
+ *
+ * @param Gems_Form $form
+ * @param boolean $isNew
+ * @return Gems_Form
+ */
+ public function beforeFormDisplay($form, $isNew) {
+ $form = parent::beforeFormDisplay($form, $isNew);
+ $checkbox = $form->getElement('grl_privileges');
+ $values = $checkbox->getValue();
+ $disabled = $checkbox->getAttrib('disable');
+
+ $values = array_merge($values, $disabled);
+ $checkbox->setValue($values);
+ return $form;
+ }
+
+ /**
+ *
+ * @param array $data The data that will be saved.
+ * @param boolean $isNew
+ * $param Zend_Form $form
+ * @return array|null Returns null if save was already handled, the data otherwise.
+ */
+ public function beforeSave(array &$data, $isNew, Zend_Form $form = null)
+ {
+ if (isset($data['grl_parents'])) {
+ $data['grl_parents'] = implode(',', $data['grl_parents']);
+ }
+
+ if (isset($data['grl_privileges'])) {
+ $data['grl_privileges'] = implode(',', $data['grl_privileges']);
+ }
+
+ return true;
+ }
+
+ /**
* Creates a model for getModel(). Called only for each new $action.
*
* The parameters allow you to easily adapt the model to the current action. The $detailed
@@ -156,14 +169,14 @@
$model->set('grl_privileges', 'label', $this->_('Privileges'), 'formatFunction', array($this, 'formatLongLine'));
Gems_Model::setChangeFieldsByPrefix($model, 'grl');
-
+
return $model;
}
-
+
public function formatLongLine($line)
{
if (strlen($line) > 50) {
- return substr($line, 0, 50) . '...';
+ return substr($line, 0, 50) . '...';
} else {
return $line;
}
@@ -178,12 +191,46 @@
{
return $this->_('Administrative roles');
}
-
+
protected function getUsedPrivileges()
{
$privileges = $this->menu->getUsedPrivileges();
asort($privileges);
return $privileges;
- }
+ }
+
+ public function overviewAction()
+ {
+ $roles = array();
+
+ foreach ($this->acl->getRolePrivileges() as $role => $privileges) {
+ $roles[$role][$this->_('Role')] = $role;
+ $roles[$role][$this->_('Parents')] = $privileges[MUtil_Acl::PARENTS] ? implode(', ', $privileges[MUtil_Acl::PARENTS]) : null;
+ $roles[$role][$this->_('Allowed')] = $privileges[Zend_Acl::TYPE_ALLOW] ? implode(', ', $privileges[Zend_Acl::TYPE_ALLOW]) : null;
+ $roles[$role][$this->_('Denied')] = $privileges[Zend_Acl::TYPE_DENY] ? implode(', ', $privileges[Zend_Acl::TYPE_DENY]) : null;
+ }
+ ksort($roles);
+
+ $this->html->h2($this->_('Project role overview'));
+
+ $this->_showTable($this->_('Roles'), $roles, true);
+ }
+
+ public function privilegeAction()
+ {
+ $privileges = array();
+
+ foreach ($this->acl->getPrivilegeRoles() as $privilege => $roles) {
+ $privileges[$privilege][$this->_('Privilege')] = $privilege;
+ $privileges[$privilege][$this->_('Allowed')] = $roles[Zend_Acl::TYPE_ALLOW] ? implode(', ', $roles[Zend_Acl::TYPE_ALLOW]) : null;
+ $privileges[$privilege][$this->_('Denied')] = $roles[Zend_Acl::TYPE_DENY] ? implode(', ', $roles[Zend_Acl::TYPE_DENY]) : null;
+ }
+ ksort($privileges);
+
+ $this->html->h2($this->_('Project privileges'));
+ $this->_showTable($this->_('Privileges'), $privileges, true);
+
+ // $this->acl->echoRules();
+ }
}
Modified: trunk/library/classes/Gems/Default/StaffAction.php
===================================================================
--- trunk/library/classes/Gems/Default/StaffAction.php 2011-09-15 15:08:23 UTC (rev 25)
+++ trunk/library/classes/Gems/Default/StaffAction.php 2011-09-15 16:00:09 UTC (rev 26)
@@ -36,7 +36,7 @@
/**
*
- * @package Gems
+ * @package Gems
* @subpackage Default
* @copyright Copyright (c) 2011 Erasmus MC
* @license New BSD License
@@ -184,7 +184,7 @@
'multiOptions', $this->util->getDbLookup()->getOrganizations(),
'default', $this->escort->getCurrentOrganization());
}
-
+
$model->set('gsf_id_primary_group', 'label', $this->_('Primary function'), 'multiOptions', MUtil_Lazy::call($this->util->getDbLookup()->getStaffGroups));
$model->set('gsf_gender', 'label', $this->_('Gender'), 'multiOptions', $this->util->getTranslated()->getGenders());
Modified: trunk/library/classes/Gems/Menu.php
===================================================================
--- trunk/library/classes/Gems/Menu.php 2011-09-15 15:08:23 UTC (rev 25)
+++ trunk/library/classes/Gems/Menu.php 2011-09-15 16:00:09 UTC (rev 26)
@@ -185,12 +185,9 @@
// PROJECT
$page = $setup->addPage($this->_('Project setup'), 'pr.project-information', 'project-information');
- $page->addAction($this->_('ACL'), null, 'acl');
$page->addAction($this->_('Errors'), null, 'errors');
$page->addAction($this->_('PHP'), null, 'php');
- $page->addAction($this->_('Privileges'), null, 'privilege');
$page->addAction($this->_('Project'), null, 'project');
- $page->addAction($this->_('Roles'), null, 'role');
$page->addAction($this->_('Session'), null, 'session');
// COUNTRIES CONTROLLER
@@ -209,9 +206,11 @@
$setup->addBrowsePage($this->_('Groups'), 'pr.group', 'group');
// ROLES CONTROLLER
- $setup->addBrowsePage($this->_('Roles'), 'pr.role', 'role');
+ $page = $setup->addBrowsePage($this->_('Roles'), 'pr.role', 'role');
+ $page->addAction($this->_('ACL'), null, 'acl');
+ $page->addAction($this->_('Assigned'), null, 'overview');
+ $page->addAction($this->_('Privileges'), null, 'privilege');
-
// RECEPTION CODE CONTROLLER
$setup->addBrowsePage($this->_('Reception codes'), 'pr.reception', 'reception');
Modified: trunk/library/configs/db/tables/gems__mail_templates.200.sql
===================================================================
--- trunk/library/configs/db/tables/gems__mail_templates.200.sql 2011-09-15 15:08:23 UTC (rev 25)
+++ trunk/library/configs/db/tables/gems__mail_templates.200.sql 2011-09-15 16:00:09 UTC (rev 26)
@@ -20,3 +20,19 @@
AUTO_INCREMENT = 20
CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
+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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-09-19 08:07:42
|
Revision: 33
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=33&view=rev
Author: mennodekker
Date: 2011-09-19 08:07:34 +0000 (Mon, 19 Sep 2011)
Log Message:
-----------
Updated sources to be 'survey sources' instead of 'lime survey sources' and updated translations
Modified Paths:
--------------
trunk/library/classes/Gems/Default/SourceAction.php
trunk/library/languages/default-en.mo
trunk/library/languages/default-en.po
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
Modified: trunk/library/classes/Gems/Default/SourceAction.php
===================================================================
--- trunk/library/classes/Gems/Default/SourceAction.php 2011-09-16 15:14:56 UTC (rev 32)
+++ trunk/library/classes/Gems/Default/SourceAction.php 2011-09-19 08:07:34 UTC (rev 33)
@@ -26,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- *
+ *
* @package Gems
* @subpackage Default
* @author Matijs de Jong <mj...@ma...>
@@ -191,7 +191,7 @@
public function getTopicTitle()
{
- return $this->_('Lime Survey Sources');
+ return $this->_('Survey Sources');
}
public function pingAction()
Modified: trunk/library/languages/default-en.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-en.po
===================================================================
--- trunk/library/languages/default-en.po 2011-09-16 15:14:56 UTC (rev 32)
+++ trunk/library/languages/default-en.po 2011-09-19 08:07:34 UTC (rev 33)
@@ -2,9 +2,9 @@
msgstr ""
"Project-Id-Version: Pulse EN\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-09-15 16:26+0100\n"
+"POT-Creation-Date: 2011-09-19 10:05+0100\n"
"PO-Revision-Date: \n"
-"Last-Translator: Matijs de Jong <mj...@ma...>\n"
+"Last-Translator: Menno Dekker <men...@er...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -32,34 +32,34 @@
msgid "version"
msgstr "version"
-#: classes/GemsEscort.php:1401
+#: classes/GemsEscort.php:1422
msgid "Take note: your session has expired, your inputs where not saved. Please check the input data and try again"
msgstr "Take note: your session has expired, your inputs where not saved. Please check the input data and try again"
-#: classes/GemsEscort.php:1523
+#: classes/GemsEscort.php:1544
msgid "No access to site."
msgstr "No access to site."
-#: classes/GemsEscort.php:1525
-#: classes/GemsEscort.php:1561
+#: classes/GemsEscort.php:1546
+#: classes/GemsEscort.php:1582
msgid "You have no access to this site."
msgstr "You have no access to this site."
-#: classes/GemsEscort.php:1541
+#: classes/GemsEscort.php:1562
msgid "No access to page"
msgstr "No access to page"
-#: classes/GemsEscort.php:1543
+#: classes/GemsEscort.php:1564
#, 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:1548
-#: classes/GemsEscort.php:1559
+#: classes/GemsEscort.php:1569
+#: classes/GemsEscort.php:1580
msgid "You are no longer logged in."
msgstr "You are no longer logged in."
-#: classes/GemsEscort.php:1549
+#: classes/GemsEscort.php:1570
msgid "You must login to access this page."
msgstr "You must login to access this page."
@@ -153,234 +153,230 @@
msgstr "Project setup"
#: classes/Gems/Menu.php:188
-msgid "ACL"
-msgstr "ACL"
-
-#: classes/Gems/Menu.php:189
msgid "Errors"
msgstr "Errors"
-#: classes/Gems/Menu.php:190
+#: classes/Gems/Menu.php:189
msgid "PHP"
msgstr "PHP"
-#: classes/Gems/Menu.php:191
-msgid "Privileges"
-msgstr "Privileges"
-
-#: classes/Gems/Menu.php:192
-#: classes/Gems/Menu.php:589
+#: classes/Gems/Menu.php:190
+#: classes/Gems/Menu.php:581
msgid "Project"
msgstr "Project"
-#: classes/Gems/Menu.php:193
-#: classes/Gems/Menu.php:212
-msgid "Roles"
-msgstr "Roles"
-
-#: classes/Gems/Menu.php:194
+#: classes/Gems/Menu.php:191
msgid "Session"
msgstr "Session"
-#: classes/Gems/Menu.php:203
+#: classes/Gems/Menu.php:200
msgid "Consents"
msgstr "Consents"
-#: classes/Gems/Menu.php:206
+#: classes/Gems/Menu.php:203
msgid "Organizations"
msgstr "Organizations"
-#: classes/Gems/Menu.php:209
+#: classes/Gems/Menu.php:206
msgid "Groups"
msgstr "Groups"
-#: classes/Gems/Menu.php:216
+#: classes/Gems/Menu.php:209
+msgid "Roles"
+msgstr "Roles"
+
+#: classes/Gems/Menu.php:210
+msgid "ACL"
+msgstr "ACL"
+
+#: classes/Gems/Menu.php:211
+#: classes/Gems/Menu.php:398
+msgid "Assigned"
+msgstr "Assigned"
+
+#: classes/Gems/Menu.php:212
+msgid "Privileges"
+msgstr "Privileges"
+
+#: classes/Gems/Menu.php:215
msgid "Reception codes"
msgstr "Reception codes"
-#: classes/Gems/Menu.php:219
-msgid "Email servers"
-msgstr "Email servers"
-
-#: classes/Gems/Menu.php:223
-msgid "Email"
-msgstr "Email"
-
-#: classes/Gems/Menu.php:226
+#: classes/Gems/Menu.php:218
msgid "Survey Sources"
msgstr "Survey Sources"
-#: classes/Gems/Menu.php:228
+#: classes/Gems/Menu.php:220
msgid "Check status"
msgstr "Check status"
-#: classes/Gems/Menu.php:229
+#: classes/Gems/Menu.php:221
msgid "Synchronize surveys"
msgstr "Synchronize surveys"
-#: classes/Gems/Menu.php:230
-#: classes/Gems/Menu.php:241
+#: classes/Gems/Menu.php:222
+#: classes/Gems/Menu.php:233
msgid "Check answers"
msgstr "Check answers"
-#: classes/Gems/Menu.php:231
+#: classes/Gems/Menu.php:223
msgid "Synchronize all surveys"
msgstr "Synchronize all surveys"
-#: classes/Gems/Menu.php:232
-#: classes/Gems/Menu.php:242
+#: classes/Gems/Menu.php:224
+#: classes/Gems/Menu.php:234
msgid "Check all answers"
msgstr "Check all answers"
-#: classes/Gems/Menu.php:235
-#: classes/Gems/Menu.php:396
+#: classes/Gems/Menu.php:227
+#: classes/Gems/Menu.php:388
msgid "Surveys"
msgstr "Surveys"
-#: classes/Gems/Menu.php:238
+#: classes/Gems/Menu.php:230
msgid "PDF"
msgstr "PDF"
-#: classes/Gems/Menu.php:247
-#: classes/Gems/Menu.php:362
+#: classes/Gems/Menu.php:239
+#: classes/Gems/Menu.php:354
msgid "Tracks"
msgstr "Tracks"
-#: classes/Gems/Menu.php:250
+#: classes/Gems/Menu.php:242
msgid "Fields"
msgstr "Fields"
-#: classes/Gems/Menu.php:257
+#: classes/Gems/Menu.php:249
msgid "Rounds"
msgstr "Rounds"
-#: classes/Gems/Menu.php:266
+#: classes/Gems/Menu.php:258
msgid "Round"
msgstr "Round"
-#: classes/Gems/Menu.php:272
+#: classes/Gems/Menu.php:264
msgid "Check assignments"
msgstr "Check assignments"
-#: classes/Gems/Menu.php:275
+#: classes/Gems/Menu.php:267
msgid "Check all assignments"
msgstr "Check all assignments"
-#: classes/Gems/Menu.php:278
+#: classes/Gems/Menu.php:270
msgid "Logging"
msgstr "Logging"
-#: classes/Gems/Menu.php:282
+#: classes/Gems/Menu.php:274
msgid "Maintenance"
msgstr "Maintenance"
-#: classes/Gems/Menu.php:296
+#: classes/Gems/Menu.php:288
#, php-format
msgid "Stand-alone privilige: %s"
msgstr "Stand-alone privilige: %s"
-#: classes/Gems/Menu.php:303
+#: classes/Gems/Menu.php:295
msgid "Logon"
msgstr "Logon"
-#: classes/Gems/Menu.php:304
+#: classes/Gems/Menu.php:296
msgid "Lost password"
msgstr "Lost password"
-#: classes/Gems/Menu.php:305
+#: classes/Gems/Menu.php:297
msgid "Your account"
msgstr "Your account"
-#: classes/Gems/Menu.php:306
+#: classes/Gems/Menu.php:298
msgid "Activity overview"
msgstr "Activity overview"
-#: classes/Gems/Menu.php:307
+#: classes/Gems/Menu.php:299
msgid "Change password"
msgstr "Change password"
-#: classes/Gems/Menu.php:308
-#: classes/Gems/Menu.php:348
-#: classes/Gems/Menu.php:383
+#: classes/Gems/Menu.php:300
+#: classes/Gems/Menu.php:340
+#: classes/Gems/Menu.php:375
msgid "Token"
msgstr "Token"
-#: classes/Gems/Menu.php:309
+#: classes/Gems/Menu.php:301
msgid "Logoff"
msgstr "Logoff"
-#: classes/Gems/Menu.php:344
+#: classes/Gems/Menu.php:336
msgid "Track"
msgstr "Track"
-#: classes/Gems/Menu.php:351
-#: classes/Gems/Menu.php:371
-#: classes/Gems/Menu.php:402
+#: classes/Gems/Menu.php:343
+#: classes/Gems/Menu.php:363
+#: classes/Gems/Menu.php:394
msgid "Add"
msgstr "Add"
-#: classes/Gems/Menu.php:355
-#: classes/Gems/Menu.php:438
+#: classes/Gems/Menu.php:347
+#: classes/Gems/Menu.php:430
msgid "Preview"
msgstr "Preview"
-#: classes/Gems/Menu.php:375
+#: classes/Gems/Menu.php:367
msgid "Assignments"
msgstr "Assignments"
-#: classes/Gems/Menu.php:379
+#: classes/Gems/Menu.php:371
msgid "Show"
msgstr "Show"
-#: classes/Gems/Menu.php:387
+#: classes/Gems/Menu.php:379
msgid "Edit"
msgstr "Edit"
-#: classes/Gems/Menu.php:391
+#: classes/Gems/Menu.php:383
msgid "Delete"
msgstr "Delete"
-#: classes/Gems/Menu.php:406
-msgid "Assigned"
-msgstr "Assigned"
-
-#: classes/Gems/Menu.php:428
+#: classes/Gems/Menu.php:420
msgid "Fill in"
msgstr "Fill in"
-#: classes/Gems/Menu.php:432
+#: classes/Gems/Menu.php:424
msgid "Print PDF"
msgstr "Print PDF"
-#: classes/Gems/Menu.php:435
+#: classes/Gems/Menu.php:427
msgid "E-Mail now!"
msgstr "E-Mail now!"
-#: classes/Gems/Menu.php:441
+#: classes/Gems/Menu.php:433
msgid "Answers"
msgstr "Answers"
-#: classes/Gems/Menu.php:579
+#: classes/Gems/Menu.php:571
msgid "Respondents"
msgstr "Patients"
-#: classes/Gems/Menu.php:582
+#: classes/Gems/Menu.php:574
msgid "Overview"
msgstr "Overview"
-#: classes/Gems/Menu.php:592
+#: classes/Gems/Menu.php:584
msgid "Staff"
msgstr "Staff"
-#: classes/Gems/Menu.php:595
+#: classes/Gems/Menu.php:587
msgid "Setup"
msgstr "Setup"
-#: classes/Gems/Menu.php:601
+#: classes/Gems/Menu.php:590
+msgid "Mail"
+msgstr "Mail"
+
+#: classes/Gems/Menu.php:599
msgid "Contact"
msgstr "Contact"
-#: classes/Gems/Menu.php:613
+#: classes/Gems/Menu.php:612
msgid "Changelog"
msgstr "Changelog"
@@ -882,7 +878,6 @@
msgstr "%d new or changed patch(es)."
#: classes/Gems/Default/DatabaseAction.php:317
-#: classes/Gems/Default/ProjectInformationAction.php:114
msgid "Gems build"
msgstr "Gems build"
@@ -1018,8 +1013,32 @@
msgid "Contents of %s %s"
msgstr "Contents of %s %s"
+#: classes/Gems/Default/ExportAction.php:69
+msgid "Data"
+msgstr "Data"
+
+#: classes/Gems/Default/ExportAction.php:74
+msgid "Export data"
+msgstr "Export data"
+
+#: classes/Gems/Default/ExportAction.php:161
+msgid "Survey"
+msgstr "Survey"
+
+#: classes/Gems/Default/ExportAction.php:178
+#, php-format
+msgid "%s records found."
+msgstr "%s records found."
+
+#: classes/Gems/Default/ExportAction.php:182
+msgid "Organization"
+msgstr "Organization"
+
+#: classes/Gems/Default/ExportAction.php:190
+msgid "Export to"
+msgstr "Export to"
+
#: classes/Gems/Default/GroupAction.php:88
-#: classes/Gems/Default/ProjectInformationAction.php:174
msgid "Role"
msgstr "Role"
@@ -1224,7 +1243,7 @@
#: classes/Gems/Default/MailServerAction.php:68
msgid "From address [part]"
-msgstr ""
+msgstr "From address [part]"
#: classes/Gems/Default/MailServerAction.php:70
msgid "E.g.: '%', '%.org' or '%@gemstracker.org' or 'ro...@ge...'."
@@ -1278,6 +1297,10 @@
msgstr[0] "email server"
msgstr[1] "email servers"
+#: classes/Gems/Default/MailServerAction.php:105
+msgid "Email servers"
+msgstr "Email servers"
+
#: classes/Gems/Default/OptionAction.php:73
#: classes/Gems/Default/OrganizationAction.php:128
msgid "Language"
@@ -1391,6 +1414,9 @@
msgstr "Participating organizations"
#: classes/Gems/Default/OverviewPlanAction.php:115
+#: classes/Gems/Default/ProjectSurveysAction.php:88
+#: classes/Gems/Default/SurveyAction.php:203
+#: classes/Gems/Default/SurveyMaintenanceAction.php:424
msgid "survey"
msgid_plural "surveys"
msgstr[0] "survey"
@@ -1400,147 +1426,108 @@
msgid "Planning overview"
msgstr "Planning overview"
-#: classes/Gems/Default/ProjectInformationAction.php:59
-msgid "Access Control Lists"
-msgstr "Access Control Lists"
-
-#: classes/Gems/Default/ProjectInformationAction.php:60
-msgid "ACL's"
-msgstr "ACL's"
-
-#: classes/Gems/Default/ProjectInformationAction.php:77
+#: classes/Gems/Default/ProjectInformationAction.php:71
#, php-format
msgid "No changelog found. Place one in %s."
msgstr "No changelog found. Place one in %s."
-#: classes/Gems/Default/ProjectInformationAction.php:83
+#: classes/Gems/Default/ProjectInformationAction.php:77
msgid "Logged errors"
msgstr "Logged errors"
-#: classes/Gems/Default/ProjectInformationAction.php:94
-#: classes/Gems/Default/ProjectInformationAction.php:101
+#: classes/Gems/Default/ProjectInformationAction.php:88
+#: classes/Gems/Default/ProjectInformationAction.php:95
msgid "Empty logfile"
msgstr "Empty logfile"
-#: classes/Gems/Default/ProjectInformationAction.php:100
+#: classes/Gems/Default/ProjectInformationAction.php:94
msgid "No logged errors found."
msgstr "No logged errors found."
-#: classes/Gems/Default/ProjectInformationAction.php:107
+#: classes/Gems/Default/ProjectInformationAction.php:101
msgid "Project information"
msgstr "Project information"
-#: classes/Gems/Default/ProjectInformationAction.php:111
+#: classes/Gems/Default/ProjectInformationAction.php:105
msgid "Project name"
msgstr "Project name"
-#: classes/Gems/Default/ProjectInformationAction.php:112
+#: classes/Gems/Default/ProjectInformationAction.php:106
msgid "Project version"
msgstr "Project version"
-#: classes/Gems/Default/ProjectInformationAction.php:113
+#: classes/Gems/Default/ProjectInformationAction.php:107
msgid "Gems version"
msgstr "Gems version"
-#: classes/Gems/Default/ProjectInformationAction.php:115
+#: classes/Gems/Default/ProjectInformationAction.php:109
msgid "Gems project"
msgstr "Gems project"
-#: classes/Gems/Default/ProjectInformationAction.php:116
+#: classes/Gems/Default/ProjectInformationAction.php:110
msgid "Gems web directory"
msgstr "Gems web directory"
-#: classes/Gems/Default/ProjectInformationAction.php:117
+#: classes/Gems/Default/ProjectInformationAction.php:111
msgid "Gems code directory"
msgstr "Gems code directory"
-#: classes/Gems/Default/ProjectInformationAction.php:118
+#: classes/Gems/Default/ProjectInformationAction.php:112
msgid "Gems project path"
msgstr "Gems project path"
-#: classes/Gems/Default/ProjectInformationAction.php:119
+#: classes/Gems/Default/ProjectInformationAction.php:113
msgid "MUtil version"
msgstr "MUtil version"
-#: classes/Gems/Default/ProjectInformationAction.php:120
+#: classes/Gems/Default/ProjectInformationAction.php:114
msgid "Zend version"
msgstr "Zend version"
-#: classes/Gems/Default/ProjectInformationAction.php:121
+#: classes/Gems/Default/ProjectInformationAction.php:115
msgid "Application environment"
msgstr "Application environment"
-#: classes/Gems/Default/ProjectInformationAction.php:122
+#: classes/Gems/Default/ProjectInformationAction.php:116
msgid "Application baseuri"
msgstr "Application baseuri"
-#: classes/Gems/Default/ProjectInformationAction.php:123
+#: classes/Gems/Default/ProjectInformationAction.php:117
msgid "Application directory"
msgstr "Application directory"
-#: classes/Gems/Default/ProjectInformationAction.php:124
+#: classes/Gems/Default/ProjectInformationAction.php:118
msgid "PHP version"
msgstr "PHP version"
-#: classes/Gems/Default/ProjectInformationAction.php:125
+#: classes/Gems/Default/ProjectInformationAction.php:119
msgid "Server Hostname"
msgstr "Server Hostname"
-#: classes/Gems/Default/ProjectInformationAction.php:126
+#: classes/Gems/Default/ProjectInformationAction.php:120
msgid "Server OS"
msgstr "Server OS"
-#: classes/Gems/Default/ProjectInformationAction.php:127
+#: classes/Gems/Default/ProjectInformationAction.php:121
msgid "Time on server"
msgstr "Time on server"
-#: classes/Gems/Default/ProjectInformationAction.php:129
+#: classes/Gems/Default/ProjectInformationAction.php:123
msgid "Version information"
msgstr "Version information"
-#: classes/Gems/Default/ProjectInformationAction.php:134
+#: classes/Gems/Default/ProjectInformationAction.php:128
msgid "Server PHP Info"
msgstr "Server PHP Info"
-#: classes/Gems/Default/ProjectInformationAction.php:147
-msgid "Privilege"
-msgstr "Privilege"
-
-#: classes/Gems/Default/ProjectInformationAction.php:148
-#: classes/Gems/Default/ProjectInformationAction.php:176
-msgid "Allowed"
-msgstr "Allowed"
-
-#: classes/Gems/Default/ProjectInformationAction.php:149
-#: classes/Gems/Default/ProjectInformationAction.php:177
-msgid "Denied"
-msgstr "Denied"
-
-#: classes/Gems/Default/ProjectInformationAction.php:153
-msgid "Project privileges"
-msgstr "Project privileges"
-
-#: classes/Gems/Default/ProjectInformationAction.php:164
+#: classes/Gems/Default/ProjectInformationAction.php:141
msgid "Project settings"
msgstr "Project settings"
-#: classes/Gems/Default/ProjectInformationAction.php:175
-msgid "Parents"
-msgstr "Parents"
-
-#: classes/Gems/Default/ProjectInformationAction.php:181
-msgid "Project roles"
-msgstr "Project roles"
-
-#: classes/Gems/Default/ProjectInformationAction.php:189
+#: classes/Gems/Default/ProjectInformationAction.php:148
msgid "Session content"
msgstr "Session content"
-#: classes/Gems/Default/ProjectSurveysAction.php:67
-#: classes/Gems/Default/SurveyAction.php:191
-msgid "Survey"
-msgstr "Survey"
-
#: classes/Gems/Default/ProjectSurveysAction.php:68
#: classes/Gems/Default/SurveyAction.php:192
msgid "By"
@@ -1571,7 +1558,6 @@
#: classes/Gems/Default/ProjectTracksAction.php:85
#: classes/Gems/Default/TrackAction.php:451
-#: classes/Gems/Default/TrackMaintenanceAction.php:242
msgid "track"
msgid_plural "tracks"
msgstr[0] "track"
@@ -1783,16 +1769,51 @@
msgid "Respondent planning"
msgstr "Respondent planning"
-#: classes/Gems/Default/RoleAction.php:174
+#: classes/Gems/Default/RoleAction.php:58
+msgid "Access Control Lists"
+msgstr "Access Control Lists"
+
+#: classes/Gems/Default/RoleAction.php:59
+msgid "ACL's"
+msgstr "ACL's"
+
+#: classes/Gems/Default/RoleAction.php:168
+#: classes/Gems/Default/RoleAction.php:209
+msgid "Parents"
+msgstr "Parents"
+
+#: classes/Gems/Default/RoleAction.php:187
msgid "role"
msgid_plural "roles"
msgstr[0] "role"
msgstr[1] "roles"
-#: classes/Gems/Default/RoleAction.php:179
+#: classes/Gems/Default/RoleAction.php:192
msgid "Administrative roles"
msgstr "Administrative roles"
+#: classes/Gems/Default/RoleAction.php:210
+#: classes/Gems/Default/RoleAction.php:226
+msgid "Allowed"
+msgstr "Allowed"
+
+#: classes/Gems/Default/RoleAction.php:211
+#: classes/Gems/Default/RoleAction.php:227
+msgid "Denied"
+msgstr "Denied"
+
+#: classes/Gems/Default/RoleAction.php:215
+msgid "Project role overview"
+msgstr "Project role overview"
+
+#: classes/Gems/Default/RoleAction.php:225
+msgid "Privilege"
+msgstr "Privilege"
+
+#: classes/Gems/Default/RoleAction.php:231
+msgid "Project privileges"
+msgstr "Project privileges"
+
#: classes/Gems/Default/SourceAction.php:69
msgid "Leave empty for the Gems database."
msgstr "Leave empty for the Gems database."
@@ -1840,10 +1861,6 @@
msgstr[0] "source"
msgstr[1] "sources"
-#: classes/Gems/Default/SourceAction.php:194
-msgid "Lime Survey Sources"
-msgstr "Lime Survey Sources"
-
#: classes/Gems/Default/SourceAction.php:202
msgid "This installation is active."
msgstr "This installation is active."
@@ -1882,15 +1899,11 @@
msgid "You are not allowed to edit this staff member."
msgstr "You are not allowed to edit this staff member."
-#: classes/Gems/Default/StaffAction.php:182
-msgid "Organization"
-msgstr "Organization"
-
-#: classes/Gems/Default/StaffAction.php:186
+#: classes/Gems/Default/StaffAction.php:188
msgid "Primary function"
msgstr "Primary function"
-#: classes/Gems/Default/StaffAction.php:233
+#: classes/Gems/Default/StaffAction.php:240
msgid "staff member"
msgid_plural "staff members"
msgstr[0] "staff member"
@@ -2269,12 +2282,10 @@
msgstr "Free text"
#: classes/Gems/Default/TrackFieldsAction.php:114
-#: classes/Gems/Default/TrackMaintenanceAction.php:211
msgid "Values"
msgstr "Values"
#: classes/Gems/Default/TrackFieldsAction.php:116
-#: classes/Gems/Default/TrackMaintenanceAction.php:213
msgid "Required"
msgstr "Required"
@@ -2314,6 +2325,10 @@
msgstr "%s in track"
#: classes/Gems/Default/TrackRoundAction.php:89
+#: classes/Gems/Default/TrackRoundsAction.php:82
+#: classes/Gems/Default/TrackRoundsAction.php:109
+#: classes/Gems/Default/TrackRoundsAction.php:144
+#: classes/Gems/Default/TrackRoundsAction.php:173
msgid "Missing track identifier."
msgstr "Missing track identifier."
@@ -2442,12 +2457,12 @@
msgstr "Last contact"
#: classes/Gems/Email/OneMailForm.php:131
-#: classes/Gems/Email/TemplateMailer.php:256
+#: classes/Gems/Email/TemplateMailer.php:211
msgid "The sending of emails was blocked for this installation."
msgstr "The sending of emails was blocked for this installation."
#: classes/Gems/Email/OneMailForm.php:139
-#: classes/Gems/Email/TemplateMailer.php:286
+#: classes/Gems/Email/TemplateMailer.php:244
msgid "Mail failed to send."
msgstr "Mail failed to send."
@@ -2456,24 +2471,60 @@
msgid "Sent email to %s."
msgstr "Sent email to %s."
-#: classes/Gems/Email/TemplateMailer.php:302
+#: classes/Gems/Email/TemplateMailer.php:260
#, php-format
msgid "Sent %d e-mails, updated %d tokens."
msgstr "Sent %d e-mails, updated %d tokens."
-#: classes/Gems/Menu/MenuAbstract.php:229
+#: classes/Gems/Export/Excel.php:60
+msgid "Excel options"
+msgstr "Excel options"
+
+#: classes/Gems/Export/Excel.php:62
+msgid "Export questions instead of variable names"
+msgstr "Export questions instead of variable names"
+
+#: classes/Gems/Export/Excel.php:63
+msgid "Format answers"
+msgstr "Format answers"
+
+#: classes/Gems/Export/Spss.php:60
+msgid "Which file"
+msgstr "Which file"
+
+#: classes/Gems/Export/Spss.php:61
+msgid "syntax"
+msgstr "syntax"
+
+#: classes/Gems/Export/Spss.php:62
+msgid "data"
+msgstr "data"
+
+#: classes/Gems/Export/Spss.php:67
+msgid "Some help for this export"
+msgstr "Some help for this export"
+
+#: classes/Gems/Menu/MenuAbstract.php:206
+msgid "Servers"
+msgstr "Servers"
+
+#: classes/Gems/Menu/MenuAbstract.php:210
+msgid "Templates"
+msgstr "Templates"
+
+#: classes/Gems/Menu/MenuAbstract.php:243
msgid "By period"
msgstr "By period"
-#: classes/Gems/Menu/MenuAbstract.php:230
+#: classes/Gems/Menu/MenuAbstract.php:244
msgid "By token"
msgstr "By token"
-#: classes/Gems/Menu/MenuAbstract.php:231
+#: classes/Gems/Menu/MenuAbstract.php:245
msgid "By respondent"
msgstr "By respondent"
-#: classes/Gems/Menu/MenuAbstract.php:235
+#: classes/Gems/Menu/MenuAbstract.php:249
msgid "Bulk mail"
msgstr "Bulk mail"
@@ -2845,11 +2896,13 @@
msgstr "Add new round"
#: classes/Gems/Tracker/Snippets/EditTokenSnippetAbstract.php:124
+#: classes/Gems/Tracker/Snippets/ShowTokenSnippetAbstract.php:164
#, php-format
msgid "Token %s not found."
msgstr "Token %s not found."
#: classes/Gems/Tracker/Snippets/EditTokenSnippetAbstract.php:128
+#: classes/Gems/Tracker/Snippets/ShowTokenSnippetAbstract.php:168
msgid "No token specified."
msgstr "No token specified."
@@ -3325,6 +3378,7 @@
msgstr "Deleted token %s for survey %s."
#: snippets/DeleteTrackTokenSnippet.php:269
+#: snippets/EditTrackTokenSnippet.php:174
#, php-format
msgid "%d token changed by recalculation."
msgid_plural "%d tokens changed by recalculation."
@@ -3442,9 +3496,16 @@
msgid "This track can be assigned since %s."
msgstr "This track can be assigned since %s."
-#~ msgid "The Pulse software was made possible thanks to support from "
-#~ msgstr "The Pulse software was made possible thanks to support from "
+#: views/scripts/index/login.phtml:12
+msgid "The Pulse software was made possible thanks to support from "
+msgstr "The Pulse software was made possible thanks to support from "
+#~ msgid "Email"
+#~ msgstr "Email"
+
+#~ msgid "Lime Survey Sources"
+#~ msgstr "Lime Survey Sources"
+
#~ msgid "Filling in by"
#~ msgstr "Filling in by"
Modified: trunk/library/languages/default-nl.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-nl.po
===================================================================
--- trunk/library/languages/default-nl.po 2011-09-16 15:14:56 UTC (rev 32)
+++ trunk/library/languages/default-nl.po 2011-09-19 08:07:34 UTC (rev 33)
@@ -2,9 +2,9 @@
msgstr ""
"Project-Id-Version: Pulse NL\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-09-15 16:22+0100\n"
+"POT-Creation-Date: 2011-09-19 09:57+0100\n"
"PO-Revision-Date: \n"
-"Last-Translator: Matijs de Jong <mj...@ma...>\n"
+"Last-Translator: Menno Dekker <men...@er...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -32,34 +32,34 @@
msgid "version"
msgstr "versie"
-#: classes/GemsEscort.php:1401
+#: classes/GemsEscort.php:1422
msgid "Take note: your session has expired, your inputs where not saved. Please check the input data and try again"
msgstr "Let op: uw sessie is verlopen, uw invoer is niet opgeslagen. Controleer de gegevens en probeer a.u.b. opnieuw."
-#: classes/GemsEscort.php:1523
+#: classes/GemsEscort.php:1544
msgid "No access to site."
msgstr "Geen toegang tot website."
-#: classes/GemsEscort.php:1525
-#: classes/GemsEscort.php:1561
+#: classes/GemsEscort.php:1546
+#: classes/GemsEscort.php:1582
msgid "You have no access to this site."
msgstr "U heeft geen toegang tot deze website."
-#: classes/GemsEscort.php:1541
+#: classes/GemsEscort.php:1562
msgid "No access to page"
msgstr "Geen toegang tot pagina"
-#: classes/GemsEscort.php:1543
+#: classes/GemsEscort.php:1564
#, php-format
msgid "Access to this page is not allowed for current role: %s."
msgstr "U heeft geen toegang tot deze pagina. Uw huidige rol is: %s."
-#: classes/GemsEscort.php:1548
-#: classes/GemsEscort.php:1559
+#: classes/GemsEscort.php:1569
+#: classes/GemsEscort.php:1580
msgid "You are no longer logged in."
msgstr "U bent niet meer ingelogd."
-#: classes/GemsEscort.php:1549
+#: classes/GemsEscort.php:1570
msgid "You must login to access this page."
msgstr "U moet ingelogd zijn voor toegang tot deze pagina."
@@ -153,234 +153,230 @@
msgstr "Projectinfo"
#: classes/Gems/Menu.php:188
-msgid "ACL"
-msgstr "ACL"
-
-#: classes/Gems/Menu.php:189
msgid "Errors"
msgstr "Foutmeldingen"
-#: classes/Gems/Menu.php:190
+#: classes/Gems/Menu.php:189
msgid "PHP"
msgstr "PHP"
-#: classes/Gems/Menu.php:191
-msgid "Privileges"
-msgstr "Priviléges"
-
-#: classes/Gems/Menu.php:192
-#: classes/Gems/Menu.php:589
+#: classes/Gems/Menu.php:190
+#: classes/Gems/Menu.php:581
msgid "Project"
msgstr "Project"
-#: classes/Gems/Menu.php:193
-#: classes/Gems/Menu.php:212
-msgid "Roles"
-msgstr "Rollen"
-
-#: classes/Gems/Menu.php:194
+#: classes/Gems/Menu.php:191
msgid "Session"
msgstr "Sessie"
-#: classes/Gems/Menu.php:203
+#: classes/Gems/Menu.php:200
msgid "Consents"
msgstr "Toestemmingen"
-#: classes/Gems/Menu.php:206
+#: classes/Gems/Menu.php:203
msgid "Organizations"
msgstr "Organisaties"
-#: classes/Gems/Menu.php:209
+#: classes/Gems/Menu.php:206
msgid "Groups"
msgstr "Groepen"
-#: classes/Gems/Menu.php:216
+#: classes/Gems/Menu.php:209
+msgid "Roles"
+msgstr "Rollen"
+
+#: classes/Gems/Menu.php:210
+msgid "ACL"
+msgstr "ACL"
+
+#: classes/Gems/Menu.php:211
+#: classes/Gems/Menu.php:398
+msgid "Assigned"
+msgstr "Toegewezen"
+
+#: classes/Gems/Menu.php:212
+msgid "Privileges"
+msgstr "Priviléges"
+
+#: classes/Gems/Menu.php:215
msgid "Reception codes"
msgstr "Ontvangst codes"
-#: classes/Gems/Menu.php:219
-msgid "Email servers"
-msgstr "Email servers"
-
-#: classes/Gems/Menu.php:223
-msgid "Email"
-msgstr "Email"
-
-#: classes/Gems/Menu.php:226
+#: classes/Gems/Menu.php:218
msgid "Survey Sources"
msgstr "Bronnen"
-#: classes/Gems/Menu.php:228
+#: classes/Gems/Menu.php:220
msgid "Check status"
msgstr "Status controle"
-#: classes/Gems/Menu.php:229
+#: classes/Gems/Menu.php:221
msgid "Synchronize surveys"
msgstr "Synchroniseer vragenlijsten"
-#: classes/Gems/Menu.php:230
-#: classes/Gems/Menu.php:241
+#: classes/Gems/Menu.php:222
+#: classes/Gems/Menu.php:233
msgid "Check answers"
msgstr "Antwoord controle"
-#: classes/Gems/Menu.php:231
+#: classes/Gems/Menu.php:223
msgid "Synchronize all surveys"
msgstr "Synchroniseer alle vragenlijsten"
-#: classes/Gems/Menu.php:232
-#: classes/Gems/Menu.php:242
+#: classes/Gems/Menu.php:224
+#: classes/Gems/Menu.php:234
msgid "Check all answers"
msgstr "Controleer alle antwoorden"
-#: classes/Gems/Menu.php:235
-#: classes/Gems/Menu.php:396
+#: classes/Gems/Menu.php:227
+#: classes/Gems/Menu.php:388
msgid "Surveys"
msgstr "Vragenlijsten"
-#: classes/Gems/Menu.php:238
+#: classes/Gems/Menu.php:230
msgid "PDF"
msgstr "PDF"
-#: classes/Gems/Menu.php:247
-#: classes/Gems/Menu.php:362
+#: classes/Gems/Menu.php:239
+#: classes/Gems/Menu.php:354
msgid "Tracks"
msgstr "Trajecten"
-#: classes/Gems/Menu.php:250
+#: classes/Gems/Menu.php:242
msgid "Fields"
msgstr "Velden"
-#: classes/Gems/Menu.php:257
+#: classes/Gems/Menu.php:249
msgid "Rounds"
msgstr "Rondes"
-#: classes/Gems/Menu.php:266
+#: classes/Gems/Menu.php:258
msgid "Round"
msgstr "Ronde"
-#: classes/Gems/Menu.php:272
+#: classes/Gems/Menu.php:264
msgid "Check assignments"
msgstr "Controleer toewijzingen"
-#: classes/Gems/Menu.php:275
+#: classes/Gems/Menu.php:267
msgid "Check all assignments"
msgstr "Controleer alle toewijzingen"
-#: classes/Gems/Menu.php:278
+#: classes/Gems/Menu.php:270
msgid "Logging"
msgstr "Logboek"
-#: classes/Gems/Menu.php:282
+#: classes/Gems/Menu.php:274
msgid "Maintenance"
msgstr "Onderhoud"
-#: classes/Gems/Menu.php:296
+#: classes/Gems/Menu.php:288
#, php-format
msgid "Stand-alone privilige: %s"
msgstr "Zelfstandig privilege: %s"
-#: classes/Gems/Menu.php:303
+#: classes/Gems/Menu.php:295
msgid "Logon"
msgstr "Login"
-#: classes/Gems/Menu.php:304
+#: classes/Gems/Menu.php:296
msgid "Lost password"
msgstr "Wachtwoord zoek"
...
[truncated message content] |
|
From: <gem...@li...> - 2011-09-19 16:29:30
|
Revision: 40
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=40&view=rev
Author: matijsdejong
Date: 2011-09-19 16:29:20 +0000 (Mon, 19 Sep 2011)
Log Message:
-----------
Started on #9 MailLog activity overview en #10 replacement for BrowseEditAction
The results works for browsing, but misses a data cache as in BrowseEdit
Updated the Marker object to allow changes later in the execution of the program
Modified Paths:
--------------
trunk/library/classes/Gems/Menu/MenuAbstract.php
trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php
trunk/library/classes/MUtil/Html/Marker.php
trunk/library/classes/MUtil/Html/PagePanel.php
trunk/library/classes/MUtil/Snippets/ModelSnippetAbstract.php
trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php
trunk/library/classes/MUtil/Snippets/SnippetAbstract.php
trunk/library/languages/default-en.mo
trunk/library/languages/default-en.po
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
Added Paths:
-----------
trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php
trunk/library/classes/Gems/Default/MailLogAction.php
trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php
trunk/library/controllers/MailLogController.php
trunk/library/snippets/Generic/
trunk/library/snippets/Generic/AutosearchForm.php
trunk/library/snippets/Generic/ModelTableSnippet.php
Added: trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php
===================================================================
--- trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php (rev 0)
+++ trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php 2011-09-19 16:29:20 UTC (rev 40)
@@ -0,0 +1,97 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Short description of file
+ *
+ * @package Gems
+ * @subpackage Controller
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ * Short description for class
+ *
+ * Long description for class (if any)...
+ *
+ * @package Gems
+ * @subpackage Controller
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.2
+ */
+abstract class Gems_Controller_ModelSnippetActionAbstract extends MUtil_Controller_ModelSnippetActionAbstract
+{
+ /**
+ *
+ * @var GemsEscort
+ */
+ public $escort;
+
+ /**
+ * The parameters used for the autofilter action.
+ *
+ * @var array Mixed key => value array for snippet initialization
+ */
+ protected $autofilterParameters = array(
+ 'browse' => true,
+ 'containingId' => 'autofilter_target',
+ 'keyboard' => true,
+ );
+
+ /**
+ * The snippets used for the autofilter action.
+ *
+ * @var mixed String or array of snippets name
+ */
+ protected $autofilterSnippets = 'Generic_ModelTableSnippet';
+
+ /**
+ * The snippets used for the index action, minus those in autofilter
+ *
+ * @var mixed String or array of snippets name
+ */
+ protected $indexSnippets = 'Generic_AutosearchForm';
+
+ /**
+ * Intializes the html component.
+ *
+ * @param boolean $reset Throws away any existing html output when true
+ * @return void
+ */
+ public function initHtml($reset = false)
+ {
+ if (! $this->html) {
+ Gems_Html::init();
+ }
+
+ parent::initHtml($reset);
+ }
+}
Added: trunk/library/classes/Gems/Default/MailLogAction.php
===================================================================
--- trunk/library/classes/Gems/Default/MailLogAction.php (rev 0)
+++ trunk/library/classes/Gems/Default/MailLogAction.php 2011-09-19 16:29:20 UTC (rev 40)
@@ -0,0 +1,89 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Short description of file
+ *
+ * @package Gems
+ * @subpackage Default
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ * Short description for class
+ *
+ * Long description for class (if any)...
+ *
+ * @package Gems
+ * @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4
+ */
+class Gems_Default_MailLogAction extends Gems_Controller_ModelSnippetActionAbstract
+{
+ /**
+ * Creates a model for getModel(). Called only for each new $action.
+ *
+ * The parameters allow you to easily adapt the model to the current action. The $detailed
+ * parameter was added, because the most common use of action is a split between detailed
+ * and summarized actions.
+ *
+ * @param boolean $detailed True when the current action is not in $summarizedActions.
+ * @param string $action The current action.
+ * @return MUtil_Model_ModelAbstract
+ */
+ public function createModel($detailed, $action)
+ {
+ $model = new MUtil_Model_TableModel('gems__respondent_communications');
+
+ // $model->set('grco_id_to', 'label', $this->_(''));
+ // $model->set('grco_id_by', 'label', $this->_(''));
+ $model->set('grco_address', 'label', $this->_('To'));
+ $model->set('grco_sender', 'label', $this->_('From'));
+ $model->set('grco_topic', 'label', $this->_('Subject'));
+ $model->set('grco_created', 'label', $this->_('Date sent'));
+ // $model->set('', 'label', $this->_(''));
+
+ return $model;
+ }
+
+ public function indexAction()
+ {
+ $this->html->h3($this->_('Mail Activity Log'));
+
+ $filter = array('grco_organization' => $this->escort->getCurrentOrganization());
+
+ $this->indexParameters['extraFilter'] = $filter;
+ $this->indexParameters['extraSort'] = array('grco_created' => SORT_DESC);
+
+ parent::indexAction();
+ }
+}
Modified: trunk/library/classes/Gems/Menu/MenuAbstract.php
===================================================================
--- trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-09-19 13:46:53 UTC (rev 39)
+++ trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-09-19 16:29:20 UTC (rev 40)
@@ -202,6 +202,9 @@
{
$setup = $this->addContainer($label);
+ // MAIL ACTIVITY CONTROLLER
+ $setup->addBrowsePage($this->_('Activity'), 'pr.mail.log', 'mail-log');
+
// MAIL Server CONTROLLER
$page = $setup->addBrowsePage($this->_('Servers'), 'pr.mail.server', 'mail-server');
// $page->addAction($this->_('Test'), 'pr.mail.server.test', 'test')->addParameters(MUtil_Model::REQUEST_ID);
Modified: trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php 2011-09-19 13:46:53 UTC (rev 39)
+++ trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php 2011-09-19 16:29:20 UTC (rev 40)
@@ -3,7 +3,7 @@
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@@ -14,7 +14,7 @@
* * Neither the name of Erasmus MC nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -25,8 +25,8 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
+ *
+ *
* @package Gems
* @subpackage Snippets
* @author Matijs de Jong <mj...@ma...>
@@ -37,10 +37,10 @@
/**
* Adds Gems specific display details and helper functions:
- *
+ *
* Items set are:
* - Display class: 'browser'
- *
+ *
* Extra helpers are:
* - Baseurl helper: $this->requestCache
* - Keyboard access: $this->keyboard & getHtmlOutput()
@@ -63,6 +63,12 @@
protected $class = 'browser';
/**
+ *
+ * @var string The id of a div that contains the table.
+ */
+ protected $containingId;
+
+ /**
* Use keyboard to select row
*
* @var boolean
@@ -96,6 +102,19 @@
protected $sortParamDesc = 'dsrt';
/**
+ * Add the paginator panel to the table.
+ *
+ * Only called when $this->browse is true. Overrule this function
+ * to define your own method.
+ *
+ * $param Zend_Paginator $paginator
+ */
+ protected function addPaginator(MUtil_Html_TableElement $table, Zend_Paginator $paginator)
+ {
+ $table->tfrow()->pagePanel($paginator, $this->request, $this->translate, array('baseUrl' => $this->baseUrl));
+ }
+
+ /**
* Should be called after answering the request to allow the Target
* to check if all required registry values have been set correctly.
*
@@ -153,12 +172,16 @@
$table = parent::getHtmlOutput($view);
$table->getOnEmpty()->class = 'centerAlign';
- if ($this->keyboard) {
+ if ($this->containingId || $this->keyboard) {
$this->applyHtmlAttributes($table);
- $div = MUtil_Html::create()->div(array('id' => 'keys_target'), $table);
+ $div = MUtil_Html::create()->div(array('id' => $this->containingId ? $this->containingId : 'keys_target'), $table);
- return array($div, new Gems_JQuery_TableRowKeySelector($div));
+ if ($this->keyboard) {
+ return array($div, new Gems_JQuery_TableRowKeySelector($div));
+ } else {
+ return $div;
+ }
} else {
return $table;
}
Added: trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php (rev 0)
+++ trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php 2011-09-19 16:29:20 UTC (rev 40)
@@ -0,0 +1,134 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Controller
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ * Controller class with standard model and snippet based browse (index), IN THE NEAR FUTURE show, edit and delete actions.
+ *
+ * To change the behaviour of this class the prime method is changing the snippets used for an action.
+ *
+ * @package MUtil
+ * @subpackage Controller
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.2
+ */
+abstract class MUtil_Controller_ModelSnippetActionAbstract extends MUtil_Controller_ModelActionAbstract
+{
+ /**
+ * The parameters used for the autofilter action.
+ *
+ * @var array Mixed key => value array for snippet initialization
+ */
+ protected $autofilterParameters = array();
+
+ /**
+ * The snippets used for the autofilter action.
+ *
+ * @var mixed String or array of snippets name
+ */
+ protected $autofilterSnippets = 'ModelTableSnippet';
+
+ /**
+ * The parameters used for the index action minus those in autofilter.
+ *
+ * @var array Mixed key => value array for snippet initialization
+ */
+ protected $indexParameters = array();
+
+ /**
+ * The snippets used for the index action, minus those in autofilter
+ *
+ * @var mixed String or array of snippets name
+ */
+ protected $indexSnippets = null;
+
+ /**
+ * Set the action key in request
+ *
+ * Use this when an action is a Ajax action for retrieving
+ * information for use within the screen of another action
+ *
+ * @param string $alias
+ */
+ protected function aliasAction($alias)
+ {
+ $request = $this->getRequest();
+ $request->setActionName($alias);
+ $request->setParam($request->getActionKey(), $alias);
+ }
+
+ /**
+ * The automatically filtered result
+ */
+ public function autofilterAction($resetMvc = true)
+ {
+ // MUtil_Model::$verbose = true;
+
+ // We do not need to return the layout, just the above table
+ if ($resetMvc) {
+ // Make sure all links are generated as if the current request was index.
+ $this->aliasAction('index');
+
+ Zend_Layout::resetMvcInstance();
+ }
+
+ if ($this->autofilterSnippets) {
+ $this->autofilterParameters['model'] = $this->getModel();
+ $this->autofilterParameters['request'] = $this->getRequest();
+
+ $this->addSnippets($this->autofilterSnippets, $this->autofilterParameters);
+ }
+ }
+
+ /**
+ * Action for showing a browse page, optional with
+ */
+ public function indexAction()
+ {
+ if ($this->indexSnippets) {
+ $this->indexParameters = $this->indexParameters + $this->autofilterParameters;
+
+ $this->indexParameters['model'] = $this->getModel();
+ $this->indexParameters['request'] = $this->getRequest();
+
+ $this->addSnippets($this->indexSnippets, $this->indexParameters);
+ }
+
+ $this->autofilterAction(false);
+ }
+
+}
Modified: trunk/library/classes/MUtil/Html/Marker.php
===================================================================
--- trunk/library/classes/MUtil/Html/Marker.php 2011-09-19 13:46:53 UTC (rev 39)
+++ trunk/library/classes/MUtil/Html/Marker.php 2011-09-19 16:29:20 UTC (rev 40)
@@ -1,33 +1,33 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+
+/**
+ * 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.
- *
- * @version $Id$
+ *
+ * @version $Id$
* @package MUtil
* @subpackage Html
* @copyright Copyright (c) 2011 Erasmus MC
@@ -39,7 +39,7 @@
* @subpackage Html
* @copyright Copyright (c) 2011 Erasmus MC
* @license New BSD License
- */
+ */
class MUtil_Html_Marker
{
const TAG_MARKER = "\0";
@@ -52,23 +52,14 @@
public function __construct($searches, $tag, $encoding, $attributes = 'class="marked"')
{
- $this->_encoding = $encoding;
+ $this->setEncoding($encoding);
$this->_tag = $tag;
if ($attributes) {
$this->_attributes = ' ' . trim($attributes) . ' ';
}
- // Do not use the $tag itself here: str_replace will then replace
- // the text of tag itself on later finds
- $topen = '<' . self::TAG_MARKER . '>';
- $tclose = '</' . self::TAG_MARKER . '>';
-
- foreach ((array) $searches as $search) {
- $searchHtml = $this->escape($search);
- $this->_searches[] = $searchHtml;
- $this->_replaces[] = $topen . $searchHtml . $tclose;
- }
+ $this->_searches = (array) $searches;
}
private function _fillTags($text)
@@ -91,6 +82,23 @@
public function mark($value)
{
+ if (! $this->_replaces) {
+ // Late setting of search & replaces
+ $searches = $this->_searches;
+ $this->_searches = array();
+
+ // Do not use the $tag itself here: str_replace will then replace
+ // the text of tag itself on later finds
+ $topen = '<' . self::TAG_MARKER . '>';
+ $tclose = '</' . self::TAG_MARKER . '>';
+
+ foreach ((array) $searches as $search) {
+ $searchHtml = $this->escape($search);
+ $this->_searches[] = $searchHtml;
+ $this->_replaces[] = $topen . $searchHtml . $tclose;
+ }
+ }
+
if ($value instanceof MUtil_Html_Raw) {
$values = array();
// Split into HTML Elements
@@ -128,5 +136,33 @@
return new MUtil_Html_Raw($this->_fillTags($valueTemp));
}
}
+
+ /**
+ * Function to allow later setting of encoding.
+ *
+ * @see htmlspecialchars()
+ *
+ * @param string $encoding Encoding htmlspecialchars
+ * @return MUtil_Html_Marker (continuation pattern)
+ */
+ public function setEncoding($encoding)
+ {
+ $this->_encoding = $encoding;
+
+ return $this;
+ }
+
+ /**
+ * Function to allow later setting of tag name.
+ *
+ * @param string $tagName Html element tag name
+ * @return MUtil_Html_Marker (continuation pattern)
+ */
+ public function setTagName($tagName)
+ {
+ $this->_tag = $tagName;
+
+ return $this;
+ }
}
Modified: trunk/library/classes/MUtil/Html/PagePanel.php
===================================================================
--- trunk/library/classes/MUtil/Html/PagePanel.php 2011-09-19 13:46:53 UTC (rev 39)
+++ trunk/library/classes/MUtil/Html/PagePanel.php 2011-09-19 16:29:20 UTC (rev 40)
@@ -1,33 +1,33 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
class MUtil_Html_PagePanel extends MUtil_Html_Sequence implements MUtil_Lazy_Procrastinator
{
protected $_baseUrl = array();
@@ -401,9 +401,9 @@
return new MUtil_Html_PageRangeRenderer($this, $args);
}
- public function setBaseUrl(array $baseUrl)
+ public function setBaseUrl(array $baseUrl = null)
{
- $this->_baseUrl = $baseUrl;
+ $this->_baseUrl = (array) $baseUrl;
return $this;
}
Modified: trunk/library/classes/MUtil/Snippets/ModelSnippetAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Snippets/ModelSnippetAbstract.php 2011-09-19 13:46:53 UTC (rev 39)
+++ trunk/library/classes/MUtil/Snippets/ModelSnippetAbstract.php 2011-09-19 16:29:20 UTC (rev 40)
@@ -3,7 +3,7 @@
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@@ -14,7 +14,7 @@
* * Neither the name of Erasmus MC nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -25,8 +25,8 @@
* ON ANY THEORY ...
[truncated message content] |
|
From: <gem...@li...> - 2011-09-20 17:20:52
|
Revision: 54
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=54&view=rev
Author: matijsdejong
Date: 2011-09-20 17:20:46 +0000 (Tue, 20 Sep 2011)
Log Message:
-----------
- documentation changes only
Modified Paths:
--------------
trunk/library/classes/Gems/Controller/BrowseEditAction.php
trunk/library/classes/Gems/Default/TokenPlanAction.php
trunk/library/controllers/MailLogController.php
trunk/library/controllers/OverviewPlanController.php
Modified: trunk/library/classes/Gems/Controller/BrowseEditAction.php
===================================================================
--- trunk/library/classes/Gems/Controller/BrowseEditAction.php 2011-09-20 16:00:47 UTC (rev 53)
+++ trunk/library/classes/Gems/Controller/BrowseEditAction.php 2011-09-20 17:20:46 UTC (rev 54)
@@ -181,7 +181,7 @@
*
* @param MUtil_Model_TableBridge $bridge
* @param MUtil_Model_ModelAbstract $model
- * @rturn void
+ * @return void
*/
protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model)
{
Modified: trunk/library/classes/Gems/Default/TokenPlanAction.php
===================================================================
--- trunk/library/classes/Gems/Default/TokenPlanAction.php 2011-09-20 16:00:47 UTC (rev 53)
+++ trunk/library/classes/Gems/Default/TokenPlanAction.php 2011-09-20 17:20:46 UTC (rev 54)
@@ -75,7 +75,7 @@
$bridge->addSortable('gto_valid_from');
$bridge->addSortable('gto_valid_until');
- $bridge->addMultiSort('gr2o_patient_nr', $HTML->raw(', '), 'respondent_name');
+ $bridge->addMultiSort('gr2o_patient_nr', $HTML->raw('; '), 'respondent_name');
$bridge->addMultiSort('ggp_name', array($this->getActionLinks($bridge)));
$bridge->tr();
@@ -83,7 +83,7 @@
$bridge->addSortable('gto_completion_time');
if ($this->escort instanceof Gems_Project_Tracks_SingleTrackInterface) {
- $bridge->addMultiSort('calc_round_description', $HTML->raw(', '), 'gsu_survey_name');
+ $bridge->addMultiSort('calc_round_description', $HTML->raw('; '), 'gsu_survey_name');
} else {
$model->set('calc_track_info', 'tableDisplay', 'smallData');
$model->set('calc_round_description', 'tableDisplay', 'smallData');
Modified: trunk/library/controllers/MailLogController.php
===================================================================
--- trunk/library/controllers/MailLogController.php 2011-09-20 16:00:47 UTC (rev 53)
+++ trunk/library/controllers/MailLogController.php 2011-09-20 17:20:46 UTC (rev 54)
@@ -36,7 +36,7 @@
/**
*
- * @package Gems
+ * @package Gems
* @subpackage Default
* @copyright Copyright (c) 2011 Erasmus MC
* @license New BSD License
Modified: trunk/library/controllers/OverviewPlanController.php
===================================================================
--- trunk/library/controllers/OverviewPlanController.php 2011-09-20 16:00:47 UTC (rev 53)
+++ trunk/library/controllers/OverviewPlanController.php 2011-09-20 17:20:46 UTC (rev 54)
@@ -1,10 +1,9 @@
<?php
-
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@@ -15,7 +14,7 @@
* * Neither the name of Erasmus MC nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -26,8 +25,24 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Default
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
*/
+/**
+ *
+ * @package Gems
+ * @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.1
+ */
class OverviewPlanController extends Gems_Default_OverviewPlanAction
{
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-09-22 08:58:48
|
Revision: 65
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=65&view=rev
Author: mennodekker
Date: 2011-09-22 08:58:42 +0000 (Thu, 22 Sep 2011)
Log Message:
-----------
Updated versions after release
Modified Paths:
--------------
trunk/library/classes/Gems/Versions.php
trunk/library/configs/db/tables/gems__patch_levels.10.sql
Modified: trunk/library/classes/Gems/Versions.php
===================================================================
--- trunk/library/classes/Gems/Versions.php 2011-09-22 08:56:58 UTC (rev 64)
+++ trunk/library/classes/Gems/Versions.php 2011-09-22 08:58:42 UTC (rev 65)
@@ -43,12 +43,12 @@
{
public final function getBuild()
{
- return 40;
+ return 41;
}
public final function getGemsVersion()
{
- return '1.4.2';
+ return '1.4.3';
}
public function getProjectVersion()
Modified: trunk/library/configs/db/tables/gems__patch_levels.10.sql
===================================================================
--- trunk/library/configs/db/tables/gems__patch_levels.10.sql 2011-09-22 08:56:58 UTC (rev 64)
+++ trunk/library/configs/db/tables/gems__patch_levels.10.sql 2011-09-22 08:58:42 UTC (rev 65)
@@ -11,5 +11,5 @@
INSERT INTO gems__patch_levels (gpl_level, gpl_created)
VALUES
- (40, CURRENT_TIMESTAMP);
+ (41, CURRENT_TIMESTAMP);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-09-26 16:29:11
|
Revision: 75
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=75&view=rev
Author: matijsdejong
Date: 2011-09-26 16:29:02 +0000 (Mon, 26 Sep 2011)
Log Message:
-----------
- documented Echo and added hasOutput function
- continued new Model Action
Modified Paths:
--------------
trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php
trunk/library/classes/Gems/Default/MailLogAction.php
trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php
trunk/library/classes/MUtil/Echo.php
trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php
Added Paths:
-----------
trunk/library/snippets/Generic/ModelItemTableSnippet.php
Modified: trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php
===================================================================
--- trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php 2011-09-26 11:48:45 UTC (rev 74)
+++ trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php 2011-09-26 16:29:02 UTC (rev 75)
@@ -81,6 +81,34 @@
protected $indexSnippets = 'Generic_AutosearchForm';
/**
+ * The snippets used for the show action
+ *
+ * @var mixed String or array of snippets name
+ */
+ protected $showSnippets = 'Generic_ModelItemTableSnippet';
+
+ /**
+ * Finds the first item with one of the actions specified as parameter and using the current controller
+ *
+ * @param string $action
+ * @param string $action2
+ * @return Gems_Menu_SubMenuItem
+ */
+ protected function firstAllowedMenuItem($action, $action2 = null)
+ {
+ $actions = MUtil_Ra::args(func_get_args());
+ $controller = $this->_getParam('controller');
+
+ foreach ($actions as $action) {
+ $menuItem = $this->menu->find(array('controller' => $controller, 'action' => $action, 'allowed' => true));
+
+ if ($menuItem) {
+ return $menuItem;
+ }
+ }
+ }
+
+ /**
* Intializes the html component.
*
* @param boolean $reset Throws away any existing html output when true
Modified: trunk/library/classes/Gems/Default/MailLogAction.php
===================================================================
--- trunk/library/classes/Gems/Default/MailLogAction.php 2011-09-26 11:48:45 UTC (rev 74)
+++ trunk/library/classes/Gems/Default/MailLogAction.php 2011-09-26 16:29:02 UTC (rev 75)
@@ -50,6 +50,43 @@
class Gems_Default_MailLogAction extends Gems_Controller_ModelSnippetActionAbstract
{
/**
+ * Adds columns from the model to the bridge that creates the browse table.
+ *
+ * Adds a button column to the model, if such a button exists in the model.
+ *
+ * @param MUtil_Model_TableBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @rturn void
+ */
+ public function addTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model)
+ {
+ if ($menuItem = $this->firstAllowedMenuItem('show')) {
+ $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge));
+ }
+
+ // Newline placeholder
+ $br = MUtil_Html::create('br');
+
+ $bridge->addMultiSort('grco_created', $br, 'respondent_name', $br, 'grco_address');
+ $bridge->addMultiSort('grco_id_token', $br, 'assigned_by', $br, 'grco_sender');
+ $bridge->addMultiSort('grco_topic');
+ }
+
+ /**
+ * The automatically filtered result
+ */
+ public function autofilterAction($resetMvc = true)
+ {
+ $filter = array('grco_organization' => $this->escort->getCurrentOrganization());
+
+ $this->autofilterParameters['addTableColumns'] = array($this, 'addTableColumns');
+ $this->autofilterParameters['extraFilter'] = $filter;
+ $this->autofilterParameters['extraSort'] = array('grco_created' => SORT_DESC);
+
+ return parent::autofilterAction($resetMvc);
+ }
+
+ /**
* Creates a model for getModel(). Called only for each new $action.
*
* The parameters allow you to easily adapt the model to the current action. The $detailed
@@ -107,11 +144,7 @@
{
$this->html->h3($this->_('Mail Activity Log'));
- $filter = array('grco_organization' => $this->escort->getCurrentOrganization());
-
- $this->indexParameters['extraFilter'] = $filter;
- $this->indexParameters['extraSort'] = array('grco_created' => SORT_DESC);
-
+ // MUtil_Echo::track($this->indexParameters);
parent::indexAction();
}
}
Modified: trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php 2011-09-26 11:48:45 UTC (rev 74)
+++ trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php 2011-09-26 16:29:02 UTC (rev 75)
@@ -77,6 +77,20 @@
protected $indexSnippets = null;
/**
+ * The parameters used for the show action
+ *
+ * @var array Mixed key => value array for snippet initialization
+ */
+ protected $showParameters = array();
+
+ /**
+ * The snippets used for the show action
+ *
+ * @var mixed String or array of snippets name
+ */
+ protected $showSnippets = 'ModelVerticalTableSnippet';
+
+ /**
* Set the action key in request
*
* Use this when an action is a Ajax action for retrieving
@@ -93,6 +107,8 @@
/**
* The automatically filtered result
+ *
+ * @param $resetMvc When true only the filtered resulsts
*/
public function autofilterAction($resetMvc = true)
{
@@ -112,10 +128,14 @@
$this->addSnippets($this->autofilterSnippets, $this->autofilterParameters);
}
+
+ if ($resetMvc && MUtil_Echo::hasOutput()) {
+ $this->html->raw(MUtil_Echo::out());
+ }
}
/**
- * Action for showing a browse page, optional with
+ * Action for showing a browse page
*/
public function indexAction()
{
@@ -131,4 +151,19 @@
$this->autofilterAction(false);
}
+
+ /**
+ * Action for showing an item page
+ */
+ public function showAction()
+ {
+ if ($this->showSnippets) {
+ $this->showParameters = $this->indexParameters + $this->autofilterParameters;
+
+ $this->showParameters['model'] = $this->getModel();
+ $this->showParameters['request'] = $this->getRequest();
+
+ $this->addSnippets($this->showSnippets, $this->showParameters);
+ }
+ }
}
Modified: trunk/library/classes/MUtil/Echo.php
===================================================================
--- trunk/library/classes/MUtil/Echo.php 2011-09-26 11:48:45 UTC (rev 74)
+++ trunk/library/classes/MUtil/Echo.php 2011-09-26 16:29:02 UTC (rev 75)
@@ -1,68 +1,96 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
+
/**
- * @package MUtil
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Echo
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
*/
+/**
+ * This class allows you to echo debug statements over multiple requests by
+ * storing the output in the session.
+ *
+ * @package MUtil
+ * @subpackage Echo
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
+ */
class MUtil_Echo
{
+ /**
+ * Add's a backtrace of the position of the code
+ * where this function is called.
+ *
+ * The function itself is not in the backtrace.
+ *
+ * @return void
+ */
public static function backtrace()
{
- $trace = debug_backtrace(false);
+ $trace = debug_backtrace(false);
- $content = "\n<h8><b>Print backtrace</b></h8>\n<br/>\n";
- foreach ($trace as $key => $line) {
- if (0 === $key) {
- // First line is different
- $content .= '<i>Starting backtrace at</i>: ';
- } else {
- if (isset($line['type'])) {
- $content .= $line['class'] . $line['type'];
+ $content = "\n<h8><b>Print backtrace</b></h8>\n<br/>\n";
+ foreach ($trace as $key => $line) {
+ if (0 === $key) {
+ // First line is different
+ $content .= '<i>Starting backtrace at</i>: ';
+ } else {
+ if (isset($line['type'])) {
+ $content .= $line['class'] . $line['type'];
+ }
+ if (isset($line['function'])) {
+ $content .= $line['function'] . '() ';
+ }
}
- if (isset($line['function'])) {
- $content .= $line['function'] . '() ';
+ if (isset($line['file'])) {
+ $content .= $line['file'];
}
+ if (isset($line['line'])) {
+ $content .= ' (' . $line['line'] . ')';
+ }
+ $content .= "<br/>\n";
}
- if (isset($line['file'])) {
- $content .= $line['file'];
- }
- if (isset($line['line'])) {
- $content .= ' (' . $line['line'] . ')';
- }
- $content .= "<br/>\n";
- }
- $session = self::getSession();
- $session->content .= $content . "\n";
+ $session = self::getSession();
+ $session->content .= $content . "\n";
}
+ /**
+ * Returns the current session namespace that stores the content.
+ *
+ * @staticvar Zend_Session_Namespace $session
+ * @return Zend_Session_Namespace
+ */
private static function getSession()
{
static $session;
@@ -74,6 +102,22 @@
return $session;
}
+ /**
+ * Returns true if there is information to output.
+ *
+ * @return boolean
+ */
+ public static function hasOutput()
+ {
+ $session = self::getSession();
+ return isset($session->content);
+ }
+
+ /**
+ * Returns and resets the content of the output/
+ *
+ * @return string Raw html content.
+ */
public static function out()
{
$session = self::getSession();
@@ -89,11 +133,23 @@
}
}
+ /**
+ * Outputs a wordwrapped string with an optional caption.
+ *
+ * @param string $var The variable to wordwrap
+ * @param string $caption Optional text descibing the variable or moment of debugging.
+ */
public static function pre($var, $caption = null)
{
self::r(wordwrap((string) $var, 120), $caption);
}
+ /**
+ * Adds the content of a variable and an optional caption to the output.
+ *
+ * @param mixed $var Any kind of variable
+ * @param string $caption Optional text descibing the variable or moment of debugging.
+ */
public static function r($var, $caption = null)
{
$session = self::getSession();
@@ -121,13 +177,26 @@
$session->content .= $content;
}
+ /**
+ * Adds multiple variables to the output (without captions).
+ *
+ * @param mixed $var_1 Any kind of variable
+ * @param mixed $var_2 Optional, any kind of variable
+ */
public static function rs($var_1, $var_2 = null)
{
foreach (func_get_args() as $var) {
self::r($var);
}
}
-
+
+ /**
+ * Adds multiple variables to the output with as caption information on the line
+ * of code that called this function.
+ *
+ * @param mixed $var_1 Any kind of variable
+ * @param mixed $var_2 Optional, any kind of variable
+ */
public static function track($var_1, $var_2 = null)
{
$trace = debug_backtrace(false);
@@ -144,7 +213,7 @@
$header .= ': ' . $trace[0]['line'];
}
-
+
foreach (func_get_args() as $var) {
self::r($var, $header);
$header = null;
Modified: trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php 2011-09-26 11:48:45 UTC (rev 74)
+++ trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php 2011-09-26 16:29:02 UTC (rev 75)
@@ -57,6 +57,13 @@
protected $_marker;
/**
+ * Functional extension: optionally use this function to add the browse columns
+ *
+ * @var callable With signature: function(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model)
+ */
+ public $addTableColumns;
+
+ /**
* Url parts added to each link in the resulting table
*
* @var array
@@ -71,13 +78,6 @@
public $browse = false;
/**
- * When true the post parameters are removed from the request while filtering
- *
- * @var boolean Should post variables be removed from the request?
- */
- public $removePost = false;
-
- /**
* Content to show when there are no rows.
*
* Null shows '…'
@@ -87,6 +87,13 @@
public $onEmpty = null;
/**
+ * When true the post parameters are removed from the request while filtering
+ *
+ * @var boolean Should post variables be removed from the request?
+ */
+ public $removePost = false;
+
+ /**
* Adds columns from the model to the bridge that creates the browse table.
*
* Overrule this function to add different columns to the browse table, without
@@ -139,7 +146,11 @@
$bridge->setBaseUrl($this->baseUrl);
}
- $this->addBrowseTableColumns($bridge, $model);
+ if (is_callable($this->addTableColumns)) {
+ call_user_func($this->addTableColumns, $bridge, $model);
+ } else {
+ $this->addBrowseTableColumns($bridge, $model);
+ }
return $bridge->getTable();
}
Copied: trunk/library/snippets/Generic/ModelItemTableSnippet.php (from rev 74, trunk/library/classes/MUtil/Snippets/Standard/ModelVerticalTableSnippet.php)
===================================================================
--- trunk/library/snippets/Generic/ModelItemTableSnippet.php (rev 0)
+++ trunk/library/snippets/Generic/ModelItemTableSnippet.php 2011-09-26 16:29:02 UTC (rev 75)
@@ -0,0 +1,103 @@
+<?php
+
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Snippets
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * 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.
+ *
+ * @package MUtil
+ * @subpackage Gems
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.2
+ */
+class Generic_ModelItemTableSnippet extends MUtil_Snippets_ModelVerticalTableSnippetAbstract
+{
+ /**
+ * The PHP class used to create the VerticalTableBridge.
+ *
+ * Must be instanceof MUtil_Model_VerticalTableBridge.
+ *
+ * @var string Class name
+ */
+ // protected $bridgeClass = 'Gems_Model_ThreeColumnTableBridge';
+
+ /**
+ * Shortfix to add class attribute
+ *
+ * @var string
+ */
+ protected $class = 'displayer';
+
+ /**
+ * Required
+ *
+ * @var Gems_Loader
+ */
+ protected $loader;
+
+ /**
+ * Required
+ *
+ * @var Gems_Menu
+ */
+ protected $menu;
+
+ /**
+ *
+ * @var MUtil_Model_ModelAbstract
+ */
+ protected $model;
+
+ /**
+ * Required
+ *
+ * @var Zend_Controller_Request_Abstract
+ */
+ protected $request;
+
+ /**
+ * Creates the model
+ *
+ * @return MUtil_Model_ModelAbstract
+ */
+ protected function createModel()
+ {
+ return $this->model;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-09-27 11:09:01
|
Revision: 77
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=77&view=rev
Author: matijsdejong
Date: 2011-09-27 11:08:50 +0000 (Tue, 27 Sep 2011)
Log Message:
-----------
- added documentation to BrowseEditAction.php
- corrected whitespace in gems__staff.20.sql
- bug #13 fixed StaffAction.php for correct treatment of rights
Modified Paths:
--------------
trunk/library/classes/Gems/Controller/BrowseEditAction.php
trunk/library/classes/Gems/Default/StaffAction.php
trunk/library/configs/db/tables/gems__staff.20.sql
Modified: trunk/library/classes/Gems/Controller/BrowseEditAction.php
===================================================================
--- trunk/library/classes/Gems/Controller/BrowseEditAction.php 2011-09-27 10:38:07 UTC (rev 76)
+++ trunk/library/classes/Gems/Controller/BrowseEditAction.php 2011-09-27 11:08:50 UTC (rev 77)
@@ -608,6 +608,16 @@
return $data;
}
+ /**
+ * Additional data filter statements for the user input.
+ *
+ * User input that has the same name as a model field is automatically
+ * used as a filter, but if the name is different processing is needed.
+ * That processing should happen here.
+ *
+ * @param array $data The current user input
+ * @return array New filter statements
+ */
protected function getDataFilter(array $data)
{
if ($this->filterStandard) {
@@ -617,6 +627,13 @@
return array();
}
+ /**
+ * Returns the default search values for this class instance.
+ *
+ * Used to specify the filter when no values have been entered by the user.
+ *
+ * @return array
+ */
public function getDefaultSearchData()
{
return array();
Modified: trunk/library/classes/Gems/Default/StaffAction.php
===================================================================
--- trunk/library/classes/Gems/Default/StaffAction.php 2011-09-27 10:38:07 UTC (rev 76)
+++ trunk/library/classes/Gems/Default/StaffAction.php 2011-09-27 11:08:50 UTC (rev 77)
@@ -42,7 +42,7 @@
* @license New BSD License
* @since Class available since version 1.0
*/
-class Gems_Default_StaffAction extends Gems_Controller_BrowseEditAction // implements Gems_Menu_ParameterSourceInterface
+class Gems_Default_StaffAction extends Gems_Controller_BrowseEditAction
{
public $filterStandard = array('gsf_active' => 1);
public $sortKey = array('name' => SORT_ASC);
@@ -133,7 +133,7 @@
$this->_groups = MUtil_Lazy::call(array($this->db, 'fetchPairs'), $sql);
$bridge->addExhibitor('gsf_id_organization');
- $bridge->addSelect( 'gsf_id_primary_group', 'multiOptions', $dbLookup->getStaffGroupsNoSuper());
+ $bridge->addSelect( 'gsf_id_primary_group', 'multiOptions', $dbLookup->getStaffGroupsNoSuper());
}
$bridge->addCheckbox('gsf_logout_on_survey', 'description', $this->_('If checked the user will logoff when answering a survey.'));
@@ -149,9 +149,8 @@
$sql = "SELECT ggp_id_group,ggp_role FROM gems__groups WHERE ggp_id_group = " . (int) $data['gsf_id_primary_group'];
$groups = $this->db->fetchPairs($sql);
- if (($this->session->user_role == 'admin' && isset($groups) && $groups[$data['gsf_id_primary_group']] == 'super')
- || (! $this->escort->hasPrivilege('pr.staff.edit.all') &&
- $data['gsf_id_organization'] != $this->escort->getCurrentOrganization())) {
+ if (! ($this->escort->hasPrivilege('pr.staff.edit.all') ||
+ $data['gsf_id_organization'] == $this->escort->getCurrentOrganization())) {
throw new Zend_Exception($this->_('You are not allowed to edit this staff member.'));
}
}
@@ -179,7 +178,9 @@
'column_expression', "CONCAT(COALESCE(CONCAT(gsf_last_name, ', '), '-, '), COALESCE(CONCAT(gsf_first_name, ' '), ''), COALESCE(gsf_surname_prefix, ''))");
$model->set('gsf_email', 'label', $this->_('E-Mail'), 'itemDisplay', 'MUtil_Html_AElement::ifmail');
- if ($this->escort->hasPrivilege('pr.staff.see.all')) {
+ if ($detailed || $this->escort->hasPrivilege('pr.staff.see.all')) {
+ $this->menu->getParameterSource()->offsetSet('gsf_id_organization', $this->escort->getCurrentOrganization());
+
$model->set('gsf_id_organization', 'label', $this->_('Organization'),
'multiOptions', $this->util->getDbLookup()->getOrganizations(),
'default', $this->escort->getCurrentOrganization());
@@ -208,18 +209,35 @@
// Select organization
$options = array('' => $this->_('(all organizations)')) + $this->getModel()->get('gsf_id_organization', 'multiOptions');
$select = new Zend_Form_Element_Select('gsf_id_organization', array('multiOptions' => $options));
- } else {
- $select = new Zend_Form_Element_Hidden('gsf_id_organization',
- array('value' => $this->escort->getCurrentOrganization()));
+
+ // Position as second element
+ $search = array_shift($elements);
+ array_unshift($elements, $search, $select);
}
- // Position as second element
- $search = array_shift($elements);
- array_unshift($elements, $search, $select);
-
return $elements;
}
+ /**
+ * Additional data filter statements for the user input.
+ *
+ * User input that has the same name as a model field is automatically
+ * used as a filter, but if the name is different processing is needed.
+ * That processing should happen here.
+ *
+ * @param array $data The current user input
+ * @return array New filter statements
+ */
+ protected function getDataFilter(array $data)
+ {
+ $filter = parent::getDataFilter($data);
+
+ if (! $this->escort->hasPrivilege('pr.staff.see.all')) {
+ $filter['gsf_id_organization'] = $this->escort->getCurrentOrganization();
+ }
+ return $filter;
+ }
+
public function getInstanceId()
{
if ($this->_instanceId) {
@@ -229,11 +247,27 @@
return parent::getInstanceId();
}
- /*
- public function getMenuParameter($name, $default)
+ /**
+ * Creates from the model a MUtil_Html_TableElement for display of a single item.
+ *
+ * Overruled to add css classes for Gems
+ *
+ * @param integer $columns The number of columns to use for presentation
+ * @param mixed $filter A valid filter for MUtil_Model_ModelAbstract->load()
+ * @param mixed $sort A valid sort for MUtil_Model_ModelAbstract->load()
+ * @return MUtil_Html_TableElement
+ */
+ public function getShowTable($columns = 1, $filter = null, $sort = null)
{
+ if ($this->escort->hasPrivilege('pr.staff.see.all')) {
+ // Model filter has now been set.
+ $data = $this->getModel()->loadFirst();
- } // */
+ $this->_setParam('gsf_id_organization', $data['gsf_id_organization']);
+ $this->menu->getParameterSource()->offsetSet('gsf_id_organization', $data['gsf_id_organization']);
+ }
+ return parent::getShowTable($columns, $filter, $sort);
+ }
public function getTopic($count = 1)
{
Modified: trunk/library/configs/db/tables/gems__staff.20.sql
===================================================================
--- trunk/library/configs/db/tables/gems__staff.20.sql 2011-09-27 10:38:07 UTC (rev 76)
+++ trunk/library/configs/db/tables/gems__staff.20.sql 2011-09-27 11:08:50 UTC (rev 77)
@@ -1,5 +1,5 @@
--- Table containing the project staff
+-- Table containing the project staff
--
CREATE TABLE if not exists gems__staff (
gsf_id_user bigint unsigned not null auto_increment,
@@ -9,12 +9,12 @@
gsf_password varchar(32) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'
not null,
- gsf_active boolean not null default 1,
- gsf_failed_logins int(11) unsigned not null default 0,
+ gsf_active boolean not null default 1,
+ gsf_failed_logins int(11) unsigned not null default 0,
gsf_last_failed timestamp null,
gsf_id_primary_group bigint unsigned
references gems__groups (ggp_id_group),
- gsf_id_organization bigint not null
+ gsf_id_organization bigint not null
references gems__organizations (gor_id_organization),
gsf_iso_lang char(2) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'
not null default 'nl' references gems__languages (gml_iso_lang),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-10-11 11:35:55
|
Revision: 86
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=86&view=rev
Author: matijsdejong
Date: 2011-10-11 11:35:46 +0000 (Tue, 11 Oct 2011)
Log Message:
-----------
Updated documentation and removed obsolete files.
Modified Paths:
--------------
trunk/library/classes/MUtil/Form/Decorator/AutoFocus.php
trunk/library/classes/MUtil/Form/Decorator/Table.php
trunk/library/classes/MUtil/Html/PagePanel.php
trunk/library/classes/MUtil/JQuery/Form/Element/DatePicker.php
trunk/library/classes/MUtil/Lazy/ObjectWrap.php
trunk/library/classes/MUtil/Markup/Renderer/Text/Url.php
trunk/library/classes/MUtil/Markup/Renderer/Text.php
trunk/library/classes/MUtil/Model/Transform/RequiredRowsTransformer.php
trunk/library/classes/MUtil/Parser/Sql/WordsParser.php
trunk/library/classes/MUtil/Parser/Sql/WordsParserException.php
trunk/library/classes/MUtil/Ra.php
trunk/library/classes/MUtil/Registry/SourceInterface.php
Removed Paths:
-------------
trunk/library/classes/Gems/Default/CountryAction.php
trunk/library/classes/Gems/Default/LanguageAction.php
trunk/library/controllers/CountryController.php
trunk/library/controllers/LanguageController.php
Deleted: trunk/library/classes/Gems/Default/CountryAction.php
===================================================================
--- trunk/library/classes/Gems/Default/CountryAction.php 2011-09-28 13:59:38 UTC (rev 85)
+++ trunk/library/classes/Gems/Default/CountryAction.php 2011-10-11 11:35:46 UTC (rev 86)
@@ -1,93 +0,0 @@
-<?php
-
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- *
- * @author Matijs de Jong
- * @since 1.0
- * @version 1.1
- * @package Gems
- * @subpackage Default
- */
-
-/**
- *
- * @author Matijs de Jong
- * @package Gems
- * @subpackage Default
- */
-class Gems_Default_CountryAction extends Gems_Controller_BrowseEditAction
-{
- public $sortKey = array('gct_code' => SORT_ASC);
-
- /**
- * Creates a model for getModel(). Called only for each new $action.
- *
- * The parameters allow you to easily adapt the model to the current action. The $detailed
- * parameter was added, because the most common use of action is a split between detailed
- * and summarized actions.
- *
- * @param boolean $detailed True when the current action is not in $summarizedActions.
- * @param string $action The current action.
- * @return MUtil_Model_ModelAbstract
- */
- public function createModel($detailed, $action)
- {
- $model = new MUtil_Model_TableModel('gems__countries');
- $model->copyKeys(); // The user can edit the keys.
-
- $model->set('gct_code', 'label', $this->_('Code'));
- $model->set('gct_description', 'label', $this->_('Description'));
- $model->set('gct_in_eu', 'label', $this->_('In EU'),
- 'multiOptions', $this->util->getTranslated()->getYesNo(),
- 'elementClass', 'CheckBox',
- 'required', false);
- $model->set('gct_extra', 'label', $this->_('Notes'), 'elementClass', 'TextArea', 'rows', 5);
-
- if ($detailed) {
- $model->set('gct_code', 'validator', $model->createUniqueValidator('gct_code'));
- $model->set('gct_description', 'validator', $model->createUniqueValidator('gct_description'));
- }
-
- Gems_Model::setChangeFieldsByPrefix($model, 'gct');
-
- return $model;
- }
-
- public function getTopic($count = 1)
- {
- return $this->plural('country', 'countries', $count);
- }
-
- public function getTopicTitle()
- {
- return $this->_('Countries');
- }
-}
Deleted: trunk/library/classes/Gems/Default/LanguageAction.php
===================================================================
--- trunk/library/classes/Gems/Default/LanguageAction.php 2011-09-28 13:59:38 UTC (rev 85)
+++ trunk/library/classes/Gems/Default/LanguageAction.php 2011-10-11 11:35:46 UTC (rev 86)
@@ -1,68 +0,0 @@
-<?php
-
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- *
- * @author Matijs de Jong
- * @since 1.0
- * @version 1.1
- * @package Gems
- * @subpackage Default
- */
-
-/**
- *
- * @author Matijs de Jong
- * @package Gems
- * @subpackage Default
- */
-class Gems_Default_LanguageAction extends Gems_Controller_Action
-{
- public function changeUiAction()
- {
- $request = $this->getRequest();
-
- $lang = strtolower($request->getParam('language'));
- $url = base64_decode($request->getParam('current_uri'));
-
- if (in_array($lang, $this->view->project->locales)) {
-
- $this->session->user_locale = $lang;
- if (Gems_Cookies::setLocale($lang, $this->basepath->getBasePath())) {
- $this->getResponse()->setRedirect($url);
- return;
- }
-
- throw new Exception($this->_('Cookies must be enabled for setting the language.'));
- }
-
- throw new Exception($this->_('Invalid language setting.'));
- }
-}
Modified: trunk/library/classes/MUtil/Form/Decorator/AutoFocus.php
===================================================================
--- trunk/library/classes/MUtil/Form/Decorator/AutoFocus.php 2011-09-28 13:59:38 UTC (rev 85)
+++ trunk/library/classes/MUtil/Form/Decorator/AutoFocus.php 2011-10-11 11:35:46 UTC (rev 86)
@@ -1,47 +1,48 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
/**
- *
- * @author Matijs de Jong
- * @since 1.0
- * @version 1.1
- * @package MUtil
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
* @subpackage Form
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
*/
/**
- *
- * @author Matijs de Jong
- * @package MUtil
+ * Form decorator that sets the focus on the first suitable element.
+ *
+ * @package MUtil
* @subpackage Form
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
*/
class MUtil_Form_Decorator_AutoFocus extends Zend_Form_Decorator_Abstract
{
@@ -55,7 +56,7 @@
}
}
} elseif ($element instanceof Zend_Form_Element) {
- if (($element instanceof Zend_Form_Element_Hidden) ||
+ if (($element instanceof Zend_Form_Element_Hidden) ||
($element instanceof MUtil_Form_Element_NoFocusInterface) ||
($element->helper == 'Button') ||
($element->helper == 'formSubmit') ||
@@ -64,14 +65,14 @@
}
return $element->getId();
- } elseif (($element instanceof Zend_Form) ||
+ } elseif (($element instanceof Zend_Form) ||
($element instanceof Zend_Form_DisplayGroup)) {
foreach ($element as $subelement) {
if ($focus = $this->_getFocus($subelement)) {
return $focus;
}
}
- }
+ }
return null;
}
Modified: trunk/library/classes/MUtil/Form/Decorator/Table.php
===================================================================
--- trunk/library/classes/MUtil/Form/Decorator/Table.php 2011-09-28 13:59:38 UTC (rev 85)
+++ trunk/library/classes/MUtil/Form/Decorator/Table.php 2011-10-11 11:35:46 UTC (rev 86)
@@ -1,33 +1,49 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Form
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Display a form in a table decorator.
+ *
+ * @package MUtil
+ * @subpackage Form
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
+ */
class MUtil_Form_Decorator_Table extends Zend_Form_Decorator_ViewHelper
{
protected $_cellDecorators;
Modified: trunk/library/classes/MUtil/Html/PagePanel.php
===================================================================
--- trunk/library/classes/MUtil/Html/PagePanel.php 2011-09-28 13:59:38 UTC (rev 85)
+++ trunk/library/classes/MUtil/Html/PagePanel.php 2011-10-11 11:35:46 UTC (rev 86)
@@ -1,6 +1,5 @@
<?php
-
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
@@ -26,8 +25,28 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Html
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
*/
+/**
+ * Html Element used to display paginator page links and links to increase or decrease
+ * the number of items shown.
+ *
+ * Includes functions for specirfying your own text and separators.
+ *
+ * @package MUtil
+ * @subpackage Html
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
+ */
class MUtil_Html_PagePanel extends MUtil_Html_Sequence implements MUtil_Lazy_Procrastinator
{
protected $_baseUrl = array();
Modified: trunk/library/classes/MUtil/JQuery/Form/Element/DatePicker.php
===================================================================
--- trunk/library/classes/MUtil/JQuery/Form/Element/DatePicker.php 2011-09-28 13:59:38 UTC (rev 85)
+++ trunk/library/classes/MUtil/JQuery/Form/Element/DatePicker.php 2011-10-11 11:35:46 UTC (rev 86)
@@ -1,46 +1,52 @@
<?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.
- */
-
-/*
- http://jquery-ui.googlecode.com/svn/tags/latest/ui/minified/i18n/jquery-ui-i18n.min.js"
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage JQuery
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
- $(function() {
- $.datepicker.setDefaults($.datepicker.regional['']);
- $("#datepicker").datepicker($.datepicker.regional['fr']);
- $("#locale").change(function() {
- $('#datepicker').datepicker('option', $.datepicker.regional[$(this).val()]);
- });
- });
-
+/**
+ * Extension of ZendX DatePicker element that add's locale awareness and input and output date
+ * parsing to the original element.
+ *
+ * @see ZendX_JQuery_Form_Element_DatePicker
+ *
+ * @package MUtil
+ * @subpackage JQuery
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
*/
-
class MUtil_JQuery_Form_Element_DatePicker extends ZendX_JQuery_Form_Element_DatePicker
{
protected $_dateFormat;
@@ -178,6 +184,19 @@
public function setView(Zend_View_Interface $view = null)
{
+ /*
+ http://jquery-ui.googlecode.com/svn/tags/latest/ui/minified/i18n/jquery-ui-i18n.min.js"
+
+ $(function() {
+ $.datepicker.setDefaults($.datepicker.regional['']);
+ $("#datepicker").datepicker($.datepicker.regional['fr']);
+ $("#locale").change(function() {
+ $('#datepicker').datepicker('option', $.datepicker.regional[$(this).val()]);
+ });
+ });
+
+ */
+
if ($locale = Zend_Registry::get('Zend_Locale')) {
$language = $locale->getLanguage();
if ($language && $language != 'en') {
Modified: trunk/library/classes/MUtil/Lazy/ObjectWrap.php
===================================================================
--- trunk/library/classes/MUtil/Lazy/ObjectWrap.php 2011-09-28 13:59:38 UTC (rev 85)
+++ trunk/library/classes/MUtil/Lazy/ObjectWrap.php 2011-10-11 11:35:46 UTC (rev 86)
@@ -1,39 +1,38 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
/**
- * @author Matijs de Jong
- * @since 1.0
- * @version 1.1
- * @package MUtil
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
* @subpackage Lazy
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
*/
/**
@@ -60,6 +59,12 @@
* echo $output[0] . ' -> ' . $output[1] . ' | ' . $output[2] . ' -> ' . $output[3];
* // Result old -> new | 1 -> 2
* </code>
+ *
+ * @package MUtil
+ * @subpackage Lazy
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
*/
class MUtil_Lazy_ObjectWrap extends MUtil_Lazy_LazyAbstract
{
Modified: trunk/library/classes/MUtil/Markup/Renderer/Text/Url.php
===================================================================
--- trunk/library/classes/MUtil/Markup/Renderer/Text/Url.php 2011-09-28 13:59:38 UTC (rev 85)
+++ trunk/library/classes/MUtil/Markup/Renderer/Text/Url.php 2011-10-11 11:35:46 UTC (rev 86)
@@ -1,34 +1,50 @@
<?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...
[truncated message content] |
|
From: <gem...@li...> - 2011-10-11 15:59:56
|
Revision: 89
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=89&view=rev
Author: matijsdejong
Date: 2011-10-11 15:59:49 +0000 (Tue, 11 Oct 2011)
Log Message:
-----------
Extended autofocus to skip readonly inputs.
ModelTableSnippetAbstract now has sortableLinks as an option and a caption variable.
Removed gems__countries table.
Modified Paths:
--------------
trunk/library/changelog.txt
trunk/library/classes/MUtil/Form/Decorator/AutoFocus.php
trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php
trunk/library/configs/db/tables/gems__respondents.30.sql
Removed Paths:
-------------
trunk/library/configs/db/tables/gems__countries.10.sql
Modified: trunk/library/changelog.txt
===================================================================
--- trunk/library/changelog.txt 2011-10-11 12:59:41 UTC (rev 88)
+++ trunk/library/changelog.txt 2011-10-11 15:59:49 UTC (rev 89)
@@ -1,6 +1,7 @@
Important changes from 1.4.2 => 1.4.3
============================================================
* gtr_organisations renamed to gtr_organizations
+ * table gems__countries is no longer in use
Important changes from 1.4.1 => 1.4.2
============================================================
Modified: trunk/library/classes/MUtil/Form/Decorator/AutoFocus.php
===================================================================
--- trunk/library/classes/MUtil/Form/Decorator/AutoFocus.php 2011-10-11 12:59:41 UTC (rev 88)
+++ trunk/library/classes/MUtil/Form/Decorator/AutoFocus.php 2011-10-11 15:59:49 UTC (rev 89)
@@ -58,6 +58,7 @@
} elseif ($element instanceof Zend_Form_Element) {
if (($element instanceof Zend_Form_Element_Hidden) ||
($element instanceof MUtil_Form_Element_NoFocusInterface) ||
+ ($element->getAttrib('readonly')) ||
($element->helper == 'Button') ||
($element->helper == 'formSubmit') ||
($element->helper == 'SubmitButton')) {
Modified: trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php 2011-10-11 12:59:41 UTC (rev 88)
+++ trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php 2011-10-11 15:59:49 UTC (rev 89)
@@ -59,7 +59,7 @@
/**
* Functional extension: optionally use this function to add the browse columns
*
- * @var callable With signature: function(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model)
+ * @var callable With signature: function(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model, MUtil_Snippets_ModelTableSnippetAbstract $snippet)
*/
public $addTableColumns;
@@ -78,6 +78,13 @@
public $browse = false;
/**
+ * Optional table caption.
+ *
+ * @var string
+ */
+ public $caption;
+
+ /**
* Content to show when there are no rows.
*
* Null shows '…'
@@ -94,6 +101,13 @@
public $removePost = false;
/**
+ * When true (= default) the headers get sortable links.
+ *
+ * @var boolean
+ */
+ public $sortableLinks = true;
+
+ /**
* Adds columns from the model to the bridge that creates the browse table.
*
* Overrule this function to add different columns to the browse table, without
@@ -105,10 +119,18 @@
*/
protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model)
{
- foreach($model->getItemsOrdered() as $name) {
- if ($label = $model->get($name, 'label')) {
- $bridge->addSortable($name, $label);
+ if ($this->sortableLinks) {
+ foreach($model->getItemsOrdered() as $name) {
+ if ($label = $model->get($name, 'label')) {
+ $bridge->addSortable($name, $label);
+ }
}
+ } else {
+ foreach($model->getItemsOrdered() as $name) {
+ if ($label = $model->get($name, 'label')) {
+ $bridge->addColumn($bridge->$name, $label);
+ }
+ }
}
}
@@ -137,6 +159,9 @@
public function getBrowseTable(MUtil_Model_ModelAbstract $model)
{
$bridge = new MUtil_Model_TableBridge($model);
+ if ($this->caption) {
+ $bridge->caption($this->caption);
+ }
if ($this->onEmpty) {
$bridge->setOnEmpty($this->onEmpty);
} else {
@@ -147,7 +172,7 @@
}
if (is_callable($this->addTableColumns)) {
- call_user_func($this->addTableColumns, $bridge, $model);
+ call_user_func($this->addTableColumns, $bridge, $model, $this);
} else {
$this->addBrowseTableColumns($bridge, $model);
}
Deleted: trunk/library/configs/db/tables/gems__countries.10.sql
===================================================================
--- trunk/library/configs/db/tables/gems__countries.10.sql 2011-10-11 12:59:41 UTC (rev 88)
+++ trunk/library/configs/db/tables/gems__countries.10.sql 2011-10-11 15:59:49 UTC (rev 89)
@@ -1,266 +0,0 @@
-
-CREATE TABLE if not exists gems__countries (
- gct_code varchar(2) not null,
- gct_description varchar(50) not null,
- gct_in_eu boolean not null default 0,
-
- gct_extra varchar(255) null,
-
- gct_changed timestamp not null default current_timestamp on update current_timestamp,
- gct_changed_by bigint unsigned not null,
- gct_created timestamp not null,
- gct_created_by bigint unsigned not null,
-
- PRIMARY KEY (gct_code)
- )
- ENGINE=InnoDB
- CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
-
-
-INSERT INTO gems__countries
- (gct_code, gct_description, gct_in_eu, gct_extra, gct_changed, gct_changed_by, gct_created, gct_created_by)
- VALUES
- ('AD', 'Andorra', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AE', 'United Arab Emirates', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AF', 'Afghanistan', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AG', 'Antigua and Barbuda', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AI', 'Anguilla', 0, 'AI previously represented French Territory of the Afars and the Issas', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AL', 'Albania', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AM', 'Armenia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AN', 'Netherlands Antilles', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AO', 'Angola', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AQ', 'Antarctica', 0, 'Code taken from "Antarctique", its French name Consisting of all territory south of latitude 60\xB0S', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AR', 'Argentina', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AS', 'American Samoa', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AT', 'Austria', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AU', 'Australia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AW', 'Aruba', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AX', '\xC5land Islands', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('AZ', 'Azerbaijan', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BA', 'Bosnia and Herzegovina', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BB', 'Barbados', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BD', 'Bangladesh', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BE', 'Belgium', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BF', 'Burkina Faso', 0, 'Previously named "Upper Volta" HV', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BG', 'Bulgaria', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BH', 'Bahrain', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BI', 'Burundi', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BJ', 'Benin', 0, 'Previously named "Dahomey" DY', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BM', 'Bermuda', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BN', 'Brunei Darussalam', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BO', 'Bolivia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BR', 'Brazil', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BS', 'Bahamas', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BT', 'Bhutan', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BV', 'Bouvet Island', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BW', 'Botswana', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BY', 'Belarus', 0, 'Previously named "Byelorussian S.S.R." Code taken from "Byelorussia", its former name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('BZ', 'Belize', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CA', 'Canada', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CC', 'Cocos (Keeling) Islands', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CD', 'Congo, the Democratic Republic of the', 0, 'Previously named "Zaire" ZR', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CF', 'Central African Republic', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CG', 'Congo', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CH', 'Switzerland', 0, 'Code taken from "Confoederatio Helvetica", its official Latin name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CI', 'C\xF4te d''Ivoire', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CK', 'Cook Islands', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CL', 'Chile', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CM', 'Cameroon', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CN', 'China', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CO', 'Colombia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CR', 'Costa Rica', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CU', 'Cuba', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CV', 'Cape Verde', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CX', 'Christmas Island', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CY', 'Cyprus', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('CZ', 'Czech Republic', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('DE', 'Germany', 1, 'Code taken from "Deutschland", its German name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('DJ', 'Djibouti', 0, 'Previously named "French Territory of the Afars and the Issas" AI', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('DK', 'Denmark', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('DM', 'Dominica', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('DO', 'Dominican Republic', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('DZ', 'Algeria', 0, 'Code taken from "Ledzayer", its Berber name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('EC', 'Ecuador', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('EE', 'Estonia', 1, 'Code taken from "Eesti", its Estonian name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('EG', 'Egypt', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('EH', 'Western Sahara', 0, 'Previously named "Spanish Sahara" Code taken from "S\xE1hara Espa\xF1ol", its former Spanish name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('ER', 'Eritrea', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('ES', 'Spain', 1, 'Includes Canary Islands, Ceuta and Melilla, Code taken from "Espa\xF1a", its Spanish name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('ET', 'Ethiopia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('FI', 'Finland', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('FJ', 'Fiji', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('FK', 'Falkland Islands (Malvinas)', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('FM', 'Micronesia, Federated States of', 0, 'Previously named "Micronesia"', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('FO', 'Faroe Islands', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('FR', 'France', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GA', 'Gabon', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GB', 'United Kingdom', 1, 'Code taken from "Great Britain", part of the United Kingdom', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GD', 'Grenada', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GE', 'Georgia', 0, 'GE previously represented Gilbert and Ellice Islands', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GF', 'French Guiana', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GG', 'Guernsey', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GH', 'Ghana', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GI', 'Gibraltar', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GL', 'Greenland', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GM', 'Gambia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GN', 'Guinea', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GP', 'Guadeloupe', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GQ', 'Equatorial Guinea', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GR', 'Greece', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GS', 'South Georgia and the South Sandwich Islands', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GT', 'Guatemala', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GU', 'Guam', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GW', 'Guinea-Bissau', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('GY', 'Guyana', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('HK', 'Hong Kong', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('HM', 'Heard Island and McDonald Islands', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('HN', 'Honduras', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('HR', 'Croatia', 0, 'Code taken from "Hrvatska", its Croatian name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('HT', 'Haiti', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('HU', 'Hungary', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('ID', 'Indonesia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('IE', 'Ireland', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('IL', 'Israel', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('IM', 'Isle of Man', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('IN', 'India', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('IO', 'British Indian Ocean Territory', 0, 'Includes Diego Garcia', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('IQ', 'Iraq', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('IR', 'Iran, Islamic Republic of', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('IS', 'Iceland', 0, 'Code taken from "\xCDsland", its Icelandic name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('IT', 'Italy', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('JE', 'Jersey', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('JM', 'Jamaica', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('JO', 'Jordan', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('JP', 'Japan', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('KE', 'Kenya', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('KG', 'Kyrgyzstan', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('KH', 'Cambodia', 0, 'Previously named "Kampuchea", Code taken from "Kampuchea", its former name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('KI', 'Kiribati', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('KM', 'Comoros', 0, 'Code taken from "Komori", its Comorian name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('KN', 'Saint Kitts and Nevis', 0, 'Previously named "Saint Kitts-Nevis-Anguilla"', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('KP', 'Korea, Democratic People''s Republic of', 0, 'i.e., North Korea', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('KR', 'Korea, Republic of''', 0, 'i.e., South Korea', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('KW', 'Kuwait', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('KY', 'Cayman Islands', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('KZ', 'Kazakhstan', 0, 'Previously named "Kazakstan"', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('LA', 'Lao People''s Democratic Republic', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('LB', 'Lebanon', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('LC', 'Saint Lucia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('LI', 'Liechtenstein', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('LK', 'Sri Lanka', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('LR', 'Liberia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('LS', 'Lesotho', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('LT', 'Lithuania', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('LU', 'Luxembourg', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('LV', 'Latvia', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('LY', 'Libyan Arab Jamahiriya', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MA', 'Morocco', 0, 'Code taken from "Maroc", its French name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MC', 'Monaco', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MD', 'Moldova, Republic of', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('ME', 'Montenegro', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MG', 'Madagascar', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MH', 'Marshall Islands', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MK', 'Macedonia, the former Yugoslav Republic of', 0, 'Designated as such due to naming dispute, Code taken from "Makedonija", its Macedonian name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('ML', 'Mali', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MM', 'Myanmar', 0, 'Previously named "Burma" BU', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MN', 'Mongolia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MO', 'Macao', 0, 'Previously named "Macau"', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MP', 'Northern Mariana Islands', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MQ', 'Martinique', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MR', 'Mauritania', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MS', 'Montserrat', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MT', 'Malta', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MU', 'Mauritius', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MV', 'Maldives', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MW', 'Malawi', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MX', 'Mexico', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MY', 'Malaysia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('MZ', 'Mozambique', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('NA', 'Namibia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('NC', 'New Caledonia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('NE', 'Niger', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('NF', 'Norfolk Island', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('NG', 'Nigeria', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('NI', 'Nicaragua', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('NL', 'Netherlands', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('NO', 'Norway', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('NP', 'Nepal', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('NR', 'Nauru', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('NU', 'Niue', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('NZ', 'New Zealand', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('OM', 'Oman', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('PA', 'Panama', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('PE', 'Peru', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('PF', 'French Polynesia', 0, 'Includes Clipperton Island', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('PG', 'Papua New Guinea', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('PH', 'Philippines', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('PK', 'Pakistan', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('PL', 'Poland', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('PM', 'Saint Pierre and Miquelon', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('PN', 'Pitcairn', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('PR', 'Puerto Rico', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('PS', 'Palestinian Territory, Occupied', 0, 'Consisting of the West Bank and the Gaza Strip', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('PT', 'Portugal', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('PW', 'Palau', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('PY', 'Paraguay', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('QA', 'Qatar', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('RE', 'R\xE9union', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('RO', 'Romania', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('RS', 'Serbia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('RU', 'Russian Federation', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('RW', 'Rwanda', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SA', 'Saudi Arabia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SB', 'Solomon Islands', 0, 'Code taken from "British Solomon Islands", its former name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SC', 'Seychelles', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SD', 'Sudan', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SE', 'Sweden', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SG', 'Singapore', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SH', 'Saint Helena', 0, 'Includes Ascension Island and Tristan da Cunha', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SI', 'Slovenia', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SJ', 'Svalbard and Jan Mayen', 0, 'Consisting of Svalbard and Jan Mayen', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SK', 'Slovakia', 1, 'SK previously represented Sikkim', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SL', 'Sierra Leone', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SM', 'San Marino', 1, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SN', 'Senegal', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SO', 'Somalia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SR', 'Suriname', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('ST', 'Sao Tome and Principe', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SV', 'El Salvador', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SY', 'Syrian Arab Republic', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('SZ', 'Swaziland', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TC', 'Turks and Caicos Islands', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TD', 'Chad', 0, 'Code taken from "Tchad", its French name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TF', 'French Southern Territories', 0, 'Covers the current jurisdiction of the French Southern and Antarctic Lands except Ad\xE9lie Land', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TG', 'Togo', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TH', 'Thailand', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TJ', 'Tajikistan', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TK', 'Tokelau', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TL', 'Timor-Leste', 0, 'Previously used the code TP, Previously named "East Timor"', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TM', 'Turkmenistan', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TN', 'Tunisia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TO', 'Tonga', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TR', 'Turkey', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TT', 'Trinidad and Tobago', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TV', 'Tuvalu', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TW', 'Taiwan, Province of China', 0, 'Covers the current jurisdiction of the Republic of China except Kinmen and Lienchiang, Designated as such due to its political status within the UN', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('TZ', 'Tanzania, United Republic of', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('UA', 'Ukraine', 0, 'Previously named "Ukrainian S.S.R."', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('UG', 'Uganda', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('UM', 'United States Minor Outlying Islands', 0, 'Consisting of Baker Island, Howland Island, Jarvis Island, Johnston Atoll, Kingman Reef, Midway Atoll, Navassa Island, Palmyra Atoll, and Wake Island', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('US', 'United States', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('UY', 'Uruguay', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('UZ', 'Uzbekistan', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('VA', 'Holy See (Vatican City State)', 0, 'Administered by the Holy See, Previously named "Vatican City State (Holy See)"', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('VC', 'Saint Vincent and the Grenadines', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('VE', 'Venezuela', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('VG', 'Virgin Islands, British', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('VI', 'Virgin Islands, U.S.', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('VN', 'Viet Nam', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('VU', 'Vanuatu', 0, 'Previously named "New Hebrides" NH', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('WF', 'Wallis and Futuna', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('WS', 'Samoa', 0, 'Code taken from "Western Samoa", its former name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('YE', 'Yemen', 0, 'Previously named "Yemen, Republic of"', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('YT', 'Mayotte', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('ZA', 'South Africa', 0, 'Code taken from "Zuid-Afrika", its Dutch name', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('ZM', 'Zambia', 0, NULL, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
- ('ZW', 'Zimbabwe', 0, 'Previously named "Rhodesia" RH', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1);
Modified: trunk/library/configs/db/tables/gems__respondents.30.sql
===================================================================
--- trunk/library/configs/db/tables/gems__respondents.30.sql 2011-10-11 12:59:41 UTC (rev 88)
+++ trunk/library/configs/db/tables/gems__respondents.30.sql 2011-10-11 15:59:49 UTC (rev 89)
@@ -49,8 +49,7 @@
grs_zipcode varchar(10) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
grs_city varchar(40) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
-- grs_region varchar(40) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
- grs_iso_country char(2) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'
- not null default 'NL' references gems__countries (gct_code),
+ grs_iso_country char(2) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'NL',
grs_phone_1 varchar(25) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
-- grs_phone_2 varchar(25) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
-- grs_phone_3 varchar(25) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-10-14 15:07:01
|
Revision: 104
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=104&view=rev
Author: matijsdejong
Date: 2011-10-14 15:06:50 +0000 (Fri, 14 Oct 2011)
Log Message:
-----------
Redo & copy answers #16
Modified Paths:
--------------
trunk/library/classes/Gems/Default/ReceptionAction.php
trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php
trunk/library/classes/Gems/Tracker/Token.php
trunk/library/classes/Gems/Util/Translated.php
trunk/library/configs/db/tables/gems__reception_codes.10.sql
trunk/library/languages/default-en.mo
trunk/library/languages/default-en.po
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
trunk/library/snippets/DeleteTrackTokenSnippet.php
Modified: trunk/library/classes/Gems/Default/ReceptionAction.php
===================================================================
--- trunk/library/classes/Gems/Default/ReceptionAction.php 2011-10-14 10:43:36 UTC (rev 103)
+++ trunk/library/classes/Gems/Default/ReceptionAction.php 2011-10-14 15:06:50 UTC (rev 104)
@@ -1,10 +1,9 @@
<?php
-
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@@ -15,7 +14,7 @@
* * Neither the name of Erasmus MC nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -26,35 +25,34 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- *
- * @author Matijs de Jong
- * @since 1.0
- * @version 1.1
- * @package Gems
+ *
+ *
+ * @package Gems
* @subpackage Default
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
*/
/**
- *
- * @author Matijs de Jong
- * @package Gems
+ * Controller for maintaining reception codes.
+ *
+ * @package Gems
* @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
*/
class Gems_Default_ReceptionAction extends Gems_Controller_BrowseEditAction
{
- public $sortKey = array('grc_active' => SORT_DESC,
- 'grc_success' => SORT_DESC,
- 'grc_for_respondents' => SORT_DESC,
- 'grc_for_tracks' => SORT_DESC,
- 'grc_for_surveys' => SORT_DESC,
- 'grc_description' => SORT_ASC);
-
- public function addFormElements(MUtil_Model_FormBridge $bridge, MUtil_Model_ModelAbstract $model, array $data, $new = false) {
+ public $sortKey = array('grc_id_reception_code' => SORT_ASC);
+
+ public function addFormElements(MUtil_Model_FormBridge $bridge, MUtil_Model_ModelAbstract $model, array $data, $new = false)
+ {
$model->set('desc1', 'elementClass', 'Html', 'order', 55, 'label', $this->_('Can be assigned to'));
$model->set('desc2', 'elementClass', 'Html', 'order', 85, 'label', $this->_('Additional action'));
+
parent::addFormElements($bridge, $model, $data, $new);
}
@@ -101,9 +99,9 @@
'elementClass', 'CheckBox',
'description', $this->_('This reception code can be assigned to a survey.'));
$model->set('grc_redo_survey', 'label', $this->_('Redo survey'),
- 'multiOptions', $yesNo ,
- 'elementClass', 'CheckBox',
- 'description', $this->_('Redo a survey on this reception code.'));
+ 'multiOptions', $this->util->getTranslated()->getRedoCodes(),
+ 'elementClass', 'Select',
+ 'description', $this->_('Redo a survey on this reception code.'));
$model->set('grc_overwrite_answers', 'label', $this->_('Overwrite ansers'),
'multiOptions', $yesNo ,
'elementClass', 'CheckBox',
Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2011-10-14 10:43:36 UTC (rev 103)
+++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2011-10-14 15:06:50 UTC (rev 104)
@@ -106,6 +106,28 @@
protected $util;
/**
+ * Filters an answers array, return only those fields that where answered by the user.
+ *
+ * @param int $sourceSurveyId Survey ID
+ * @param array $answers
+ * @return array
+ */
+ protected function _filterAnswersOnly($sourceSurveyId, array $answers)
+ {
+ $s = $sourceSurveyId . 'X';
+ $l = strlen($s);
+
+ $results = array();
+ foreach ($answers as $key => $value) {
+ if (substr($key, 0, $l) == $s) {
+ $results[$key] = $value;
+ }
+ }
+
+ return $results;
+ }
+
+ /**
* Return a fieldmap object
*
* @param int $sourceSurveyId Survey ID
@@ -822,6 +844,7 @@
$lsTokenId = $this->_getToken($token->getTokenId());
$answers = $this->_getFieldMap($sourceSurveyId)->mapTitlesToKeys($answers);
+ $answers = $this->_filterAnswersOnly($sourceSurveyId, $answers);
if ($lsDb->fetchOne("SELECT token FROM $lsTab WHERE token = ?", $lsTokenId)) {
$where = $lsDb->quoteInto("token = ?", $lsTokenId);
Modified: trunk/library/classes/Gems/Tracker/Token.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Token.php 2011-10-14 10:43:36 UTC (rev 103)
+++ trunk/library/classes/Gems/Tracker/Token.php 2011-10-14 15:06:50 UTC (rev 104)
@@ -987,13 +987,27 @@
$this->_ensureReceptionCode();
}
- return $this->_gemsData['grc_redo_survey'];
+ return (boolean) $this->_gemsData['grc_redo_survey'];
}
/**
+ * True if the reception code is a redo survey copy.
*
* @return boolean
*/
+ public function hasRedoCopyCode()
+ {
+ if (! isset($this->_gemsData['grc_redo_survey'])) {
+ $this->_ensureReceptionCode();
+ }
+
+ return Gems_Util_Translated::REDO_COPY == $this->_gemsData['grc_redo_survey'];
+ }
+
+ /**
+ *
+ * @return boolean
+ */
public function hasSuccesCode()
{
if (! isset($this->_gemsData['grc_success'])) {
Modified: trunk/library/classes/Gems/Util/Translated.php
===================================================================
--- trunk/library/classes/Gems/Util/Translated.php 2011-10-14 10:43:36 UTC (rev 103)
+++ trunk/library/classes/Gems/Util/Translated.php 2011-10-14 15:06:50 UTC (rev 104)
@@ -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
@@ -42,6 +42,10 @@
*/
class Gems_Util_Translated extends Gems_Registry_TargetAbstract
{
+ const REDO_NONE = 0;
+ const REDO_ONLY = 1;
+ const REDO_COPY = 2;
+
protected $phpDateFormatString = 'd-m-Y';
/**
@@ -78,7 +82,7 @@
}
}
self::$emptyDropdownArray = array('' => $this->_('-'));
-
+
return parent::checkRegistryRequestsAnswers();
}
@@ -128,11 +132,11 @@
if ($dateTimeValue) {
//$dateTime = strtotime($dateTimeValue);
// MUtil_Echo::track($dateTimeValue, date('c', $dateTime), $dateTime / 86400, date('c', time()), time() / 86400);
- // TODO: Timezone seems to screw this one up
- //$days = floor($dateTime / 86400) - floor(time() / 86400); // 86400 = 24*60*60
+ // TODO: Timezone seems to screw this one up
+ //$days = floor($dateTime / 86400) - floor(time() / 86400); // 86400 = 24*60*60
$dateTime = new MUtil_Date($dateTimeValue, Zend_Date::ISO_8601);
$days = $dateTime->diffDays(new MUtil_Date());
-
+
switch ($days) {
case -2:
return $this->_('2 days ago');
@@ -167,7 +171,7 @@
/**
* Get a translated empty value for usage in dropdowns
- *
+ *
* On instantiation of the class via Gems_Loader this variable will be populated
* in checkRegistryRequestsAnswers
*
@@ -193,6 +197,27 @@
return array('M' => $this->_('Mr.'), 'F' => $this->_('Mrs.'), 'U' => $this->_('Mr./Mrs.'));
}
+ /**
+ * Return the field values for the redo code.
+ *
+ * <ul><li>0: do not redo</li>
+ * <li>1: redo but do not copy answers</li>
+ * <li>2: redo and copy answers</li></ul>
+ *
+ * @staticvar array $data
+ * @return array
+ */
+ public function getRedoCodes()
+ {
+ static $data;
+
+ if (! $data) {
+ $data = array(self::REDO_NONE => $this->_('No'), self::REDO_ONLY => $this->_('Yes (forget answers)'), self::REDO_COPY => $this->_('Yes (keep answers)'));
+ }
+
+ return $data;
+ }
+
public function getYesNo()
{
static $data;
Modified: trunk/library/configs/db/tables/gems__reception_codes.10.sql
===================================================================
--- trunk/library/configs/db/tables/gems__reception_codes.10.sql 2011-10-14 10:43:36 UTC (rev 103)
+++ trunk/library/configs/db/tables/gems__reception_codes.10.sql 2011-10-14 15:06:50 UTC (rev 104)
@@ -4,14 +4,14 @@
grc_description varchar(40) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
grc_success boolean not null default 0,
-
- grc_for_surveys boolean not null default 0,
- grc_redo_survey boolean 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_for_surveys boolean 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 on update current_timestamp,
grc_changed_by bigint unsigned not null,
grc_created timestamp not null,
@@ -24,9 +24,9 @@
auto_increment = 1
CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
-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_active,
- grc_changed, grc_changed_by, grc_created, grc_created_by)
+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_active,
+ grc_changed, grc_changed_by, grc_created, grc_created_by)
VALUES
('OK', '', 1, 1, 0, 1, 1, 1, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1),
('skip', 'Skipped by calculation', 0, 1, 0, 0, 0, 0, 0, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1);
Modified: trunk/library/languages/default-en.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-en.po
===================================================================
--- trunk/library/languages/default-en.po 2011-10-14 10:43:36 UTC (rev 103)
+++ trunk/library/languages/default-en.po 2011-10-14 15:06:50 UTC (rev 104)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse EN\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-10-11 18:18+0100\n"
+"POT-Creation-Date: 2011-10-14 17:00+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -32,34 +32,34 @@
msgid "version"
msgstr "version"
-#: classes/GemsEscort.php:1421
+#: classes/GemsEscort.php:1410
msgid "Take note: your session has expired, your inputs where not saved. Please check the input data and try again"
msgstr "Take note: your session has expired, your inputs where not saved. Please check the input data and try again"
-#: classes/GemsEscort.php:1543
+#: classes/GemsEscort.php:1532
msgid "No access to site."
msgstr "No access to site."
-#: classes/GemsEscort.php:1545
-#: classes/GemsEscort.php:1581
+#: classes/GemsEscort.php:1534
+#: classes/GemsEscort.php:1570
msgid "You have no access to this site."
msgstr "You have no access to this site."
-#: classes/GemsEscort.php:1561
+#: classes/GemsEscort.php:1550
msgid "No access to page"
msgstr "No access to page"
-#: classes/GemsEscort.php:1563
+#: classes/GemsEscort.php:1552
#, 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:1557
#: classes/GemsEscort.php:1568
-#: classes/GemsEscort.php:1579
msgid "You are no longer logged in."
msgstr "You are no longer logged in."
-#: classes/GemsEscort.php:1569
+#: classes/GemsEscort.php:1558
msgid "You must login to access this page."
msgstr "You must login to access this page."
@@ -165,158 +165,153 @@
msgstr "Roles"
#: classes/Gems/Menu.php:196
-msgid "ACL"
-msgstr "ACL"
-
-#: classes/Gems/Menu.php:197
-#: classes/Gems/Menu.php:338
+#: classes/Gems/Menu.php:337
msgid "Assigned"
msgstr "Assigned"
-#: classes/Gems/Menu.php:198
+#: classes/Gems/Menu.php:197
msgid "Privileges"
msgstr "Privileges"
-#: classes/Gems/Menu.php:201
+#: classes/Gems/Menu.php:200
msgid "Groups"
msgstr "Groups"
-#: classes/Gems/Menu.php:204
+#: classes/Gems/Menu.php:203
msgid "Organizations"
msgstr "Organizations"
-#: classes/Gems/Menu.php:207
-#: classes/Gems/Menu.php:524
+#: classes/Gems/Menu.php:206
msgid "Staff"
msgstr "Staff"
-#: classes/Gems/Menu.php:210
+#: classes/Gems/Menu.php:209
msgid "Logging"
msgstr "Logging"
-#: classes/Gems/Menu.php:214
+#: classes/Gems/Menu.php:213
msgid "Maintenance"
msgstr "Maintenance"
-#: classes/Gems/Menu.php:228
+#: classes/Gems/Menu.php:227
#, php-format
msgid "Stand-alone privilige: %s"
msgstr "Stand-alone privilige: %s"
-#: classes/Gems/Menu.php:235
+#: classes/Gems/Menu.php:234
msgid "Logon"
msgstr "Logon"
-#: classes/Gems/Menu.php:236
+#: classes/Gems/Menu.php:235
msgid "Lost password"
msgstr "Lost password"
-#: classes/Gems/Menu.php:237
+#: classes/Gems/Menu.php:236
msgid "Your account"
msgstr "Your account"
-#: classes/Gems/Menu.php:238
+#: classes/Gems/Menu.php:237
msgid "Activity overview"
msgstr "Activity overview"
-#: classes/Gems/Menu.php:239
+#: classes/Gems/Menu.php:238
msgid "Change password"
msgstr "Change password"
-#: classes/Gems/Menu.php:240
-#: classes/Gems/Menu.php:280
-#: classes/Gems/Menu.php:315
+#: classes/Gems/Menu.php:239
+#: classes/Gems/Menu.php:279
+#: classes/Gems/Menu.php:314
msgid "Token"
msgstr "Token"
-#: classes/Gems/Menu.php:241
+#: classes/Gems/Menu.php:240
msgid "Logoff"
msgstr "Logoff"
-#: classes/Gems/Menu.php:276
+#: classes/Gems/Menu.php:275
msgid "Track"
msgstr "Track"
-#: classes/Gems/Menu.php:283
-#: classes/Gems/Menu.php:303
-#: classes/Gems/Menu.php:334
+#: classes/Gems/Menu.php:282
+#: classes/Gems/Menu.php:302
+#: classes/Gems/Menu.php:333
msgid "Add"
msgstr "Add"
-#: classes/Gems/Menu.php:287
-#: classes/Gems/Menu.php:370
+#: classes/Gems/Menu.php:286
+#: classes/Gems/Menu.php:369
msgid "Preview"
msgstr "Preview"
-#: classes/Gems/Menu.php:294
+#: classes/Gems/Menu.php:293
msgid "Tracks"
msgstr "Tracks"
-#: classes/Gems/Menu.php:307
+#: classes/Gems/Menu.php:306
msgid "Assignments"
msgstr "Assignments"
-#: classes/Gems/Menu.php:311
+#: classes/Gems/Menu.php:310
msgid "Show"
msgstr "Show"
-#: classes/Gems/Menu.php:319
+#: classes/Gems/Menu.php:318
msgid "Edit"
msgstr "Edit"
-#: classes/Gems/Menu.php:323
+#: classes/Gems/Menu.php:322
msgid "Delete"
msgstr "Delete"
-#: classes/Gems/Menu.php:328
+#: classes/Gems/Menu.php:327
msgid "Surveys"
msgstr "Surveys"
-#: classes/Gems/Menu.php:360
+#: classes/Gems/Menu.php:359
msgid "Fill in"
msgstr "Fill in"
-#: classes/Gems/Menu.php:364
+#: classes/Gems/Menu.php:363
msgid "Print PDF"
msgstr "Print PDF"
-#: classes/Gems/Menu.php:367
+#: classes/Gems/Menu.php:366
msgid "E-Mail now!"
msgstr "E-Mail now!"
-#: classes/Gems/Menu.php:373
+#: classes/Gems/Menu.php:372
msgid "Answers"
msgstr "Answers"
-#: classes/Gems/Menu.php:511
+#: classes/Gems/Menu.php:510
msgid "Respondents"
msgstr "Patients"
-#: classes/Gems/Menu.php:514
+#: classes/Gems/Menu.php:513
msgid "Overview"
msgstr "Overview"
-#: classes/Gems/Menu.php:521
+#: classes/Gems/Menu.php:520
msgid "Project"
msgstr "Project"
-#: classes/Gems/Menu.php:527
+#: classes/Gems/Menu.php:523
msgid "Setup"
msgstr "Setup"
-#: classes/Gems/Menu.php:530
+#: classes/Gems/Menu.php:526
msgid "Mail"
msgstr "Mail"
-#: classes/Gems/Menu.php:533
+#: classes/Gems/Menu.php:529
msgid "Track Builder"
msgstr "Track Builder"
-#: classes/Gems/Menu.php:542
+#: classes/Gems/Menu.php:538
msgid "Contact"
msgstr "Contact"
-#: classes/Gems/Menu.php:555
+#: classes/Gems/Menu.php:551
msgid "Changelog"
msgstr "Changelog"
@@ -380,89 +375,89 @@
msgid "Checks performed"
msgstr "Checks performed"
-#: classes/Gems/Controller/BrowseEditAction.php:342
+#: classes/Gems/Controller/BrowseEditAction.php:344
#, php-format
msgid "New %s..."
msgstr "New %s..."
-#: classes/Gems/Controller/BrowseEditAction.php:374
+#: classes/Gems/Controller/BrowseEditAction.php:376
#, php-format
msgid "Delete %s"
msgstr "Delete %s"
-#: classes/Gems/Controller/BrowseEditAction.php:378
+#: classes/Gems/Controller/BrowseEditAction.php:380
#, php-format
msgid "%2$u %1$s deleted"
msgstr "%2$u %1$s deleted"
-#: classes/Gems/Controller/BrowseEditAction.php:392
+#: classes/Gems/Controller/BrowseEditAction.php:394
#, php-format
msgid "Edit %s"
msgstr "Edit %s"
-#: classes/Gems/Controller/BrowseEditAction.php:489
+#: classes/Gems/Controller/BrowseEditAction.php:491
msgid "Free search text"
msgstr "Free search text"
-#: classes/Gems/Controller/BrowseEditAction.php:560
+#: classes/Gems/Controller/BrowseEditAction.php:562
msgid "Search"
msgstr "Search"
-#: classes/Gems/Controller/BrowseEditAction.php:576
+#: classes/Gems/Controller/BrowseEditAction.php:578
#, php-format
msgid "No %s found"
msgstr "No %s found"
-#: classes/Gems/Controller/BrowseEditAction.php:649
+#: classes/Gems/Controller/BrowseEditAction.php:651
#, php-format
msgid "No %s found."
msgstr "No %s found."
-#: classes/Gems/Controller/BrowseEditAction.php:764
+#: classes/Gems/Controller/BrowseEditAction.php:766
msgid "Are you sure?"
msgstr "Are you sure?"
-#: classes/Gems/Controller/BrowseEditAction.php:780
+#: classes/Gems/Controller/BrowseEditAction.php:782
msgid "Yes"
msgstr "Yes"
-#: classes/Gems/Controller/BrowseEditAction.php:781
+#: classes/Gems/Controller/BrowseEditAction.php:783
msgid "No"
msgstr "No"
-#: classes/Gems/Controller/BrowseEditAction.php:834
+#: classes/Gems/Controller/BrowseEditAction.php:836
#, php-format
msgid "Unknown %s requested"
msgstr "Unknown %s requested"
-#: classes/Gems/Controller/BrowseEditAction.php:857
+#: classes/Gems/Controller/BrowseEditAction.php:859
#, php-format
msgid "New %1$s..."
msgstr "New %1$s..."
-#: classes/Gems/Controller/BrowseEditAction.php:865
+#: classes/Gems/Controller/BrowseEditAction.php:867
msgid "Save"
msgstr "Save"
-#: classes/Gems/Controller/BrowseEditAction.php:901
+#: classes/Gems/Controller/BrowseEditAction.php:903
#, php-format
msgid "%2$u %1$s saved"
msgstr "%2$u %1$s saved"
-#: classes/Gems/Controller/BrowseEditAction.php:904
+#: classes/Gems/Controller/BrowseEditAction.php:906
msgid "No changes to save."
msgstr "No changes to save."
-#: classes/Gems/Controller/BrowseEditAction.php:913
+#: classes/Gems/Controller/BrowseEditAction.php:915
msgid "Input error! No changes saved!"
msgstr "Input error! No changes saved!"
-#: classes/Gems/Controller/BrowseEditAction.php:941
+#: classes/Gems/Controller/BrowseEditAction.php:943
#, php-format
msgid "Show %s"
msgstr "Show %s"
-#: classes/Gems/Controller/BrowseEditAction.php:948
+#: classes/Gems/Controller/BrowseEditAction.php:950
#, php-format
msgid "Unknown %s."
msgstr "Unknown %s."
@@ -944,20 +939,20 @@
msgid "Export data"
msgstr "Export data"
-#: classes/Gems/Default/ExportAction.php:161
+#: classes/Gems/Default/ExportAction.php:155
msgid "Survey"
msgstr "Survey"
-#: classes/Gems/Default/ExportAction.php:178
+#: classes/Gems/Default/ExportAction.php:170
#, php-format
msgid "%s records found."
msgstr "%s records found."
-#: classes/Gems/Default/ExportAction.php:182
+#: classes/Gems/Default/ExportAction.php:174
msgid "Organization"
msgstr "Organization"
-#: classes/Gems/Default/ExportAction.php:190
+#: classes/Gems/Default/ExportAction.php:183
msgid "Export to"
msgstr "Export to"
@@ -1271,12 +1266,12 @@
#: classes/Gems/Default/OptionAction.php:73
#: classes/Gems/Default/OrganizationAction.php:128
#: classes/Gems/Default/RespondentAction.php:173
-#: classes/Gems/Default/StaffAction.php:193
+#: classes/Gems/Default/StaffAction.php:188
msgid "Language"
msgstr "Language"
#: classes/Gems/Default/OptionAction.php:74
-#: classes/Gems/Default/StaffAction.php:194
+#: classes/Gems/Default/StaffAction.php:189
msgid "Logout on survey"
msgstr "Logout on survey"
@@ -1560,71 +1555,71 @@
msgid "Track %s does not exist."
msgstr "Track %s does not exist."
-#: classes/Gems/Default/ReceptionAction.php:56
+#: classes/Gems/Default/ReceptionAction.php:53
msgid "Can be assigned to"
msgstr "Can be assigned to"
-#: classes/Gems/Default/ReceptionAction.php:57
+#: classes/Gems/Default/ReceptionAction.php:54
msgid "Additional action"
msgstr "Additional action"
-#: classes/Gems/Default/ReceptionAction.php:79
+#: classes/Gems/Default/ReceptionAction.php:77
msgid "Code"
msgstr "Code"
-#: classes/Gems/Default/ReceptionAction.php:82
+#: classes/Gems/Default/ReceptionAction.php:80
msgid "Is success code"
msgstr "Is success code"
-#: classes/Gems/Default/ReceptionAction.php:86
+#: classes/Gems/Default/ReceptionAction.php:84
msgid "This reception code is a success code."
msgstr "This reception code is a success code."
-#: classes/Gems/Default/ReceptionAction.php:90
+#: classes/Gems/Default/ReceptionAction.php:88
msgid "Only active codes can be selected."
msgstr "Only active codes can be selected."
-#: classes/Gems/Default/ReceptionAction.php:91
+#: classes/Gems/Default/ReceptionAction.php:89
msgid "For respondents"
msgstr "For patients"
-#: classes/Gems/Default/ReceptionAction.php:94
+#: classes/Gems/Default/ReceptionAction.php:92
msgid "This reception code can be assigned to a respondent."
msgstr "This reception code can be assigned to a respondent."
-#: classes/Gems/Default/ReceptionAction.php:95
+#: classes/Gems/Default/ReceptionAction.php:93
msgid "For tracks"
msgstr "For tracks"
-#: classes/Gems/Default/ReceptionAction.php:98
+#: classes/Gems/Default/ReceptionAction.php:96
msgid "This reception code can be assigned to a track."
msgstr "This reception code can be assigned to a track."
-#: classes/Gems/Default/ReceptionAction.php:99
+#: classes/Gems/Default/ReceptionAction.php:97
msgid "For surveys"
msgstr "For surveys"
-#: classes/Gems/Default/ReceptionAction.php:102
+#: classes/Gems/Default/ReceptionAction.php:100
msgid "This reception code can be assigned to a survey."
msgstr "This reception code can be assigned to a survey."
-#: classes/Gems/Default/ReceptionAction.php:103
+#: classes/Gems/Default/ReceptionAction.php:101
msgid "Redo survey"
msgstr "Redo survey"
-#: classes/Gems/Default/ReceptionAction.php:106
+#: classes/Gems/Default/ReceptionAction.php:104
msgid "Redo a survey on this reception code."
msgstr "Redo a survey on this reception code."
-#: classes/Gems/Default/ReceptionAction.php:107
+#: classes/Gems/Default/ReceptionAction.php:105
msgid "Overwrite ansers"
msgstr "Overwrite ansers"
-#: classes/Gems/Default/ReceptionAction.php:110
+#: classes/Gems/Default/ReceptionAction.php:108
msgid "Remove the consent from already answered surveys."
msgstr "Remove the consent from already answered surveys."
-#: classes/Gems/Default/ReceptionAction.php:128
+#: classes/Gems/Default/ReceptionAction.php:126
msgid "reception code"
msgid_plural "reception codes"
msgstr[0] "reception code"
@@ -1745,48 +1740,40 @@
msgid "Respondent planning"
msgstr "Respondent planning"
-#: classes/Gems/Default/RoleAction.php:58
-msgid "Access Control Lists"
-msgstr "Access Control Lists"
-
-#: classes/Gems/Default/RoleAction.php:59
-msgid "ACL's"
-msgstr "ACL's"
-
-#: classes/Gems/Default/RoleAction.php:172
-#: classes/Gems/Default/RoleAction.php:213
+#: classes/Gems/Default/RoleAction.php:166
+#: classes/Gems/Default/RoleAction.php:207
msgid "Parents"
msgstr "Parents"
-#: classes/Gems/Default/RoleAction.php:191
+#: classes/Gems/Default/RoleAction.php:185
msgid "role"
msgid_plural "roles"
msgstr[0] "role"
msgstr[1] "roles"
-#: classes/Gems/Default/RoleAction.php:196
+#: classes/Gems/Default/RoleAction.php:190
msgid "Administrative roles"
msgstr "Administrative roles"
-#: classes/Gems/Default/RoleAction.php:214
-#: classes/Gems/Default/RoleAction.php:230
+#: classes/Gems/Default/RoleAction.php:208
+#: classes/Gems/Default/RoleAction.php:224
msgid "Allowed"
msgstr "Allowed"
-#: classes/Gems/Default/RoleAction.php:215
-#: classes/Gems/Default/RoleAction.php:231
+#: classes/Gems/Default/RoleAction.php:209
+#: classes/Gems/Default/RoleAction.php:225
msgid "Denied"
msgstr "Denied"
-#: classes/Gems/Default/RoleAction.php:219
+#: classes/Gems/Default/RoleAction.php:213
msgid "Project role overview"
msgstr "Project role overview"
-#: classes/Gems/Default/RoleAction.php:229
+#: classes/Gems/Default/RoleAction.php:223
msgid "Privilege"
msgstr "Privilege"
-#: classes/Gems/Default/RoleAction.php:235
+#: classes/Gems/Default/RoleAction.php:229
msgid "Project privileges"
msgstr "Project privileges"
@@ -1871,19 +1858,19 @@
msgid "Are you sure you want to synchronize all survey sources?"
msgstr "Are you sure you want to synchronize all survey sources?"
-#: classes/Gems/Default/StaffAction.php:138
+#: classes/Gems/Default/StaffAction.php:133
msgid "If checked the user will logoff when answering a survey."
msgstr "If checked the user will logoff when answering a survey."
-#: classes/Gems/Default/StaffAction.php:154
+#: classes/Gems/Default/StaffAction.php:149
msgid "You are not allowed to edit this staff member."
msgstr "You are not allowed to edit this staff member."
-#: classes/Gems/Default/StaffAction.php:189
+#: classes/Gems/Default/StaffAction.php:184
msgid "Primary function"
msgstr "Primary function"
-#: classes/Gems/Default/StaffAction.php:274
+#: classes/Gems/Default/StaffAction.php:269
msgid "staff member"
msgid_plural "staff members"
msgstr[0] "staff member"
@@ -2781,96 +2768,96 @@
msgid "This track type does not allow the creation of new rounds."
msgstr "This track type does not allow the creation of new rounds."
-#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:360
+#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:363
msgid "Track start"
msgstr "Track start"
-#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:361
+#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:364
msgid "Track end"
msgstr "Track end"
-#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:369
+#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:372
msgid "Start time"
msgstr "Start time"
-#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:370
+#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:373
msgid "Completion time"
msgstr "Completion time"
-#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:385
+#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:388
msgid "Minutes"
msgstr "Minutes"
-#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:386
+#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:389
msgid "Hours"
msgstr "Hours"
-#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:387
+#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:390
msgid "Days"
msgstr "Days"
-#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:388
+#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:391
msgid "Weeks"
msgstr "Weeks"
-#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:389
+#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:392
msgid "Months"
msgstr "Months"
-#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:390
+#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:393
msgid "Quarters"
msgstr "Quarters"
-#: classes/Gems/T...
[truncated message content] |
|
From: <gem...@li...> - 2011-10-20 13:56:42
|
Revision: 120
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=120&view=rev
Author: matijsdejong
Date: 2011-10-20 13:56:34 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
Old patches are not shown for new installations.
Modified Paths:
--------------
trunk/library/classes/Gems/Util/DatabasePatcher.php
trunk/library/configs/db/patches.sql
Modified: trunk/library/classes/Gems/Util/DatabasePatcher.php
===================================================================
--- trunk/library/classes/Gems/Util/DatabasePatcher.php 2011-10-20 13:30:18 UTC (rev 119)
+++ trunk/library/classes/Gems/Util/DatabasePatcher.php 2011-10-20 13:56:34 UTC (rev 120)
@@ -1,43 +1,47 @@
<?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.
- *
- * @version $Id$
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
* @package Gems
* @subpackage Util
+ * @author Matijs de Jong <mj...@ma...>
* @copyright Copyright (c) 2011 Erasmus MC
* @license New BSD License
+ * @version $Id$
*/
/**
+ * File for checking and executing (new) patches.
+ *
* @package Gems
* @subpackage Util
* @copyright Copyright (c) 2011 Erasmus MC
* @license New BSD License
+ * @since Class available since version 1.1
*/
class Gems_Util_DatabasePatcher
{
@@ -175,6 +179,22 @@
return $executed;
}
+ /**
+ * New installations should not be trequired to run patches. This esthablishes that level.
+ *
+ * @return int The lowest level of patch stored in the database.
+ */
+ protected function getMinimumPatchLevel()
+ {
+ static $level;
+
+ if (! $level) {
+ $level = intval($this->db->fetchOne("SELECT COALESCE(MIN(gpl_level), 1) FROM gems__patch_levels"));
+ }
+
+ return $level;
+ }
+
public function hasPatchFiles()
{
return (boolean) $this->patch_files;
@@ -195,33 +215,36 @@
$tree = MUtil_Ra_Nested::toTree($existing, 'gpa_level', 'gpa_location', 'gpa_name', 'gpa_order');
$changed = 0;
$current = new Zend_Db_Expr('CURRENT_TIMESTAMP');
+ $minimum = $this->getMinimumPatchLevel();
+ // MUtil_Echo::track($minimum);
$this->_loadPatches($applicationLevel);
foreach ($this->_loaded_patches as $patch) {
+ if ($minimum <= $patch['gpa_level']) {
+ $level = $patch['gpa_level'];
+ $location = $patch['gpa_location'];
+ $name = $patch['gpa_name'];
+ $order = $patch['gpa_order'];
- $level = $patch['gpa_level'];
- $location = $patch['gpa_location'];
- $name = $patch['gpa_name'];
- $order = $patch['gpa_order'];
+ // Does it exist?
+ if (isset($tree[$level][$location][$name][$order])) {
+ $sql = $patch['gpa_sql'];
+ if ($sql != $tree[$level][$location][$name][$order]['gpa_sql']) {
+ $values['gpa_sql'] = $sql;
+ $values['gpa_executed'] = 0;
+ $values['gpa_completed'] = 0;
+ $values['gpa_changed'] = $current;
- // Does it exist?
- if (isset($tree[$level][$location][$name][$order])) {
- $sql = $patch['gpa_sql'];
- if ($sql != $tree[$level][$location][$name][$order]['gpa_sql']) {
- $values['gpa_sql'] = $sql;
- $values['gpa_executed'] = 0;
- $values['gpa_completed'] = 0;
- $values['gpa_changed'] = $current;
+ $this->db->update('gems__patches', $values, $this->db->quoteInto('gpa_id_patch = ?', $tree[$level][$location][$name][$order]['gpa_id_patch']));
+ $changed++;
+ }
- $this->db->update('gems__patches', $values, $this->db->quoteInto('gpa_id_patch = ?', $tree[$level][$location][$name][$order]['gpa_id_patch']));
+ } else {
+ $patch['gpa_changed'] = $current;
+ $patch['gpa_created'] = $current;
+ $this->db->insert('gems__patches', $patch);
$changed++;
}
-
- } else {
- $patch['gpa_changed'] = $current;
- $patch['gpa_created'] = $current;
- $this->db->insert('gems__patches', $patch);
- $changed++;
}
} // */
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-10-20 13:30:18 UTC (rev 119)
+++ trunk/library/configs/db/patches.sql 2011-10-20 13:56:34 UTC (rev 120)
@@ -1,4 +1,8 @@
+-- GEMS VERSION: 1
+-- PATCH: Test skip earlier patch levels
+SELECT NULL;
+
-- GEMS VERSION: 27
-- PATCH: Use OK reception code
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-10-21 13:55:30
|
Revision: 125
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=125&view=rev
Author: matijsdejong
Date: 2011-10-21 13:55:24 +0000 (Fri, 21 Oct 2011)
Log Message:
-----------
Fix for #26, new round timing defaults to Day units.
Fix for #27, incorrectly escaped question labels
Modified Paths:
--------------
trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php
trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php
trunk/library/configs/db/patches.sql
Modified: trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php 2011-10-21 12:29:37 UTC (rev 124)
+++ trunk/library/classes/Gems/Tracker/Engine/StepEngineAbstract.php 2011-10-21 13:55:24 UTC (rev 125)
@@ -438,7 +438,7 @@
$model->set('grp_valid_for_id', 'label', $this->_('Round used'), 'default', '');
$model->set('grp_valid_for_field', 'label', $this->_('Date used'), 'default', 'gto_valid_from');
$model->set('grp_valid_for_length', 'label', $this->_('Add to date'), 'required', false, 'default', 2);
- $model->set('grp_valid_for_unit', 'label', $this->_('Add to date unit'), 'multiOptions', $this->getDateUnitsList(false), 'default', 'M');
+ $model->set('grp_valid_for_unit', 'label', $this->_('Add to date unit'), 'multiOptions', $this->getDateUnitsList(false));
// Continue with last round level items
$model->set('gro_active');
Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php 2011-10-21 12:29:37 UTC (rev 124)
+++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php 2011-10-21 13:55:24 UTC (rev 125)
@@ -605,22 +605,22 @@
}
if (! isset($oldfld) || ($oldfld['question'] !== $field['question'])) {
- $tmpres['label'] = $this->removeHtml($field['question']);
+ $tmpres['label'] = MUtil_Html::raw($this->removeHtml($field['question']));
}
// Juggle the labels for sub-questions etc..
if (isset($field['sq_question'])) {
if (isset($field['sq_question1'])) {
- $field['label'] = sprintf($this->translate->_('%s: %s'), $field['sq_question'], $field['sq_question1']);
+ $field['label'] = MUtil_Html::raw(sprintf($this->translate->_('%s: %s'), $field['sq_question'], $field['sq_question1']));
}
if (! isset($tmpres['label'])) {
- $tmpres['label'] = $this->removeHtml($field['sq_question']);
+ $tmpres['label'] = MUtil_Html::raw($this->removeHtml($field['sq_question']));
} else {
// Add non answered question for grouping
$model->set('_' . $name . '_', $tmpres);
// "Next" question
- $tmpres['label'] = $this->removeHtml($field['sq_question']);
+ $tmpres['label'] = MUtil_Html::raw($this->removeHtml($field['sq_question']));
}
$tmpres['thClass'] = 'question_sub';
}
@@ -826,7 +826,7 @@
* @param string $removeContent Pipe | separated tags from which contect will be stripped
* @return string
*/
- private function removeHtml($s , $keepTags = '' , $removeContent = 'script|style|noframes|select|option'){
+ private function removeHtml($s, $keepTags = '' , $removeContent = 'script|style|noframes|select|option'){
/**///prep the string
$s = ' ' . $s;
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-10-21 12:29:37 UTC (rev 124)
+++ trunk/library/configs/db/patches.sql 2011-10-21 13:55:24 UTC (rev 125)
@@ -211,3 +211,7 @@
-- PATCH: Add mail actions to admin role
UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges, ',pr.mail.log') WHERE grl_name = 'admin' AND grl_privileges NOT LIKE '%pr.mail.log%';
UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges, ',pr.mail.server,pr.mail.server.create,pr.mail.server.delete,pr.mail.server.edit') WHERE grl_name = 'super' AND grl_privileges NOT LIKE '%pr.mail.server%';
+
+-- PATCH: Set default for new rounds at days
+ALTER TABLE `gems__round_periods` CHANGE `grp_valid_after_unit` `grp_valid_after_unit` CHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'D',
+ CHANGE `grp_valid_for_unit` `grp_valid_for_unit` CHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'D';
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-10-21 15:43:14
|
Revision: 126
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=126&view=rev
Author: matijsdejong
Date: 2011-10-21 15:43:06 +0000 (Fri, 21 Oct 2011)
Log Message:
-----------
Fix for #28 database actions do not show correctly in menu.
Preparations started for #29 and associated #18: configurable automatic mails.
Continued working on #10: SnippetAction now has create and edit actions as well.
Made MUtil/Controller/ModelSnippetActionAbstract.php independent of MUtil/Controller/ModelActionAbstract.php less code was copied than was left unused and the copied code has been stable for a long time.
Modified Paths:
--------------
trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php
trunk/library/classes/Gems/Default/DatabaseAction.php
trunk/library/classes/Gems/Email/MultiMailForm.php
trunk/library/classes/Gems/Util/DbLookup.php
trunk/library/classes/Gems/Util/Translated.php
trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php
trunk/library/configs/db/patches.sql
trunk/library/controllers/MailController.php
Added Paths:
-----------
trunk/library/classes/Gems/Snippets/ModelFormSnippetGeneric.php
trunk/library/snippets/Generic/ModelFormSnippet.php
Modified: trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php
===================================================================
--- trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php 2011-10-21 13:55:24 UTC (rev 125)
+++ trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php 2011-10-21 15:43:06 UTC (rev 126)
@@ -26,7 +26,6 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Short description of file
*
* @package Gems
* @subpackage Controller
@@ -37,10 +36,8 @@
*/
/**
- * Short description for class
+ * Class contains Gems specific adaptations to parent class.
*
- * Long description for class (if any)...
- *
* @package Gems
* @subpackage Controller
* @copyright Copyright (c) 2011 Erasmus MC
@@ -50,12 +47,6 @@
abstract class Gems_Controller_ModelSnippetActionAbstract extends MUtil_Controller_ModelSnippetActionAbstract
{
/**
- *
- * @var GemsEscort
- */
- public $escort;
-
- /**
* The parameters used for the autofilter action.
*
* @var array Mixed key => value array for snippet initialization
@@ -74,6 +65,19 @@
protected $autofilterSnippets = 'Generic_ModelTableSnippet';
/**
+ * The snippets used for the create and edit actions.
+ *
+ * @var mixed String or array of snippets name
+ */
+ protected $createEditSnippets = 'Generic_ModelFormSnippet';
+
+ /**
+ *
+ * @var GemsEscort
+ */
+ public $escort;
+
+ /**
* The snippets used for the index action, before those in autofilter
*
* @var mixed String or array of snippets name
Modified: trunk/library/classes/Gems/Default/DatabaseAction.php
===================================================================
--- trunk/library/classes/Gems/Default/DatabaseAction.php 2011-10-21 13:55:24 UTC (rev 125)
+++ trunk/library/classes/Gems/Default/DatabaseAction.php 2011-10-21 15:43:06 UTC (rev 126)
@@ -93,6 +93,18 @@
}
/**
+ * Set the parameters needed by the menu.
+ *
+ * @param array $data The current model item
+ */
+ private function _setMenuParameters(array $data)
+ {
+ $source = $this->menu->getParameterSource();
+ $source['script'] = $data['script'] ? true : false;
+ $source['exists'] = $data['exists'] ? true : false;
+ }
+
+ /**
* Adds elements from the model to the bridge that creates the form.
*
* Overrule this function to add different elements to the browse table, without
@@ -180,6 +192,8 @@
$model = $this->getModel();
$data = $model->applyRequest($this->getRequest())->loadFirst();
+ $this->_setMenuParameters($data);
+
if (! ($data && isset($data['exists']) && $data['exists'])) {
$this->addMessage($this->_('This database object does not exist. You cannot delete it.'));
$this->html->buttonDiv($this->createMenuLinks(1));
@@ -438,6 +452,8 @@
$model = $this->getModel();
$data = $model->loadFirst();
+ $this->_setMenuParameters($data);
+
if (! ($data && isset($data['exists'], $data['script']) && ($data['exists'] || $data['script']))) {
$this->addMessage($this->_('This database object does not exist. You cannot create it.'));
$this->html->buttonDiv($this->createMenuLinks(1));
@@ -580,9 +596,9 @@
$model = $this->getModel();
$data = $model->loadFirst();
- $source = $this->menu->getParameterSource();
- $source['script'] = $data['script'];
- $source['exists'] = $data['exists'];
+ if ($data) {
+ $this->_setMenuParameters($data);
+ }
parent::showAction();
}
@@ -592,6 +608,8 @@
$model = $this->getModel();
$data = $model->loadFirst();
+ $this->_setMenuParameters($data);
+
if (! ($data && isset($data['exists']) && $data['exists'])) {
$this->addMessage($this->_('This database object does not exist. You cannot view it.'));
$this->html->buttonDiv($this->createMenuLinks(1));
Modified: trunk/library/classes/Gems/Email/MultiMailForm.php
===================================================================
--- trunk/library/classes/Gems/Email/MultiMailForm.php 2011-10-21 13:55:24 UTC (rev 125)
+++ trunk/library/classes/Gems/Email/MultiMailForm.php 2011-10-21 15:43:06 UTC (rev 126)
@@ -1,31 +1,31 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
* @version $Id$
* @package Gems
* @subpackage Email
@@ -69,15 +69,11 @@
protected function createMethodElement()
{
- $options = array(
- 'M' => $this->escort->_('Send multiple mails per respondent, one for each checked token.'),
- 'O' => $this->escort->_('Send one mail per respondent, mark all checked tokens as send.'),
- 'A' => $this->escort->_('Send one mail per respondent, mark only mailed tokens as send.'),
- );
+ $options = $this->escort->getUtil()->getTranslated()->getBulkMailProcessOptions();
return new Zend_Form_Element_Radio('multi_method', array(
'label' => $this->escort->_('Method'),
- 'multiOptions' => $options,
+ 'multiOptions' => $options,
'required' => true,
));
}
@@ -138,11 +134,11 @@
$title = null;
}
- return $this->_createMultiOption($tokenData,
- $this->mailer->getTokenName($tokenData),
- $tokenData['grs_email'],
- $tokenData['survey_short'],
- $title,
+ return $this->_createMultiOption($tokenData,
+ $this->mailer->getTokenName($tokenData),
+ $tokenData['grs_email'],
+ $tokenData['survey_short'],
+ $title,
$menuFind);
}
@@ -202,7 +198,7 @@
$this->tokensData = $tokensData;
$this->setTokenData(reset($tokensData));
-
+
return $this;
}
}
Copied: trunk/library/classes/Gems/Snippets/ModelFormSnippetGeneric.php (from rev 124, trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php)
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelFormSnippetGeneric.php (rev 0)
+++ trunk/library/classes/Gems/Snippets/ModelFormSnippetGeneric.php 2011-10-21 15:43:06 UTC (rev 126)
@@ -0,0 +1,70 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Snippets
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Displays 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.
+ *
+ * @package MUtil
+ * @subpackage Snippets
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.4
+ */
+class Gems_Snippets_ModelFormSnippetGeneric extends Gems_Snippets_ModelFormSnippetAbstract
+{
+ /**
+ *
+ * @var MUtil_Model_ModelAbstract
+ */
+ protected $model;
+
+ /**
+ * Creates the model
+ *
+ * @return MUtil_Model_ModelAbstract
+ */
+ protected function createModel()
+ {
+ return $this->model;
+ }
+}
Modified: trunk/library/classes/Gems/Util/DbLookup.php
===================================================================
--- trunk/library/classes/Gems/Util/DbLookup.php 2011-10-21 13:55:24 UTC (rev 125)
+++ trunk/library/classes/Gems/Util/DbLookup.php 2011-10-21 15:43:06 UTC (rev 126)
@@ -104,6 +104,33 @@
return $groups;
}
+ /**
+ * Retrieve an array of groups the user is allowed to assign: his own group and all groups
+ * he inherits rights from
+ *
+ * @return array
+ */
+ public function getAllowedStaffGroups()
+ {
+ $groups = $this->getActiveStaffGroups();
+ if ($this->session->user_role === 'super') {
+ return $groups;
+
+ } else {
+ $rolesAllowed = $this->acl->getRoleAndParents($this->session->user_role);
+ $roles = $this->db->fetchPairs('SELECT ggp_id_group, ggp_role FROM gems__groups WHERE ggp_group_active=1 AND ggp_staff_members=1 ORDER BY ggp_name');
+ $result = array();
+
+ foreach ($roles as $id => $role) {
+ if ((in_array($role, $rolesAllowed)) && isset($groups[$id])) {
+ $result[$id] = $groups[$id];
+ }
+ }
+
+ return $result;
+ }
+ }
+
public function getDefaultGroup()
{
$groups = $this->getActiveStaffGroups();
@@ -140,7 +167,24 @@
}
/**
+ * Return the available mail templates.
*
+ * @staticvar array $data
+ * @return array The tempalteId => subject list
+ */
+ public function getMailTemplates()
+ {
+ static $data;
+
+ if (! $data) {
+ $data = $this->db->fetchPairs("SELECT gmt_id_message, gmt_subject FROM gems__mail_templates ORDER BY gmt_subject");
+ }
+
+ return $data;
+ }
+
+ /**
+ *
* @staticvar array $organizations
* @return array List of the active organizations
*/
@@ -192,33 +236,6 @@
return $groups;
}
- /**
- * Retrieve an array of groups the user is allowed to assign: his own group and all groups
- * he inherits rights from
- *
- * @return array
- */
- public function getAllowedStaffGroups()
- {
- $groups = $this->getActiveStaffGroups();
- if ($this->session->user_role === 'super') {
- return $groups;
-
- } else {
- $rolesAllowed = $this->acl->getRoleAndParents($this->session->user_role);
- $roles = $this->db->fetchPairs('SELECT ggp_id_group, ggp_role FROM gems__groups WHERE ggp_group_active=1 AND ggp_staff_members=1 ORDER BY ggp_name');
- $result = array();
-
- foreach ($roles as $id => $role) {
- if ((in_array($role, $rolesAllowed)) && isset($groups[$id])) {
- $result[$id] = $groups[$id];
- }
- }
-
- return $result;
- }
- }
-
public function getUserConsents()
{
static $consents;
Modified: trunk/library/classes/Gems/Util/Translated.php
===================================================================
--- trunk/library/classes/Gems/Util/Translated.php 2011-10-21 13:55:24 UTC (rev 125)
+++ trunk/library/classes/Gems/Util/Translated.php 2011-10-21 15:43:06 UTC (rev 126)
@@ -170,6 +170,20 @@
}
/**
+ * The options for bulk mail token processing.
+ *
+ * @return array
+ */
+ public function getBulkMailProcessOptions()
+ {
+ return array(
+ 'M' => $this->_('Send multiple mails per respondent, one for each checked token.'),
+ 'O' => $this->_('Send one mail per respondent, mark all checked tokens as send.'),
+ 'A' => $this->_('Send one mail per respondent, mark only mailed tokens as send.'),
+ );
+ }
+
+ /**
* Get a translated empty value for usage in dropdowns
*
* On instantiation of the class via Gems_Loader this variable will be populated
Modified: trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php 2011-10-21 13:55:24 UTC (rev 125)
+++ trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php 2011-10-21 15:43:06 UTC (rev 126)
@@ -46,9 +46,18 @@
* @license New BSD License
* @since Class available since version 1.4.2
*/
-abstract class MUtil_Controller_ModelSnippetActionAbstract extends MUtil_Controller_ModelActionAbstract
+abstract class MUtil_Controller_ModelSnippetActionAbstract extends MUtil_Controller_Action
{
/**
+ * Created in createModel().
+ *
+ * Always retrieve using $this->getModel().
+ *
+ * $var MUtil_Model_ModelAbstract $_model The model in use
+ */
+ private $_model;
+
+ /**
* The parameters used for the autofilter action.
*
* @var array Mixed key => value array for snippet initialization
@@ -63,6 +72,20 @@
protected $autofilterSnippets = 'ModelTableSnippet';
/**
+ * The parameters used for the create and edit actions.
+ *
+ * @var array Mixed key => value array for snippet initialization
+ */
+ protected $createEditParameters = array();
+
+ /**
+ * The snippets used for the create and edit actions.
+ *
+ * @var mixed String or array of snippets name
+ */
+ protected $createEditSnippets = 'ModelFormSnippet';
+
+ /**
* The parameters used for the index action minus those in autofilter.
*
* @var array Mixed key => value array for snippet initialization
@@ -111,6 +134,23 @@
public $summarizedActions = array('index', 'autofilter');
/**
+ * Set to true in so $this->html is created at startup.
+ *
+ * @var boolean $useHtmlView true
+ */
+ public $useHtmlView = true; // Overrule parent
+
+ /**
+ * The request ID value
+ *
+ * @return string The request ID value
+ */
+ protected function _getIdParam()
+ {
+ return $this->_getParam(MUtil_Model::REQUEST_ID);
+ }
+
+ /**
* Set the action key in request
*
* Use this when an action is a Ajax action for retrieving
@@ -157,6 +197,77 @@
}
/**
+ * Action for showing a create new page
+ */
+ public function createAction()
+ {
+ if ($this->createEditSnippets) {
+ $this->createEditParameters['createData'] = true;
+ $this->createEditParameters['model'] = $this->getModel();
+ $this->createEditParameters['request'] = $this->getRequest();
+
+ $this->addSnippets($this->createEditSnippets, $this->createEditParameters);
+ }
+ }
+
+ /**
+ * Creates a model for getModel(). Called only for each new $action.
+ *
+ * The parameters allow you to easily adapt the model to the current action. The $detailed
+ * parameter was added, because the most common use of action is a split between detailed
+ * and summarized actions.
+ *
+ * @param boolean $detailed True when the current action is not in $summarizedActions.
+ * @param string $action The current action.
+ * @return MUtil_Model_ModelAbstract
+ */
+ abstract protected function createModel($detailed, $action);
+
+ /**
+ * Action for showing a edit item page
+ */
+ public function editAction()
+ {
+ if ($this->createEditSnippets) {
+ $this->createEditParameters['createData'] = false;
+ $this->createEditParameters['model'] = $this->getModel();
+ $this->createEditParameters['request'] = $this->getRequest();
+
+ $this->addSnippets($this->createEditSnippets, $this->createEditParameters);
+ }
+ }
+
+ /**
+ * Returns the model for the current $action.
+ *
+ * The parameters allow you to easily adapt the model to the current action. The $detailed
+ * parameter was added, because the most common use of action is a split between detailed
+ * and summarized actions.
+ *
+ * @return MUtil_Model_ModelAbstract
+ */
+ protected function getModel()
+ {
+ $request = $this->getRequest();
+ $action = null === $request ? '' : $request->getActionName();
+
+ // Only get new model if there is no model or the model was for a different action
+ if (! ($this->_model && $this->_model->isMeta('action', $action))) {
+ $detailed = ! in_array($action, $this->summarizedActions);
+
+ $this->_model = $this->createModel($detailed, $action);
+ $this->_model->setMeta('action', $action);
+
+ // Detailed models DO NOT USE $_POST for filtering,
+ // multirow models DO USE $_POST parameters for filtering.
+ $this->_model->applyRequest($request, $detailed);
+ }
+
+ return $this->_model;
+ }
+
+
+ /**
* Action for showing a browse page
*/
public function indexAction()
@@ -179,7 +290,6 @@
}
}
-
/**
* Action for showing an item page
*/
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-10-21 13:55:24 UTC (rev 125)
+++ trunk/library/configs/db/patches.sql 2011-10-21 15:43:06 UTC (rev 126)
@@ -211,6 +211,7 @@
-- PATCH: Add mail actions to admin role
UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges, ',pr.mail.log') WHERE grl_name = 'admin' AND grl_privileges NOT LIKE '%pr.mail.log%';
UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges, ',pr.mail.server,pr.mail.server.create,pr.mail.server.delete,pr.mail.server.edit') WHERE grl_name = 'super' AND grl_privileges NOT LIKE '%pr.mail.server%';
+UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges, ',pr.mail.job,pr.mail.job.create,pr.mail.job.delete,pr.mail.job.edit') WHERE grl_name = 'super' AND grl_privileges NOT LIKE '%pr.mail.job%';
-- PATCH: Set default for new rounds at days
ALTER TABLE `gems__round_periods` CHANGE `grp_valid_after_unit` `grp_valid_after_unit` CHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'D',
Modified: trunk/library/controllers/MailController.php
===================================================================
--- trunk/library/controllers/MailController.php 2011-10-21 13:55:24 UTC (rev 125)
+++ trunk/library/controllers/MailController.php 2011-10-21 15:43:06 UTC (rev 126)
@@ -1,33 +1,48 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Default
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ *
+ * @package Gems
+ * @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.2
+ */
class MailController extends Gems_Default_MailAction
{
}
Copied: trunk/library/snippets/Generic/ModelFormSnippet.php (from rev 124, trunk/library/snippets/Generic/ModelTableSnippet.php)
===================================================================
--- trunk/library/snippets/Generic/ModelFormSnippet.php (rev 0)
+++ trunk/library/snippets/Generic/ModelFormSnippet.php 2011-10-21 15:43:06 UTC (rev 126)
@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Snippets
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Displays an edit form based on the model the model set through the $model snippet parameter.
+ *
+ * Usage sni...
[truncated message content] |
|
From: <gem...@li...> - 2011-10-24 11:58:08
|
Revision: 132
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=132&view=rev
Author: matijsdejong
Date: 2011-10-24 11:58:01 +0000 (Mon, 24 Oct 2011)
Log Message:
-----------
Completed first complete version of snippet based BrowseEditAction replacement. #10 is done.
Modified Paths:
--------------
trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php
trunk/library/classes/Gems/Default/MailJobAction.php
trunk/library/classes/Gems/Default/MailLogAction.php
trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php
trunk/library/classes/MUtil/Snippets/ModelVerticalTableSnippetAbstract.php
trunk/library/classes/MUtil/Snippets/Standard/ModelVerticalTableSnippet.php
trunk/library/snippets/Generic/ModelItemTableSnippet.php
Added Paths:
-----------
trunk/library/classes/Gems/Snippets/ModelItemTableSnippetAbstract.php
trunk/library/classes/Gems/Snippets/ModelItemTableSnippetGeneric.php
trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetAbstract.php
trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetGeneric.php
trunk/library/classes/MUtil/Snippets/ModelYesNoDeleteSnippetAbstract.php
trunk/library/classes/MUtil/Snippets/Standard/ModelYesNoDeleteSnippet.php
trunk/library/snippets/Generic/ModelItemYesNoDeleteSnippet.php
Modified: trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php
===================================================================
--- trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php 2011-10-24 11:45:14 UTC (rev 131)
+++ trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php 2011-10-24 11:58:01 UTC (rev 132)
@@ -72,7 +72,14 @@
protected $createEditSnippets = 'Generic_ModelFormSnippet';
/**
+ * The snippets used for the delete action.
*
+ * @var mixed String or array of snippets name
+ */
+ protected $deleteSnippets = 'Generic_ModelItemYesNoDeleteSnippet';
+
+ /**
+ *
* @var GemsEscort
*/
public $escort;
Modified: trunk/library/classes/Gems/Default/MailJobAction.php
===================================================================
--- trunk/library/classes/Gems/Default/MailJobAction.php 2011-10-24 11:45:14 UTC (rev 131)
+++ trunk/library/classes/Gems/Default/MailJobAction.php 2011-10-24 11:58:01 UTC (rev 132)
@@ -125,12 +125,23 @@
}
/**
+ * Action for showing a delete item page
+ */
+ public function deleteAction()
+ {
+ $this->deleteParameters['deleteQuestion'] = $this->_('Do you want to delete this mail job?');
+ $this->deleteParameters['displayTitle'] = $this->deleteParameters['deleteQuestion'];
+
+ parent::deleteAction();
+ }
+
+ /**
* Action for showing a edit item page
*/
public function editAction()
{
$this->createEditParameters['formTitle'] = $this->_('Edit automatic mail job');
-
+
parent::editAction();
}
@@ -177,4 +188,14 @@
$this->html->pInfo($this->_('With automatic mail jobs and a cron job on the server, mails can be sent without manual user action.'));
}
+
+ /**
+ * Action for showing an item page
+ */
+ public function showAction()
+ {
+ $this->showParameters['displayTitle'] = $this->_('Automatic mail job details');
+
+ parent::showAction();
+ }
}
Modified: trunk/library/classes/Gems/Default/MailLogAction.php
===================================================================
--- trunk/library/classes/Gems/Default/MailLogAction.php 2011-10-24 11:45:14 UTC (rev 131)
+++ trunk/library/classes/Gems/Default/MailLogAction.php 2011-10-24 11:58:01 UTC (rev 132)
@@ -137,7 +137,7 @@
*/
public function showAction()
{
- $this->html->h3($this->_('Show Mail Activity Log item'));
+ $this->showParameters['displayTitle'] = $this->_('Show Mail Activity Log item');
// MUtil_Echo::track($this->indexParameters);
parent::showAction();
Copied: trunk/library/classes/Gems/Snippets/ModelItemTableSnippetAbstract.php (from rev 127, trunk/library/snippets/Generic/ModelItemTableSnippet.php)
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelItemTableSnippetAbstract.php (rev 0)
+++ trunk/library/classes/Gems/Snippets/ModelItemTableSnippetAbstract.php 2011-10-24 11:58:01 UTC (rev 132)
@@ -0,0 +1,186 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Snippets
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * 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.
+ *
+ * @package Gems
+ * @subpackage Snippets
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.2
+ */
+abstract class Gems_Snippets_ModelItemTableSnippetAbstract extends MUtil_Snippets_ModelVerticalTableSnippetAbstract
+{
+ /**
+ * Shortfix to add class attribute
+ *
+ * @var string
+ */
+ protected $class = 'displayer';
+
+ /**
+ * Optional title to display at the head of this page.
+ *
+ * @var string Optional
+ */
+ protected $displayTitle;
+
+ /**
+ * Required
+ *
+ * @var Gems_Loader
+ */
+ protected $loader;
+
+ /**
+ * Required
+ *
+ * @var Gems_Menu
+ */
+ protected $menu;
+
+ /**
+ * Required
+ *
+ * @var Zend_Controller_Request_Abstract
+ */
+ protected $request;
+
+ /**
+ * Adds rows from the model to the bridge that creates the browse table.
+ *
+ * Overrule this function to add different columns to the browse table, without
+ * having to recode the core table building code.
+ *
+ * @param MUtil_Model_TableBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @return void
+ */
+ protected function addShowTableRows(MUtil_Model_VerticalTableBridge $bridge, MUtil_Model_ModelAbstract $model)
+ {
+ if ($menuItem = $this->getEditMenuItem()) {
+ // Add click to edit
+ $bridge->tbody()->onclick = array('location.href=\'', $menuItem->toHRefAttribute($this->request), '\';');
+ }
+
+ parent::addShowTableRows($bridge, $model);
+ }
+
+ /**
+ * Finds a specific active menu item
+ *
+ * @param string $controller
+ * @param string $action
+ * @return Gems_Menu_SubMenuItem
+ */
+ protected function findMenuItem($controller, $action = 'index')
+ {
+ return $this->menu->find(array('controller' => $controller, 'action' => $action, 'allowed' => true));
+ }
+
+ /**
+ * Returns an edit menu item, if access is allowed by privileges
+ *
+ * @return Gems_Menu_SubMenuItem
+ */
+ protected function getEditMenuItem()
+ {
+ return $this->findMenuItem($this->request->getControllerName(), 'edit');
+ }
+
+ /**
+ * Create the snippets content
+ *
+ * This is a stub function either override getHtmlOutput() or override render()
+ *
+ * @param Zend_View_Abstract $view Just in case it is needed here
+ * @return MUtil_Html_HtmlInterface Something that can be rendered
+ */
+ public function getHtmlOutput(Zend_View_Abstract $view)
+ {
+ if ($table = parent::getHtmlOutput($view)) {
+ if ($title = $this->getTitle()) {
+ $htmlDiv = MUtil_Html::div();
+
+ $htmlDiv->h3($title);
+
+ $this->applyHtmlAttributes($table);
+
+ $htmlDiv[] = $table;
+
+ return $htmlDiv;
+ } else {
+ return $table;
+ }
+ }
+ }
+
+ /**
+ * An optional title for the head of the page.
+ *
+ * @return string
+ */
+ protected function getTitle()
+ {
+ return $this->displayTitle;
+ }
+
+ /**
+ * Set the footer of the browse table.
+ *
+ * Overrule this function to set the header differently, without
+ * having to recode the core table building code.
+ *
+ * @param MUtil_Model_TableBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @return void
+ */
+ protected function setShowTableFooter(MUtil_Model_VerticalTableBridge $bridge, MUtil_Model_ModelAbstract $model)
+ {
+ $controller = $this->request->getControllerName();
+
+ $menuList = $this->menu->getMenuList();
+ $menuList->addParameterSources($bridge)
+ ->addByController($controller, 'index', $this->_('Cancel'))
+ ->addByController($controller, 'edit')
+ ->addByController($controller, 'delete');
+
+ $bridge->tfrow($menuList, array('class' => 'centerAlign'));
+ }
+}
Copied: trunk/library/classes/Gems/Snippets/ModelItemTableSnippetGeneric.php (from rev 127, trunk/library/classes/Gems/Snippets/ModelFormSnippetGeneric.php)
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelItemTableSnippetGeneric.php (rev 0)
+++ trunk/library/classes/Gems/Snippets/ModelItemTableSnippetGeneric.php 2011-10-24 11:58:01 UTC (rev 132)
@@ -0,0 +1,71 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Snippets
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Displays each fields of a single item in a model in a row in a Html table
+ * the model set through the $model snippet parameter.
+ *
+ * If you want to use this class "as is" use the 'Generic_ModelItemTableSnippet' snippet.
+ *
+ * This class is not in the standard snippet loading directories and does not follow
+ * their naming conventions, but exists only to make it simple to extend this class
+ * for a specific implementation.
+ *
+ * @package MUtil
+ * @subpackage Snippets
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.4
+ */
+class Gems_Snippets_ModelItemTableSnippetGeneric extends Gems_Snippets_ModelItemTableSnippetAbstract
+{
+ /**
+ *
+ * @var MUtil_Model_ModelAbstract
+ */
+ protected $model;
+
+ /**
+ * Creates the model
+ *
+ * @return MUtil_Model_ModelAbstract
+ */
+ protected function createModel()
+ {
+ return $this->model;
+ }
+}
Copied: trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetAbstract.php (from rev 127, trunk/library/snippets/Generic/ModelItemTableSnippet.php)
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetAbstract.php (rev 0)
+++ trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetAbstract.php 2011-10-24 11:58:01 UTC (rev 132)
@@ -0,0 +1,185 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Snippets
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Ask Yes/No conformation for deletion and deletes item when confirmed.
+ *
+ * Can be used for other uses than delete by overriding performAction().
+ *
+ * @package Gems
+ * @subpackage Snippets
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.4
+ */
+abstract class Gems_Snippets_ModelItemYesNoDeleteSnippetAbstract extends MUtil_Snippets_ModelYesNoDeleteSnippetAbstract
+{
+ /**
+ * Shortfix to add class attribute
+ *
+ * @var string
+ */
+ protected $class = 'displayer';
+
+ /**
+ * Optional title to display at the head of this page.
+ *
+ * @var string Optional
+ */
+ protected $displayTitle;
+
+ /**
+ * Required
+ *
+ * @var Gems_Loader
+ */
+ protected $loader;
+
+ /**
+ * Required
+ *
+ * @var Gems_Menu
+ */
+ protected $menu;
+
+ /**
+ * Required
+ *
+ * @var Zend_Controller_Request_Abstract
+ */
+ protected $request;
+
+ /**
+ * Adds rows from the model to the bridge that creates the browse table.
+ *
+ * Overrule this function to add different columns to the browse table, without
+ * having to recode the core table building code.
+ *
+ * @param MUtil_Model_TableBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @return void
+ */
+ protected function addShowTableRows(MUtil_Model_VerticalTableBridge $bridge, MUtil_Model_ModelAbstract $model)
+ {
+ if ($menuItem = $this->getEditMenuItem()) {
+ // Add click to edit
+ $bridge->tbody()->onclick = array('location.href=\'', $menuItem->toHRefAttribute($this->request), '\';');
+ }
+
+ parent::addShowTableRows($bridge, $model);
+ }
+
+ /**
+ * Finds a specific active menu item
+ *
+ * @param string $controller
+ * @param string $action
+ * @return Gems_Menu_SubMenuItem
+ */
+ protected function findMenuItem($controller, $action = 'index')
+ {
+ return $this->menu->find(array('controller' => $controller, 'action' => $action, 'allowed' => true));
+ }
+
+ /**
+ * Returns an edit menu item, if access is allowed by privileges
+ *
+ * @return Gems_Menu_SubMenuItem
+ */
+ protected function getEditMenuItem()
+ {
+ return $this->findMenuItem($this->request->getControllerName(), 'edit');
+ }
+
+ /**
+ * Create the snippets content
+ *
+ * This is a stub function either override getHtmlOutput() or override render()
+ *
+ * @param Zend_View_Abstract $view Just in case it is needed here
+ * @return MUtil_Html_HtmlInterface Something that can be rendered
+ */
+ public function getHtmlOutput(Zend_View_Abstract $view)
+ {
+ if ($table = parent::getHtmlOutput($view)) {
+ if ($title = $this->getTitle()) {
+ $htmlDiv = MUtil_Html::div();
+
+ $htmlDiv->h3($title);
+
+ $this->applyHtmlAttributes($table);
+
+ $htmlDiv[] = $table;
+
+ return $htmlDiv;
+ } else {
+ return $table;
+ }
+ }
+ }
+
+ /**
+ * An optional title for the head of the page.
+ *
+ * @return string
+ */
+ protected function getTitle()
+ {
+ return $this->displayTitle;
+ }
+
+ /**
+ * Set the footer of the browse table.
+ *
+ * Overrule this function to set the header differently, without
+ * having to recode the core table building code.
+ *
+ * @param MUtil_Model_TableBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @return void
+ */
+ protected function setShowTableFooter(MUtil_Model_VerticalTableBridge $bridge, MUtil_Model_ModelAbstract $model)
+ {
+ $footer = $bridge->tfrow();
+
+ $footer[] = $this->getQuestion();
+ $footer[] = ' ';
+ $footer->actionLink(array($this->confirmParameter => 1), $this->_('Yes'));
+ $footer[] = ' ';
+ $footer->actionLink(array($this->request->getActionKey() => $this->abortAction), $this->_('No'));
+ }
+}
Copied: trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetGeneric.php (from rev 127, trunk/library/classes/Gems/Snippets/ModelFormSnippetGeneric.php)
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetGeneric.php (rev 0)
+++ trunk/library/classes/Gems/Snippets/ModelItemYesNoDeleteSnippetGeneric.php 2011-10-24 11:58:01 UTC (rev 132)
@@ -0,0 +1,72 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Snippets
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Ask Yes/No conformation for deletion and deletes item when confirmed.
+ *
+ * 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.
+ *
+ * @package MUtil
+ * @subpackage Snippets
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.4
+ */
+class Gems_Snippets_ModelItemYesNoDeleteSnippetGeneric extends Gems_Snippets_ModelItemYesNoDeleteSnippetAbstract
+{
+ /**
+ *
+ * @var MUtil_Model_ModelAbstract
+ */
+ protected $model;
+
+ /**
+ * Creates the model
+ *
+ * @return MUtil_Model_ModelAbstract
+ */
+ protected function createModel()
+ {
+ return $this->model;
+ }
+}
Modified: trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php 2011-10-24 11:45:14 UTC (rev 131)
+++ trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php 2011-10-24 11:58:01 UTC (rev 132)
@@ -86,6 +86,20 @@
protected $createEditSnippets = 'ModelFormSnippet';
/**
+ * The parameters used for the delete action.
+ *
+ * @var array Mixed key => value array for snippet initialization
+ */
+ protected $deleteParameters = array();
+
+ /**
+ * The snippets used for the delete action.
+ *
+ * @var mixed String or array of snippets name
+ */
+ protected $deleteSnippets = 'ModelYesNoDeleteSnippet';
+
+ /**
* The parameters used for the index action minus those in autofilter.
*
* @var array Mixed key => value array for snippet initialization
@@ -211,6 +225,19 @@
}
/**
+ * Action for showing a delete item page
+ */
+ public function deleteAction()
+ {
+ if ($this->deleteSnippets) {
+ $this->deleteParameters['model'] = $this->getModel();
+ $this->deleteParameters['request'] = $this->getRequest();
+
+ $this->addSnippets($this->deleteSnippets, $this->deleteParameters);
+ }
+ }
+
+ /**
* Creates a model for getModel(). Called only for each new $action.
*
* The parameters allow you to easily adapt the model to the current action. The $detailed
Modified: trunk/library/classes/MUtil/Snippets/ModelVerticalTableSnippetAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Snippets/ModelVerticalTableSnippetAbstract.php 2011-10-24 11:45:14 UTC (rev 131)
+++ trunk/library/classes/MUtil/Snippets/ModelVerticalTableSnippetAbstract.php 2011-10-24 11:58:01 UTC (rev 132)
@@ -142,8 +142,36 @@
$bridge = new $this->bridgeClass($model);
$bridge->setColumnCount($this->bridgeColumns);
+ $this->setShowTableHeader($bridge, $model);
+ $this->setShowTableFooter($bridge, $model);
$this->addShowTableRows($bridge, $model);
return $bridge->getTable();
}
+
+ /**
+ * Set the footer of the browse table.
+ *
+ * Overrule this function to set the header differently, without
+ * having to recode the core table building code.
+ *
+ * @param MUtil_Model_TableBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @return void
+ */
+ protected function setShowTableFooter(MUtil_Model_VerticalTableBridge $bridge, MUtil_Model_ModelAbstract $model)
+ { }
+
+ /**
+ * Set the header of the browse table.
+ *
+ * Overrule this function to set the header differently, without
+ * having to recode the core table building code.
+ *
+ * @param MUtil_Model_TableBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @return void
+ */
+ protected function setShowTableHeader(MUtil_Model_VerticalTableBridge $bridge, MUtil_Model_ModelAbstract $model)
+ { }
}
Added: trunk/library/classes/MUtil/Snippets/ModelYesNoDeleteSnippetAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Snippets/ModelYesNoDeleteSnippetAbstract.php (rev 0)
+++ trunk/library/classes/MUtil/Snippets/ModelYesNoDeleteSnippetAbstract.php 2011-10-24 11:58:01 UTC (rev 132)
@@ -0,0 +1,196 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Snippets
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ * Ask Yes/No conformation for deletion and deletes item when confirmed.
+ *
+ * Can be used for other uses than delete by overriding performAction().
+ *
+ * @package MUtil
+ * @subpackage Snippets
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.4
+ */
+abstract class MUtil_Snippets_ModelYesNoDeleteSnippetAbstract extends MUtil_Snippets_ModelVerticalTableSnippetAbstract
+{
+ /**
+ * The action to go to when the user clicks 'No'.
+ *
+ * If you want to change to another controller you'll have to code it.
+ *
+ * @var string
+ */
+ protected $abortAction = 'show';
+
+ /**
+ * @see Zend_Controller_Action_Helper_Redirector
+ *
+ * @var mixed Nothing or either an array or a string that is acceptable for Redector->gotoRoute()
+ */
+ protected $afterSaveRouteUrl;
+
+ /**
+ * The request parameter used to store the confirmation
+ *
+ * @var string Required
+ */
+ protected $confirmParameter = 'confirmed';
+
+ /**
+ * The action to go to when the user clicks 'Yes' and the data is deleted.
+ *
+ * If you want to change to another ...
[truncated message content] |
|
From: <gem...@li...> - 2011-10-24 17:16:16
|
Revision: 134
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=134&view=rev
Author: matijsdejong
Date: 2011-10-24 17:16:04 +0000 (Mon, 24 Oct 2011)
Log Message:
-----------
#29 seems finished, test it further tomorrow and add some nice on/off options to the auto mail.
Bug fix in DbLookup.php
Reset super role to standard method.
Modified Paths:
--------------
trunk/library/changelog.txt
trunk/library/classes/Gems/Default/MailJobAction.php
trunk/library/classes/Gems/Email/TemplateMailer.php
trunk/library/classes/Gems/Menu.php
trunk/library/classes/Gems/Roles.php
trunk/library/classes/Gems/Util/DbLookup.php
trunk/library/configs/db/tables/gems__mail_jobs.300.sql
trunk/library/controllers/EmailController.php
Added Paths:
-----------
trunk/library/classes/Gems/Default/CronAction.php
trunk/library/classes/MUtil/Mail/
trunk/library/classes/MUtil/Mail/Transport/
trunk/library/classes/MUtil/Mail/Transport/EchoLog.php
trunk/library/controllers/CronController.php
Removed Paths:
-------------
trunk/library/classes/Gems/Default/EmailAction.php
Modified: trunk/library/changelog.txt
===================================================================
--- trunk/library/changelog.txt 2011-10-24 12:06:15 UTC (rev 133)
+++ trunk/library/changelog.txt 2011-10-24 17:16:04 UTC (rev 134)
@@ -1,6 +1,7 @@
Important changes from 1.4.3 => 1.5
============================================================
-MailController is now claaed MailTemplateController
+MailController is now called MailTemplateController
+EmailController is now called CronController (with stub for compatibility)
Important changes from 1.4.2 => 1.4.3
============================================================
Copied: trunk/library/classes/Gems/Default/CronAction.php (from rev 133, trunk/library/classes/Gems/Default/EmailAction.php)
===================================================================
--- trunk/library/classes/Gems/Default/CronAction.php (rev 0)
+++ trunk/library/classes/Gems/Default/CronAction.php 2011-10-24 17:16:04 UTC (rev 134)
@@ -0,0 +1,217 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @author Michiel Rook <mi...@to...>
+ * @package Gems
+ * @subpackage Default
+ */
+
+/**
+ * Performs bulk-mail action, can be called from a cronjob
+ *
+ * @author Michiel Rook <mi...@to...>
+ * @package Gems
+ * @subpackage Default
+ */
+class Gems_Default_CronAction extends MUtil_Controller_Action
+{
+ /**
+ *
+ * @var Zend_Db_Adapter_Abstract
+ */
+ public $db;
+
+ /**
+ * Standard filter that must be true for every token query.
+ *
+ * @var array
+ */
+ protected $defaultFilter = array(
+ 'can_email' => 1,
+ 'gtr_active' => 1,
+ 'gsu_active' => 1,
+ 'grc_success' => 1,
+ 'gto_completion_time' => NULL,
+ 'gto_valid_from <= CURRENT_DATE',
+ '(gto_valid_until IS NULL OR gto_valid_until >= CURRENT_TIMESTAMP)'
+ );
+
+ /**
+ *
+ * @var GemsEscort
+ */
+ public $escort;
+
+ /**
+ *
+ * @var Zend_Session_Namespace
+ */
+ public $session;
+
+ /**
+ * Set to true in child class for automatic creation of $this->html.
+ *
+ * Otherwise call $this->initHtml()
+ *
+ * @var boolean $useHtmlView
+ */
+ public $useHtmlView = true;
+
+ /**
+ * Loads an e-mail template
+ *
+ * @param integer|null $templateId
+ */
+ protected function getTemplate($templateId)
+ {
+ return $this->db->fetchRow('SELECT * FROM gems__mail_templates WHERE gmt_id_message = ?', $templateId);
+ }
+
+ /**
+ * Returns the login name belonging to this user.
+ *
+ * @param int $userId
+ * @return string
+ */
+ protected function getUserLogin($userId)
+ {
+ return $this->db->fetchOne("SELECT gsf_login FROM gems__staff WHERE gsf_id_user = ?", $userId);
+ }
+
+ public function indexAction()
+ {
+ $this->initHtml();
+ $this->mailJob();
+ }
+
+ public function mailJob()
+ {
+ // Test: update `gems__tokens` set `gto_mail_sent_date` = null where `gto_mail_sent_date` > '2011-10-23'
+
+ $currentUser = isset($this->session->user_login) ? $this->session->user_login : null;
+
+ $model = $this->loader->getTracker()->getTokenModel();
+ $mailer = new Gems_Email_TemplateMailer($this->escort);
+ // $mailer->setDefaultTransport(new MUtil_Mail_Transport_EchoLog());
+
+ $jobs = $this->db->fetchAll("SELECT * FROM gems__mail_jobs WHERE gmj_active = 1");
+
+ if ($jobs) {
+ foreach ($jobs as $job) {
+ $this->escort->loadLoginInfo($this->getUserLogin($job['gmj_id_user_as']));
+
+ // Set up filter
+ $filter = $this->defaultFilter;
+ if ($job['gmj_filter_mode'] == 'R') {
+ $filter[] = 'gto_mail_sent_date <= DATE_SUB(CURRENT_DATE, INTERVAL ' . $job['gmj_filter_days_between'] . ' DAY)';
+ } else {
+ $filter['gto_mail_sent_date'] = NULL;
+ }
+ if ($job['gmj_id_organization']) {
+ $filter['gto_id_organization'] = $job['gmj_id_organization'];
+ }
+ if ($job['gmj_id_track']) {
+ $filter['gto_id_track'] = $job['gmj_id_track'];
+ }
+ if ($job['gmj_id_survey']) {
+ $filter['gto_id_survey'] = $job['gmj_id_survey'];
+ }
+
+ $tokensData = $model->load($filter);
+
+ if (count($tokensData)) {
+ $mailer->setMethod($job['gmj_process_method']);
+ if ($job['gmj_from_method'] == 'F') {
+ $mailer->setFrom($job['gmj_from_fixed']);
+ } else {
+ $mailer->setFrom($job['gmj_from_method']);
+ }
+
+ $templateData = $this->getTemplate($job['gmj_id_message']);
+ $mailer->setSubject($templateData['gmt_subject']);
+ $mailer->setBody($templateData['gmt_body']);
+
+ $mailer->setTokens(MUtil_Ra::column('gto_id_token', $tokensData));
+ $mailer->process($tokensData);
+ }
+
+ Gems_Auth::getInstance()->clearIdentity();
+ $this->escort->session->unsetAll();
+ }
+ }
+
+ $this->html->append($mailer->getMessages());
+
+ if ($currentUser) {
+ $this->escort->loadLoginInfo($currentUser);
+ } else {
+ $this->escort->afterLogout();
+ }
+
+ /*
+ if (isset($this->project->email['automatic'])) {
+ $batches = $this->project->email['automatic'];
+ $numBatches = count($batches['mode']);
+
+ for ($i = 0; $i < $numBatches; $i++) {
+ $this->_organizationId = $batches['organization'][$i];
+
+ if (isset($batches['days'][$i])) {
+ $this->_intervalDays = $batches['days'][$i];
+ }
+
+ $this->escort->loadLoginInfo($batches['user'][$i]);
+
+ $model->setFilter($this->getFilter($batches['mode'][$i]));
+
+ $tokensData = $model->load();
+
+ if (count($tokensData)) {
+ $tokens = array();
+
+ foreach ($tokensData as $tokenData) {
+ $tokens[] = $tokenData['gto_id_token'];
+ }
+
+ $templateData = $this->getTemplate($batches['template'][$i]);
+ $mailer->setSubject($templateData['gmt_subject']);
+ $mailer->setBody($templateData['gmt_body']);
+ $mailer->setMethod($batches['method'][$i]);
+ $mailer->setFrom($batches['from'][$i]);
+ $mailer->setTokens($tokens);
+
+ $mailer->process($tokensData);
+ }
+
+ Gems_Auth::getInstance()->clearIdentity();
+ $this->escort->session->unsetAll();
+ }
+ }
+ // */
+ }
+}
\ No newline at end of file
Deleted: trunk/library/classes/Gems/Default/EmailAction.php
===================================================================
--- trunk/library/classes/Gems/Default/EmailAction.php 2011-10-24 12:06:15 UTC (rev 133)
+++ trunk/library/classes/Gems/Default/EmailAction.php 2011-10-24 17:16:04 UTC (rev 134)
@@ -1,135 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @author Michiel Rook <mi...@to...>
- * @package Gems
- * @subpackage Default
- */
-
-/**
- * Performs bulk-mail action, can be called from a cronjob
- *
- * @author Michiel Rook <mi...@to...>
- * @package Gems
- * @subpackage Default
- */
-class Gems_Default_EmailAction extends Gems_Default_TokenPlanAction
-{
- private $_organizationId = null;
- private $_intervalDays = 7;
-
- /**
- * Constructs
- * @param strings $mode Either 'notmailed' or 'reminder'
- */
- protected function getFilter($mode = null)
- {
- $filter = array(
- 'can_email' => 1,
- 'gto_id_organization' => $this->_organizationId,
- 'gtr_active' => 1,
- 'gsu_active' => 1,
- 'grc_success' => 1,
- 'gto_completion_time' => NULL,
- '`gto_valid_from` >= DATE_ADD(CURRENT_DATE, INTERVAL -4 WEEK)',
- '`gto_valid_from` <= DATE_ADD(CURRENT_DATE, INTERVAL 2 WEEK)',
- '(gto_valid_until IS NULL OR gto_valid_until >= CURRENT_TIMESTAMP)'
- );
-
- if (isset($mode) && $mode == 'reminder') {
- $filter[] = 'gto_mail_sent_date <= DATE_SUB(CURRENT_DATE, INTERVAL ' . $this->_intervalDays . ' DAY)';
- } else {
- $filter['gto_mail_sent_date'] = NULL;
- }
-
- return $filter;
- }
-
- /**
- * Loads an e-mail template
- * @param integer|null $templateId
- */
- protected function getTemplate($templateId)
- {
- $model = new MUtil_Model_TableModel('gems__mail_templates');
-
- return $model->loadFirst(array('gmt_id_message' => $templateId));
- }
-
- public function indexAction()
- {
- $this->initHtml();
-
- $model = $this->loader->getTracker()->getTokenModel();
- $model->setCreate(false);
-
- $mailer = new Gems_Email_TemplateMailer($this->escort);
-
- if (isset($this->project->email['automatic'])) {
- $batches = $this->project->email['automatic'];
- $numBatches = count($batches['mode']);
-
- for ($i = 0; $i < $numBatches; $i++) {
- $this->_organizationId = $batches['organization'][$i];
-
- if (isset($batches['days'][$i])) {
- $this->_intervalDays = $batches['days'][$i];
- }
-
- $this->escort->loadLoginInfo($batches['user'][$i]);
-
- $model->setFilter($this->getFilter($batches['mode'][$i]));
-
- $tokensData = $model->load();
-
- if (count($tokensData)) {
- $tokens = array();
-
- foreach ($tokensData as $tokenData) {
- $tokens[] = $tokenData['gto_id_token'];
- }
-
- $templateData = $this->getTemplate($batches['template'][$i]);
- $mailer->setSubject($templateData['gmt_subject']);
- $mailer->setBody($templateData['gmt_body']);
- $mailer->setMethod($batches['method'][$i]);
- $mailer->setFrom($batches['from'][$i]);
- $mailer->setTokens($tokens);
-
- $mailer->process($tokensData);
- }
-
- Gems_Auth::getInstance()->clearIdentity();
- $this->escort->session->unsetAll();
- }
- }
-
- $this->html->append($mailer->getMessages());
-
- }
-}
\ No newline at end of file
Modified: trunk/library/classes/Gems/Default/MailJobAction.php
===================================================================
--- trunk/library/classes/Gems/Default/MailJobAction.php 2011-10-24 12:06:15 UTC (rev 133)
+++ trunk/library/classes/Gems/Default/MailJobAction.php 2011-10-24 17:16:04 UTC (rev 134)
@@ -98,27 +98,28 @@
Gems_Model::setChangeFieldsByPrefix($model, 'gmj');
- $model->set('gmj_id_message', 'label', $this->_('Template'), 'multiOptions', $unselected + $dbLookup->getMailTemplates());
- $model->set('gmj_id_user_as', 'label', $this->_('By staff member'),
+ $model->set('gmj_id_message', 'label', $this->_('Template'), 'multiOptions', $unselected + $dbLookup->getMailTemplates());
+ $model->set('gmj_id_user_as', 'label', $this->_('By staff member'),
'multiOptions', $unselected + $dbLookup->getActiveStaff(), 'default', $this->escort->getCurrentUserId(),
'description', $this->_('Used for logging and possibly from address.'));
- $model->set('gmj_active', 'label', $this->_('Active'),
+ $model->set('gmj_active', 'label', $this->_('Active'),
'multiOptions', $translated->getYesNo(), 'elementClass', 'Checkbox', 'required', true,
'description', $this->_('Job is only run when active.'));
$fromMethods = $unselected + $this->getBulkMailFromOptions();
- $model->set('gmj_from_method', 'label', $this->_('From address used'), 'multiOptions', $fromMethods);
+ $model->set('gmj_from_method', 'label', $this->_('From address used'), 'multiOptions', $fromMethods);
if ($detailed) {
- $model->set('gmj_from_fixed', 'label', $this->_('From other'),
+ $model->set('gmj_from_fixed', 'label', $this->_('From other'),
'description', sprintf($this->_("Only when '%s' is '%s'."), $model->get('gmj_from_method', 'label'), end($fromMethods)));
}
- $model->set('gmj_process_method', 'label', $this->_('Processing Method'), 'multiOptions', $unselected + $translated->getBulkMailProcessOptions());
- $model->set('gmj_filter_mode', 'label', $this->_('Filter for'), 'multiOptions', $unselected + $this->getBulkMailFilterOptions());
+ $model->set('gmj_process_method', 'label', $this->_('Processing Method'), 'multiOptions', $unselected + $translated->getBulkMailProcessOptions());
+ $model->set('gmj_filter_mode', 'label', $this->_('Filter for'), 'multiOptions', $unselected + $this->getBulkMailFilterOptions());
+ $model->set('gmj_filter_days_between', 'label', $this->_('Days between reminders'), 'validators[]', 'Digits');
if ($detailed) {
$model->set('gmj_id_organization', 'label', $this->_('Organization'), 'multiOptions', $empty + $dbLookup->getOrganizations());
$model->set('gmj_id_track', 'label', $this->_('Track'), 'multiOptions', $empty + $dbTracks->getAllTracks());
- $model->set('gsu_id_survey', 'label', $this->_('Survey'), 'multiOptions', $empty + $dbTracks->getAllSurveys());
+ $model->set('gmj_id_survey', 'label', $this->_('Survey'), 'multiOptions', $empty + $dbTracks->getAllSurveys());
}
return $model;
Modified: trunk/library/classes/Gems/Email/TemplateMailer.php
===================================================================
--- trunk/library/classes/Gems/Email/TemplateMailer.php 2011-10-24 12:06:15 UTC (rev 133)
+++ trunk/library/classes/Gems/Email/TemplateMailer.php 2011-10-24 17:16:04 UTC (rev 134)
@@ -49,6 +49,12 @@
const MAIL_TLS = 2;
/**
+ *
+ * @var Zend_Mail_Transport
+ */
+ protected $defaultTransport = null;
+
+ /**
* @var GemsEscort $escort
*/
protected $escort;
@@ -161,7 +167,7 @@
$mailServers[$from] = new Zend_Mail_Transport_Smtp($serverData['gms_server'], $options);
} else {
- $mailServers[$from] = null;
+ $mailServers[$from] = $this->defaultTransport;
}
}
@@ -317,7 +323,7 @@
* @param string $from
* @param string $from_name
* @param array $tokenData
- * @return boolean|string
+ * @return boolean|string String = error message from protocol.
*/
public function sendMail($to, $to_name, $from, $from_name, array $tokenData)
{
@@ -368,23 +374,39 @@
/**
* Sets the body of the mail
* @param string $body
+ * @return Gems_Email_TemplateMailer (continuation pattern)
*/
public function setBody($body)
{
$this->_body = $body;
+ return $this;
}
/**
+ * Set a different default transport protocol.
+ *
+ * @param Zend_Mail_Transport_Abstract $transport
+ * @return Gems_Email_TemplateMailer (continuation pattern)
+ */
+ public function setDefaultTransport(Zend_Mail_Transport_Abstract $transport)
+ {
+ $this->defaultTransport = $transport;
+ return $this;
+ }
+
+ /**
* Sets sender (regular e-mail address) or one of:
* 'O' - Uses the contact information of the selected organization
* 'S' - Uses the site-wide contact information
* 'U' - Uses the contact information of the currently logged in user
*
* @param string $from
+ * @return Gems_Email_TemplateMailer (continuation pattern)
*/
public function setFrom($from)
{
$this->_from = $from;
+ return $this;
}
/**
@@ -394,15 +416,18 @@
* 'A' - Send one mail per respondent, mark only mailed tokens as send.
*
* @param string $method
+ * @return Gems_Email_TemplateMailer (continuation pattern)
*/
public function setMethod($method)
{
$this->_method = $method;
+ return $this;
}
/**
* Sets the subject of the mail
* @param string $subject
+ * @return Gems_Email_TemplateMailer (continuation pattern)
*/
public function setSubject($subject)
{
@@ -412,7 +437,6 @@
public function setTemplateId($templatedId)
{
$this->_templateId = $templatedId;
-
return $this;
}
@@ -438,22 +462,27 @@
}
/**
- * Sets a list of tokens
+ * Sets the list of tokens that will be mailed.
+ *
* @param string[] $tokens
+ * @return Gems_Email_TemplateMailer (continuation pattern)
*/
public function setTokens(array $tokens)
{
$this->_tokens = $tokens;
+ return $this;
}
/**
* Sets verbose (noisy) operation
*
* @param boolean $verbose
+ * @return Gems_Email_TemplateMailer (continuation pattern)
*/
public function setVerbose($verbose)
{
$this->_verbose = $verbose;
+ return $this;
}
/**
Modified: trunk/library/classes/Gems/Menu.php
===================================================================
--- trunk/library/classes/Gems/Menu.php 2011-10-24 12:06:15 UTC (rev 133)
+++ trunk/library/classes/Gems/Menu.php 2011-10-24 17:16:04 UTC (rev 134)
@@ -551,6 +551,7 @@
$this->addButtonOnly($this->_('Changelog'), 'pr.project-information.changelog', 'project-information','changelog');
// Special page for automated e-mail cronjob
+ $this->addPage(null, null, 'cron', 'index');
$this->addPage(null, null, 'email', 'index');
}
Modified: trunk/library/classes/Gems/Roles.php
===================================================================
--- trunk/library/classes/Gems/Roles.php 2011-10-24 12:06:15 UTC (rev 133)
+++ trunk/library/classes/Gems/Roles.php 2011-10-24 17:16:04 UTC (rev 134)
@@ -113,7 +113,9 @@
return self::$_instanceOfSelf;
}
-//Reset de ACL en bouw opnieuw op
+ /**
+ * Reset de ACL en bouw opnieuw op
+ */
private function initAcl() {
$this->_acl = new MUtil_Acl();
if (get_class(self::$_instanceOfSelf)!=='Gems_Roles') {
@@ -139,8 +141,8 @@
}
//Now allow super admin all access, except for the actions that have the nologin privilege (->the login action)
- $this->_acl->allow('super');
- $this->_acl->deny('super', null, 'pr.nologin');
+ // $this->_acl->allow('super');
+ // $this->_acl->deny('super', null, 'pr.nologin');
}
public function load() {
Modified: trunk/library/classes/Gems/Util/DbLookup.php
===================================================================
--- trunk/library/classes/Gems/Util/DbLookup.php 2011-10-24 12:06:15 UTC (rev 133)
+++ trunk/library/classes/Gems/Util/DbLookup.php 2011-10-24 17:16:04 UTC (rev 134)
@@ -243,7 +243,7 @@
if (! $data) {
$data = $this->db->fetchPairs("SELECT gsf_id_user, CONCAT(COALESCE(gsf_last_name, '-'), ', ', COALESCE(gsf_first_name, ''), COALESCE(CONCAT(' ', gsf_surname_prefix), ''))
- FROM gems__staff WHERE ORDER BY gsf_last_name, gsf_first_name, gsf_surname_prefix");
+ FROM gems__staff ORDER BY gsf_last_name, gsf_first_name, gsf_surname_prefix");
}
return $data;
Property changes on: trunk/library/classes/MUtil/Mail
___________________________________________________________________
Added: bugtraq:url
+ http://survey.erasmusmc.nl/support/mantis/view.php?id=%BUGID%
Added: bugtraq:number
+ true
Added: bugtraq:logregex
+ #(\d+)
Property changes on: trunk/library/classes/MUtil/Mail/Transport
___________________________________________________________________
Added: bugtraq:url
+ http://survey.erasmusmc.nl/support/mantis/view.php?id=%BUGID%
Added: bugtraq:number
+ true
Added: bugtraq:logregex
+ #(\d+)
Added: trunk/library/classes/MUtil/Mail/Transport/EchoLog.php
===================================================================
--- trunk/library/classes/MUtil/Mail/Transport/EchoLog.php (rev 0)
+++ trunk/library/classes/MUtil/Mail/Transport/EchoLog.php 2011-10-24 17:16:04 UTC (rev 134)
@@ -0,0 +1,63 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Mail
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ * Zend Mail transport adapter that does not send the mail, but just echo's the output.
+ *
+ * @package MUtil
+ * @subpackage Mail
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.4
+ */
+class MUtil_Mail_Transport_EchoLog extends Zend_Mail_Transport_Abstract
+{
+ /**
+ * Send an email independent from the used transport
+ *
+ * The requisite information for the email will be found in the following
+ * properties:
+ *
+ * - {@link $recipients} - list of recipients (string)
+ * - {@link $header} - message header
+ * - {@link $body} - message body
+ */
+ protected function _sendMail()
+ {
+ MUtil_Echo::r(reset($this->_headers['Subject']), reset($this->_headers['From']) . '=>' . reset($this->_headers['To']));
+ }
+}
\ No newline at end of file
Modified: trunk/library/configs/db/tables/gems__mail_jobs.300.sql
===================================================================
--- trunk/library/configs/db/tables/gems__mail_jobs.300.sql 2011-10-24 12:06:15 UTC (rev 133)
+++ trunk/library/configs/db/tables/gems__mail_jobs.300.sql 2011-10-24 17:16:04 UTC (rev 134)
@@ -25,11 +25,12 @@
-- N => notmailed
-- R => reminder
gmj_filter_mode varchar(1) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
+ gmj_filter_days_between int unsigned not null default 7,
-- Optional filters
gmj_id_organization bigint unsigned null references gems__organizations (gor_id_organization),
gmj_id_track int unsigned null references gems__tracks (gtr_id_track),
- gsu_id_survey int unsigned null references gems__surveys (gsu_id_survey),
+ gmj_id_survey int unsigned null references gems__surveys (gsu_id_survey),
gmj_changed timestamp not null default current_timestamp on update current_timestamp,
gmj_changed_by bigint unsigned not null,
Copied: trunk/library/controllers/CronController.php (from rev 133, trunk/library/controllers/EmailController.php)
===================================================================
--- trunk/library/controllers/CronController.php (rev 0)
+++ trunk/library/controllers/CronController.php 2011-10-24 17:16:04 UTC (rev 134)
@@ -0,0 +1,48 @@
+<?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 ...
[truncated message content] |
|
From: <gem...@li...> - 2011-10-27 16:21:56
|
Revision: 151
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=151&view=rev
Author: matijsdejong
Date: 2011-10-27 16:21:42 +0000 (Thu, 27 Oct 2011)
Log Message:
-----------
First step for #31: login info moved from gems__staff to gems__users.10.sql
Temp fix for moving to new password situation while retaining the older versions.
DeleteValues moved up to DatabaseModelAbstract.
setModelParameters() added to menu for 2 parameter menu items.
Modified Paths:
--------------
trunk/library/changelog.txt
trunk/library/classes/Gems/Auth.php
trunk/library/classes/Gems/Cookies.php
trunk/library/classes/Gems/Default/CronAction.php
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/Default/OptionAction.php
trunk/library/classes/Gems/Default/RespondentAction.php
trunk/library/classes/Gems/Default/StaffAction.php
trunk/library/classes/Gems/Default/TokenPlanAction.php
trunk/library/classes/Gems/Loader/LoaderAbstract.php
trunk/library/classes/Gems/Loader.php
trunk/library/classes/Gems/Menu/MenuAbstract.php
trunk/library/classes/Gems/Menu/SubMenuItem.php
trunk/library/classes/Gems/Util/DbLookup.php
trunk/library/classes/Gems/Validate/GemsPasswordUsername.php
trunk/library/classes/GemsEscort.php
trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php
trunk/library/classes/MUtil/Model/JoinModel.php
trunk/library/classes/MUtil/Model/ModelAbstract.php
trunk/library/classes/MUtil/Model/TableBridgeAbstract.php
trunk/library/classes/MUtil/Model/TableModel.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__staff.20.sql
trunk/library/controllers/StaffController.php
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
Added Paths:
-----------
trunk/library/classes/Gems/Model/UserModel.php
trunk/library/classes/Gems/User/
trunk/library/classes/Gems/User/DatabaseUserAbstract.php
trunk/library/classes/Gems/User/NoLoginUser.php
trunk/library/classes/Gems/User/ProjectSuperUser.php
trunk/library/classes/Gems/User/RespondentUser.php
trunk/library/classes/Gems/User/StaffUser.php
trunk/library/classes/Gems/User/UserAbstract.php
trunk/library/classes/Gems/User/UserInterface.php
trunk/library/classes/Gems/User/UserLoader.php
trunk/library/configs/db/tables/gems__users.10.sql
Removed Paths:
-------------
trunk/library/classes/Gems/User/DatabaseUserAbstract.php
trunk/library/classes/Gems/User/NoLoginUser.php
trunk/library/classes/Gems/User/ProjectSuperUser.php
trunk/library/classes/Gems/User/RespondentUser.php
trunk/library/classes/Gems/User/StaffUser.php
trunk/library/classes/Gems/User/UserAbstract.php
trunk/library/classes/Gems/User/UserInterface.php
trunk/library/classes/Gems/User/UserLoader.php
Property Changed:
----------------
trunk/library/
Property changes on: trunk/library
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/newUser:113-150
Modified: trunk/library/changelog.txt
===================================================================
--- trunk/library/changelog.txt 2011-10-27 15:55:57 UTC (rev 150)
+++ trunk/library/changelog.txt 2011-10-27 16:21:42 UTC (rev 151)
@@ -1,5 +1,7 @@
Important changes from 1.4.3 => 1.5
============================================================
+The table gems__staff is split into gems__staff and gems__user with all login data in gems__users
+Passwords should be set with a project.ini->salt
MailController is now called MailTemplateController
EmailController is now called CronController (with stub for compatibility)
Modified: trunk/library/classes/Gems/Auth.php
===================================================================
--- trunk/library/classes/Gems/Auth.php 2011-10-27 15:55:57 UTC (rev 150)
+++ trunk/library/classes/Gems/Auth.php 2011-10-27 16:21:42 UTC (rev 151)
@@ -98,8 +98,8 @@
* Lookup last failed login and number of failed logins
*/
try {
- $sql = "SELECT gsf_failed_logins, UNIX_TIMESTAMP(gsf_last_failed)
- AS gsf_last_failed FROM gems__staff WHERE gsf_login = ?";
+ $sql = "SELECT gsu_failed_logins, UNIX_TIMESTAMP(gsu_last_failed)
+ AS gsu_last_failed FROM gems__users WHERE gsu_login = ?";
$results = $this->db->fetchRow($sql, array($username));
} catch (Zend_Db_Exception $zde) {
//If we need to apply a db patch, just use a default value
@@ -107,10 +107,10 @@
MUtil_Echo::r(GemsEscort::getInstance()->translate->_('Please update the database'));
}
- $delay = pow($results['gsf_failed_logins'], $this->_delayFactor);
- $remaining = ($results['gsf_last_failed'] + $delay) - time();
+ $delay = pow($results['gsu_failed_logins'], $this->_delayFactor);
+ $remaining = ($results['gsu_last_failed'] + $delay) - time();
- if ($results['gsf_failed_logins'] > 0 && $remaining > 0) {
+ if ($results['gsu_failed_logins'] > 0 && $remaining > 0) {
//$this->_obscureValue = false;
$result = $this->_error(self::ERROR_PASSWORD_DELAY, ceil($remaining / 60));
}
Modified: trunk/library/classes/Gems/Cookies.php
===================================================================
--- trunk/library/classes/Gems/Cookies.php 2011-10-27 15:55:57 UTC (rev 150)
+++ trunk/library/classes/Gems/Cookies.php 2011-10-27 16:21:42 UTC (rev 151)
@@ -1,63 +1,86 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @author Matijs de Jong
- * @since 1.0
- * @version $Id$
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
* @package Gems
* @subpackage Cookies
+ * @author Matijs de Jong <mj...@ma...>
* @copyright Copyright (c) 2011 Erasmus MC
* @license New BSD License
+ * @version $Id$
*/
/**
* Static Gems cookie utilities
- *
- * @author Matijs de Jong
+ *
* @package Gems
* @subpackage Cookies
* @copyright Copyright (c) 2011 Erasmus MC
* @license New BSD License
+ * @since Class available since version 1.0
*/
class Gems_Cookies
{
const LOCALE_COOKIE = 'gems_locale';
- public static function get(Zend_Controller_Request_Abstract $request, $name)
+ /**
+ * Get a specific cookie from the request.
+ *
+ * @param Zend_Controller_Request_Abstract $request
+ * @param string $name
+ * @param mixed $default
+ * @return mixed Cookie value
+ */
+ public static function get(Zend_Controller_Request_Abstract $request, $name, $default = null)
{
- return $request->getCookie($name);
+ return $request->getCookie($name, $default);
}
+ /**
+ * Get the current locale from the cookie.
+ *
+ * @param Zend_Controller_Request_Abstract $request
+ * @return string The current locale
+ */
public static function getLocale(Zend_Controller_Request_Abstract $request)
{
return self::get($request, self::LOCALE_COOKIE);
}
+ /**
+ * Store this cookie in a generic save method that works for both sub-directory
+ * installations and own url installations.
+ *
+ * @param string $name Name of the cookie
+ * @param mixed $value Value to set
+ * @param int $days Number of days to keep this cookie
+ * @param string $basepath The folder of the domain, if any.
+ * @return boolean True if the cookie was stored.
+ */
public static function set($name, $value, $days = 30, $basepath = '/')
{
// Gems uses the empty string when the base path is '/'
@@ -69,6 +92,13 @@
return setcookie($name, $value, time() + ($days * 86400), $basepath);
}
+ /**
+ * Store the locale in a cookie.
+ *
+ * @param string $locale Locale to store
+ * @param string $basepath The folder of the domain, if any.
+ * @return boolean True if the cookie was stored.
+ */
public static function setLocale($locale, $basepath = '/')
{
// Set the cookie for 30 days
Modified: trunk/library/classes/Gems/Default/CronAction.php
===================================================================
--- trunk/library/classes/Gems/Default/CronAction.php 2011-10-27 15:55:57 UTC (rev 150)
+++ trunk/library/classes/Gems/Default/CronAction.php 2011-10-27 16:21:42 UTC (rev 151)
@@ -125,7 +125,7 @@
*/
protected function getUserLogin($userId)
{
- return $this->db->fetchOne("SELECT gsf_login FROM gems__staff WHERE gsf_id_user = ?", $userId);
+ return $this->db->fetchOne("SELECT gsu_login FROM gems__users WHERE gsu_id_user = ?", $userId);
}
public function indexAction()
Modified: trunk/library/classes/Gems/Default/IndexAction.php
===================================================================
--- trunk/library/classes/Gems/Default/IndexAction.php 2011-10-27 15:55:57 UTC (rev 150)
+++ trunk/library/classes/Gems/Default/IndexAction.php 2011-10-27 16:21:42 UTC (rev 151)
@@ -74,7 +74,7 @@
* @return Zend_Auth_Adapter_Interface
*/
protected function _getAuthAdapter($formValues) {
- $adapter = new Zend_Auth_Adapter_DbTable($this->db, 'gems__staff', 'gsf_login', 'gsf_password');
+ $adapter = new Zend_Auth_Adapter_DbTable($this->db, 'gems__users', 'gsu_login', 'gsu_password');
$adapter->setIdentity($formValues['userlogin']);
$adapter->setCredential($this->escort->passwordHash(null, $formValues['password'], false));
return $adapter;
@@ -97,6 +97,21 @@
$form->setMethod('post');
$form->setDescription(sprintf($this->_('Login to %s application'), $this->project->name));
+ if ($this->escort instanceof Gems_Project_Organization_SingleOrganizationInterface) {
+ $element = new Zend_Form_Element_Hidden('organization');
+ $element->setValue($this->escort->getRespondentOrganization());
+ } else {
+ $element = new Zend_Form_Element_Select('organization');
+ $element->setLabel($this->_('Organization'));
+ $element->setMultiOptions($this->util->getDbLookup()->getOrganizations());
+ $element->setRequired(true);
+
+ if (! $this->_request->isPost()) {
+ $element->setValue($this->escort->getCurrentOrganization());
+ }
+ }
+ $form->addElement($element);
+
// Veld inlognaam
$element = new Zend_Form_Element_Text('userlogin');
$element->setLabel($this->_('Username'));
@@ -135,7 +150,7 @@
return $form;
}
- // Dummy: always rerouted by Gems
+ // Dummy: always rerouted by GemsEscort
public function indexAction() { }
public function loginAction()
@@ -152,11 +167,17 @@
$this->_reroute(array('controller' => 'respondent', 'action'=>'index'));
}
}
+ // MUtil_Echo::track(get_class($this->loader->getUser('super', null)));
$form = $this->_getLoginForm();
if ($this->_request->isPost()) {
if ($form->isValid($_POST, false)) {
+ /*
+ if ($user = $this->loader->getUser($_POST['userlogin'], $_POST['organization'])) {
+
+ } // */
+
if (isset($this->project->admin) && $this->project->admin['user'] == $_POST['userlogin'] && $this->project->admin['pwd'] == $_POST['password']) {
$this->session->user_id = 2000;
$this->session->user_name = $_POST['userlogin'];
@@ -180,6 +201,19 @@
$adapter = $this->_getAuthAdapter($form->getValues());
$auth = Gems_Auth::getInstance();
$result = $auth->authenticate($adapter, $_POST['userlogin']);
+
+ // Allow login using old password.
+ if ((! $result->isValid()) && ($userid = $this->db->fetchOne("SELECT gsu_id_user FROM gems__users WHERE gsu_active = 1 AND gsu_password IS NULL AND gsu_login = ?", $_POST['userlogin']))) {
+
+ $adapter = new Zend_Auth_Adapter_DbTable($this->db, 'gems__staff', 'gsf_id_user', 'gsf_password');
+ $adapter->setIdentity($userid);
+ $adapter->setCredential(md5($_POST['password'], false));
+ $result = $auth->authenticate($adapter, $_POST['userlogin']);
+ MUtil_Echo::track('old autho');
+ } else {
+ MUtil_Echo::track('new autho');
+ }
+
if (!$result->isValid()) {
// Invalid credentials
$errors = $result->getMessages();
@@ -295,19 +329,19 @@
}
if ($this->_request->isPost() && $form->isValid($_POST)) {
- $sql = $this->db->quoteInto("SELECT gsf_id_user,gsf_email,gsf_reset_key,DATEDIFF(NOW(), gsf_reset_req) AS gsf_days FROM gems__staff WHERE gsf_login = ?", $_POST['userlogin']);
+ $sql = $this->db->quoteInto("SELECT gsu_id_user, gsf_email, gsu_reset_key, DATEDIFF(NOW(), gsu_reset_requested) AS gsf_days FROM gems__users INNER JOIN gems__staff ON gsu_id_user = gsf_id_user WHERE gsu_login = ?", $_POST['userlogin']);
$result = $this->db->fetchRow($sql);
if (empty($result) || empty($result['gsf_email'])) {
$this->addMessage($this->_('No such user found or no e-mail address known'));
- } else if (!empty($result['gsf_reset_key']) && $result['gsf_days'] < 1) {
+ } else if (!empty($result['gsu_reset_key']) && $result['gsf_days'] < 1) {
$this->addMessage($this->_('Reset e-mail already sent, please try again after 24 hours'));
} else {
$email = $result['gsf_email'];
$key = md5(time() . $email);
$url = $this->util->getCurrentURI('index/resetpassword/key/' . $key);
- $this->db->update('gems__staff', array('gsf_reset_key' => $key, 'gsf_reset_req' => new Zend_Db_Expr('NOW()')), 'gsf_id_user = ' . $result['gsf_id_user']);
+ $this->db->update('gems__users', array('gsu_reset_key' => $key, 'gsu_reset_requested' => new Zend_Db_Expr('NOW()')), 'gsu_id_user = ' . $result['gsu_id_user']);
$mail->setSubject('Password reset requested');
$mail->setBodyText('To reset your password, please click this link: ' . $url);
@@ -323,7 +357,7 @@
}
}
} else if ($key = $this->_request->getParam('key')) {
- $sql = $this->db->quoteInto("SELECT gsf_id_user,gsf_email FROM gems__staff WHERE gsf_reset_key = ?", $key);
+ $sql = $this->db->quoteInto("SELECT gsu_id_user, gsf_email FROM gems__users INNER JOIN gems__staff ON gsu_id_user = gsf_id_user WHERE gsu_reset_key = ?", $key);
$result = $this->db->fetchRow($sql);
if (!empty($result)) {
@@ -339,7 +373,7 @@
try {
$mail->send();
$this->addMessage($this->_('An e-mail was sent containing your new password'));
- $this->db->update('gems__staff', array('gsf_reset_key' => new Zend_Db_Expr('NULL'), 'gsf_reset_req' => new Zend_Db_Expr('NULL'), 'gsf_password' => $passwordHash), 'gsf_id_user = ' . $result['gsf_id_user']);
+ $this->db->update('gems__users', array('gsu_reset_key' => new Zend_Db_Expr('NULL'), 'gsu_reset_requested' => new Zend_Db_Expr('NULL'), 'gsu_password' => $passwordHash), 'gsu_id_user = ' . $result['gsu_id_user']);
$this->_reroute(array('action' => 'index'), true);
} catch (Exception $e) {
$this->addMessage($this->_('Unable to send e-mail'));
Modified: trunk/library/classes/Gems/Default/OptionAction.php
===================================================================
--- trunk/library/classes/Gems/Default/OptionAction.php 2011-10-27 15:55:57 UTC (rev 150)
+++ trunk/library/classes/Gems/Default/OptionAction.php 2011-10-27 16:21:42 UTC (rev 151)
@@ -61,8 +61,10 @@
*/
protected function addFormElements(MUtil_Model_FormBridge $bridge, MUtil_Model_ModelAbstract $model, array $data, $new = false)
{
+ $bridge->addHidden( 'gsu_id_user');
+ $bridge->addHidden( 'gsu_id_organization');
$bridge->addHidden( 'gsf_id_user');
- $bridge->addExhibitor('gsf_login', array('size' => 15, 'minlength' => 4));
+ $bridge->addExhibitor('gsu_login', array('size' => 15, 'minlength' => 4));
$bridge->addText( 'gsf_first_name');
$bridge->addText( 'gsf_surname_prefix');
$bridge->addText( 'gsf_last_name');
@@ -71,12 +73,11 @@
$bridge->addRadio( 'gsf_gender', 'separator', '');
$bridge->addSelect( 'gsf_iso_lang', array('label' => $this->_('Language'), 'multiOptions' => $this->util->getLocalized()->getLanguages()));
- $bridge->addCheckbox( 'gsf_logout_on_survey', 'label', $this->_('Logout on survey'), 'description', $this->_('If checked you will logoff after answering a survey.'));
}
public function afterSave(array $data, $isNew)
{
- $this->escort->loadLoginInfo($data['gsf_login']);
+ $this->escort->loadLoginInfo($data['gsu_login']);
}
public function changePasswordAction()
@@ -86,15 +87,18 @@
*************/
$form = $this->createForm();
- // Veld current password
- $element = new Zend_Form_Element_Password('old_password');
- $element->setLabel($this->_('Current password'));
- $element->setAttrib('size', 10);
- $element->setAttrib('maxlength', 20);
- $element->setRenderPassword(true);
- $element->setRequired(true);
- $element->addValidator(new Gems_Validate_GemsPasswordUsername($this->session->user_login, 'old_password', $this->db));
- $form->addElement($element);
+ $sql = "SELECT CASE WHEN gsu_password IS NULL THEN 0 ELSE 1 END FROM gems__users WHERE gsu_id_user = ? AND gsu_id_organization = ?";
+ if ($this->db->fetchOne($sql, array($this->session->user_id, $this->session->user_organization_id))) {
+ // Veld current password
+ $element = new Zend_Form_Element_Password('old_password');
+ $element->setLabel($this->_('Current password'));
+ $element->setAttrib('size', 10);
+ $element->setAttrib('maxlength', 20);
+ $element->setRenderPassword(true);
+ $element->setRequired(true);
+ $element->addValidator(new Gems_Validate_GemsPasswordUsername($this->session->user_login, 'old_password', $this->db));
+ $form->addElement($element);
+ }
// Veld new password
$element = new Zend_Form_Element_Password('new_password');
@@ -127,8 +131,9 @@
****************/
if ($this->_request->isPost() && $form->isValid($_POST)) {
- $data['gsf_id_user'] = $this->session->user_id;
- $data['gsf_password'] = $this->escort->passwordHash(null,$_POST['new_password']);
+ $data['gsu_id_user'] = $this->session->user_id;
+ $data['gsu_id_organization'] = $this->session->user_organization_id;
+ $data['gsu_password'] = $this->escort->passwordHash(null, $_POST['new_password']);
$this->getModel()->save($data);
@@ -180,10 +185,10 @@
*/
public function createModel($detailed, $action)
{
- $model = new MUtil_Model_TableModel('gems__staff');
- $model->canCreate = false;
+ $model = new Gems_Model_UserModel('staff', 'gems__staff', array('gsu_id_user' => 'gsf_id_user'), 'gsf');
+ $model->copyKeys();
- $model->set('gsf_login', 'label', $this->_('Login Name'));
+ $model->set('gsu_login', 'label', $this->_('Login Name'));
$model->set('gsf_email', 'label', $this->_('E-Mail'));
$model->set('gsf_first_name', 'label', $this->_('First name'));
$model->set('gsf_surname_prefix', 'label', $this->_('Surname prefix'), 'description', 'de, van der, \'t, etc...');
@@ -191,14 +196,12 @@
$model->set('gsf_gender', 'label', $this->_('Gender'), 'multiOptions', $this->util->getTranslated()->getGenders());
- Gems_Model::setChangeFieldsByPrefix($model, 'gsf');
-
return $model;
}
public function editAction()
{
- $this->getModel()->setFilter(array('gsf_id_user' => $this->session->user_id));
+ $this->getModel()->setFilter(array('gsu_id_user' => $this->session->user_id));
if ($form = $this->processForm()) {
$this->html->h3(sprintf($this->_('Options'), $this->getTopic()));
Modified: trunk/library/classes/Gems/Default/RespondentAction.php
===================================================================
--- trunk/library/classes/Gems/Default/RespondentAction.php 2011-10-27 15:55:57 UTC (rev 150)
+++ trunk/library/classes/Gems/Default/RespondentAction.php 2011-10-27 16:21:42 UTC (rev 151)
@@ -326,8 +326,8 @@
$values = $this->db->fetchPairs("
SELECT gsf_id_user,
CONCAT(gsf_last_name, ', ', COALESCE(CONCAT(gsf_first_name, ' '), ''), COALESCE(gsf_surname_prefix, '')) AS name
- FROM gems__staff INNER JOIN gems__groups ON gsf_id_primary_group = ggp_id_group
- WHERE gsf_active=1 AND gsf_id_organization = ? AND ggp_role = 'physician'
+ FROM (gems__users INNER JOIN gems__staff ON gsu_id_user = gsf_id_user) INNER JOIN gems__groups ON gsf_id_primary_group = ggp_id_group
+ WHERE gsu_active=1 AND gsu_id_organization = ? AND ggp_role = 'physician'
ORDER BY 2", $organizationId);
$session->physicians = $values;
Modified: trunk/library/classes/Gems/Default/StaffAction.php
===================================================================
--- trunk/library/classes/Gems/Default/StaffAction.php 2011-10-27 15:55:57 UTC (rev 150)
+++ trunk/library/classes/Gems/Default/StaffAction.php 2011-10-27 16:21:42 UTC (rev 151)
@@ -44,7 +44,7 @@
*/
class Gems_Default_StaffAction extends Gems_Controller_BrowseEditAction
{
- public $filterStandard = array('gsf_active' => 1);
+ public $filterStandard = array('gsu_active' => 1);
public $sortKey = array('name' => SORT_ASC);
protected $_instanceId;
@@ -96,18 +96,28 @@
if ($new) {
$model->set('gsf_id_primary_group', 'default', $dbLookup->getDefaultGroup());
} else {
- $model->set('gsf_password', 'description', $this->_('Enter only when changing'));
- $model->setSaveWhenNotNull('gsf_password');
+ $model->set('gsu_password', 'description', $this->_('Enter only when changing'));
+ $model->setSaveWhenNotNull('gsu_password');
}
- $model->setOnSave('gsf_password', array($this->escort, 'passwordHash'));
+ $model->setOnSave('gsu_password', array($this->escort, 'passwordHash'));
$ucfirst = new Zend_Filter_Callback('ucfirst');
- $bridge->addHidden( 'gsf_id_user');
- $bridge->addText( 'gsf_login', 'size', 15, 'minlength', 4,
- 'validator', $model->createUniqueValidator('gsf_login'));
+ $bridge->addHidden( 'gsu_id_user');
+ $bridge->addHidden( 'gsf_id_user'); // Needed for e-mail validation
+ $bridge->addHidden( 'gsu_user_class');
+ $bridge->addText( 'gsu_login', 'size', 15, 'minlength', 4,
+ 'validator', $model->createUniqueValidator('gsu_login'));
- $bridge->addPassword('gsf_password',
+ // Can the organization be changed?
+ if ($this->escort->hasPrivilege('pr.staff.edit.all')) {
+ $bridge->addHiddenMulti($model->getKeyCopyName('gsu_id_organization'));
+ $bridge->addSelect('gsu_id_organization');
+ } else {
+ $bridge->addExhibitor('gsu_id_organization');
+ }
+
+ $bridge->addPassword('gsu_password',
'label', $this->_('Password'),
'minlength', $this->project->passwords['MinimumLength'],
// 'renderPassword', true,
@@ -123,11 +133,6 @@
$bridge->addFilter( 'gsf_last_name', $ucfirst);
$bridge->addText( 'gsf_email', array('size' => 30))->addValidator('SimpleEmail')->addValidator($model->createUniqueValidator('gsf_email'));
- if ($this->escort->hasPrivilege('pr.staff.edit.all')) {
- $bridge->addSelect('gsf_id_organization');
- } else {
- $bridge->addExhibitor('gsf_id_organization');
- }
$bridge->addSelect('gsf_id_primary_group');
$bridge->addCheckbox('gsf_logout_on_survey', 'description', $this->_('If checked the user will logoff when answering a survey.'));
@@ -136,15 +141,15 @@
public function afterFormLoad(array &$data, $isNew)
{
- if (array_key_exists('gsf_login', $data)) {
- $this->_instanceId = $data['gsf_login'];
+ if (array_key_exists('gsu_login', $data)) {
+ $this->_instanceId = $data['gsu_login'];
}
$sql = "SELECT ggp_id_group,ggp_role FROM gems__groups WHERE ggp_id_group = " . (int) $data['gsf_id_primary_group'];
$groups = $this->db->fetchPairs($sql);
if (! ($this->escort->hasPrivilege('pr.staff.edit.all') ||
- $data['gsf_id_organization'] == $this->escort->getCurrentOrganization())) {
+ $data['gsu_id_organization'] == $this->escort->getCurrentOrganization())) {
throw new Zend_Exception($this->_('You are not allowed to edit this staff member.'));
}
}
@@ -164,18 +169,21 @@
{
// MUtil_Model::$verbose = true;
- $model = new MUtil_Model_TableModel('gems__staff');
+ $model = new Gems_Model_UserModel('staff', 'gems__staff', array('gsu_id_user' => 'gsf_id_user'), 'gsf');
+ if ($detailed) {
+ $model->copyKeys();
+ }
//$model->resetOrder();
- $model->set('gsf_login', 'label', $this->_('Login'));
+ $model->set('gsu_login', 'label', $this->_('Login'));
$model->set('name', 'label', $this->_('Name'),
'column_expression', "CONCAT(COALESCE(CONCAT(gsf_last_name, ', '), '-, '), COALESCE(CONCAT(gsf_first_name, ' '), ''), COALESCE(gsf_surname_prefix, ''))");
$model->set('gsf_email', 'label', $this->_('E-Mail'), 'itemDisplay', 'MUtil_Html_AElement::ifmail');
if ($detailed || $this->escort->hasPrivilege('pr.staff.see.all')) {
- $this->menu->getParameterSource()->offsetSet('gsf_id_organization', $this->escort->getCurrentOrganization());
+ $this->menu->getParameterSource()->offsetSet('gsu_id_organization', $this->escort->getCurrentOrganization());
- $model->set('gsf_id_organization', 'label', $this->_('Organization'),
+ ...
[truncated message content] |
|
From: <gem...@li...> - 2011-10-31 09:46:37
|
Revision: 155
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=155&view=rev
Author: matijsdejong
Date: 2011-10-31 09:46:30 +0000 (Mon, 31 Oct 2011)
Log Message:
-----------
Fix for ticket #32: fieldmap cache crashes with the language 'nl-informal'.
AddTrackSnippet can now handle organization switches correctly.
Made it easier to write your own AnswerModel.
Small fixes for #31
Modified Paths:
--------------
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php
trunk/library/configs/db/patches.sql
trunk/library/snippets/AddTracksSnippet.php
trunk/library/snippets/AnswerModelSnippet.php
trunk/library/snippets/TrackAnswersModelSnippet.php
Added Paths:
-----------
trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php
Modified: trunk/library/classes/Gems/Default/IndexAction.php
===================================================================
--- trunk/library/classes/Gems/Default/IndexAction.php 2011-10-31 09:13:59 UTC (rev 154)
+++ trunk/library/classes/Gems/Default/IndexAction.php 2011-10-31 09:46:30 UTC (rev 155)
@@ -209,9 +209,9 @@
$adapter->setIdentity($userid);
$adapter->setCredential(md5($_POST['password'], false));
$result = $auth->authenticate($adapter, $_POST['userlogin']);
- MUtil_Echo::track('old autho');
+ // MUtil_Echo::track('old autho');
} else {
- MUtil_Echo::track('new autho');
+ // MUtil_Echo::track('new autho');
}
if (!$result->isValid()) {
Added: trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php (rev 0)
+++ trunk/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php 2011-10-31 09:46:30 UTC (rev 155)
@@ -0,0 +1,229 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Tracker
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: AnswerModelSnippet.php 28 2011-09-16 06:24:15Z mennodekker $
+ */
+
+/**
+ * Displays answers to a survey.
+ *
+ * @package Gems
+ * @subpackage Tracker
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class Gems_Tracker_Snippets_AnswerModelSnippetGeneric extends Gems_Snippets_ModelTableSnippetAbstract
+{
+ /**
+ * Set a fixed model sort.
+ *
+ * Leading _ means not overwritten by sources.
+ *
+ * @var array
+ */
+ protected $_fixedSort = array('gto_round_order' => SORT_ASC);
+
+ /**
+ * Shortfix to add class attribute
+ *
+ * @var string
+ */
+ protected $class = 'browser';
+
+ /**
+ *
+ * @var string Format used for displaying dates.
+ */
+ protected $dateFormat = Zend_Date::DATE_MEDIUM;
+
+ /**
+ * Required
+ *
+ * @var Gems_Loader
+ */
+ protected $loader;
+
+ /**
+ * Required
+ *
+ * @var Zend_Locale
+ */
+ protected $locale;
+
+ /**
+ * Optional: $request or $tokenData must be set
+ *
+ * The display data of the token shown
+ *
+ * @var Gems_Tracker_Token
+ */
+ protected $token;
+
+ /**
+ * Required: id of the selected token to show
+ *
+ * @var string
+ */
+ protected $tokenId;
+
+ /**
+ * Adds columns from the model to the bridge that creates the browse table.
+ *
+ * Overrule this function to add different columns to the browse table, without
+ * having to recode the core table building code.
+ *
+ * @param MUtil_Model_TableBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @return void
+ */
+ protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model)
+ {
+ $br = MUtil_Html::create('br');
+ $selectedClass = MUtil_Lazy::iff(MUtil_Lazy::comp($bridge->gto_id_token, '==', $this->tokenId), 'selectedColumn', null);
+
+ $bridge->th($this->_('Status'));
+ $td = $bridge->tdh(MUtil_Lazy::first($bridge->grc_description, $this->_('OK')));
+ $td->appendAttrib('class', $selectedClass);
+
+ $bridge->th($this->_('Question'));
+ $td = $bridge->tdh(
+ $bridge->gto_round_description,
+ MUtil_Lazy::iif($bridge->gto_round_description, $br),
+ MUtil_Lazy::iif($bridge->gto_completion_time, $bridge->gto_completion_time, $bridge->gto_valid_from)
+ );
+ $td->appendAttrib('class', $selectedClass);
+ $td->appendAttrib('class', $bridge->row_class);
+
+ foreach($model->getItemsOrdered() as $name) {
+ if ($label = $model->get($name, 'label')) {
+ $bridge->thd($label, array('class' => $model->get($name, 'thClass')));
+ $td = $bridge->td($bridge->$name);
+
+ $td->appendAttrib('class', 'answer');
+ $td->appendAttrib('class', $selectedClass);
+ $td->appendAttrib('class', $bridge->row_class);
+ }
+ }
+
+ $bridge->th($this->_('Token'));
+ $td = $bridge->tdh($bridge->gto_id_token->strtoupper());
+ $td->appendAttrib('class', $selectedClass);
+ $td->appendAttrib('class', $bridge->row_class);
+ }
+
+ /**
+ * Creates the model
+ *
+ * @return MUtil_Model_ModelAbstract
+ */
+ protected function createModel()
+ {
+ $model = $this->token->getSurveyAnswerModel($this->locale->getLanguage());
+
+ $model->set('gto_valid_from', 'dateFormat', $this->dateFormat);
+ $model->set('gto_completion_time', 'dateFormat', $this->dateFormat);
+
+ return $model;
+ }
+
+
+ /**
+ * Create the snippets content
+ *
+ * This is a stub function either override getHtmlOutput() or override render()
+ *
+ * @param Zend_View_Abstract $view Just in case it is needed here
+ * @return MUtil_Html_HtmlInterface Something that can be rendered
+ */
+ public function getHtmlOutput(Zend_View_Abstract $view)
+ {
+ $htmlDiv = MUtil_Html::create()->div();
+
+ if ($this->tokenId) {
+ if ($this->token->exists) {
+ $htmlDiv->h3(sprintf($this->_('%s answers for patient number %s'), $this->token->getSurveyName(), $this->token->getPatientNumber()));
+
+ $htmlDiv->pInfo(sprintf(
+ $this->_('Answers for token %s, patient number %s: %s.'),
+ strtoupper($this->tokenId),
+ $this->token->getPatientNumber(),
+ $this->token->getRespondentName()))
+ ->appendAttrib('class', 'noprint');
+
+ $table = parent::getHtmlOutput($view);
+ $table->setPivot(true, 2, 1);
+
+ $this->applyHtmlAttributes($table);
+ $htmlDiv[] = $table;
+
+ } else {
+ $htmlDiv->ul(sprintf($this->_('Token %s not found.'), $this->tokenId), array('class' => 'errors'));
+ }
+
+ } else {
+ $htmlDiv->ul($this->_('No token specified.'), array('class' => 'errors'));
+ }
+
+ $buttonDiv = $htmlDiv->buttonDiv();
+ $buttonDiv->actionLink(array(), $this->_('Close'), array('onclick' => 'window.close();'));
+ $buttonDiv->actionLink(array(), $this->_('Print'), array('onclick' => 'window.print();'));
+ return $htmlDiv;
+ }
+
+ /**
+ * The place to check if the data set in the snippet is valid
+ * to generate the snippet.
+ *
+ * When invalid data should result in an error, you can throw it
+ * here but you can also perform the check in the
+ * checkRegistryRequestsAnswers() function from the
+ * {@see MUtil_Registry_TargetInterface}.
+ *
+ * @return boolean
+ */
+ public function hasHtmlOutput()
+ {
+ if (! $this->tokenId) {
+ if (isset($this->token)) {
+ $this->tokenId = $this->token->getTokenId();
+ }
+ } elseif (! $this->token) {
+ $this->token = $this->loader->getTracker()->getToken($this->tokenId);
+ }
+
+ // Output always true, returns an error message as html when anything is wrong
+ return true;
+ }
+}
Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php 2011-10-31 09:13:59 UTC (rev 154)
+++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php 2011-10-31 09:46:30 UTC (rev 155)
@@ -204,9 +204,10 @@
protected function _getMap()
{
- $cacheId = 'lsFieldMap'.$this->sourceSurveyId.$this->language;
+ $cacheId = 'lsFieldMap'.$this->sourceSurveyId.strtr($this->language, '-.', '__');
+ $this->_fieldMap = $this->cache->load($cacheId);
- if( ($this->_fieldMap = $this->cache->load($cacheId)) === false ) {
+ if (false === $this->_fieldMap) {
$gTable = $this->_getGroupsTableName();
$qTable = $this->_getQuestionsTableName();
@@ -344,7 +345,6 @@
$this->cache->save($this->_fieldMap, $cacheId);
}
-
return $this->_fieldMap;
}
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-10-31 09:13:59 UTC (rev 154)
+++ trunk/library/configs/db/patches.sql 2011-10-31 09:46:30 UTC (rev 155)
@@ -228,4 +228,8 @@
ALTER TABLE `gems__staff` CHANGE `gsf_id_user` `gsf_id_user` BIGINT( 20 ) UNSIGNED NOT NULL;
-ALTER TABLE `gems__staff` DROP INDEX `gsf_login`;
\ No newline at end of file
+ALTER TABLE `gems__staff` DROP INDEX `gsf_login`;
+
+ALTER TABLE `gems__staff` CHANGE `gsf_login` `gsf_login` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ CHANGE `gsf_password` `gsf_password` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ CHANGE `gsf_id_organization` `gsf_id_organization` BIGINT( 20 ) NULL DEFAULT NULL;
Modified: trunk/library/snippets/AddTracksSnippet.php
===================================================================
--- trunk/library/snippets/AddTracksSnippet.php 2011-10-31 09:13:59 UTC (rev 154)
+++ trunk/library/snippets/AddTracksSnippet.php 2011-10-31 09:46:30 UTC (rev 155)
@@ -103,10 +103,11 @@
throw new exception('Invalid track type requested.');
}
- $trackTypeTime = $trackType . '_time';
+ $trackTypeCache = $trackType . '_' . $this->session->user_style;
+ $trackTypeTime = $trackType . '_time';
- if (isset($this->session->$trackType, $this->session->$trackTypeTime) && (time() < $this->session->$trackTypeTime)) {
- $tracks = $this->session->$trackType;
+ if (isset($this->session->$trackTypeCache, $this->session->$trackTypeTime) && (time() < $this->session->$trackTypeTime)) {
+ $tracks = $this->session->$trackTypeCache;
} else {
$organization_id = $this->escort->getCurrentOrganization();
switch ($trackType) {
@@ -153,8 +154,8 @@
}
$tracks = $this->db->fetchPairs($sql);
- $this->session->$trackType = $tracks;
- $this->session->$trackTypeTime = time() + 600;
+ $this->session->$trackTypeCache = $tracks;
+ $this->session->$trackTypeTime = time() + 600;
}
$div = MUtil_Html::create()->div(array('class' => 'toolbox'));
Modified: trunk/library/snippets/AnswerModelSnippet.php
===================================================================
--- trunk/library/snippets/AnswerModelSnippet.php 2011-10-31 09:13:59 UTC (rev 154)
+++ trunk/library/snippets/AnswerModelSnippet.php 2011-10-31 09:46:30 UTC (rev 155)
@@ -44,186 +44,5 @@
* @license New BSD License
* @since Class available since version 1.4
*/
-class AnswerModelSnippet extends Gems_Snippets_ModelTableSnippetAbstract
-{
- /**
- * Set a fixed model sort.
- *
- * Leading _ means not overwritten by sources.
- *
- * @var array
- */
- protected $_fixedSort = array('gto_round_order' => SORT_ASC);
-
- /**
- * Shortfix to add class attribute
- *
- * @var string
- */
- protected $class = 'browser';
-
- /**
- *
- * @var string Format used for displaying dates.
- */
- protected $dateFormat = Zend_Date::DATE_MEDIUM;
-
- /**
- * Required
- *
- * @var Gems_Loader
- */
- protected $loader;
-
- /**
- * Required
- *
- * @var Zend_Locale
- */
- protected $locale;
-
- /**
- * Optional: $request or $tokenData must be set
- *
- * The display data of the token shown
- *
- * @var Gems_Tracker_Token
- */
- protected $token;
-
- /**
- * Required: id of the selected token to show
- *
- * @var string
- */
- protected $tokenId;
-
- /**
- * Adds columns from the model to the bridge that creates the browse table.
- *
- * Overrule this function to add different columns to the browse table, without
- * having to recode the core table building code.
- *
- * @param MUtil_Model_TableBridge $bridge
- * @param MUtil_Model_ModelAbstract $model
- * @return void
- */
- protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model)
- {
- $br = MUtil_Html::create('br');
- $selectedClass = MUtil_Lazy::iff(MUtil_Lazy::comp($bridge->gto_id_token, '==', $this->tokenId), 'selectedColumn', null);
-
- $bridge->th($this->_('Status'));
- $td = $bridge->tdh(MUtil_Lazy::first($bridge->grc_description, $this->_('OK')));
- $td->appendAttrib('class', $selectedClass);
-
- $bridge->th($this->_('Question'));
- $td = $bridge->tdh(
- $bridge->gto_round_description,
- MUtil_Lazy::iif($bridge->gto_round_description, $br),
- MUtil_Lazy::iif($bridge->gto_completion_time, $bridge->gto_completion_time, $bridge->gto_valid_from)
- );
- $td->appendAttrib('class', $selectedClass);
- $td->appendAttrib('class', $bridge->row_class);
-
- foreach($model->getItemsOrdered() as $name) {
- if ($label = $model->get($name, 'label')) {
- $bridge->thd($label, array('class' => $model->get($name, 'thClass')));
- $td = $bridge->td($bridge->$name);
-
- $td->appendAttrib('class', 'answer');
- $td->appendAttrib('class', $selectedClass);
- $td->appendAttrib('class', $bridge->row_class);
- }
- }
-
- $bridge->th($this->_('Token'));
- $td = $bridge->tdh($bridge->gto_id_token->strtoupper());
- $td->appendAttrib('class', $selectedClass);
- $td->appendAttrib('class', $bridge->row_class);
- }
-
- /**
- * Creates the model
- *
- * @return MUtil_Model_ModelAbstract
- */
- protected function createModel()
- {
- $model = $this->token->getSurveyAnswerModel($this->locale->getLanguage());
-
- $model->set('gto_valid_from', 'dateFormat', $this->dateFormat);
- $model->set('gto_completion_time', 'dateFormat', $this->dateFormat);
-
- return $model;
- }
-
-
- /**
- * Create the snippets content
- *
- * This is a stub function either override getHtmlOutput() or override render()
- *
- * @param Zend_View_Abstract $view Just in case it is needed here
- * @return MUtil_Html_HtmlInterface Something that can be rendered
- */
- public function getHtmlOutput(Zend_View_Abstract $view)
- {
- $htmlDiv = MUtil_Html::create()->div();
-
- if ($this->tokenId) {
- if ($this->token->exists) {
- $htmlDiv->h3(sprintf($this->_('%s answers for patient number %s'), $this->token->getSurveyName(), $this->token->getPatientNumber()));
-
- $htmlDiv->pInfo(sprintf(
- $this->_('Answers for token %s, patient number %s: %s.'),
- strtoupper($this->tokenId),
- $this->token->getPatientNumber(),
- $this->token->getRespondentName()))
- ->appendAttrib('class', 'noprint');
-
- $table = parent::getHtmlOutput($view);
- $table->setPivot(true, 2, 1);
-
- $this->applyHtmlAttributes($table);
- $htmlDiv[] = $table;
-
- } else {
- $htmlDiv->ul(sprintf($this->_('Token %s not found.'), $this->tokenId), array('class' => 'errors'));
- }
-
- } else {
- $htmlDiv->ul($this->_('No token specified.'), array('class' => 'errors'));
- }
-
- $buttonDiv = $htmlDiv->buttonDiv();
- $buttonDiv->actionLink(array(), $this->_('Close'), array('onclick' => 'window.close();'));
- $buttonDiv->actionLink(array(), $this->_('Print'), array('onclick' => 'window.print();'));
- return $htmlDiv;
- }
-
- /**
- * The place to check if the data set in the snippet is valid
- * to generate the snippet.
- *
- * When invalid data should result in an error, you can throw it
- * here but you can also perform the check in the
- * checkRegistryRequestsAnswers() function from the
- * {@see MUtil_Registry_TargetInterface}.
- *
- * @return boolean
- */
- public function hasHtmlOutput()
- {
- if (! $this->tokenId) {
- if (isset($this->token)) {
- $this->tokenId = $this->token->getTokenId();
- }
- } elseif (! $this->token) {
- $this->token = $this->loader->getTracker()->getToken($this->tokenId);
- }
-
- // Output always true, returns an error message as html when anything is wrong
- return true;
- }
-}
+class AnswerModelSnippet extends Gems_Tracker_Snippets_AnswerModelSnippetGeneric
+{ }
Modified: trunk/library/snippets/TrackAnswersModelSnippet.php
===================================================================
--- trunk/library/snippets/TrackAnswersModelSnippet.php 2011-10-31 09:13:59 UTC (rev 154)
+++ trunk/library/snippets/TrackAnswersModelSnippet.php 2011-10-31 09:46:30 UTC (rev 155)
@@ -36,8 +36,6 @@
* @version $Id$
*/
-include_once(dirname(__FILE__) . '/AnswerModelSnippet.php');
-
/**
* Class description of TrackAnswersModelSnippet
*
@@ -47,7 +45,7 @@
* @license New BSD License
* @since Class available since version 1.4
*/
-class TrackAnswersModelSnippet extends AnswerModelSnippet
+class TrackAnswersModelSnippet extends Gems_Tracker_Snippets_AnswerModelSnippetGeneric
{
/**
* Overrule to implement snippet specific filtering and sorting.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|