You can subscribe to this list here.
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(84) |
Oct
(70) |
Nov
(164) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(52) |
Feb
(77) |
Mar
(70) |
Apr
(58) |
May
(81) |
Jun
(74) |
Jul
(87) |
Aug
(30) |
Sep
(45) |
Oct
(37) |
Nov
(51) |
Dec
(31) |
2013 |
Jan
(47) |
Feb
(29) |
Mar
(40) |
Apr
(33) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <gem...@li...> - 2012-04-06 18:13:33
|
Revision: 605 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=605&view=rev Author: matijsdejong Date: 2012-04-06 18:13:27 +0000 (Fri, 06 Apr 2012) Log Message: ----------- Added Paths: ----------- tags/1.5.3-rc1/ Property changes on: tags/1.5.3-rc1 ___________________________________________________________________ Added: svn:ignore + nbproject Added: svn:mergeinfo + /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472,475-481 /tags/1.5.0beta1:305 /tags/1.5.1:485,489,509-510 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-06 18:11:55
|
Revision: 604 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=604&view=rev Author: matijsdejong Date: 2012-04-06 18:11:50 +0000 (Fri, 06 Apr 2012) Log Message: ----------- Changed the display of errors if dd form layout (like the login form) Modified Paths: -------------- trunk/new_project/htdocs/gems/css/gems-new.css trunk/new_project/htdocs/gems/css/gems.css Modified: trunk/new_project/htdocs/gems/css/gems-new.css =================================================================== --- trunk/new_project/htdocs/gems/css/gems-new.css 2012-04-06 18:09:30 UTC (rev 603) +++ trunk/new_project/htdocs/gems/css/gems-new.css 2012-04-06 18:11:50 UTC (rev 604) @@ -174,10 +174,6 @@ font-weight: bold; } -.zend_echo { - font-weight: normal; -} - .errors { border-radius: 6px; -moz-border-radius: 6px; @@ -185,6 +181,10 @@ display: inline-block; } +dd .errors { + display: block; +} + ul.errors { padding-left: 1.5em; padding-right: 0.5em; @@ -687,5 +687,10 @@ } span.thetooltip { -display: none; -} \ No newline at end of file + display: none; +} + +.zend_echo { + font-weight: normal; +} + Modified: trunk/new_project/htdocs/gems/css/gems.css =================================================================== --- trunk/new_project/htdocs/gems/css/gems.css 2012-04-06 18:09:30 UTC (rev 603) +++ trunk/new_project/htdocs/gems/css/gems.css 2012-04-06 18:11:50 UTC (rev 604) @@ -122,6 +122,10 @@ padding: 5px 2px; } +dd .errors { + display: block; +} + ul.errors { padding-left: 1.5em; padding-right: 0.5em; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-06 18:09:37
|
Revision: 603 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=603&view=rev Author: matijsdejong Date: 2012-04-06 18:09:30 +0000 (Fri, 06 Apr 2012) Log Message: ----------- Fixed bug in change password form Form element errors are displayed after the description = easier on the eye Added documentation to form layout elements ElementDecorator.php can now display the errors for the whole form on top of the form Modified Paths: -------------- trunk/library/classes/Gems/User/Form/ChangePasswordForm.php trunk/library/classes/MUtil/Form.php trunk/library/classes/MUtil/Html/DlElement.php trunk/library/classes/MUtil/Html/ElementDecorator.php trunk/library/classes/MUtil/Html/FormLayout.php trunk/library/classes/MUtil/Html/TableElement.php trunk/library/classes/MUtil/Html.php Modified: trunk/library/classes/Gems/User/Form/ChangePasswordForm.php =================================================================== --- trunk/library/classes/Gems/User/Form/ChangePasswordForm.php 2012-04-06 14:02:23 UTC (rev 602) +++ trunk/library/classes/Gems/User/Form/ChangePasswordForm.php 2012-04-06 18:09:30 UTC (rev 603) @@ -75,13 +75,6 @@ protected $_reportRulesFieldName = 'report_rules'; /** - * The field name for the submit element. - * - * @var string - */ - protected $_submitFieldName = 'submit'; - - /** * Layout table * * @var MUtil_Html_TableElements @@ -327,25 +320,13 @@ } /** - * Returns/sets a submit button. + * Returns the label for the submitbutton * - * @param string $label - * @return Zend_Form_Element_Submit + * @return string */ - public function getSubmitButton($label = null) + public function getSubmitButtonLabel() { - $element = $this->getElement($this->_submitFieldName); - - if (! $element) { - // Submit knop - $element = new Zend_Form_Element_Submit($this->_submitFieldName); - $element->setLabel(null === $label ? $this->translate->_('Save') : $label); - $element->setAttrib('class', 'button'); - - $this->addElement($element); - } - - return $element; + return $this->translate->_($this->translate->_('Save')); } /** Modified: trunk/library/classes/MUtil/Form.php =================================================================== --- trunk/library/classes/MUtil/Form.php 2012-04-06 14:02:23 UTC (rev 602) +++ trunk/library/classes/MUtil/Form.php 2012-04-06 18:09:30 UTC (rev 603) @@ -45,7 +45,12 @@ class MUtil_Form extends Zend_Form { protected $_displayOrder = array('element', 'errors', 'description'); + + /** + * $var MUtil_HtmlElement + */ protected $_html_element; + protected $_labelWidth; protected $_labelWidthFactor; protected $_no_dojo = true; @@ -161,11 +166,25 @@ } /** + * Returns an Html element that is used to render the form contents. * - * @return MUtil_Html_HtmlElement + * @return MUtil_Html_HtmlElement Or an equivalent class */ public function getHtml() { + if (! $this->_html_element) { + foreach ($this->_decorators as $decorator) { + if ($decorator instanceof MUtil_Html_ElementDecorator) { + break; + } + } + if ($decorator instanceof MUtil_Html_ElementDecorator) { + $this->_html_element = $decorator->getHtmlElement(); + } else { + $this->setHtml(); + } + } + return $this->_html_element; } @@ -253,7 +272,7 @@ return $this; } - public function setDisplayOrder(array $order) + public function setDisplayOrder(array $order) { $this->_displayOrder = $order; @@ -304,6 +323,12 @@ return $this; } + /** + * Render the element labels with a fixed width + * + * @param mixed $width The style.width content for the labels + * @return MUtil_Form (continuation pattern) + */ public function setLabelWidth($width) { $this->_labelWidth = $width; @@ -316,6 +341,13 @@ return $this; } + /** + * Render elements with an automatically calculated label width, by multiplying the maximum number of + * characters in a label with this factor. + * + * @param float $factor To multiply the widest nummers of letters in the labels with to calculate the width in em at drawing time + * @return MUtil_Form (continuation pattern) + */ public function setLabelWidthFactor($factor) { $this->_labelWidthFactor = $factor; Modified: trunk/library/classes/MUtil/Html/DlElement.php =================================================================== --- trunk/library/classes/MUtil/Html/DlElement.php 2012-04-06 14:02:23 UTC (rev 602) +++ trunk/library/classes/MUtil/Html/DlElement.php 2012-04-06 18:09:30 UTC (rev 603) @@ -1,53 +1,90 @@ <?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 Html + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ */ +/** + * Html DL element with functions for applying it to a form. + * + * @package MUtil + * @subpackage Html + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 + */ class MUtil_Html_DlElement extends MUtil_Html_HtmlElement implements MUtil_Html_FormLayout { - public $renderWithoutContent = false; - + /** + * Only dt and dd elements are allowed as content. + * + * @var string|array A string or array of string values of the allowed element tags. + */ protected $_allowedChildTags = array('dt', 'dd'); + /** + * Put a Dl element on it's own line + * + * @var string Content added after the element. + */ protected $_appendString = "\n"; + /** + * Can process form elements + * + * @var array + */ protected $_specialTypes = array( 'Zend_Form' => 'setAsFormLayout', ); + /** + * Should have content + * + * @var boolean The element is rendered even without content when true. + */ + public $renderWithoutContent = false; + + + /** + * Make a DL element + * + * Any parameters are added as either content, attributes or handled + * as special types, if defined as such for this element. + * + * @param mixed $arg_array MUtil_Ra::args arguments + */ public function __construct($arg_array = null) { $args = MUtil_Ra::args(func_get_args()); @@ -94,6 +131,15 @@ return $ds; } + /** + * Helper function for creating automatically calculated widths. + * + * @staticvar Zend_Form $last_form Prevent recalculation. This function is called for every label + * @staticvar string $last_factor Last result + * @param Zend_Form $form The form to calculate the widest label for + * @param float $factor The factor to multiple the number of characters with for to get the number of em's + * @return string E.g.: '10em' + */ public static function calculateAutoWidthFormLayout(Zend_Form $form, $factor = 1) { static $last_form; @@ -130,6 +176,12 @@ } + /** + * Static helper function for creation, used by @see MUtil_Html_Creator. + * + * @param mixed $arg_array Optional MUtil_Ra::args processed settings + * @return MUtil_Html_DlElement + */ public static function dl($arg_array = null) { $args = func_get_args(); @@ -141,6 +193,14 @@ return $this->addItem($dt, $dd); } + /** + * Apply this element to the form as the output decorator. + * + * @param Zend_Form $form + * @param mixed $width The style.width content for the labels + * @param array $order The display order of the elements + * @return MUtil_Html_DlElement + */ public function setAsFormLayout(Zend_Form $form, $width = null, array $order = array('element', 'errors', 'description')) { // Make a Lazy repeater for the form elements and set it as the element repeater @@ -171,7 +231,14 @@ return $this; } - + /** + * Apply this element to the form as the output decorator with automatically calculated widths. + * + * @param Zend_Form $form + * @param float $factor To multiply the widest nummers of letters in the labels with to calculate the width in em at drawing time + * @param array $order The display order of the elements + * @return MUtil_Html_DlElement + */ public function setAutoWidthFormLayout(Zend_Form $form, $factor = 1, array $order = array('element', 'errors', 'description')) { // Lazy call becase the form might not be completed at this stage. Modified: trunk/library/classes/MUtil/Html/ElementDecorator.php =================================================================== --- trunk/library/classes/MUtil/Html/ElementDecorator.php 2012-04-06 14:02:23 UTC (rev 602) +++ trunk/library/classes/MUtil/Html/ElementDecorator.php 2012-04-06 18:09:30 UTC (rev 603) @@ -1,51 +1,102 @@ <?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 Html + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ */ +/** + * Zend style form decorator the uses MUtil_Html + * + * @package MUtil + * @subpackage Html + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 + */ class MUtil_Html_ElementDecorator extends Zend_Form_Decorator_Abstract { + /** + * + * @var MUtil_Html_HtmlInterface + */ protected $_html_element; + + /** + * When existing prepends all error messages before the form elements. + * + * When a MUtil_Html_HtmlElement the errors are appended to the element, + * otherwise an UL is created + * + * @var mixed + */ + protected $_prepend_errors; + + /** + * Any content to be displayed before the visible elements + * + * @var mixed + */ protected $_prologue; + /** + * The element used to display the (visible) form elements. + * + * @return MUtil_Html_HtmlInterface + */ public function getHtmlElement() { return $this->_html_element; } + /** + * Must the form prepend all error messages before the visible form elements? + * + * When a MUtil_Html_HtmlElement the errors are appended to the element, + * otherwise an UL is created + * + * @return mixed false, true or MUtil_Html_HtmlElement + */ + public function getPrependErrors() + { + return $this->_prepend_errors; + } + + /** + * Any content to be displayed before the visible elements + * + * @return mixed + */ public function getPrologue() { return $this->_prologue; @@ -82,7 +133,23 @@ } else { $prologue = ''; } + if ($prependErrors = $this->getPrependErrors()) { + $form = $this->getElement(); + if ($errors = $form->getMessages()) { + $errors = MUtil_Ra::flatten($errors); + $errors = array_unique($errors); + if ($prependErrors instanceof MUtil_Html_ElementInterface) { + $html = $prependErrors; + } else { + $html = MUtil_Html::create('ul'); + } + $html->append($errors); + + $prologue .= $html->render($view); + } + } + $result = $this->renderElement($htmlelement, $view); if (parent::APPEND == $this->getPlacement()) { @@ -107,12 +174,42 @@ return $htmlElement->render($view); } + /** + * Set the default + * + * @param MUtil_Html_HtmlInterface $htmlElement + * @return MUtil_Html_ElementDecorator (continuation pattern) + */ public function setHtmlElement(MUtil_Html_HtmlInterface $htmlElement) { $this->_html_element = $htmlElement; return $this; } + /** + * Set the form to prepends all error messages before the visible form elements. + * + * When a MUtil_Html_HtmlElement the errors are appended to the element, + * otherwise an UL is created + * + * @param mixed $prepend false, true or MUtil_Html_HtmlElement + * @return MUtil_Html_ElementDecorator (continuation pattern) + */ + public function setPrependErrors($prepend = true) + { + $this->_prepend_errors = $prepend; + return $this; + } + + /** + * Hidden elements should be displayed at the start of the form. + * + * If the prologue is a MUtil_Lazy_RepeatableFormElements repeater then all the hidden elements are + * displayed in a div at the start of the form. + * + * @param mixed $prologue E.g. a repeater or a html element + * @return MUtil_Html_ElementDecorator + */ public function setPrologue($prologue) { $this->_prologue = $prologue; Modified: trunk/library/classes/MUtil/Html/FormLayout.php =================================================================== --- trunk/library/classes/MUtil/Html/FormLayout.php 2012-04-06 14:02:23 UTC (rev 602) +++ trunk/library/classes/MUtil/Html/FormLayout.php 2012-04-06 18:09:30 UTC (rev 603) @@ -1,42 +1,57 @@ <?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 Html + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ */ +/** + * Interface extensions that allows HtmlElements to define how to display + * form elements. + * + * @package MUtil + * @subpackage Html + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 + */ interface MUtil_Html_FormLayout { + /** + * Apply this element to the form as the output decorator. + * + * @param Zend_Form $form + * @return MUtil_Html_FormLayout + */ public function setAsFormLayout(Zend_Form $form); } Modified: trunk/library/classes/MUtil/Html/TableElement.php =================================================================== --- trunk/library/classes/MUtil/Html/TableElement.php 2012-04-06 14:02:23 UTC (rev 602) +++ trunk/library/classes/MUtil/Html/TableElement.php 2012-04-06 18:09:30 UTC (rev 603) @@ -1,6 +1,5 @@ <?php - /** * Copyright (c) 2011, Erasmus MC * All rights reserved. @@ -734,6 +733,14 @@ return $this; } + /** + * Apply this element to the form as the output decorator. + * + * @param Zend_Form $form + * @param boolean $add_description When true the description is displayed + * @param boolean $include_description When false the description is added in a separate column instead of the element column. + * @return MUtil_Html_TableElement + */ public function setAsFormLayout(Zend_Form $form, $add_description = false, $include_description = false) { // Make a Lazy repeater for the form elements and set it as the element repeater @@ -746,12 +753,12 @@ // $this->tdh()->label('[', $formrep->element, ']'); $elements[] = $formrep->element; - $elements[] = ' '; - $elements[] = $formrep->errors; if ($add_description && $include_description) { $elements[] = ' '; $elements[] = $formrep->description; } + $elements[] = ' '; + $elements[] = $formrep->errors; $this->addColumn($elements); // Element, Error & optional description if ($add_description && (! $include_description)) { $this->addColumn($formrep->description); // Description in separate column Modified: trunk/library/classes/MUtil/Html.php =================================================================== --- trunk/library/classes/MUtil/Html.php 2012-04-06 14:02:23 UTC (rev 602) +++ trunk/library/classes/MUtil/Html.php 2012-04-06 18:09:30 UTC (rev 603) @@ -98,6 +98,7 @@ } /** + * Create an element or return an element creator * * @param string $tagName Optional tag to create * @param mixed $arg_array Optional MUtil_Ra::args processed settings @@ -131,6 +132,13 @@ return self::getCreator()->create($tagName, $args); } + /** + * Create an element bypassing the standard element creation function stored for certain tags. + * + * @param string $tagName Optional tag to create + * @param mixed $arg_array Optional MUtil_Ra::args processed settings + * @return MUtil_Html_HtmlElement Always, never another type + */ public static function createRaw($tagName, array $args = array()) { return self::getCreator()->createRaw($tagName, $args); @@ -196,11 +204,26 @@ return self::$_snippetLoader; } + /** + * Replaces the non html name characters in the name. + * + * Helper function for working with Zend_Form_Element's + * + * @param string $name + * @param string $belongsTo + * @return string + */ public static function name2id($name, $belongsTo = null) { return preg_replace('/\[([^\]]+)\]/', '-$1', $name . '-' . $belongsTo); } + /** + * String content that should be rendered without output escaping + * + * @param string $content + * @return MUtil_Html_Raw + */ public static function raw($content) { return self::getCreator()->create('raw', array($content)); @@ -285,6 +308,12 @@ } } + /** + * Returns a href attribute + * + * @param mixed $arg_array MUtil_Args::ra arguements + * @return MUtil_Html_HrefArrayAttribute + */ public static function url($arg_array = null) { $args = func_get_args(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-06 14:02:30
|
Revision: 602 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=602&view=rev Author: matijsdejong Date: 2012-04-06 14:02:23 +0000 (Fri, 06 Apr 2012) Log Message: ----------- Generalized TokenForm and made it project adaptable Moved security checks for Token to TokenValidator.php Restore last functionality to IndexAction.php Modified Paths: -------------- trunk/library/classes/Gems/Default/AskAction.php trunk/library/classes/Gems/Default/IndexAction.php trunk/library/classes/Gems/Form/AutoLoadFormAbstract.php trunk/library/classes/Gems/Tracker/Token/TokenValidator.php trunk/library/classes/Gems/Tracker/TrackerInterface.php trunk/library/classes/Gems/Tracker.php trunk/library/classes/Gems/User/Form/OrganizationFormAbstract.php trunk/library/languages/FakeTranslations.php trunk/library/snippets/Track/AvailableTracksSnippets.php trunk/library/snippets/Track/Token/ShowFirstOpenSnippet.php Added Paths: ----------- trunk/library/classes/Gems/Tracker/Form/ trunk/library/classes/Gems/Tracker/Form/AskTokenForm.php Modified: trunk/library/classes/Gems/Default/AskAction.php =================================================================== --- trunk/library/classes/Gems/Default/AskAction.php 2012-04-06 10:53:27 UTC (rev 601) +++ trunk/library/classes/Gems/Default/AskAction.php 2012-04-06 14:02:23 UTC (rev 602) @@ -52,6 +52,15 @@ protected $forwardSnippets = 'Track_Token_ShowFirstOpenSnippet'; /** + * The width factor for the label elements. + * + * Width = (max(characters in labels) * labelWidthFactor) . 'em' + * + * @var float + */ + protected $labelWidthFactor = 0.8; + + /** * Set to true in child class for automatic creation of $this->html. * * To initiate the use of $this->html from the code call $this->initHtml() @@ -64,6 +73,32 @@ public $useHtmlView = true; /** + * Function for overruling the display of the login form. + * + * @param Gems_Tracker_Form_AskTokenForm $form + */ + protected function displayTokenForm(Gems_Tracker_Form_AskTokenForm $form) + { + $user = $this->loader->getCurrentUser(); + + $form->setDescription(sprintf($this->_('Enter your %s token'), $this->project->name)); + $this->html->h3($form->getDescription()); + $this->html[] = $form; + $this->html->pInfo($this->_('Tokens identify a survey that was assigned to you personally.') . ' ' . $this->_('Entering the token and pressing OK will open that survey.')); + + if ($user->isActive()) { + if ($user->isLogoutOnSurvey()) { + $this->html->pInfo($this->_('After answering the survey you will be logged off automatically.')); + } + } + + $this->html->pInfo( + $this->_('A token consists of two groups of four letters and numbers, separated by an optional hyphen. Tokens are case insensitive.'), ' ', + $this->_('The number zero and the letter O are treated as the same; the same goes for the number one and the letter L.') + ); + } + + /** * Show the user a screen with token information and a button to take at least one survey * * @return void @@ -120,85 +155,22 @@ // Make sure to return to ask screen $this->loader->getCurrentUser()->setSurveyReturn($this->getRequest()); - $tracker = $this->loader->getTracker(); - $max_length = $tracker->getTokenLibrary()->getLength(); + $request = $this->getRequest(); + $tracker = $this->loader->getTracker(); + $form = $tracker->getAskTokenForm(array('displayOrder' => array('element', 'description', 'errors'), 'labelWidthFactor' => 0.8)); - $form = new Gems_Form(array('displayOrder' => array('element', 'description', 'errors'), 'labelWidthFactor' => 0.8)); - $form->setMethod('post'); - $form->setDescription(sprintf($this->_('Enter your %s token'), $this->project->name)); - - // Veld token - $element = new Zend_Form_Element_Text(MUtil_Model::REQUEST_ID); - $element->setLabel($this->_('Token')); - $element->setDescription(sprintf($this->_('Enter tokens as %s.'), $tracker->getTokenLibrary()->getFormat())); - $element->setAttrib('size', $max_length); - $element->setAttrib('maxlength', $max_length); - $element->setRequired(true); - $element->addFilter($tracker->getTokenFilter()); - $element->addValidator($tracker->getTokenValidator()); - $form->addElement($element); - - // Submit knop - $element = new Zend_Form_Element_Submit('button'); - $element->setLabel($this->_('OK')); - $element->setAttrib('class', 'button'); - $form->addElement($element); - - if ($this->_request->isPost()) { - $throttleSettings = $this->project->getAskThrottleSettings(); - - // Prune the database for (very) old attempts - $this->db->query("DELETE FROM gems__token_attempts WHERE gta_datetime < DATE_SUB(NOW(), INTERVAL ? second)", - $throttleSettings['period'] * 20); - - // Retrieve the number of failed attempts that occurred within the specified window - $attemptData = $this->db->fetchRow("SELECT COUNT(1) AS attempts, UNIX_TIMESTAMP(MAX(gta_datetime)) AS last " . - "FROM gems__token_attempts WHERE gta_datetime > DATE_SUB(NOW(), INTERVAL ? second)", $throttleSettings['period']); - - $remainingDelay = ($attemptData['last'] + $throttleSettings['delay']) - time(); - - if ($attemptData['attempts'] > $throttleSettings['threshold'] && $remainingDelay > 0) { - $this->escort->logger->log("Possible token brute force attack, throttling for $remainingDelay seconds", Zend_Log::ERR); - - $this->addMessage($this->_('The server is currently busy, please wait a while and try again.')); - } else if ($form->isValid($_POST)) { - $this->_forward('forward'); - return; - } else { - if (isset($_POST[MUtil_Model::REQUEST_ID])) { - $this->db->insert( - 'gems__token_attempts', - array( - 'gta_id_token' => substr($_POST[MUtil_Model::REQUEST_ID], 0, $max_length), - 'gta_ip_address' => $this->getRequest()->getClientIp() - ) - ); - } - } - } elseif ($id = $this->_getParam(MUtil_Model::REQUEST_ID)) { - $form->populate(array(MUtil_Model::REQUEST_ID => $id)); + if ($request->isPost() && $form->isValid($request->getParams())) { + $this->_forward('forward'); + return; } - $this->html->h3($form->getDescription()); - $this->html[] = $form; - $this->html->pInfo($this->_('Tokens identify a survey that was assigned to you personally.') . ' ' . $this->_('Entering the token and pressing OK will open that survey.')); - - if (isset($this->session->user_id)) { - if ($this->session->user_logout) { - $this->html->pInfo($this->_('After answering the survey you will be logged off automatically.')); - } else { - $this->html->pInfo($this->_('After answering the survey you will return to the respondent overview screen.')); - } - // } else { - // $this->html->pInfo($this->_('After answering the survey you will return here.')); - } - - $this->html->pInfo( - $this->_('A token consists of two groups of four letters and numbers, separated by an optional hyphen. Tokens are case insensitive.'), ' ', - $this->_('The number zero and the letter O are treated as the same; the same goes for the number one and the letter L.') - ); + $form->populate($request->getParams()); + $this->displayTokenForm($form); } + /** + * The action where survey sources should return to after survey completion + */ public function returnAction() { $user = $this->loader->getCurrentUser(); @@ -225,9 +197,11 @@ } } + /** + * Duplicate of to-survey to enable separate rights + */ public function takeAction() { - // Dummy to enable separate rights $this->_forward('to-survey'); } @@ -274,10 +248,4 @@ // Default option $this->_forward('index'); } - public function routeError($message) - { - // TODO make nice - throw new exception($message); - } } - Modified: trunk/library/classes/Gems/Default/IndexAction.php =================================================================== --- trunk/library/classes/Gems/Default/IndexAction.php 2012-04-06 10:53:27 UTC (rev 601) +++ trunk/library/classes/Gems/Default/IndexAction.php 2012-04-06 14:02:23 UTC (rev 602) @@ -1,4 +1,5 @@ <?php + /** * Copyright (c) 2011, Erasmus MC * All rights reserved. @@ -238,12 +239,9 @@ $this->_reroute(array('controller' => null, 'action' => null), true); } return; - } /* - else { - //Now present the user with an error message - // $errors = MUtil_Ra::flatten($form->getMessages()); - // $this->addMessage($errors); - MUtil_Echo::track($errors); + } else { + $errors = MUtil_Ra::flatten($form->getMessages()); + // MUtil_Echo::track($errors); //Also log the error to the log table //when the project has logging enabled Modified: trunk/library/classes/Gems/Form/AutoLoadFormAbstract.php =================================================================== --- trunk/library/classes/Gems/Form/AutoLoadFormAbstract.php 2012-04-06 10:53:27 UTC (rev 601) +++ trunk/library/classes/Gems/Form/AutoLoadFormAbstract.php 2012-04-06 14:02:23 UTC (rev 602) @@ -47,6 +47,13 @@ abstract class Gems_Form_AutoLoadFormAbstract extends Gems_Form { /** + * The field name for the submit element. + * + * @var string + */ + protected $_submitFieldName = 'button'; + + /** * When true all elements are loaded after initiation. * * @var boolean @@ -54,6 +61,12 @@ protected $loadDefault = true; /** + * + * @var Zend_Translate + */ + protected $translate; + + /** * Should be called after answering the request to allow the Target * to check if all required registry values have been set correctly. * @@ -79,6 +92,34 @@ } /** + * Returns/sets a submit button. + * + * @return Zend_Form_Element_Submit + */ + public function getSubmitButton() + { + $element = $this->getElement($this->_submitFieldName); + + if (! $element) { + // Submit knop + $element = new Zend_Form_Element_Submit($this->_submitFieldName); + $element->setLabel($this->getSubmitButtonLabel()); + $element->setAttrib('class', 'button'); + + $this->addElement($element); + } + + return $element; + } + + /** + * Returns the label for the submitbutton + * + * @return string + */ + abstract public function getSubmitButtonLabel(); + + /** * The function loads the elements for this form * * @return Gems_Form_AutoLoadFormAbstract (continuation pattern) Property changes on: trunk/library/classes/Gems/Tracker/Form ___________________________________________________________________ Added: bugtraq:url + http://survey.erasmusmc.nl/support/mantis/view.php?id=%BUGID% Added: bugtraq:logregex + #(\d+) Added: trunk/library/classes/Gems/Tracker/Form/AskTokenForm.php =================================================================== --- trunk/library/classes/Gems/Tracker/Form/AskTokenForm.php (rev 0) +++ trunk/library/classes/Gems/Tracker/Form/AskTokenForm.php 2012-04-06 14:02:23 UTC (rev 602) @@ -0,0 +1,114 @@ +<?php + +/** + * Copyright (c) 2012, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package Gems + * @subpackage Tracker + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: AskToken.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage Tracker + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5 + */ +class Gems_Tracker_Form_AskTokenForm extends Gems_Form_AutoLoadFormAbstract +{ + /** + * The field name for the token element. + * + * @var string + */ + protected $_tokenFieldName = MUtil_Model::REQUEST_ID; + + /** + * + * @var Gems_Tracker + */ + protected $tracker; + + /** + * Returns/sets a password element. + * + * @return Zend_Form_Element_Password + */ + public function getTokenElement() + { + $element = $this->getElement($this->_tokenFieldName); + + if (! $element) { + $tokenLib = $this->tracker->getTokenLibrary(); + $max_length = $tokenLib->getLength(); + + // Veld token + $element = new Zend_Form_Element_Text($this->_tokenFieldName); + $element->setLabel($this->translate->_('Token')); + $element->setDescription(sprintf($this->translate->_('Enter tokens as %s.'), $tokenLib->getFormat())); + $element->setAttrib('size', $max_length + 2); + $element->setAttrib('maxlength', $max_length); + $element->setRequired(true); + $element->addFilter($this->tracker->getTokenFilter()); + $element->addValidator($this->tracker->getTokenValidator()); + + $this->addElement($element); + } + + return $element; + } + + /** + * Returns the label for the submitbutton + * + * @return string + */ + public function getSubmitButtonLabel() + { + return $this->translate->_('OK'); + } + + /** + * The function loads the elements for this form + * + * @return Gems_Form_AutoLoadFormAbstract (continuation pattern) + */ + public function loadDefaultElements() + { + $this->getTokenElement(); + $this->getSubmitButton(); + + return $this; + } + +} Modified: trunk/library/classes/Gems/Tracker/Token/TokenValidator.php =================================================================== --- trunk/library/classes/Gems/Tracker/Token/TokenValidator.php 2012-04-06 10:53:27 UTC (rev 601) +++ trunk/library/classes/Gems/Tracker/Token/TokenValidator.php 2012-04-06 14:02:23 UTC (rev 602) @@ -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,79 +25,111 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * File description of TokenValidator * - * @author Matijs de Jong <mj...@ma...> - * @since 1.4 - * @version 1.4 - * @package Gems - * @subpackage Tracker + * + * @package Gems + * @subpackage Tracker + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ */ /** - * Class description of TokenValidator + * Checks whether a token kan be used for the ask/forward loop * - * @author Matijs de Jong <mj...@ma...> - * @package Gems - * @subpackage Tracker + * @package Gems + * @subpackage Tracker + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.4 */ -class Gems_Tracker_Token_TokenValidator extends Zend_Validate_Abstract +class Gems_Tracker_Token_TokenValidator extends MUtil_Registry_TargetAbstract implements Zend_Validate_Interface { /** - * Error constants + * + * @var array Or single string */ - const NOT_TOKEN_FORMAT = 'notFormat'; - const TOKEN_DOES_NOT_EXIST = 'notThere'; - const TOKEN_NO_LONGER_VALID = 'noLongerValid'; - const TOKEN_NOT_YET_VALID = 'notYetValid'; - + protected $_messages; + /** - * @var array Message templates + * + * @var Zend_Db_Adapter_Abstract */ - protected $_messageTemplates = array( - self::NOT_TOKEN_FORMAT => 'Not a valid token. The format for valid tokens is: %tokenFormat%.', - self::TOKEN_DOES_NOT_EXIST => 'Unknown token.', - self::TOKEN_NO_LONGER_VALID => 'This token is no longer valid.', - self::TOKEN_NOT_YET_VALID => 'This token cannot be used (yet).', - ); + protected $db; /** - * @var array + * + * @var Gems_Log */ - protected $_messageVariables = array( - 'reuse' => '_reuse', - 'tokenFormat' => '_tokenFormat', - ); + protected $logger; /** + * Optional * - * @var int + * @var Zend_Controller_Request_Abstract */ - protected $_reuse; - + protected $request; + /** + * Required * - * @var string + * @var Gems_Project_ProjectSettings */ - protected $_tokenFormat; + protected $project; /** * - * @var Gems_Tracker + * @var Gems_Tracker_TrackerInterface */ protected $tracker; - - public function __construct(Gems_Tracker $tracker, $tokenFormat, $reuse) + + /** + * + * @var Zend_Translate + */ + protected $translate; + + /** + * Should be called after answering the request to allow the Target + * to check if all required registry values have been set correctly. + * + * @return boolean False if required values are missing. + */ + public function checkRegistryRequestsAnswers() { - $this->_reuse = $reuse; - $this->_tokenFormat = $tokenFormat; - $this->tracker = $tracker; + return $this->db instanceof Zend_Db_Adapter_Abstract && + $this->logger instanceof Gems_Log && + $this->project instanceof Gems_Project_ProjectSettings && + $this->tracker instanceof Gems_Tracker_TrackerInterface && + $this->translate instanceof Zend_Translate; } /** + * Returns an array of messages that explain why the most recent isValid() + * call returned false. The array keys are validation failure message identifiers, + * and the array values are the corresponding human-readable message strings. + * + * If isValid() was never called or if the most recent isValid() call + * returned true, then this method returns an empty array. + * + * @return array + */ + public function getMessages() + { + return (array) $this->_messages; + } + + protected function getRequest() + { + if (! $this->request) { + $this->request = Zend_Controller_Front::getInstance()->getRequest(); + } + + return $this->request; + } + + /** * Returns true if and only if $value meets the validation requirements * * If $value fails validation, then this method returns false, and @@ -111,57 +142,100 @@ */ public function isValid($value) { + if ($throttleSettings = $this->project->getAskThrottleSettings()) { + + // Prune the database for (very) old attempts + $where = $this->db->quoteInto('gta_datetime < DATE_SUB(NOW(), INTERVAL ? second)', $throttleSettings['period'] * 20); + $this->db->delete('gems__token_attempts', $where); + + // Retrieve the number of failed attempts that occurred within the specified window + $select = $this->db->select(); + $select->from('gems__token_attempts', array('COUNT(*) AS attempts', 'UNIX_TIMESTAMP(MAX(gta_datetime)) - UNIX_TIMESTAMP() AS last')) + ->where('gta_datetime > DATE_SUB(NOW(), INTERVAL ? second)', $throttleSettings['period']); + $attemptData = $this->db->fetchRow($select); + + $remainingDelay = ($attemptData['last'] + $throttleSettings['delay']); + + + // MUtil_Echo::track($throttleSettings, $attemptData, $remainingDelay); + if ($attemptData['attempts'] > $throttleSettings['threshold'] && $remainingDelay > 0) { + $this->logger->log("Possible token brute force attack, throttling for $remainingDelay seconds", Zend_Log::ERR); + + $this->_messages = $this->translate->_('The server is currently busy, please wait a while and try again.'); + return false; + } + } + + // The pure token check + if ($this->isValidToken($value)) { + return true; + } + + $max_length = $this->tracker->getTokenLibrary()->getLength(); + $this->db->insert('gems__token_attempts', + array( + 'gta_id_token' => substr($value, 0, $max_length), + 'gta_ip_address' => $this->getRequest()->getClientIp() + ) + ); + return false; + } + + /** + * Seperate the incorrect tokens from the right tokens + * + * @param mixed $value + * @return boolean + */ + protected function isValidToken($value) + { // Make sure the value has the right format - $value = $this->tracker->filterToken($value); + $value = $this->tracker->filterToken($value); + $library = $this->tracker->getTokenLibrary(); + $format = $library->getFormat(); + $reuse = $library->hasReuse() ? $library->getReuse() : -1; - if (strlen($value) !== strlen($this->_tokenFormat)) { - $this->_error(self::NOT_TOKEN_FORMAT, $value); + if (strlen($value) !== strlen($format)) { + $this->_messages = sprintf($this->translate->_('Not a valid token. The format for valid tokens is: %s.'), $format); return false; } - - if ($token = $this->tracker->getToken($value)) { + + $token = $this->tracker->getToken($value); + if ($token && $token->exists) { $currentDate = new MUtil_Date(); - + if ($completionTime = $token->getCompletionTime()) { - - if ($this->_reuse >= 0) { - if ($completionTime->diffDays($currentDate) > $this->_reuse) { - // Oldest date AFTER completiondate. Oldest date is today minus reuse time - $this->_error(self::TOKEN_NO_LONGER_VALID, $value); - return false; - } else { - // It is completed and may be used to look up other - // valid tokens. + // Reuse means a user can use an old token to check for new surveys + if ($reuse >= 0) { + // Oldest date AFTER completiondate. Oldest date is today minus reuse time + if ($completionTime->diffDays($currentDate) <= $reuse) { + // It is completed and may still be used to look + // up other valid tokens. return true; } - } else { - $this->_error(self::TOKEN_NO_LONGER_VALID, $value); - return false; } + $this->_messages = $this->translate->_('This token is no longer valid.'); + return false; } - - if ($fromDate = $token->getValidFrom()) { - if ($currentDate->isEarlier($fromDate)) { - // Current date is BEFORE from date - $this->_error(self::TOKEN_NOT_YET_VALID, $value); - return false; - } - } else { - $this->_error(self::TOKEN_NOT_YET_VALID, $value); + + $fromDate = $token->getValidFrom(); + if ((null === $fromDate) || $currentDate->isEarlier($fromDate)) { + // Current date is BEFORE from date + $this->_messages = $this->translate->_('This token cannot (yet) be used.'); return false; } - + if ($untilDate = $token->getValidUntil()) { if ($currentDate->isLater($untilDate)) { //Current date is AFTER until date - $this->_error(self::TOKEN_NO_LONGER_VALID, $value); + $this->_messages = $this->translate->_('This token is no longer valid.'); return false; } } return true; } else { - $this->_error(self::TOKEN_DOES_NOT_EXIST, $value); + $this->_messages = $this->translate->_('Unknown token.'); return false; } } Modified: trunk/library/classes/Gems/Tracker/TrackerInterface.php =================================================================== --- trunk/library/classes/Gems/Tracker/TrackerInterface.php 2012-04-06 10:53:27 UTC (rev 601) +++ trunk/library/classes/Gems/Tracker/TrackerInterface.php 2012-04-06 14:02:23 UTC (rev 602) @@ -115,7 +115,15 @@ public function filterToken($tokenId); /** + * Returns a form to ask for a token * + * @param mixed $args_array MUtil_Ra::args array for Form initiation. + * @return Gems_Tracker_Form_AskTokenForm + */ + public function getAskTokenForm($args_array = null); + + /** + * * @param mixed $respTrackData Track id or array containing trackdata * @return Gems_Tracker_RespondentTrack */ Modified: trunk/library/classes/Gems/Tracker.php =================================================================== --- trunk/library/classes/Gems/Tracker.php 2012-04-06 10:53:27 UTC (rev 601) +++ trunk/library/classes/Gems/Tracker.php 2012-04-06 14:02:23 UTC (rev 602) @@ -379,6 +379,19 @@ } /** + * Returns a form to ask for a token + * + * @param mixed $args_array MUtil_Ra::args array for Form initiation. + * @return Gems_Tracker_Form_AskTokenForm + */ + public function getAskTokenForm($args_array = null) + { + $args = MUtil_Ra::args(func_get_args()); + + return $this->_loadClass('Form_AskTokenForm', true, array($args)); + } + + /** * Load project specific model or general Gems model otherwise * * @return Gems_Tracker_Model_RespondentTrackModel @@ -592,10 +605,7 @@ */ public function getTokenValidator() { - $library = $this->getTokenLibrary(); - $reuse = $library->hasReuse() ? $library->getReuse() : -1; - - return $this->_loadClass('Token_TokenValidator', true, array($this, $library->getFormat(), $reuse)); + return $this->_loadClass('Token_TokenValidator', true); } /** Modified: trunk/library/classes/Gems/User/Form/OrganizationFormAbstract.php =================================================================== --- trunk/library/classes/Gems/User/Form/OrganizationFormAbstract.php 2012-04-06 10:53:27 UTC (rev 601) +++ trunk/library/classes/Gems/User/Form/OrganizationFormAbstract.php 2012-04-06 14:02:23 UTC (rev 602) @@ -54,14 +54,7 @@ protected $_organizationFromUrl = false; /** - * The field name for the submit element. * - * @var string - */ - protected $_submitFieldName = 'button'; - - /** - * * @var Gems_User_User */ protected $_user; @@ -95,12 +88,6 @@ protected $request; /** - * - * @var Zend_Translate - */ - protected $translate; - - /** * The field name for the username element. * * @var string @@ -214,34 +201,6 @@ } /** - * Returns/sets a submit button. - * - * @return Zend_Form_Element_Submit - */ - public function getSubmitButton() - { - $element = $this->getElement($this->_submitFieldName); - - if (! $element) { - // Submit knop - $element = new Zend_Form_Element_Submit($this->_submitFieldName); - $element->setLabel($this->getSubmitButtonLabel()); - $element->setAttrib('class', 'button'); - - $this->addElement($element); - } - - return $element; - } - - /** - * Returns the label for the submitbutton - * - * @return string - */ - abstract public function getSubmitButtonLabel(); - - /** * Returns a user * * @return Gems_User_User Modified: trunk/library/languages/FakeTranslations.php =================================================================== --- trunk/library/languages/FakeTranslations.php 2012-04-06 10:53:27 UTC (rev 601) +++ trunk/library/languages/FakeTranslations.php 2012-04-06 14:02:23 UTC (rev 602) @@ -46,13 +46,6 @@ _('Your account is temporarily blocked, please wait %s minutes'); _('You are not allowed to login from this location.'); -// Gems_Validate_TokenValidator -_('Not a valid token. The format for valid tokens is: %tokenFormat%.'); -_('Unknown token.'); -_('This token is no longer valid.'); -_('This token cannot be used (any more).'); -_('This token cannot be used (yet).'); - // MUtil_Validate_Date_DateAfter _("Date should be '%dateAfter%' or later."); Modified: trunk/library/snippets/Track/AvailableTracksSnippets.php =================================================================== --- trunk/library/snippets/Track/AvailableTracksSnippets.php 2012-04-06 10:53:27 UTC (rev 601) +++ trunk/library/snippets/Track/AvailableTracksSnippets.php 2012-04-06 14:02:23 UTC (rev 602) @@ -29,7 +29,7 @@ * Short description of file * * @package Gems - * @subpackage Snippets\Track + * @subpackage Tracker\Snippets * @author Matijs de Jong <mj...@ma...> * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License @@ -42,7 +42,7 @@ * Long description for class (if any)... * * @package Gems - * @subpackage Snippets\Track + * @subpackage Tracker\Snippets * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License * @since Class available since version 1.4 Modified: trunk/library/snippets/Track/Token/ShowFirstOpenSnippet.php =================================================================== --- trunk/library/snippets/Track/Token/ShowFirstOpenSnippet.php 2012-04-06 10:53:27 UTC (rev 601) +++ trunk/library/snippets/Track/Token/ShowFirstOpenSnippet.php 2012-04-06 14:02:23 UTC (rev 602) @@ -28,7 +28,7 @@ * * * @package Gems - * @subpackage Snippets\Track + * @subpackage Tracker\Snippets * @author Matijs de Jong <mj...@ma...> * @copyright Copyright (c) 2012 Erasmus MC * @license New BSD License @@ -36,10 +36,12 @@ */ /** + * Show a single button for an unanswered survey or nothing. * + * Works using $project->getAskDelay() * * @package Gems - * @subpackage Snippets\Track + * @subpackage Tracker\Snippets * @copyright Copyright (c) 2012 Erasmus MC * @license New BSD License * @since Class available since version 1.5.3 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-06 10:53:35
|
Revision: 601 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=601&view=rev Author: matijsdejong Date: 2012-04-06 10:53:27 +0000 (Fri, 06 Apr 2012) Log Message: ----------- Put token ask/forward loop in snippet as preparation for solving ticket #12 Modified Paths: -------------- trunk/library/classes/Gems/Default/AskAction.php trunk/library/classes/Gems/Menu.php trunk/library/classes/Gems/Project/ProjectSettings.php trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php trunk/library/classes/Gems/Tracker/Source/SourceInterface.php trunk/library/classes/Gems/Tracker/Survey.php trunk/library/classes/Gems/Tracker/Token.php Added Paths: ----------- trunk/library/classes/Gems/Tracker/Snippets/ShowTokenLoopAbstract.php trunk/library/snippets/Track/Token/ trunk/library/snippets/Track/Token/ShowFirstOpenSnippet.php Modified: trunk/library/classes/Gems/Default/AskAction.php =================================================================== --- trunk/library/classes/Gems/Default/AskAction.php 2012-04-05 16:40:35 UTC (rev 600) +++ trunk/library/classes/Gems/Default/AskAction.php 2012-04-06 10:53:27 UTC (rev 601) @@ -45,8 +45,29 @@ */ class Gems_Default_AskAction extends Gems_Controller_Action { + /** + * + * @var array Or string of snippet names, presumably Gems_Tracker_Snippets_ShowTokenLoopAbstract snippets + */ + protected $forwardSnippets = 'Track_Token_ShowFirstOpenSnippet'; + + /** + * Set to true in child class for automatic creation of $this->html. + * + * To initiate the use of $this->html from the code call $this->initHtml() + * + * Overrules $useRawOutput. + * + * @see $useRawOutput + * @var boolean $useHtmlView + */ public $useHtmlView = true; + /** + * Show the user a screen with token information and a button to take at least one survey + * + * @return void + */ public function forwardAction() { $tracker = $this->loader->getTracker(); @@ -66,114 +87,21 @@ $respId = $token->getRespondentId(); $tracker->processCompletedTokens($respId, $respId); - /*********************** - * Look for next token * - ***********************/ - $wasAnswered = $token->isCompleted(); - if ($wasAnswered) { - $token = $token->getNextUnansweredToken(); + // Display token when possible + if ($this->html->snippet($this->forwardSnippets, 'token', $token)) { + return; } - if ($token && $token->exists) { - $tokenId = $token->getTokenId(); - - try { - /*************** - * Get the url * - ***************/ - $request = $this->getRequest(); - $params[$request->getActionKey()] = 'to-survey'; - $params[MUtil_Model::REQUEST_ID] = $token->getTokenId(); - - $href = new MUtil_Html_HrefArrayAttribute($params); - $href->setRouteReset(false); - $url = $href->render($this->view); - - /*********************************** - * Should we stay or should we go? * - ***********************************/ - if (! $this->_getParam('delay_cancelled')) { - $_delay = $this->_getParam('delay'); - if (null !== $_delay) { - $delay = $_delay; - - } elseif ($wasAnswered) { - if (isset($this->project->askNextDelay)) { - $delay = $this->project->askNextDelay; - } - } else { - if (isset($this->project->askDelay)) { - $delay = $this->project->askDelay; - } - } - } - if (isset($delay)) { - if ($delay == 0) { - // Redirect at once - header('Location: ' . $url); - exit(); - } - - // Let the page load after stated interval - $this->view->headMeta()->appendHttpEquiv('Refresh', $delay . '; url=' . $url); - } - - $organization = $this->loader->getOrganization($token->getOrganizationId()); - - Gems_Html::init(); // Turn on Gems specific html like pInfo - $this->html->h3($this->_('Token')); - $this->html->pInfo(sprintf($this->_('Welcome %s,'), $token->getRespondentName())); - - if ($wasAnswered) { - $this->html->pInfo(sprintf($this->_('Thank you for answering the survey for token %s.'), strtoupper($this->_getParam(MUtil_Model::REQUEST_ID)))); - $this->html->pInfo($this->_('Please click the button below to answer the next survey.')); - } else { - if ($welcome = $organization->getWelcome()) { - $this->html->pInfo()->raw(MUtil_Markup::render($this->_($welcome), 'Bbcode', 'Html')); - } - $this->html->pInfo(sprintf($this->_('Please click the button below to answer the survey for token %s.'), strtoupper($tokenId))); - } - if (isset($delay)) { - $this->html->pInfo(sprintf($this->plural( - 'Wait one second to open the survey automatically or click on Cancel to stop.', - 'Wait %d seconds to open the survey automatically or click on Cancel to stop.', - $delay), $delay)); - } - - $buttonDiv = $this->html->buttonDiv(array('class' => 'centerAlign')); - $buttonDiv->actionLink($href, $token->getSurveyName()); - - if (isset($delay)) { - $buttonDiv->actionLink(array('delay_cancelled' => 1), $this->_('Cancel')); - } - - if ($next = $token->getTokenCountUnanswered()) { - $this->html->pInfo(sprintf( - $this->plural( - 'After this survey there is one other survey we would like you to answer.', - 'After this survey there are another %d surveys we would like you to answer.', - $next), $next)); - } - if ($sig = $organization->getSignature()) { - $this->html->pInfo()->raw(MUtil_Markup::render($this->_($sig), 'Bbcode', 'Html')); - } - return; - - } catch (Gems_Tracker_Source_SurveyNotFoundException $e) { - $this->addMessage(sprintf($this->_('The survey for token %s is no longer active.'), $tokenId)); - } + // Snippet had nothing to display, because of an answer + if ($this->getRequest()->getActionName() == 'return') { + $this->addMessage(sprintf($this->_('Thank you for answering. At the moment we have no further surveys for you to take.'), $tokenId)); } else { - if ($token) { - $this->addMessage(sprintf($this->_('The token %s does not exist.'), $this->_getParam(MUtil_Model::REQUEST_ID))); - } elseif ($this->_getParam('action') == 'return') { - $this->addMessage(sprintf($this->_('Thank you for answering. At the moment we have no further surveys for you to take.'), $tokenId)); - } else { - $this->addMessage(sprintf($this->_('The survey for token %s has been answered and no further surveys are open.'), $tokenId)); - } - // Do not enter a loop!! Reroute! - $this->_reroute(array('controller' => 'ask', 'action' => 'token'), true); + $this->addMessage(sprintf($this->_('The survey for token %s has been answered and no further surveys are open.'), $tokenId)); } + // Do not enter a loop!! Reroute! + $this->_reroute(array('controller' => 'ask', 'action' => 'index'), true); + } else { $this->addMessage(sprintf($this->_('The token %s does not exist (any more).'), $tokenId)); } @@ -182,10 +110,15 @@ $this->_forward('token'); } + /** + * Ask the user for a token + * + * @return void + */ public function indexAction() { // Make sure to return to ask screen - $this->session->return_controller = $this->getRequest()->getControllerName(); + $this->loader->getCurrentUser()->setSurveyReturn($this->getRequest()); $tracker = $this->loader->getTracker(); $max_length = $tracker->getTokenLibrary()->getLength(); @@ -246,7 +179,6 @@ $form->populate(array(MUtil_Model::REQUEST_ID => $id)); } - Gems_Html::init(); // Turn on Gems specific html like pInfo $this->html->h3($form->getDescription()); $this->html[] = $form; $this->html->pInfo($this->_('Tokens identify a survey that was assigned to you personally.') . ' ' . $this->_('Entering the token and pressing OK will open that survey.')); @@ -319,18 +251,23 @@ if ($token = $tracker->getToken($tokenId)) { $language = $this->locale->getLanguage(); $user = $this->loader->getCurrentUser(); - $url = $token->getUrl($language, $user->getUserId() ? $user->getUserId() : $token->getRespondentId()); - /************************ - * Optional user logout * - ************************/ - if ($user->isLogoutOnSurvey()) { - $user->unsetAsCurrentUser(); - } + try { + $url = $token->getUrl($language, $user->getUserId() ? $user->getUserId() : $token->getRespondentId()); - // Redirect at once - header('Location: ' . $url); - exit(); + /************************ + * Optional user logout * + ************************/ + if ($user->isLogoutOnSurvey()) { + $user->unsetAsCurrentUser(); + } + + // Redirect at once + header('Location: ' . $url); + exit(); + } catch (Gems_Tracker_Source_SurveyNotFoundException $e) { + $this->addMessage(sprintf($this->_('The survey for token %s is no longer active.'), $tokenId)); + } } } Modified: trunk/library/classes/Gems/Menu.php =================================================================== --- trunk/library/classes/Gems/Menu.php 2012-04-05 16:40:35 UTC (rev 600) +++ trunk/library/classes/Gems/Menu.php 2012-04-06 10:53:27 UTC (rev 601) @@ -367,8 +367,7 @@ $tkPage->addButtonOnly($this->_('Fill in'), 'pr.ask', 'ask', 'take') ->addNamedParameters(MUtil_Model::REQUEST_ID, 'gto_id_token') - ->setParameterFilter('can_be_taken', 1, Gems_Model::ID_TYPE, 'token') - ->addHiddenParameter('delay', 0); + ->setParameterFilter('can_be_taken', 1, Gems_Model::ID_TYPE, 'token'); $tkPage->addPdfButton($this->_('Print PDF'), 'pr.token.print') ->addNamedParameters(MUtil_Model::REQUEST_ID, 'gto_id_token') ->setParameterFilter('gsu_has_pdf', 1, Gems_Model::ID_TYPE, 'token'); Modified: trunk/library/classes/Gems/Project/ProjectSettings.php =================================================================== --- trunk/library/classes/Gems/Project/ProjectSettings.php 2012-04-05 16:40:35 UTC (rev 600) +++ trunk/library/classes/Gems/Project/ProjectSettings.php 2012-04-06 10:53:27 UTC (rev 601) @@ -187,6 +187,38 @@ } /** + * Calculate the delay between surveys being asked for this request. Zero means forward + * at once, a negative value means wait forever. + * + * @param Zend_Controller_Request_Abstract $request + * @param boolean $wasAnswered When true use the ask delay + * @return int -1 means waiting indefinitely + */ + public function getAskDelay(Zend_Controller_Request_Abstract $request, $wasAnswered) + { + if ($request->getParam('delay_cancelled', false)) { + return -1; + } + + $delay = $request->getParam('delay', null); + if (null != $delay) { + return $delay; + } + + if ($wasAnswered) { + if ($this->offsetExists('askNextDelay')) { + return $this->offsetGet('askNextDelay'); + } + } else { + if ($this->offsetExists('askDelay')) { + return $this->offsetGet('askDelay'); + } + } + + return -1; + } + + /** * Returns an array with throttling settings for the ask * controller * Added: trunk/library/classes/Gems/Tracker/Snippets/ShowTokenLoopAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Snippets/ShowTokenLoopAbstract.php (rev 0) +++ trunk/library/classes/Gems/Tracker/Snippets/ShowTokenLoopAbstract.php 2012-04-06 10:53:27 UTC (rev 601) @@ -0,0 +1,116 @@ +<?php + +/** + * Copyright (c) 2012, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package Gems + * @subpackage Tracker + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: ShowTokenLoopAbstract.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * Basic class for creating forward loop snippets + * + * @package Gems + * @subpackage Tracker + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5 + */ +class Gems_Tracker_Snippets_ShowTokenLoopAbstract extends MUtil_Snippets_SnippetAbstract +{ + /** + * Required + * + * @var Zend_Controller_Request_Abstract + */ + protected $request; + + /** + * Required, the current token, possibly already answered + * + * @var Gems_Tracker_Token + */ + protected $token; + + /** + * Required + * + * @var Zend_View + */ + protected $view; + + /** + * Was this token already answered? Calculated from $token + * + * @var boolean + */ + protected $wasAnswered; + + /** + * Should be called after answering the request to allow the Target + * to check if all required registry values have been set correctly. + * + * @return boolean False if required are missing. + */ + public function checkRegistryRequestsAnswers() + { + if ($this->token instanceof Gems_Tracker_Token) { + + $this->wasAnswered = $this->token->isCompleted(); + + return ($this->request instanceof Zend_Controller_Request_Abstract) && + ($this->view instanceof Zend_View) && + parent::checkRegistryRequestsAnswers(); + } else { + return false; + } + } + + /** + * Get the href for a token + * + * @param Gems_Tracker_Token $token + * @return MUtil_Html_HrefArrayAttribute + */ + protected function getTokenHref(Gems_Tracker_Token $token) + { + /*************** + * Get the url * + ***************/ + $params = array( + $this->request->getActionKey() => 'to-survey', + MUtil_Model::REQUEST_ID => $token->getTokenId(), + 'RouteReset' => false, + ); + + return new MUtil_Html_HrefArrayAttribute($params); + } +} Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-04-05 16:40:35 UTC (rev 600) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-04-06 10:53:27 UTC (rev 601) @@ -512,6 +512,7 @@ * @param int $surveyId Gems Survey Id * @param string $sourceSurveyId Optional Survey Id used by source * @return int 1 of the token was inserted or changed, 0 otherwise + * @throws Gems_Tracker_Source_SurveyNotFoundException */ public function copyTokenToSource(Gems_Tracker_Token $token, $language, $surveyId, $sourceSurveyId = null) { Modified: trunk/library/classes/Gems/Tracker/Source/SourceInterface.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/SourceInterface.php 2012-04-05 16:40:35 UTC (rev 600) +++ trunk/library/classes/Gems/Tracker/Source/SourceInterface.php 2012-04-06 10:53:27 UTC (rev 601) @@ -62,8 +62,8 @@ * @param int $surveyId Gems Survey Id * @param string $sourceSurveyId Optional Survey Id used by source * @return int 1 of the token was inserted or changed, 0 otherwise + * @throws Gems_Tracker_Source_SurveyNotFoundException */ - // public function addToSource(Gems_Tracker_Token $token, $language, $surveyId, $sourceSurveyId = null); public function copyTokenToSource(Gems_Tracker_Token $token, $language, $surveyId, $sourceSurveyId = null); @@ -87,7 +87,6 @@ * @param string $sourceSurveyId Optional Survey Id used by source * @return MUtil_Date date time or null */ - // public function getAnswerDateTime($fieldName, $tokenId, $surveyId, array $answers = null, $sourceSurveyId = null); public function getAnswerDateTime($fieldName, Gems_Tracker_Token $token, $surveyId, $sourceSurveyId = null); /** @@ -102,7 +101,6 @@ * @param string $sourceSurveyId Optional Survey Id used by source * @return MUtil_Date date time or null */ - // public function getCompletionTime($tokenId, $surveyId, array $answers = null, $sourceSurveyId = null); public function getCompletionTime(Gems_Tracker_Token $token, $surveyId, $sourceSurveyId = null); /** @@ -199,7 +197,6 @@ * @param string $sourceSurveyId Optional Survey Id used by source * @return MUtil_Date date time or null */ - // public function getStartTime($tokenId, $surveyId, array $answers = null, $sourceSurveyId = null); public function getStartTime(Gems_Tracker_Token $token, $surveyId, $sourceSurveyId = null); /** @@ -221,7 +218,6 @@ * @param string $sourceSurveyId Optional Survey Id used by source * @return string The url to start the survey */ - // public function getTokenUrl($tokenId, $language, $surveyId, $sourceSurveyId); public function getTokenUrl(Gems_Tracker_Token $token, $language, $surveyId, $sourceSurveyId); /** @@ -239,7 +235,6 @@ * @param string $sourceSurveyId Optional Survey Id used by source * @return boolean */ - // public function inSource($tokenId, $surveyId, $sourceSurveyId = null); public function inSource(Gems_Tracker_Token $token, $surveyId, $sourceSurveyId = null); /** @@ -250,7 +245,6 @@ * @param string $sourceSurveyId Optional Survey Id used by source * @return boolean True if the token has completed */ - // public function isCompleted($tokenId, $surveyId, array $answers = null, $sourceSurveyId = null); public function isCompleted(Gems_Tracker_Token $token, $surveyId, $sourceSurveyId = null); /** Modified: trunk/library/classes/Gems/Tracker/Survey.php =================================================================== --- trunk/library/classes/Gems/Tracker/Survey.php 2012-04-05 16:40:35 UTC (rev 600) +++ trunk/library/classes/Gems/Tracker/Survey.php 2012-04-06 10:53:27 UTC (rev 601) @@ -211,6 +211,7 @@ * @param Gems_Tracker_Token $token * @param string $language * @return int 1 of the token was inserted or changed, 0 otherwise + * @throws Gems_Tracker_Source_SurveyNotFoundException */ public function copyTokenToSource(Gems_Tracker_Token $token, $language) { Modified: trunk/library/classes/Gems/Tracker/Token.php =================================================================== --- trunk/library/classes/Gems/Tracker/Token.php 2012-04-05 16:40:35 UTC (rev 600) +++ trunk/library/classes/Gems/Tracker/Token.php 2012-04-06 10:53:27 UTC (rev 601) @@ -596,6 +596,15 @@ /** * + * @return Gems_User_Organization + */ + public function getOrganization() + { + return $this->loader->getOrganization($this->getOrganizationId()); + } + + /** + * * @return int */ public function getOrganizationId() @@ -811,7 +820,8 @@ } /** - * Returns the number of unanswered tokens for the person answering this token + * Returns the number of unanswered tokens for the person answering this token, + * minus this token itself * * @return int */ @@ -866,6 +876,7 @@ * * @param string $language The language currently used by the user * @param int $userId The id of the gems user + * @throws Gems_Tracker_Source_SurveyNotFoundException */ public function getUrl($language, $userId) { Property changes on: trunk/library/snippets/Track/Token ___________________________________________________________________ Added: bugtraq:url + http://survey.erasmusmc.nl/support/mantis/view.php?id=%BUGID% Added: bugtraq:logregex + #(\d+) Added: trunk/library/snippets/Track/Token/ShowFirstOpenSnippet.php =================================================================== --- trunk/library/snippets/Track/Token/ShowFirstOpenSnippet.php (rev 0) +++ trunk/library/snippets/Track/Token/ShowFirstOpenSnippet.php 2012-04-06 10:53:27 UTC (rev 601) @@ -0,0 +1,167 @@ +<?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 Snippets\Track + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: ShowFirstOpenSnippet.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage Snippets\Track + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.3 + */ +class Track_Token_ShowFirstOpenSnippet extends Gems_Tracker_Snippets_ShowTokenLoopAbstract +{ + /** + * Required + * + * @var Gems_Project_ProjectSettings + */ + protected $project; + + /** + * Optional, calculated from $token + * + * @var Gems_Tracker_Token + */ + protected $showToken; + + /** + * Should be called after answering the request to allow the Target + * to check if all required registry values have been set correctly. + * + * @return boolean False if required are missing. + */ + public function checkRegistryRequestsAnswers() + { + if (parent::checkRegistryRequestsAnswers()) { + return $this->project instanceof Gems_Project_ProjectSettings; + } else { + return false; + } + } + /** + * 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) + { + $delay = $this->project->getAskDelay($this->request, $this->wasAnswered); + $href = $this->getTokenHref($this->showToken); + $html = $this->getHtmlSequence(); + $org = $this->showToken->getOrganization(); + $url = $href->render($this->view); + + switch ($delay) { + case 0: + // Redirect at once + header('Location: ' . $url); + exit(); + + case -1: + break; + + default: + // Let the page load after stated interval + $this->view->headMeta()->appendHttpEquiv('Refresh', $delay . '; url=' . $url); + } + + $html->h3($this->_('Token')); + $html->pInfo(sprintf($this->_('Welcome %s,'), $this->showToken->getRespondentName())); + + if ($this->wasAnswered) { + $html->pInfo(sprintf($this->_('Thank you for answering the "%s" survey.'), $this->token->getSurveyName())); + $html->pInfo($this->_('Please click the button below to answer the next survey.')); + } else { + if ($welcome = $org->getWelcome()) { + $html->pInfo()->raw(MUtil_Markup::render($this->_($welcome), 'Bbcode', 'Html')); + } + $html->pInfo(sprintf($this->_('Please click the button below to answer the survey for token %s.'), strtoupper($this->showToken->getTokenId()))); + } + if ($delay > 0) { + $html->pInfo(sprintf($this->plural( + 'Wait one second to open the survey automatically or click on Cancel to stop.', + 'Wait %d seconds to open the survey automatically or click on Cancel to stop.', + $delay), $delay)); + } + + $buttonDiv = $html->buttonDiv(array('class' => 'centerAlign')); + $buttonDiv->actionLink($href, $this->showToken->getSurveyName()); + + if ($delay > 0) { + $buttonDiv->actionLink(array('delay_cancelled' => 1), $this->_('Cancel')); + } + + if ($next = $this->showToken->getTokenCountUnanswered()) { + $html->pInfo(sprintf( + $this->plural( + 'After this survey there is one other survey we would like you to answer.', + 'After this survey there are another %d surveys we would like you to answer.', + $next), $next)); + } + if ($sig = $org->getSignature()) { + $html->pInfo()->raw(MUtil_Markup::render($this->_($sig), 'Bbcode', 'Html')); + } + return $html; + } + + /** + * 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->wasAnswered) { + $this->showToken = $this->token->getNextUnansweredToken(); + } else { + $this->showToken = $this->token; + } + + return ($this->showToken instanceof Gems_Tracker_Token) && $this->showToken->exists; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-05 16:40:41
|
Revision: 600 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=600&view=rev Author: matijsdejong Date: 2012-04-05 16:40:35 +0000 (Thu, 05 Apr 2012) Log Message: ----------- Changed token forward mechanism: token is inserted in Lime Survey only when the user clicks on the link Modified Paths: -------------- trunk/library/classes/Gems/Default/AskAction.php trunk/library/classes/Gems/Menu.php trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php Modified: trunk/library/classes/Gems/Default/AskAction.php =================================================================== --- trunk/library/classes/Gems/Default/AskAction.php 2012-04-05 15:50:36 UTC (rev 599) +++ trunk/library/classes/Gems/Default/AskAction.php 2012-04-05 16:40:35 UTC (rev 600) @@ -50,7 +50,6 @@ public function forwardAction() { $tracker = $this->loader->getTracker(); - $language = $this->locale->getLanguage(); /************** * Find token * @@ -82,16 +81,14 @@ /*************** * Get the url * ***************/ - $user = $this->loader->getCurrentUser(); - $url = $token->getUrl($language, $user->getUserId() ? $user->getUserId() : $respId); + $request = $this->getRequest(); + $params[$request->getActionKey()] = 'to-survey'; + $params[MUtil_Model::REQUEST_ID] = $token->getTokenId(); + + $href = new MUtil_Html_HrefArrayAttribute($params); + $href->setRouteReset(false); + $url = $href->render($this->view); - /************************ - * Optional user logout * - ************************/ - if ($user->isLogoutOnSurvey()) { - $user->unsetAsCurrentUser(); - } - /*********************************** * Should we stay or should we go? * ***********************************/ @@ -144,7 +141,7 @@ } $buttonDiv = $this->html->buttonDiv(array('class' => 'centerAlign')); - $buttonDiv->actionLink(MUtil_Html::raw($url), $token->getSurveyName()); + $buttonDiv->actionLink($href, $token->getSurveyName()); if (isset($delay)) { $buttonDiv->actionLink(array('delay_cancelled' => 1), $this->_('Cancel')); @@ -299,15 +296,47 @@ public function takeAction() { // Dummy to enable separate rights - $this->_forward('forward'); + $this->_forward('to-survey'); } + /** + * Old action mentioned on some documentation + */ public function tokenAction() { - // Staat om sommige documentatie $this->_forward('index'); } + /** + * Go directly to url + */ + public function toSurveyAction() + { + $tracker = $this->loader->getTracker(); + if ($tokenId = $this->_getParam(MUtil_Model::REQUEST_ID)) { + $tokenId = $tracker->filterToken($tokenId); + + if ($token = $tracker->getToken($tokenId)) { + $language = $this->locale->getLanguage(); + $user = $this->loader->getCurrentUser(); + $url = $token->getUrl($language, $user->getUserId() ? $user->getUserId() : $token->getRespondentId()); + + /************************ + * Optional user logout * + ************************/ + if ($user->isLogoutOnSurvey()) { + $user->unsetAsCurrentUser(); + } + + // Redirect at once + header('Location: ' . $url); + exit(); + } + } + + // Default option + $this->_forward('index'); + } public function routeError($message) { // TODO make nice Modified: trunk/library/classes/Gems/Menu.php =================================================================== --- trunk/library/classes/Gems/Menu.php 2012-04-05 15:50:36 UTC (rev 599) +++ trunk/library/classes/Gems/Menu.php 2012-04-05 16:40:35 UTC (rev 600) @@ -114,6 +114,7 @@ // Routes for token controller $page->addAction(null, null, 'forward'); $page->addAction(null, null, 'return'); + $page->addAction(null, null, 'to-survey')->setModelParameters(1); $page->addAction(null, null, 'token'); return $page; Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php =================================================================== --- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-04-05 15:50:36 UTC (rev 599) +++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-04-05 16:40:35 UTC (rev 600) @@ -365,7 +365,7 @@ { $messages = array(); $survey = $this->tracker->getSurvey($surveyId); - + if (null === $sourceSurveyId) { // Was removed $values['gsu_active'] = 0; @@ -995,7 +995,8 @@ } // mgzdev.erasmusmc.nl/incant/index.php?sid=1&token=o7l9_b8z2 - return $this->getBaseUrl() . '/index.php?sid=' . $sourceSurveyId . '&token=' . $tokenId . $langUrl; + $baseurl = $this->getBaseUrl(); + return $baseurl . ('/' == substr($baseurl, -1) ? '' : '/') . 'index.php?sid=' . $sourceSurveyId . '&token=' . $tokenId . $langUrl; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-05 15:50:42
|
Revision: 599 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=599&view=rev Author: matijsdejong Date: 2012-04-05 15:50:36 +0000 (Thu, 05 Apr 2012) Log Message: ----------- New survey return mechanism that allows more flexible return mechanism Database patches now sorted on date changed, plus more cache cleanup for database objects Modified Paths: -------------- trunk/library/classes/Gems/Default/AskAction.php trunk/library/classes/Gems/Default/DatabaseAction.php trunk/library/classes/Gems/Default/RespondentAction.php trunk/library/classes/Gems/Default/TrackActionAbstract.php trunk/library/classes/Gems/User/User.php Modified: trunk/library/classes/Gems/Default/AskAction.php =================================================================== --- trunk/library/classes/Gems/Default/AskAction.php 2012-04-05 14:29:54 UTC (rev 598) +++ trunk/library/classes/Gems/Default/AskAction.php 2012-04-05 15:50:36 UTC (rev 599) @@ -272,46 +272,25 @@ public function returnAction() { - if (isset($this->session->user_id) && $this->session->user_id) { + $user = $this->loader->getCurrentUser(); + + if ($user->isActive()) { $tracker = $this->loader->getTracker(); $token = $tracker->getToken($tracker->filterToken($this->_getParam(MUtil_Model::REQUEST_ID))); // Check for completed tokens - $this->loader->getTracker()->processCompletedTokens($token->getRespondentId(), $this->session->user_id); + $this->loader->getTracker()->processCompletedTokens($token->getRespondentId(), $user->getUserId()); - if (isset($this->session->return_controller) && $this->session->return_controller) { - $return = $this->session->return_controller; - } else { - $return = 'respondent'; + $parameters = $user->getSurveyReturn(); + if (! $parameters) { + // Default + $request = $this->getRequest(); + $parameters[$request->getControllerKey()] = 'respondent'; + $parameters[$request->getActionKey()] = 'show'; + $parameters[MUtil_Model::REQUEST_ID] = $token->getPatientNumber(); } - $parameters['controller'] = $return; - $parameters['action'] = 'show'; - $parameters[MUtil_Model::REQUEST_ID] = $token->getPatientNumber(); - switch ($return) { - case 'track': - $parameters['action'] = 'show-track'; - $parameters[Gems_Model::RESPONDENT_TRACK] = $token->getRespondentTrackId(); - break; - - case 'survey': - $parameters[MUtil_Model::REQUEST_ID] = $token->getTokenId(); - break; - - case 'ask': - $this->_forward('forward'); - return; - - default: - // Allow open specification of return - if (strpos($return, '/') !== false) { - $parameters = MUtil_Ra::pairs(explode('/', $return)); - // MUtil_Echo::track($parameters); - } else { - $parameters['controller'] = 'respondent'; - } - } - $this->_reroute($parameters, true); + $this->_reroute($parameters, true); } else { $this->_forward('forward'); } Modified: trunk/library/classes/Gems/Default/DatabaseAction.php =================================================================== --- trunk/library/classes/Gems/Default/DatabaseAction.php 2012-04-05 14:29:54 UTC (rev 598) +++ trunk/library/classes/Gems/Default/DatabaseAction.php 2012-04-05 15:50:36 UTC (rev 599) @@ -61,6 +61,22 @@ } /** + * Make sure the cache is cleaned. + * + * As a lot of cache depends on the database, it is best to clean the cache + * now since import tables might have changed. + * + * @return void + */ + private function _cleanCache() + { + if ($this->cache instanceof Zend_Cache_Core) { + $this->cache->clean(); + $this->addMessage($this->_('Cache cleaned')); + } + } + + /** * Adds elements from the model to the bridge that creates the form. * * Overrule this function to add different elements to the browse table, without @@ -181,6 +197,7 @@ try { $stmt = $this->db->query($sql); $this->addMessage(sprintf($this->_('%1$s %2$s dropped'), $data['name'], $this->_(strtolower($data['type'])))); + $this->_cleanCache(); $model->save(array('exists' => false), $model->getFilter()); @@ -266,13 +283,14 @@ $patcher = new Gems_Util_DatabasePatcher($this->db, 'patches.sql', $this->escort->getDatabasePaths()); $changed = $patcher->uploadPatches($this->loader->getVersions()->getBuild()); $tableSql = sprintf( - 'SELECT gpa_level AS `%s`, gpa_location AS `%s`, COUNT(*) AS `%s`, COUNT(*) - SUM(gpa_executed) AS `%s`, SUM(gpa_executed) AS `%s`, SUM(gpa_completed) AS `%s` FROM gems__patches GROUP BY gpa_level, gpa_location ORDER BY gpa_level DESC, gpa_location', + 'SELECT gpa_level AS `%s`, gpa_location AS `%s`, COUNT(*) AS `%s`, COUNT(*) - SUM(gpa_executed) AS `%s`, SUM(gpa_executed) AS `%s`, SUM(gpa_completed) AS `%s`, MAX(gpa_changed) AS `%s` FROM gems__patches GROUP BY gpa_level, gpa_location ORDER BY gpa_level DESC, gpa_location', $this->_('Level'), $this->_('Subtype'), $this->_('Patches'), $this->_('To be executed'), $this->_('Executed'), - $this->_('Finished')); + $this->_('Finished'), + $this->_('Changed on')); if ($changed == -1) { $this->addMessage($this->_('Create the patch table!')); @@ -306,18 +324,11 @@ $form->getElement('db_level')->setValue($data['db_level']); $this->addMessage(sprintf($this->_('%d patch(es) executed.'), $changed)); - - //As a lot of cache depends on the database, it is best to clean the cache now - //since import tables might have changed - $cache = $this->escort->cache; - if ($cache instanceof Zend_Cache_Core) { - $cache->clean(); - $this->addMessage($this->_('Cache cleaned')); - } + $this->_cleanCache(); } $tableSql = sprintf( - 'SELECT gpa_id_patch AS `%s`, gpa_level AS `%s`, gpa_location AS `%s`, gpa_name AS `%s`, gpa_sql AS `%s`, gpa_executed AS `%s`, gpa_completed AS `%s`, gpa_result as `%s` FROM gems__patches WHERE gpa_level = ? ORDER BY gpa_level, gpa_location, gpa_name, gpa_order', + 'SELECT gpa_id_patch AS `%s`, gpa_level AS `%s`, gpa_location AS `%s`, gpa_name AS `%s`, gpa_sql AS `%s`, gpa_executed AS `%s`, gpa_completed AS `%s`, gpa_result AS `%s`, gpa_changed AS `%s` FROM gems__patches WHERE gpa_level = ? ORDER BY gpa_level, gpa_changed DESC, gpa_location, gpa_name, gpa_order', $this->_('Patch'), $this->_('Level'), $this->_('Subtype'), @@ -325,7 +336,8 @@ $this->_('Query'), $this->_('Executed'), $this->_('Finished'), - $this->_('Result')); + $this->_('Result'), + $this->_('Changed on')); $tableSql = $this->db->quoteInto($tableSql, $form->getValue('level')); } @@ -439,6 +451,7 @@ $results = $model->runScript($data); $this->addMessage($results); + $this->_cleanCache(); $this->_reroute(array('action' => 'show')); } } @@ -461,10 +474,12 @@ $results[] = sprintf($this->_('Finished %s creation script for object %d of %d'), $this->_(strtolower($data['type'])), $i, $oCount) . '<br/>'; $i++; } + } else { $results[] = $this->_('All objects exist. Nothing was executed.'); } $this->addMessage($results); + $this->_cleanCache(); $this->_reroute(array('action' => 'index'), true); } Modified: trunk/library/classes/Gems/Default/RespondentAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentAction.php 2012-04-05 14:29:54 UTC (rev 598) +++ trunk/library/classes/Gems/Default/RespondentAction.php 2012-04-05 15:50:36 UTC (rev 599) @@ -355,7 +355,8 @@ { parent::init(); - $this->session->return_controller = $this->getRequest()->getControllerName(); + // Tell the system where to return to after a survey has been taken + $this->loader->getCurrentUser()->setSurveyReturn($this->getRequest()); } protected function openedRespondent($patientId, $orgId = null, $userId = null) Modified: trunk/library/classes/Gems/Default/TrackActionAbstract.php =================================================================== --- trunk/library/classes/Gems/Default/TrackActionAbstract.php 2012-04-05 14:29:54 UTC (rev 598) +++ trunk/library/classes/Gems/Default/TrackActionAbstract.php 2012-04-05 15:50:36 UTC (rev 599) @@ -365,7 +365,8 @@ { parent::init(); - $this->session->return_controller = $this->getRequest()->getControllerName(); + // Tell the system where to return to after a survey has been taken + $this->loader->getCurrentUser()->setSurveyReturn($this->getRequest()); } public function initFilter() Modified: trunk/library/classes/Gems/User/User.php =================================================================== --- trunk/library/classes/Gems/User/User.php 2012-04-05 14:29:54 UTC (rev 598) +++ trunk/library/classes/Gems/User/User.php 2012-04-05 15:50:36 UTC (rev 599) @@ -846,6 +846,16 @@ } /** + * get the parameters where the survey should return to + * + * @return array + */ + public function getSurveyReturn() + { + return $this->_getVar('surveyReturn', array()); + } + + /** * Returns the user id, that identifies this user within this installation. * * One user id might be connected to multiple logins for multiple organizations. @@ -1317,6 +1327,25 @@ } /** + * Set the parameters where the survey should return to + * + * @param mixed $return Zend_Controller_Request_Abstract, array of something that can be turned into one. + * @return Gems_User_User + */ + public function setSurveyReturn($return) + { + if ($return instanceof Zend_Controller_Request_Abstract) { + $return = $return->getParams(); + } elseif (! is_array($return)) { + $return = MUtil_Ra::to($return); + } + + $this->_setVar('surveyReturn', $return); + + return $this; + } + + /** * Unsets this user as the current user. * * This means that the data about this user will no longer be stored in a session. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-05 14:30:05
|
Revision: 598 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=598&view=rev Author: matijsdejong Date: 2012-04-05 14:29:54 +0000 (Thu, 05 Apr 2012) Log Message: ----------- Chang password forms now can have (project definable) check questions to answer in addition to the new password Documentation standardized and small bug fixed in DatePicker.php view helper Modified Paths: -------------- trunk/library/changelog.txt trunk/library/classes/Gems/Default/IndexAction.php trunk/library/classes/Gems/User/Form/ChangePasswordForm.php trunk/library/classes/Gems/User/RespondentUserDefinition.php trunk/library/classes/Gems/User/User.php trunk/library/classes/Gems/User/UserLoader.php trunk/library/classes/MUtil/JQuery/View/Helper/DatePicker.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/changelog.txt =================================================================== --- trunk/library/changelog.txt 2012-04-05 12:12:41 UTC (rev 597) +++ trunk/library/changelog.txt 2012-04-05 14:29:54 UTC (rev 598) @@ -1,13 +1,12 @@ Important changes from 1.5.2 => 1.5.3 ============================================================ -People can login using their e-amil address as user name. -Showing a list of organizations to choose during login happens except when 1) there is only one organization or 2) a url is used that is assigned to a specific organization. +People can login using their e-mail address as user name. This can be activated by for respondents and staff seperately, by default this is off for both. +Showing a list of organizations to choose during login happens always except when 1) there is only one organization or 2) a url is used that is assigned to a specific organization. Login & other password forms are now easy to customize on a per project basis. -Login and authorizaiton rules are easier to extend. -All password rules are reported during reset. -The password reset cycle send a link that can be used to change the password straight away. +Login and authorization rules are easier to extend. +All password rules are reported on change password forms. +The password reset cycle send a link that can be used to change the password straight away. By default the systems also asks the user to enter his/her birthday if available and username otherwise, but this can be removed / changed at the project level. - Important changes from 1.5.1 => 1.5.2 ============================================================ Renamed project.ini setting concentRejected to consentRejected Modified: trunk/library/classes/Gems/Default/IndexAction.php =================================================================== --- trunk/library/classes/Gems/Default/IndexAction.php 2012-04-05 12:12:41 UTC (rev 597) +++ trunk/library/classes/Gems/Default/IndexAction.php 2012-04-05 14:29:54 UTC (rev 598) @@ -284,7 +284,7 @@ $user = $this->loader->getUserLoader()->getUserByResetKey($key); if ($user->hasValidResetKey()) { - $form = $user->getChangePasswordForm(array('askOld' => false)); + $form = $user->getChangePasswordForm(array('askOld' => false, 'askCheck' => true)); } else { if (! $request->isPost()) { if ($user->hasPassword() || (! $user->isActive())) { Modified: trunk/library/classes/Gems/User/Form/ChangePasswordForm.php =================================================================== --- trunk/library/classes/Gems/User/Form/ChangePasswordForm.php 2012-04-05 12:12:41 UTC (rev 597) +++ trunk/library/classes/Gems/User/Form/ChangePasswordForm.php 2012-04-05 14:29:54 UTC (rev 598) @@ -89,6 +89,13 @@ protected $_table; /** + * Should a user specific check question be asked? + * + * @var boolean + */ + protected $askCheck = false; + + /** * Should the old password be requested. * * Calculated when null @@ -98,6 +105,17 @@ protected $askOld = null; /** + * Returns an array of elements for check fields during password reset and/or + * 'label name' => 'required value' pairs. vor asking extra questions before allowing + * a password change. + * + * Default is asking for the username but you can e.g. ask for someones birthday. + * + * @return array Of 'label name' => 'required values' or Zend_Form_Element elements + */ + protected $checkFields = array(); + + /** * Should the password rules be reported. * * @var boolean @@ -132,6 +150,49 @@ } /** + * Add user defined checkfields + * + * @return void + */ + protected function addCheckFields() + { + $check = 1; + foreach ($this->checkFields as $label => &$value) { + if ($value instanceof Zend_Form_Element) { + $element = $value; + } else { + if ($value) { + $element = new Zend_Form_Element_Text('check_' . $check); + $element->setAllowEmpty(false); + $element->setLabel($label); + + $validator = new Zend_Validate_Identical($value); + $validator->setMessage(sprintf($this->translate->_('%s is not correct.'), $label), Zend_Validate_Identical::NOT_SAME); + $element->addValidator($validator); + + $value = $element; + $check++; + } else { + // Nothing to check for + unset($this->checkFields[$label]); + continue; + } + } + $this->addElement($element); + } + } + + /** + * Should a user specific check question be asked? + * + * @return boolean + */ + public function getAskCheck() + { + return $this->askCheck; + } + + /** * Should the for asking for an old password * * @return boolean @@ -152,7 +213,7 @@ } /** - * Returns/sets a mew password element. + * Returns/sets a new password element. * * @return Zend_Form_Element_Password */ @@ -169,8 +230,11 @@ $element->setRequired(true); $element->setRenderPassword(true); $element->addValidator(new Gems_User_Validate_NewPasswordValidator($this->user)); - $element->addValidator(new MUtil_Validate_IsConfirmed($this->_repeatPasswordFieldName, $this->translate->_('Repeat password'))); + $validator = new MUtil_Validate_IsConfirmed($this->_newPasswordFieldName, $this->translate->_('Repeat password')); + $validator->setMessage($this->translate->_("Must be the same as %fieldDescription%."), MUtil_Validate_IsConfirmed::NOT_SAME); + $element->addValidator($validator); + $this->addElement($element); } @@ -219,8 +283,11 @@ $element->setAttrib('maxlength', 20); $element->setRequired(true); $element->setRenderPassword(true); - $element->addValidator(new MUtil_Validate_IsConfirmed($this->_newPasswordFieldName, $this->translate->_('New password'))); + $validator = new MUtil_Validate_IsConfirmed($this->_newPasswordFieldName, $this->translate->_('New password')); + $validator->setMessage($this->translate->_("Must be the same as %fieldDescription%."), MUtil_Validate_IsConfirmed::NOT_SAME); + $element->addValidator($validator); + $this->addElement($element); } @@ -323,6 +390,10 @@ if ($this->getAskOld()) { $this->getOldPasswordElement(); } + if ($this->getAskCheck()) { + $this->addCheckFields(); + } + $this->getNewPasswordElement(); $this->getRepeatPasswordElement(); $this->getSubmitButton(); @@ -343,6 +414,21 @@ } /** + * Should a user specific check question be asked? + * + * Enables loading of parameter through Zend_Form::__construct() + * + * @param boolean $askCheck + * @return Gems_User_Form_ChangePasswordForm (continuation pattern) + */ + public function setAskCheck($askCheck = true) + { + $this->askCheck = $askCheck; + + return $this; + } + + /** * Should the form ask for an old password * * Enables loading of parameter through Zend_Form::__construct() @@ -358,6 +444,21 @@ } /** + * Set optional user specific check question to be asked when getAskCheck() is on. + * + * Enables loading of parameter through Zend_Form::__construct() + * + * @param array $checkFields Of 'label name' => 'required values' or Zend_Form_Element elements + * @return Gems_User_Form_ChangePasswordForm (continuation pattern) + */ + public function setCheckFields(array $checkFields) + { + $this->checkFields = $checkFields; + + return $this; + } + + /** * Should the form report the password rules * * Enables loading of parameter through Zend_Form::__construct() Modified: trunk/library/classes/Gems/User/RespondentUserDefinition.php =================================================================== --- trunk/library/classes/Gems/User/RespondentUserDefinition.php 2012-04-05 12:12:41 UTC (rev 597) +++ trunk/library/classes/Gems/User/RespondentUserDefinition.php 2012-04-05 14:29:54 UTC (rev 598) @@ -73,6 +73,7 @@ 'user_last_name' => 'grs_last_name', 'user_gender' => 'grs_gender', 'user_locale' => 'grs_iso_lang', + 'user_birthday' => 'grs_birthday', )) ->join('gems__organizations', 'gr2o_id_organization = gor_id_organization', array( 'user_group' => 'gor_respondent_group', Modified: trunk/library/classes/Gems/User/User.php =================================================================== --- trunk/library/classes/Gems/User/User.php 2012-04-05 12:12:41 UTC (rev 597) +++ trunk/library/classes/Gems/User/User.php 2012-04-05 14:29:54 UTC (rev 598) @@ -571,7 +571,12 @@ return; } - return $this->userLoader->getChangePasswordForm($this, func_get_args()); + $args = MUtil_Ra::args(func_get_args()); + if (isset($args['askCheck']) && $args['askCheck']) { + $args['checkFields'] = $this->loadResetPasswordCheckFields(); + } + + return $this->userLoader->getChangePasswordForm($this, $args); } /** @@ -1052,6 +1057,45 @@ } /** + * Returns an array of elements for check fields during password reset and/or + * 'label name' => 'required value' pairs. vor asking extra questions before allowing + * a password change. + * + * Default is asking for the username but you can e.g. ask for someones birthday. + * + * @return array Of 'label name' => 'required values' or Zend_Form_Element elements + */ + protected function loadResetPasswordCheckFields() + { + // CHECK ON SOMEONES BIRTHDAY + // Birthdays are usually not defined for staff but the do exist for respondents + if ($value = $this->_getVar('user_birthday')) { + $formData = Zend_Registry::get(MUtil_Model_FormBridge::REGISTRY_KEY); + $label = $this->translate->_('Your birthday'); + + $birthdayElem = new MUtil_JQuery_Form_Element_DatePicker('birthday'); + $birthdayElem->setLabel($label); + if (isset($formData['date'])) { + $birthdayElem->setOptions($formData['date']); + } + $birthdayElem->setStorageFormat(Zend_Date::ISO_8601); + + if ($format = $birthdayElem->getDateFormat()) { + $valueFormatted = MUtil_Date::format($value, $format, $birthdayElem->getStorageFormat()); + } else { + $valueFormatted = $value; + } + + $validator = new Zend_Validate_Identical($valueFormatted); + $validator->setMessage(sprintf($this->translate->_('%s is not correct.'), $label), Zend_Validate_Identical::NOT_SAME); + $birthdayElem->addValidator($validator); + + return array($birthdayElem); + } // */ + return array($this->translate->_('Username') => $this->getLoginName()); + } + + /** * Send an e-mail to this user * * @param string $subjectTemplate A subject template in which {fields} are replaced Modified: trunk/library/classes/Gems/User/UserLoader.php =================================================================== --- trunk/library/classes/Gems/User/UserLoader.php 2012-04-05 12:12:41 UTC (rev 597) +++ trunk/library/classes/Gems/User/UserLoader.php 2012-04-05 14:29:54 UTC (rev 598) @@ -59,13 +59,13 @@ * When true Respondent members can use their e-mail address as login name * @var boolean */ - public $allowRespondentEmailLogin = true; + public $allowRespondentEmailLogin = false; /** * When true Staff members can use their e-mail address as login name * @var boolean */ - public $allowStaffEmailLogin = true; + public $allowStaffEmailLogin = false; /** * Modified: trunk/library/classes/MUtil/JQuery/View/Helper/DatePicker.php =================================================================== --- trunk/library/classes/MUtil/JQuery/View/Helper/DatePicker.php 2012-04-05 12:12:41 UTC (rev 597) +++ trunk/library/classes/MUtil/JQuery/View/Helper/DatePicker.php 2012-04-05 14:29:54 UTC (rev 598) @@ -4,7 +4,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 @@ -15,7 +15,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,23 +26,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 MUtil + * @subpackage JQuery + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ */ /** - * - * @author Matijs de Jong - * @since 1.0 - * @version 1.1 - * @package MUtil - * @subpackage View + * + * @package MUtil + * @subpackage JQuery + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 */ - -/** - * - * @author Matijs de Jong - * @package MUtil - * @subpackage View - */ class MUtil_JQuery_View_Helper_DatePicker extends ZendX_JQuery_View_Helper_DatePicker { public function datePicker($id, $value = null, array $params = array(), array $attribs = array()) { @@ -52,7 +53,7 @@ $this->jquery->addOnLoad($js); } - if ($format = $params['dateFormat']) { + if (isset($params['dateFormat']) && ($format = $params['dateFormat'])) { //* $js = array(); $js[] = '{'; Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2012-04-05 12:12:41 UTC (rev 597) +++ trunk/library/languages/default-en.po 2012-04-05 14:29:54 UTC (rev 598) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: GemsTracker EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-05 14:09+0100\n" +"POT-Creation-Date: 2012-04-05 16:25+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -3633,11 +3633,26 @@ msgid "You are not allowed to login from this location." msgstr "You are not allowed to login from this location." -#: classes/Gems/User/User.php:1066 +#: classes/Gems/User/User.php:1074 +msgid "Your birthday" +msgstr "Your birthday" + +#: classes/Gems/User/User.php:1090 +#: classes/Gems/User/Form/ChangePasswordForm.php:169 +#, php-format +msgid "%s is not correct." +msgstr "%s is not correct." + +#: classes/Gems/User/User.php:1095 +#: classes/Gems/User/Form/OrganizationFormAbstract.php:271 +msgid "Username" +msgstr "Username" + +#: classes/Gems/User/User.php:1110 msgid "Trying to send a password reset to a user that cannot be reset." msgstr "Trying to send a password reset to a user that cannot be reset." -#: classes/Gems/User/User.php:1093 +#: classes/Gems/User/User.php:1137 msgid "Unable to send e-mail." msgstr "Unable to send e-mail." @@ -3650,33 +3665,38 @@ msgid "Radius storage" msgstr "Radius storage" -#: classes/Gems/User/Form/ChangePasswordForm.php:166 -#: classes/Gems/User/Form/ChangePasswordForm.php:222 +#: classes/Gems/User/Form/ChangePasswordForm.php:221 +#: classes/Gems/User/Form/ChangePasswordForm.php:281 msgid "New password" msgstr "New password" -#: classes/Gems/User/Form/ChangePasswordForm.php:192 +#: classes/Gems/User/Form/ChangePasswordForm.php:229 +#: classes/Gems/User/Form/ChangePasswordForm.php:282 +msgid "Must be the same as %fieldDescription%." +msgstr "Must be the same as %fieldDescription%." + +#: classes/Gems/User/Form/ChangePasswordForm.php:250 msgid "Current password" msgstr "Current password" -#: classes/Gems/User/Form/ChangePasswordForm.php:197 +#: classes/Gems/User/Form/ChangePasswordForm.php:255 msgid "Wrong password." msgstr "Wrong password." -#: classes/Gems/User/Form/ChangePasswordForm.php:243 +#: classes/Gems/User/Form/ChangePasswordForm.php:304 msgid "Password rules" msgstr "Password rules" -#: classes/Gems/User/Form/ChangePasswordForm.php:246 +#: classes/Gems/User/Form/ChangePasswordForm.php:307 #, php-format msgid "A password %s." msgstr "A password %s." -#: classes/Gems/User/Form/ChangePasswordForm.php:253 +#: classes/Gems/User/Form/ChangePasswordForm.php:314 msgid "A password:" msgstr "A password:" -#: classes/Gems/User/Form/ChangePasswordForm.php:307 +#: classes/Gems/User/Form/ChangePasswordForm.php:368 msgid "Caps Lock seems to be on!" msgstr "Caps Lock seems to be on!" @@ -3692,10 +3712,6 @@ msgid "Enter your token..." msgstr "Enter your token..." -#: classes/Gems/User/Form/OrganizationFormAbstract.php:271 -msgid "Username" -msgstr "Username" - #: classes/Gems/User/Form/ResetRequestForm.php:63 msgid "Back to login" msgstr "Back to login" @@ -3961,10 +3977,6 @@ msgid "%value% is too short for a %testDescription%. Should be %length% digits." msgstr "%value% is too short for a %testDescription%. Should be %length% digits." -#: languages/FakeTranslations.php:76 -msgid "Must be the same as %fieldDescription%." -msgstr "Must be the same as %fieldDescription%." - #: languages/FakeTranslations.php:79 msgid "'%value%' is not a phone number (e.g. +12 (0)34-567 890)." msgstr "'%value%' is not a phone number (e.g. +12 (0)34-567 890)." @@ -4199,6 +4211,9 @@ msgid "Can access" msgstr "Can access" +#~ msgid "%s not correct." +#~ msgstr "%s not correct." + #~ msgid "" #~ "Please enter the organization and username/e-mail address belonging to " #~ "this request." Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2012-04-05 12:12:41 UTC (rev 597) +++ trunk/library/languages/default-nl.po 2012-04-05 14:29:54 UTC (rev 598) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: GemsTracker NL\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-05 14:09+0100\n" +"POT-Creation-Date: 2012-04-05 16:26+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -3633,11 +3633,26 @@ msgid "You are not allowed to login from this location." msgstr "U kunt vanaf deze locatie niet inloggen." -#: classes/Gems/User/User.php:1066 +#: classes/Gems/User/User.php:1074 +msgid "Your birthday" +msgstr "Uw geboortedatum" + +#: classes/Gems/User/User.php:1090 +#: classes/Gems/User/Form/ChangePasswordForm.php:169 +#, php-format +msgid "%s is not correct." +msgstr "%s is onjuist." + +#: classes/Gems/User/User.php:1095 +#: classes/Gems/User/Form/OrganizationFormAbstract.php:271 +msgid "Username" +msgstr "Gebruikersnaam" + +#: classes/Gems/User/User.php:1110 msgid "Trying to send a password reset to a user that cannot be reset." msgstr "Het wachtwoord voor deze gebruiker kan niet gewijzigd worden." -#: classes/Gems/User/User.php:1093 +#: classes/Gems/User/User.php:1137 msgid "Unable to send e-mail." msgstr "Verzenden email mislukt." @@ -3650,33 +3665,38 @@ msgid "Radius storage" msgstr "Radius authenticatie" -#: classes/Gems/User/Form/ChangePasswordForm.php:166 -#: classes/Gems/User/Form/ChangePasswordForm.php:222 +#: classes/Gems/User/Form/ChangePasswordForm.php:221 +#: classes/Gems/User/Form/ChangePasswordForm.php:281 msgid "New password" msgstr "Nieuw wachtwoord" -#: classes/Gems/User/Form/ChangePasswordForm.php:192 +#: classes/Gems/User/Form/ChangePasswordForm.php:229 +#: classes/Gems/User/Form/ChangePasswordForm.php:282 +msgid "Must be the same as %fieldDescription%." +msgstr "Moet identiek zijn aan %fieldDescription%." + +#: classes/Gems/User/Form/ChangePasswordForm.php:250 msgid "Current password" msgstr "Huidig wachtwoord" -#: classes/Gems/User/Form/ChangePasswordForm.php:197 +#: classes/Gems/User/Form/ChangePasswordForm.php:255 msgid "Wrong password." msgstr "Verkeerd wachtwoord." -#: classes/Gems/User/Form/ChangePasswordForm.php:243 +#: classes/Gems/User/Form/ChangePasswordForm.php:304 msgid "Password rules" msgstr "Wachtwoord regels" -#: classes/Gems/User/Form/ChangePasswordForm.php:246 +#: classes/Gems/User/Form/ChangePasswordForm.php:307 #, php-format msgid "A password %s." msgstr "Een wachtwoord %s." -#: classes/Gems/User/Form/ChangePasswordForm.php:253 +#: classes/Gems/User/Form/ChangePasswordForm.php:314 msgid "A password:" msgstr "Een wachtwoord:" -#: classes/Gems/User/Form/ChangePasswordForm.php:307 +#: classes/Gems/User/Form/ChangePasswordForm.php:368 msgid "Caps Lock seems to be on!" msgstr "De Caps Lock toets lijkt aan te staan!" @@ -3692,10 +3712,6 @@ msgid "Enter your token..." msgstr "Voer uw kenmerk in..." -#: classes/Gems/User/Form/OrganizationFormAbstract.php:271 -msgid "Username" -msgstr "Gebruikersnaam" - #: classes/Gems/User/Form/ResetRequestForm.php:63 msgid "Back to login" msgstr "Terug naar de login" @@ -3961,10 +3977,6 @@ msgid "%value% is too short for a %testDescription%. Should be %length% digits." msgstr "%value% is te kort voor een %testDescription%. Die moet %length% cijfers lang zijn." -#: languages/FakeTranslations.php:76 -msgid "Must be the same as %fieldDescription%." -msgstr "Moet identiek zijn aan %fieldDescription%." - #: languages/FakeTranslations.php:79 msgid "'%value%' is not a phone number (e.g. +12 (0)34-567 890)." msgstr "'%value%' is geen telefoonnummer (zoals: +12 (0)34-567 890)." This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-05 12:12:51
|
Revision: 597 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=597&view=rev Author: matijsdejong Date: 2012-04-05 12:12:41 +0000 (Thu, 05 Apr 2012) Log Message: ----------- Fixed security leak that allowed login without a password Added reset key duration to mail template fields for reset Modified Paths: -------------- trunk/library/classes/Gems/Default/IndexAction.php trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php trunk/library/classes/Gems/User/RadiusUserDefinition.php trunk/library/classes/Gems/User/User.php trunk/library/classes/Gems/User/UserDefinitionAbstract.php trunk/library/classes/Gems/User/UserDefinitionInterface.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/IndexAction.php =================================================================== --- trunk/library/classes/Gems/Default/IndexAction.php 2012-04-04 18:33:08 UTC (rev 596) +++ trunk/library/classes/Gems/Default/IndexAction.php 2012-04-05 12:12:41 UTC (rev 597) @@ -134,7 +134,7 @@ */ protected function displayLoginForm(Gems_User_Form_LoginForm $form) { - $form->getUser()->setAsCurrentUser(); + $this->setCurrentOrganizationTo($form->getUser()); $this->view->form = $form; } @@ -148,7 +148,7 @@ protected function displayResetForm(Gems_Form_AutoLoadFormAbstract $form, $errors, Gems_User_User $user = null) { if ($form instanceof Gems_User_Form_ResetRequestForm) { - $form->getUser()->setAsCurrentUser(); + $user = $form->getUser(); $this->html->h3($this->_('Request password reset')); @@ -158,9 +158,10 @@ } else { $p->append($this->_('Please enter your username or e-mail address. ')); } - $p->append($this->_('We will then send you an e-mail with a link you can use to reset your password.')); + $this->html->p($this->_('We will then send you an e-mail with a link. The link will bring you to a page where you can set a new password of your choice.')); } elseif ($form instanceof Gems_User_Form_ChangePasswordForm) { + $form->getUser()->getCurrentOrganization()->setAsCurrentOrganization(); if ($user->hasPassword()) { $this->html->h3($this->_('Execute password reset')); $p = $this->html->pInfo($this->_('We received your password reset request.')); @@ -177,6 +178,10 @@ $this->addMessage($errors); } + if ($user) { + $this->setCurrentOrganizationTo($user); + } + $this->html->append($form); } @@ -333,8 +338,31 @@ public function sendUserResetEMail(Gems_User_User $user) { $subjectTemplate = $this->_('Password reset requested'); + /* CANNOT BE TESTED TODAY + $bbBodyTemplate = $this->_("Dear {greeting}, + +A new password was requested for your [b]{organization}[/b] site [b]{project}[/b], please click within {reset_in_hours} hours on [url={reset_url}]this link[/url] to enter the password of your choice. + +{organization_signature} + +[url={reset_url}]{reset_url}[/url] +"); // */ $bbBodyTemplate = $this->_("To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n{reset_url}"); return $user->sendMail($subjectTemplate, $bbBodyTemplate, true); } + + /** + * Helper function to safely switch org during login + * + * @param Gems_User_User $user + */ + protected function setCurrentOrganizationTo(Gems_User_User $user) + { + $current = $this->loader->getCurrentUser(); + + if ($current !== $user) { + $current->setCurrentOrganization($user->getCurrentOrganization()); + } + } } Modified: trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php =================================================================== --- trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php 2012-04-04 18:33:08 UTC (rev 596) +++ trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php 2012-04-05 12:12:41 UTC (rev 597) @@ -53,7 +53,7 @@ protected $db; /** - * The time period in hours a reset key is valid for this user. + * The time period in hours a reset key is valid for this definition. * * @var int */ Modified: trunk/library/classes/Gems/User/RadiusUserDefinition.php =================================================================== --- trunk/library/classes/Gems/User/RadiusUserDefinition.php 2012-04-04 18:33:08 UTC (rev 596) +++ trunk/library/classes/Gems/User/RadiusUserDefinition.php 2012-04-05 12:12:41 UTC (rev 597) @@ -47,7 +47,7 @@ * @license New BSD License * @since Class available since version 1.5 */ -class Gems_User_RadiusUserDefinition extends Gems_User_StaffUserDefinition implements Gems_User_UserDefinitionInterface, Gems_User_UserDefinitionConfigurableInterface +class Gems_User_RadiusUserDefinition extends Gems_User_StaffUserDefinition implements Gems_User_UserDefinitionConfigurableInterface { /** * @var Gems_Model_JoinModel Modified: trunk/library/classes/Gems/User/User.php =================================================================== --- trunk/library/classes/Gems/User/User.php 2012-04-04 18:33:08 UTC (rev 596) +++ trunk/library/classes/Gems/User/User.php 2012-04-05 12:12:41 UTC (rev 597) @@ -763,21 +763,22 @@ $orgResults = $org->getMailFields(); $projResults = $this->project->getMailFields(); - $result['bcc'] = $projResults['project_bcc']; - $result['email'] = $this->getEmailAddress(); - $result['first_name'] = $this->_getVar('user_first_name'); - $result['from'] = $this->getFrom(); - $result['full_name'] = trim($this->getGenderHello($locale) . ' ' . $this->getFullName()); - $result['greeting'] = $this->getGreeting($locale); - $result['last_name'] = ltrim($this->_getVar('user_surname_prefix') . ' ') . $this->_getVar('user_last_name'); - $result['login_url'] = $orgResults['organization_login_url']; - $result['name'] = $this->getFullName(); + $result['bcc'] = $projResults['project_bcc']; + $result['email'] = $this->getEmailAddress(); + $result['first_name'] = $this->_getVar('user_first_name'); + $result['from'] = $this->getFrom(); + $result['full_name'] = trim($this->getGenderHello($locale) . ' ' . $this->getFullName()); + $result['greeting'] = $this->getGreeting($locale); + $result['last_name'] = ltrim($this->_getVar('user_surname_prefix') . ' ') . $this->_getVar('user_last_name'); + $result['login_url'] = $orgResults['organization_login_url']; + $result['name'] = $this->getFullName(); $result = $result + $orgResults + $projResults; - $result['reset_ask'] = $orgResults['organization_login_url'] . '/index/resetpassword'; - $result['reply_to'] = $result['from']; - $result['to'] = $result['email']; + $result['reset_ask'] = $orgResults['organization_login_url'] . '/index/resetpassword'; + $result['reset_in_hours'] = $this->definition->getResetKeyDurationInHours(); + $result['reply_to'] = $result['from']; + $result['to'] = $result['email']; return $result; } @@ -813,8 +814,8 @@ */ public function getResetPasswordMailFields($locale = null) { - $result['reset_key'] = $this->getPasswordResetKey(); - $result['reset_url'] = $this->getBaseOrganization()->getLoginUrl() . '/index/resetpassword/key/' . $result['reset_key']; + $result['reset_key'] = $this->getPasswordResetKey(); + $result['reset_url'] = $this->getBaseOrganization()->getLoginUrl() . '/index/resetpassword/key/' . $result['reset_key']; return $result + $this->getMailFields($locale); } @@ -1089,7 +1090,7 @@ } catch (Exception $e) { return array( - $this->_('Unable to send e-mail.'), + $this->translate->_('Unable to send e-mail.'), $e->getMessage()); } } Modified: trunk/library/classes/Gems/User/UserDefinitionAbstract.php =================================================================== --- trunk/library/classes/Gems/User/UserDefinitionAbstract.php 2012-04-04 18:33:08 UTC (rev 596) +++ trunk/library/classes/Gems/User/UserDefinitionAbstract.php 2012-04-05 12:12:41 UTC (rev 597) @@ -49,6 +49,13 @@ abstract class Gems_User_UserDefinitionAbstract extends MUtil_Registry_TargetAbstract implements Gems_User_UserDefinitionInterface { /** + * The time period in hours a reset key is valid for this definition. + * + * @var int + */ + protected $hoursResetKeyIsValid = 0; + + /** * Return true if a password reset key can be created. * * Returns the setting for the definition whan no user is passed, otherwise @@ -100,6 +107,16 @@ } /** + * Returns the number of hours a reset key remains valud + * + * @return int + */ + public function getResetKeyDurationInHours() + { + return $this->hoursResetKeyIsValid; + } + + /** * Returns true when users using this definition are staff members. * * Used only when the definition does not return a user_staff field. Modified: trunk/library/classes/Gems/User/UserDefinitionInterface.php =================================================================== --- trunk/library/classes/Gems/User/UserDefinitionInterface.php 2012-04-04 18:33:08 UTC (rev 596) +++ trunk/library/classes/Gems/User/UserDefinitionInterface.php 2012-04-05 12:12:41 UTC (rev 597) @@ -94,6 +94,13 @@ public function getPasswordResetKey(Gems_User_User $user); /** + * Returns the number of hours a reset key remains valud + * + * @return int + */ + public function getResetKeyDurationInHours(); + + /** * Returns a user object, that may be empty if the user is unknown. * * @param string $login_name Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2012-04-04 18:33:08 UTC (rev 596) +++ trunk/library/languages/default-en.po 2012-04-05 12:12:41 UTC (rev 597) @@ -1,8 +1,8 @@ msgid "" msgstr "" -"Project-Id-Version: Pulse EN\n" +"Project-Id-Version: GemsTracker EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-03 18:47+0100\n" +"POT-Creation-Date: 2012-04-05 14:09+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -1097,65 +1097,65 @@ msgstr "Please enter your username or e-mail address. " #: classes/Gems/Default/IndexAction.php:161 -msgid "We will then send you an e-mail with a link you can use to reset your password." -msgstr "We will then send you an e-mail with a link you can use to reset your password." +msgid "We will then send you an e-mail with a link. The link will bring you to a page where you can set a new password of your choice." +msgstr "We will then send you an e-mail with a link. The link will bring you to a page where you can set a new password of your choice." -#: classes/Gems/Default/IndexAction.php:165 +#: classes/Gems/Default/IndexAction.php:166 msgid "Execute password reset" msgstr "Execute password reset" -#: classes/Gems/Default/IndexAction.php:166 +#: classes/Gems/Default/IndexAction.php:167 msgid "We received your password reset request." msgstr "We received your password reset request." -#: classes/Gems/Default/IndexAction.php:169 +#: classes/Gems/Default/IndexAction.php:170 #, php-format msgid "Welcome to %s" msgstr "Welcome to %s" -#: classes/Gems/Default/IndexAction.php:170 +#: classes/Gems/Default/IndexAction.php:171 msgid "Welcome to this website." msgstr "Welcome to this website." -#: classes/Gems/Default/IndexAction.php:173 +#: classes/Gems/Default/IndexAction.php:174 msgid "Please enter your password of choice twice." msgstr "Please enter your password of choice twice." -#: classes/Gems/Default/IndexAction.php:207 +#: classes/Gems/Default/IndexAction.php:212 msgid "Your password must be changed." msgstr "Your password must be changed." -#: classes/Gems/Default/IndexAction.php:219 +#: classes/Gems/Default/IndexAction.php:224 #, php-format msgid "Login successful, welcome %s." msgstr "Login successful, welcome %s." -#: classes/Gems/Default/IndexAction.php:262 +#: classes/Gems/Default/IndexAction.php:267 #, php-format msgid "Good bye: %s." msgstr "Good bye: %s." -#: classes/Gems/Default/IndexAction.php:286 +#: classes/Gems/Default/IndexAction.php:291 msgid "Your password reset request is no longer valid, please request a new link." msgstr "Your password reset request is no longer valid, please request a new link." -#: classes/Gems/Default/IndexAction.php:288 +#: classes/Gems/Default/IndexAction.php:293 msgid "Your password input request is no longer valid, please request a new link." msgstr "Your password input request is no longer valid, please request a new link." -#: classes/Gems/Default/IndexAction.php:307 +#: classes/Gems/Default/IndexAction.php:312 msgid "We sent you an e-mail with a reset link. Click on the link in the e-mail." msgstr "We sent you an e-mail with a reset link. Click on the link in the e-mail." -#: classes/Gems/Default/IndexAction.php:315 +#: classes/Gems/Default/IndexAction.php:320 msgid "New password is active." msgstr "New password is active." -#: classes/Gems/Default/IndexAction.php:335 +#: classes/Gems/Default/IndexAction.php:340 msgid "Password reset requested" msgstr "Password reset requested" -#: classes/Gems/Default/IndexAction.php:336 +#: classes/Gems/Default/IndexAction.php:350 msgid "" "To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n" "{reset_url}" @@ -3633,11 +3633,11 @@ msgid "You are not allowed to login from this location." msgstr "You are not allowed to login from this location." -#: classes/Gems/User/User.php:1065 +#: classes/Gems/User/User.php:1066 msgid "Trying to send a password reset to a user that cannot be reset." msgstr "Trying to send a password reset to a user that cannot be reset." -#: classes/Gems/User/User.php:1092 +#: classes/Gems/User/User.php:1093 msgid "Unable to send e-mail." msgstr "Unable to send e-mail." @@ -3810,59 +3810,59 @@ msgid "Mr./Mrs." msgstr "Mr./Mrs." -#: classes/MUtil/Date.php:217 +#: classes/MUtil/Date.php:219 #, php-format msgid "%s ago" msgstr "%s ago" -#: classes/MUtil/Date.php:220 +#: classes/MUtil/Date.php:222 #, php-format msgid "%s to go" msgstr "%s to go" -#: classes/MUtil/Date.php:231 +#: classes/MUtil/Date.php:233 msgid "second" msgid_plural "seconds" msgstr[0] "second" msgstr[1] "seconds" -#: classes/MUtil/Date.php:234 +#: classes/MUtil/Date.php:236 msgid "minute" msgid_plural "minutes" msgstr[0] "minute" msgstr[1] "minutes" -#: classes/MUtil/Date.php:237 +#: classes/MUtil/Date.php:239 msgid "hour" msgid_plural "hours" msgstr[0] "hour" msgstr[1] "hours" -#: classes/MUtil/Date.php:240 +#: classes/MUtil/Date.php:242 msgid "day" msgid_plural "days" msgstr[0] "day" msgstr[1] "days" -#: classes/MUtil/Date.php:243 +#: classes/MUtil/Date.php:245 msgid "week" msgid_plural "weeks" msgstr[0] "week" msgstr[1] "weeks" -#: classes/MUtil/Date.php:246 +#: classes/MUtil/Date.php:248 msgid "month" msgid_plural "months" msgstr[0] "month" msgstr[1] "months" -#: classes/MUtil/Date.php:249 +#: classes/MUtil/Date.php:251 msgid "year" msgid_plural "years" msgstr[0] "year" msgstr[1] "years" -#: classes/MUtil/Date.php:252 +#: classes/MUtil/Date.php:254 msgid "decade" msgid_plural "decades" msgstr[0] "decade" Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2012-04-04 18:33:08 UTC (rev 596) +++ trunk/library/languages/default-nl.po 2012-04-05 12:12:41 UTC (rev 597) @@ -1,8 +1,8 @@ msgid "" msgstr "" -"Project-Id-Version: Pulse NL\n" +"Project-Id-Version: GemsTracker NL\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-03 17:15+0100\n" +"POT-Creation-Date: 2012-04-05 14:09+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -1097,65 +1097,65 @@ msgstr "Geef uw email adres of gebruikersnaam op. " #: classes/Gems/Default/IndexAction.php:161 -msgid "We will then send you an e-mail with a link you can use to reset your password." -msgstr "Daarna sturen wij een een email met een link waarmee u uw wachtwoord kan vervangen." +msgid "We will then send you an e-mail with a link. The link will bring you to a page where you can set a new password of your choice." +msgstr "Vervolgens sturen wij u een email met een link. De link verwijst naar een pagina waar u een zelfgekozen wachtwoord in kan voeren." -#: classes/Gems/Default/IndexAction.php:165 +#: classes/Gems/Default/IndexAction.php:166 msgid "Execute password reset" msgstr "Vervang vergeten passwood" -#: classes/Gems/Default/IndexAction.php:166 +#: classes/Gems/Default/IndexAction.php:167 msgid "We received your password reset request." msgstr "We hebben uw verzoek voor een nieuw wachtwoord ontvangen." -#: classes/Gems/Default/IndexAction.php:169 +#: classes/Gems/Default/IndexAction.php:170 #, php-format msgid "Welcome to %s" msgstr "Welkom bij %s" -#: classes/Gems/Default/IndexAction.php:170 +#: classes/Gems/Default/IndexAction.php:171 msgid "Welcome to this website." msgstr "Welkom op deze website." -#: classes/Gems/Default/IndexAction.php:173 +#: classes/Gems/Default/IndexAction.php:174 msgid "Please enter your password of choice twice." msgstr "Geef twee keer een zelfgekozen wachtwoord op." -#: classes/Gems/Default/IndexAction.php:207 +#: classes/Gems/Default/IndexAction.php:212 msgid "Your password must be changed." msgstr "Uw wachtwoord moet veranderd worden." -#: classes/Gems/Default/IndexAction.php:219 +#: classes/Gems/Default/IndexAction.php:224 #, php-format msgid "Login successful, welcome %s." msgstr "Login in orde, welkom %s." -#: classes/Gems/Default/IndexAction.php:262 +#: classes/Gems/Default/IndexAction.php:267 #, php-format msgid "Good bye: %s." msgstr "Tot ziens: %s." -#: classes/Gems/Default/IndexAction.php:286 +#: classes/Gems/Default/IndexAction.php:291 msgid "Your password reset request is no longer valid, please request a new link." msgstr "Uw verzoek om een nieuw wachtwoord is niet meer geldig, maar u kan hieronder een nieuwe link aanvragen." -#: classes/Gems/Default/IndexAction.php:288 +#: classes/Gems/Default/IndexAction.php:293 msgid "Your password input request is no longer valid, please request a new link." msgstr "Uw link om een wachtwoord in te voeren is niet meer geldig, maar u kan hieronder een nieuwe link aanvragen." -#: classes/Gems/Default/IndexAction.php:307 +#: classes/Gems/Default/IndexAction.php:312 msgid "We sent you an e-mail with a reset link. Click on the link in the e-mail." msgstr "We hebben u een email met reset link gestuurd. Klik op de link in de email." -#: classes/Gems/Default/IndexAction.php:315 +#: classes/Gems/Default/IndexAction.php:320 msgid "New password is active." msgstr "Nieuwe wachtwoord geactiveerd." -#: classes/Gems/Default/IndexAction.php:335 +#: classes/Gems/Default/IndexAction.php:340 msgid "Password reset requested" msgstr "Wachtwoord reset aangevraagd" -#: classes/Gems/Default/IndexAction.php:336 +#: classes/Gems/Default/IndexAction.php:350 msgid "" "To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n" "{reset_url}" @@ -3633,11 +3633,11 @@ msgid "You are not allowed to login from this location." msgstr "U kunt vanaf deze locatie niet inloggen." -#: classes/Gems/User/User.php:1065 +#: classes/Gems/User/User.php:1066 msgid "Trying to send a password reset to a user that cannot be reset." msgstr "Het wachtwoord voor deze gebruiker kan niet gewijzigd worden." -#: classes/Gems/User/User.php:1092 +#: classes/Gems/User/User.php:1093 msgid "Unable to send e-mail." msgstr "Verzenden email mislukt." @@ -3810,59 +3810,59 @@ msgid "Mr./Mrs." msgstr "De heer/Mevrouw" -#: classes/MUtil/Date.php:217 +#: classes/MUtil/Date.php:219 #, php-format msgid "%s ago" msgstr "%s geleden" -#: classes/MUtil/Date.php:220 +#: classes/MUtil/Date.php:222 #, php-format msgid "%s to go" msgstr "over %s" -#: classes/MUtil/Date.php:231 +#: classes/MUtil/Date.php:233 msgid "second" msgid_plural "seconds" msgstr[0] "seconde" msgstr[1] "seconden" -#: classes/MUtil/Date.php:234 +#: classes/MUtil/Date.php:236 msgid "minute" msgid_plural "minutes" msgstr[0] "minuut" msgstr[1] "minuten" -#: classes/MUtil/Date.php:237 +#: classes/MUtil/Date.php:239 msgid "hour" msgid_plural "hours" msgstr[0] "uur" msgstr[1] "uur" -#: classes/MUtil/Date.php:240 +#: classes/MUtil/Date.php:242 msgid "day" msgid_plural "days" msgstr[0] "dag" msgstr[1] "dagen" -#: classes/MUtil/Date.php:243 +#: classes/MUtil/Date.php:245 msgid "week" msgid_plural "weeks" msgstr[0] "week" msgstr[1] "weken" -#: classes/MUtil/Date.php:246 +#: classes/MUtil/Date.php:248 msgid "month" msgid_plural "months" msgstr[0] "maand" msgstr[1] "maanden" -#: classes/MUtil/Date.php:249 +#: classes/MUtil/Date.php:251 msgid "year" msgid_plural "years" msgstr[0] "jaar" msgstr[1] "jaren" -#: classes/MUtil/Date.php:252 +#: classes/MUtil/Date.php:254 msgid "decade" msgid_plural "decades" msgstr[0] "decennium" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-04 18:33:14
|
Revision: 596 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=596&view=rev Author: matijsdejong Date: 2012-04-04 18:33:08 +0000 (Wed, 04 Apr 2012) Log Message: ----------- Incorrect optimization removed from MUtil_Date Date Valid_Until now includes the whol day of the date specified. Modified Paths: -------------- trunk/library/classes/MUtil/Date.php trunk/library/snippets/EditTrackTokenSnippet.php Modified: trunk/library/classes/MUtil/Date.php =================================================================== --- trunk/library/classes/MUtil/Date.php 2012-04-03 16:52:44 UTC (rev 595) +++ trunk/library/classes/MUtil/Date.php 2012-04-04 18:33:08 UTC (rev 596) @@ -68,12 +68,14 @@ $val1 = intval($day1->getUnixTimestamp() / self::DAY_SECONDS); if (null === $date) { - $val2 = intval(time() / self::DAY_SECONDS); + // We must use date objects as unix timestamps do not take + // account of leap seconds. + $day2 = new MUtil_Date(); } else { $day2 = clone $date; - $day2->setTime(0); - $val2 = intval($day2->getUnixTimestamp() / self::DAY_SECONDS); } + $day2->setTime(0); + $val2 = intval($day2->getUnixTimestamp() / self::DAY_SECONDS); return $val1 - $val2; } Modified: trunk/library/snippets/EditTrackTokenSnippet.php =================================================================== --- trunk/library/snippets/EditTrackTokenSnippet.php 2012-04-03 16:52:44 UTC (rev 595) +++ trunk/library/snippets/EditTrackTokenSnippet.php 2012-04-04 18:33:08 UTC (rev 596) @@ -155,10 +155,18 @@ */ public function saveData() { + $model = $this->getModel(); + if ($this->formData['gto_valid_until']) { + // Make sure date based units are valid until the end of the day. + $date = new MUtil_Date($this->formData['gto_valid_until'], $model->get('gto_valid_until', 'dateFormat')); + $date->addDay(1); + $date->subSecond(1); + $this->formData['gto_valid_until'] = $date; + } + parent::saveData(); if ($this->formData[self::RECALCULATE_FIELD]) { - $model = $this->getModel(); // Refresh token with current form data $updateData['gto_valid_from'] = $model->getOnSave($this->formData['gto_valid_from'], true, 'gto_valid_from'); $updateData['gto_valid_until'] = $model->getOnSave($this->formData['gto_valid_until'], true, 'gto_valid_until'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-03 16:52:56
|
Revision: 595 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=595&view=rev Author: matijsdejong Date: 2012-04-03 16:52:44 +0000 (Tue, 03 Apr 2012) Log Message: ----------- Corrected some spelling mistakes Modified Paths: -------------- 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/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2012-04-03 15:33:20 UTC (rev 594) +++ trunk/library/languages/default-en.po 2012-04-03 16:52:44 UTC (rev 595) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-03 17:20+0100\n" +"POT-Creation-Date: 2012-04-03 18:47+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2012-04-03 15:33:20 UTC (rev 594) +++ trunk/library/languages/default-nl.po 2012-04-03 16:52:44 UTC (rev 595) @@ -1106,7 +1106,7 @@ #: classes/Gems/Default/IndexAction.php:166 msgid "We received your password reset request." -msgstr "We hebben uw verzoek om een nieuw wachtwoord ontvangen." +msgstr "We hebben uw verzoek voor een nieuw wachtwoord ontvangen." #: classes/Gems/Default/IndexAction.php:169 #, php-format @@ -1536,7 +1536,7 @@ #: classes/Gems/Default/OrganizationAction.php:125 #, php-format msgid "Always switch to this organization when %s is accessed from one of these space separated url's. The first is used for mails." -msgstr "Altijd naar deze organisatie overschakelen als %s vanaf één van deze door spatie gescheiden url's wordt aangeroepen. De eerste url wordt gebruikt voor e-mails." +msgstr "Altijd naar deze organisatie overschakelen als %s vanaf één van deze door spatie gescheiden url's wordt aangeroepen. De eerste url wordt gebruikt voor emails." #: classes/Gems/Default/OrganizationAction.php:136 msgid "Can the organization be used?" @@ -1896,7 +1896,7 @@ #: classes/Gems/Default/RespondentAction.php:162 msgid "Respondent has no e-mail" -msgstr "Patiënt zonder e-mail" +msgstr "Patiënt zonder email" #: classes/Gems/Default/RespondentAction.php:163 msgid "With housenumber" @@ -3639,7 +3639,7 @@ #: classes/Gems/User/User.php:1092 msgid "Unable to send e-mail." -msgstr "Verzenden e-mail mislukt." +msgstr "Verzenden email mislukt." #: classes/Gems/User/UserLoader.php:234 #: classes/Gems/User/UserLoader.php:248 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-03 15:33:29
|
Revision: 594 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=594&view=rev Author: matijsdejong Date: 2012-04-03 15:33:20 +0000 (Tue, 03 Apr 2012) Log Message: ----------- Database was fixed Modified Paths: -------------- trunk/library/configs/db/patches.sql Modified: trunk/library/configs/db/patches.sql =================================================================== --- trunk/library/configs/db/patches.sql 2012-04-03 15:27:25 UTC (rev 593) +++ trunk/library/configs/db/patches.sql 2012-04-03 15:33:20 UTC (rev 594) @@ -391,4 +391,4 @@ ALTER TABLE gems__user_logins CHANGE gul_can_login gul_can_login boolean not null default 0; -- PATCH: make reset keys unique so we now whose key it is -ALTER TABLE `pulse`.`gems__user_passwords` ADD UNIQUE (`gup_reset_key`); +ALTER TABLE `gems__user_passwords` ADD UNIQUE (`gup_reset_key`); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-03 15:27:36
|
Revision: 593 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=593&view=rev Author: matijsdejong Date: 2012-04-03 15:27:25 +0000 (Tue, 03 Apr 2012) Log Message: ----------- Password reset sends a unique key that identifies the user & organization Added user_resetkey_valid field to User.php ImgElement can now have dirs removed Updated translations Modified Paths: -------------- trunk/library/changelog.txt trunk/library/classes/Gems/Default/IndexAction.php trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php trunk/library/classes/Gems/User/Form/OrganizationFormAbstract.php trunk/library/classes/Gems/User/Organization.php trunk/library/classes/Gems/User/RespondentUserDefinition.php trunk/library/classes/Gems/User/StaffUserDefinition.php trunk/library/classes/Gems/User/User.php trunk/library/classes/Gems/User/UserLoader.php trunk/library/classes/MUtil/Html/ImgElement.php trunk/library/configs/db/patches.sql trunk/library/languages/default-en.mo trunk/library/languages/default-en.po trunk/library/languages/default-nl.mo trunk/library/languages/default-nl.po Added Paths: ----------- trunk/library/classes/Gems/User/Form/ResetRequestForm.php trunk/library/classes/Gems/User/Validate/ResetRequestValidator.php Removed Paths: ------------- trunk/library/classes/Gems/User/Form/ResetForm.php trunk/library/classes/Gems/User/Validate/ResetKeyValidator.php Modified: trunk/library/changelog.txt =================================================================== --- trunk/library/changelog.txt 2012-04-02 17:55:47 UTC (rev 592) +++ trunk/library/changelog.txt 2012-04-03 15:27:25 UTC (rev 593) @@ -4,7 +4,8 @@ Showing a list of organizations to choose during login happens except when 1) there is only one organization or 2) a url is used that is assigned to a specific organization. Login & other password forms are now easy to customize on a per project basis. Login and authorizaiton rules are easier to extend. -Alll password rules are reported during reset. +All password rules are reported during reset. +The password reset cycle send a link that can be used to change the password straight away. Important changes from 1.5.1 => 1.5.2 Modified: trunk/library/classes/Gems/Default/IndexAction.php =================================================================== --- trunk/library/classes/Gems/Default/IndexAction.php 2012-04-02 17:55:47 UTC (rev 592) +++ trunk/library/classes/Gems/Default/IndexAction.php 2012-04-03 15:27:25 UTC (rev 593) @@ -64,6 +64,13 @@ protected $organizationMaxLines = 6; /** + * When true, the rese4t form returns to the login page after sending a change request + * + * @var boolean + */ + protected $returnToLoginAfterReset = true; + + /** * The default behaviour for showing a lost password button * * @var boolean @@ -107,7 +114,7 @@ * * @return Gems_User_Form_ResetForm */ - protected function createResetForm() + protected function createResetRequestForm() { $args = MUtil_Ra::args(func_get_args(), array(), @@ -117,7 +124,7 @@ $this->initHtml(); - return $this->loader->getUserLoader()->getResetForm($args); + return $this->loader->getUserLoader()->getResetRequestForm($args); } /** @@ -127,27 +134,22 @@ */ protected function displayLoginForm(Gems_User_Form_LoginForm $form) { + $form->getUser()->setAsCurrentUser(); + $this->view->form = $form; } /** * Function for overruling the display of the reset form. * - * @param Gems_User_Form_ResetForm $form + * @param Gems_Form_AutoLoadFormAbstract $form Rset password or reset request form * @param mixed $errors */ - protected function displayResetForm(Gems_User_Form_ResetForm $form, $errors) + protected function displayResetForm(Gems_Form_AutoLoadFormAbstract $form, $errors, Gems_User_User $user = null) { - if ($form->hasResetKey()) { - $this->html->h3($this->_('Execute password reset')); - $p = $this->html->pInfo($this->_('We received your password reset request. ')); + if ($form instanceof Gems_User_Form_ResetRequestForm) { + $form->getUser()->setAsCurrentUser(); - if ($form->getOrganizationIsVisible()) { - $p->append($this->_('Please enter the organization and username/e-mail address belonging to this request.')); - } else { - $p->append($this->_('Please enter the username or e-mail address belonging to this request.')); - } - } else { $this->html->h3($this->_('Request password reset')); $p = $this->html->pInfo(); @@ -157,6 +159,18 @@ $p->append($this->_('Please enter your username or e-mail address. ')); } $p->append($this->_('We will then send you an e-mail with a link you can use to reset your password.')); + + } elseif ($form instanceof Gems_User_Form_ChangePasswordForm) { + if ($user->hasPassword()) { + $this->html->h3($this->_('Execute password reset')); + $p = $this->html->pInfo($this->_('We received your password reset request.')); + } else { + // New user + $this->html->h3(sprintf($this->_('Welcome to %s'), $this->project->getName())); + $p = $this->html->pInfo($this->_('Welcome to this website.')); + } + $p->append(' '); + $p->append($this->_('Please enter your password of choice twice.')); } if ($errors) { @@ -256,42 +270,71 @@ */ public function resetpasswordAction() { - $this->view->setScriptPath(GEMS_LIBRARY_DIR . '/views/scripts' ); - + $errors = array(); + $form = $this->createResetRequestForm(); $request = $this->getRequest(); - $errors = array(); - $form = $this->createResetForm(); - if ($request->isPost() && $form->isValid($request->getParams())) { + $user = null; - $user = $form->getUser(); + if ($key = $this->_getParam('key')) { + $user = $this->loader->getUserLoader()->getUserByResetKey($key); - If ($user->canResetPassword()) { - if ($key = $request->getParam('key')) { - // Key has been passed by mail - if ($user->checkPasswordResetKey($key)) { - $user->setPasswordResetRequired(true); - $user->setAsCurrentUser(); - $this->addMessage($this->_('Reset accepted, enter your new password.')); - $user->gotoStartPage($this->menu, $request); - return; + if ($user->hasValidResetKey()) { + $form = $user->getChangePasswordForm(array('askOld' => false)); + } else { + if (! $request->isPost()) { + if ($user->hasPassword() || (! $user->isActive())) { + $errors[] = $this->_('Your password reset request is no longer valid, please request a new link.'); } else { - $errors[] = $this->_('This key timed out or does not belong to this user.'); + $errors[] = $this->_('Your password input request is no longer valid, please request a new link.'); } - } else { - $subjectTemplate = $this->_('Password reset requested'); - $bbBodyTemplate = $this->_("To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n{reset_url}"); + } - $errors = $user->sendMail($subjectTemplate, $bbBodyTemplate, true); - if (! $errors) { - // Everything went OK! - $errors[] = $this->_('We sent you an e-mail with a reset link. Click on the link in the e-mail.'); + if ($user->isActive()) { + $form->getUserNameElement()->setValue($user->getLoginName()); + $form->getOrganizationElement()->setValue($user->getBaseOrganizationId()); + } + } + } + + if ($request->isPost() && $form->isValid($request->getPost())) { + + if ($form instanceof Gems_User_Form_ResetRequestForm) { + $user = $form->getUser(); + + $errors = $this->sendUserResetEMail($user); + if (! $errors) { + // Everything went OK! + $this->addMessage($this->_('We sent you an e-mail with a reset link. Click on the link in the e-mail.')); + + if ($this->returnToLoginAfterReset) { + $this->loader->getCurrentUser()->gotoStartPage($this->menu, $request); } } - } else { - $errors[] = $this->_('No such user found or no e-mail address known or user cannot be reset.'); + + } elseif ($form instanceof Gems_User_Form_ChangePasswordForm) { + $this->addMessage($this->_('New password is active.')); + + $user->setAsCurrentUser(); + $user->gotoStartPage($this->menu, $this->getRequest()); } + } + $form->populate($request->getParams()); - $this->displayResetForm($form, $errors); + $this->displayResetForm($form, $errors, $user); } + + /** + * Send the user an e-mail with a link for password reset + * + * @param Gems_User_User $user + * @return mixed string or array of Errors or null when successful. + */ + public function sendUserResetEMail(Gems_User_User $user) + { + $subjectTemplate = $this->_('Password reset requested'); + $bbBodyTemplate = $this->_("To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n{reset_url}"); + + return $user->sendMail($subjectTemplate, $bbBodyTemplate, true); + } } Modified: trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php =================================================================== --- trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php 2012-04-02 17:55:47 UTC (rev 592) +++ trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php 2012-04-03 15:27:25 UTC (rev 593) @@ -53,7 +53,14 @@ protected $db; /** + * The time period in hours a reset key is valid for this user. * + * @var int + */ + protected $hoursResetKeyIsValid = 24; + + /** + * * @var Gems_Project_ProjectSettings */ protected $project; @@ -157,7 +164,7 @@ $data['gup_id_user'] = $user->getUserLoginId(); - $row = $model->loadFirst($data + array('DATE_ADD(gup_reset_requested, INTERVAL 24 HOUR) >= CURRENT_TIMESTAMP')); + $row = $model->loadFirst($data + array('DATE_ADD(gup_reset_requested, INTERVAL ' . $this->hoursResetKeyIsValid . ' HOUR) >= CURRENT_TIMESTAMP')); if ($row && $row['gup_reset_key']) { // Keep using the key. $data['gup_reset_key'] = $row['gup_reset_key']; @@ -166,9 +173,16 @@ } $data['gup_reset_requested'] = new Zend_Db_Expr('CURRENT_TIMESTAMP'); - $model->save($data); + while (true) { + try { + $model->save($data); - return $data['gup_reset_key']; + return $data['gup_reset_key']; + + } catch (Zend_Db_Exception $zde) { + $data['gup_reset_key'] = $this->hashPassword(time() . $user->getEmailAddress()); + } + } } /** Modified: trunk/library/classes/Gems/User/Form/OrganizationFormAbstract.php =================================================================== --- trunk/library/classes/Gems/User/Form/OrganizationFormAbstract.php 2012-04-02 17:55:47 UTC (rev 592) +++ trunk/library/classes/Gems/User/Form/OrganizationFormAbstract.php 2012-04-03 15:27:25 UTC (rev 593) @@ -165,6 +165,7 @@ if (! $element instanceof Zend_Form_Element_Hidden) { $element = new Zend_Form_Element_Hidden($this->organizationFieldName); + $element->setValue($orgId); $this->addElement($element); } @@ -183,16 +184,15 @@ $element->setAttrib('size', max(count($orgs) + 1, $this->organizationMaxLines)); } $this->addElement($element); - + $element->setValue($orgId); } - $element->setValue($orgId); return $element; } /** * Returns true when the organization element is visible to the user. - * + * * @return boolean */ public function getOrganizationIsVisible() Deleted: trunk/library/classes/Gems/User/Form/ResetForm.php =================================================================== --- trunk/library/classes/Gems/User/Form/ResetForm.php 2012-04-02 17:55:47 UTC (rev 592) +++ trunk/library/classes/Gems/User/Form/ResetForm.php 2012-04-03 15:27:25 UTC (rev 593) @@ -1,201 +0,0 @@ -<?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 User - * @author Matijs de Jong <mj...@ma...> - * @copyright Copyright (c) 2012 Erasmus MC - * @license New BSD License - * @version $id: ResetForm.php 203 2012-01-01t 12:51:32Z matijs $ - */ - -/** - * - * - * @package Gems - * @subpackage User - * @copyright Copyright (c) 2012 Erasmus MC - * @license New BSD License - * @since Class available since version 1.5.3 - */ -class Gems_User_Form_ResetForm extends Gems_User_Form_OrganizationFormAbstract -{ - /** - * The field name for the login link element - * - * @var string - */ - protected $_loginLinkFieldName = 'loginlink'; - - /** - * The field name for the reset key element. - * - * @var string - */ - protected $_resetKeyFieldName = 'key'; - - /** - * First the password reset is requested (= false), then the reset key is passed (= true) - * - * @var boolean Calculated when null - */ - protected $hasResetKey = null; - - /** - * Returns an html link for the login page. - * - * @return MUtil_Html_AElement - */ - public function getLoginLink() - { - return MUtil_Html::create('a', array('controller' => 'index', 'action' => 'login'), $this->translate->_('Back to login'), array('class' => 'actionlink')); - } - - /** - * Returns a link to the login page - * - * @return MUtil_Form_Element_Html - */ - public function getLoginLinkElement() - { - $element = $this->getElement($this->_tokenFieldName); - - if (! $element) { - // Login link - if ($link = $this->getLoginLink()) { - $element = new MUtil_Form_Element_Html($this->_loginLinkFieldName); - // $element->br(); - $element->setValue($link); - - $this->addElement($element); - } - - return $element; - } - } - - /** - * Returns an element for keeping a reset key. - * - * @return Zend_Form_Element_Hidden - */ - public function getResetKeyElement() - { - $element = $this->getElement($this->_resetKeyFieldName); - - if (! $element) { - $element = new Zend_Form_Element_Hidden($this->_resetKeyFieldName); - - $this->addElement($element); - } - - return $element; - } - - /** - * Returns the label for the submitbutton - * - * @return string - */ - public function getSubmitButtonLabel() - { - if ($this->hasResetKey()) { - return $this->translate->_('Reset password'); - } else { - return $this->translate->_('Request password'); - } - } - - /** - * Returns/sets a login name element. - * - * @return Zend_Form_Element_Text - * / - public function getUserNameElement() - { - $element = $this->getElement($this->usernameFieldName); - - if (! $element) { - $element = parent::getUserNameElement(); - - $element->addValidator(new Gems_User_Validate_ResetKeyValidator($this, $this->translate, $this->_resetKeyFieldName)); - } - - return $element; - } - - /** - * Is the form working in reset mode or not - * - * @return boolean - */ - public function hasResetKey() - { - if (null === $this->hasResetKey) { - $request = $this->getRequest(); - - $this->hasResetKey = (boolean) $request->getParam($this->_resetKeyFieldName, false); - } - - return $this->hasResetKey; - } - - /** - * The function that determines the element load order - * - * @return Gems_User_Form_LoginForm (continuation pattern) - */ - public function loadDefaultElements() - { - if ($this->hasResetKey()) { - $this->getResetKeyElement(); - } - $this->getOrganizationElement(); - $this->getUserNameElement(); - $this->getSubmitButton(); - $this->getLoginLinkElement(); - - return $this; - } - - /** - * Is the form working in reset mode or not - * - * Enables loading of parameter through Zend_Form::__construct() - * - * @param boolean $hasKey - * @return Gems_User_Form_ResetForm (continuation pattern) - */ - public function setHasResetKey($hasKey = true) - { - $this->hasResetKey = $hasKey; - - return $this; - } -} Added: trunk/library/classes/Gems/User/Form/ResetRequestForm.php =================================================================== --- trunk/library/classes/Gems/User/Form/ResetRequestForm.php (rev 0) +++ trunk/library/classes/Gems/User/Form/ResetRequestForm.php 2012-04-03 15:27:25 UTC (rev 593) @@ -0,0 +1,131 @@ +<?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 User + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: ResetForm.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage User + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.3 + */ +class Gems_User_Form_ResetRequestForm extends Gems_User_Form_OrganizationFormAbstract +{ + /** + * The field name for the login link element + * + * @var string + */ + protected $_loginLinkFieldName = 'loginlink'; + + /** + * Returns an html link for the login page. + * + * @return MUtil_Html_AElement + */ + public function getLoginLink() + { + return MUtil_Html::create('a', array('controller' => 'index', 'action' => 'login'), $this->translate->_('Back to login'), array('class' => 'actionlink')); + } + + /** + * Returns a link to the login page + * + * @return MUtil_Form_Element_Html + */ + public function getLoginLinkElement() + { + $element = $this->getElement($this->_tokenFieldName); + + if (! $element) { + // Login link + if ($link = $this->getLoginLink()) { + $element = new MUtil_Form_Element_Html($this->_loginLinkFieldName); + // $element->br(); + $element->setValue($link); + + $this->addElement($element); + } + + return $element; + } + } + + /** + * Returns the label for the submitbutton + * + * @return string + */ + public function getSubmitButtonLabel() + { + return $this->translate->_('Request reset'); + } + + /** + * Returns/sets a login name element. + * + * @return Zend_Form_Element_Text + */ + public function getUserNameElement() + { + $element = $this->getElement($this->usernameFieldName); + + if (! $element) { + $element = parent::getUserNameElement(); + + $element->addValidator(new Gems_User_Validate_ResetRequestValidator($this, $this->translate)); + } + + return $element; + } + + /** + * The function that determines the element load order + * + * @return Gems_User_Form_LoginForm (continuation pattern) + */ + public function loadDefaultElements() + { + $this->getOrganizationElement(); + $this->getUserNameElement(); + $this->getSubmitButton(); + $this->getLoginLinkElement(); + + return $this; + } +} Modified: trunk/library/classes/Gems/User/Organization.php =================================================================== --- trunk/library/classes/Gems/User/Organization.php 2012-04-02 17:55:47 UTC (rev 592) +++ trunk/library/classes/Gems/User/Organization.php 2012-04-03 15:27:25 UTC (rev 593) @@ -71,13 +71,26 @@ ); /** + * Required * + * @var Gems_Util_BasePath + */ + protected $basepath; + + /** + * * @var Zend_Db_Adapter_Abstract */ protected $db; /** * + * @var Gems_Project_ProjectSettings + */ + protected $project; + + /** + * * @var Gems_Util */ protected $util; @@ -317,6 +330,27 @@ } /** + * Set this organization as teh one currently active + * + * @return Gems_User_Organization (continutation pattern) + */ + public function setAsCurrentOrganization() + { + $organizationId = $this->getId(); + + if (! Gems_Cookies::setOrganization($organizationId, $this->basepath->getBasePath())) { + throw new Exception($this->translate->_('Cookies must be enabled for this site.')); + } + + $escort = GemsEscort::getInstance(); + if ($escort instanceof Gems_Project_Layout_MultiLayoutInterface) { + $escort->layoutSwitch($this->getStyle()); + } + + return $this; + } + + /** * Tell the organization there is at least one respondent attached to it. * * Does nothing if this is already known. Modified: trunk/library/classes/Gems/User/RespondentUserDefinition.php =================================================================== --- trunk/library/classes/Gems/User/RespondentUserDefinition.php 2012-04-02 17:55:47 UTC (rev 592) +++ trunk/library/classes/Gems/User/RespondentUserDefinition.php 2012-04-03 15:27:25 UTC (rev 593) @@ -83,7 +83,8 @@ )) ->joinLeft('gems__user_passwords', 'gul_id_user = gup_id_user', array( 'user_password_reset' => 'gup_reset_required', - )) + 'user_resetkey_valid' => 'CASE WHEN DATE_ADD(gup_reset_requested, INTERVAL ' . $this->hoursResetKeyIsValid . ' HOUR) >= CURRENT_TIMESTAMP THEN 1 ELSE 0 END', + )) ->joinLeft('gems__reception_codes', 'gr2o_reception_code = grc_id_reception_code', array()) ->where('ggp_group_active = 1') ->where('grc_success = 1') Modified: trunk/library/classes/Gems/User/StaffUserDefinition.php =================================================================== --- trunk/library/classes/Gems/User/StaffUserDefinition.php 2012-04-02 17:55:47 UTC (rev 592) +++ trunk/library/classes/Gems/User/StaffUserDefinition.php 2012-04-03 15:27:25 UTC (rev 593) @@ -82,6 +82,7 @@ )) ->joinLeft('gems__user_passwords', 'gul_id_user = gup_id_user', array( 'user_password_reset' => 'gup_reset_required', + 'user_resetkey_valid' => 'CASE WHEN DATE_ADD(gup_reset_requested, INTERVAL ' . $this->hoursResetKeyIsValid . ' HOUR) >= CURRENT_TIMESTAMP THEN 1 ELSE 0 END', )) ->where('ggp_group_active = 1') ->where('gsf_active = 1') @@ -90,6 +91,8 @@ ->where('gul_id_organization = ?') ->limit(1); + // MUtil_Echo::track($select->__toString()); + return $select; } } \ No newline at end of file Modified: trunk/library/classes/Gems/User/User.php =================================================================== --- trunk/library/classes/Gems/User/User.php 2012-04-02 17:55:47 UTC (rev 592) +++ trunk/library/classes/Gems/User/User.php 2012-04-03 15:27:25 UTC (rev 593) @@ -68,13 +68,6 @@ /** * Required * - * @var Gems_Util_BasePath - */ - protected $basepath; - - /** - * Required - * * @var Zend_Db_Adapter_Abstract */ protected $db; @@ -517,7 +510,7 @@ } } - return (boolean) $this->acl && $this->basepath && $this->userLoader; + return (boolean) $this->acl && $this->userLoader; } /** @@ -946,7 +939,17 @@ } /** + * True when the reset key is within it's timeframe * + * @return boolean + */ + public function hasValidResetKey() + { + return (boolean) $this->_getVar('user_resetkey_valid'); + } + + /** + * * @return boolean True when a user can log in. */ public function isActive() @@ -1181,6 +1184,8 @@ } } + $this->getCurrentOrganization()->setAsCurrentOrganization(); + return $this; } @@ -1210,39 +1215,31 @@ $this->_setVar('user_organization_name', $organization->getName()); $this->_setVar('user_style', $organization->getStyle()); // End depreciation warning + } + if ($this->isCurrentUser()) { + $this->getCurrentOrganization()->setAsCurrentOrganization(); - if ($this->isCurrentUser()) { - if (! Gems_Cookies::setOrganization($organizationId, $this->basepath->getBasePath())) { - throw new Exception($this->translate->_('Cookies must be enabled for this site.')); - } + // Now update the requestcache to change the oldOrgId to the new orgId + // Don't do it when the oldOrgId doesn't match + if ($requestCache = $this->session->requestCache) { - $escort = GemsEscort::getInstance(); - if ($escort instanceof Gems_Project_Layout_MultiLayoutInterface) { - $escort->layoutSwitch($organization->getStyle()); - } + //Create the list of request cache keys that match an organization ID (to be extended) + $possibleOrgIds = array( + 'gr2o_id_organization', + 'gto_id_organization'); - // Now update the requestcache to change the oldOrgId to the new orgId - // Don't do it when the oldOrgId doesn't match - if ($requestCache = $this->session->requestCache) { - - //Create the list of request cache keys that match an organization ID (to be extended) - $possibleOrgIds = array( - 'gr2o_id_organization', - 'gto_id_organization'); - - foreach ($requestCache as $key => $value) { - if (is_array($value)) { - foreach ($value as $paramKey => $paramValue) { - if (in_array($paramKey, $possibleOrgIds)) { - if ($paramValue == $oldOrganizationId) { - $requestCache[$key][$paramKey] = $organizationId; - } + foreach ($requestCache as $key => $value) { + if (is_array($value)) { + foreach ($value as $paramKey => $paramValue) { + if (in_array($paramKey, $possibleOrgIds)) { + if ($paramValue == $oldOrganizationId) { + $requestCache[$key][$paramKey] = $organizationId; } } } } - $this->session->requestCache = $requestCache; } + $this->session->requestCache = $requestCache; } } } Modified: trunk/library/classes/Gems/User/UserLoader.php =================================================================== --- trunk/library/classes/Gems/User/UserLoader.php 2012-04-02 17:55:47 UTC (rev 592) +++ trunk/library/classes/Gems/User/UserLoader.php 2012-04-03 15:27:25 UTC (rev 593) @@ -212,6 +212,9 @@ if (! isset($values['user_staff'])) { $values['user_staff'] = $definition->isStaff(); } + if (! isset($values['user_resetkey_valid'])) { + $values['user_resetkey_valid'] = false; + } if ($defName) { $values['__user_definition'] = $defName; @@ -301,9 +304,7 @@ { $args = MUtil_Ra::args(func_get_args()); - $form = $this->_loadClass('Form_LoginForm', true, array($args)); - - return $form; + return $this->_loadClass('Form_LoginForm', true, array($args)); } /** @@ -321,6 +322,7 @@ $user = $this->getCurrentUser(); if (! $user->isActive()) { + // Check url only when not logged im $organizationId = $this->getOrganizationIdByUrl(); } @@ -393,19 +395,13 @@ * Returns a reset form for handling both the incoming request and the outgoing reset request * * @param mixed $args_array MUtil_Ra::args array for LoginForm initiation. - * @return Gems_User_Form_ResetForm + * @return Gems_User_Form_ResetRequestForm */ - public function getResetForm($args_array = null) + public function getResetRequestForm($args_array = null) { $args = MUtil_Ra::args(func_get_args()); - if (isset($args['description'])) { - $args['description'] = sprintf($args['description'], $this->project->getName()); - } - - $form = $this->_loadClass('Form_ResetForm', true, array($args)); - - return $form; + return $this->_loadClass('Form_ResetRequestForm', true, array($args)); } /** @@ -420,8 +416,7 @@ $user = $this->getUserClass($login_name, $currentOrganization); // Check: can the user log in as this organization, if not load non-existing user - $orgs = $user->getAllowedOrganizations(); - if (! isset($orgs[$currentOrganization])) { + if (! $user->isAllowedOrganization($currentOrganization)) { $user = $this->loadUser(self::USER_NOLOGIN, $currentOrganization, $login_name); } @@ -431,6 +426,31 @@ } /** + * Get the user having the reset key specified + * + * @param string $resetKey + * @return Gems_User_User But ! ->isActive when the user does not exist + */ + public function getUserByResetKey($resetKey) + { + if ((null == $resetKey) || (0 == strlen(trim($resetKey)))) { + return $this->loadUser(self::USER_NOLOGIN, null, null); + } + + $select = $this->db->select(); + $select->from('gems__user_passwords', array()) + ->joinLeft('gems__user_logins', 'gup_id_user = gul_id_user', array("gul_user_class", 'gul_id_organization', 'gul_login')) + ->where('gup_reset_key = ?', $resetKey); + + if ($row = $this->db->fetchRow($select, null, Zend_Db::FETCH_NUM)) { + // MUtil_Echo::track($row); + return $this->loadUser($row[0], $row[1], $row[2]); + } + + return $this->loadUser(self::USER_NOLOGIN, null, null); + } + + /** * Get a staff user using the $staff_id * * @param int $staff_id Deleted: trunk/library/classes/Gems/User/Validate/ResetKeyValidator.php =================================================================== --- trunk/library/classes/Gems/User/Validate/ResetKeyValidator.php 2012-04-02 17:55:47 UTC (rev 592) +++ trunk/library/classes/Gems/User/Validate/ResetKeyValidator.php 2012-04-03 15:27:25 UTC (rev 593) @@ -1,129 +0,0 @@ -<?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 User - * @author Matijs de Jong <mj...@ma...> - * @copyright Copyright (c) 2012 Erasmus MC - * @license New BSD License - * @version $id: ResetKeyValidator.php 203 2012-01-01t 12:51:32Z matijs $ - */ - -/** - * - * - * @package Gems - * @subpackage User - * @copyright Copyright (c) 2012 Erasmus MC - * @license New BSD License - * @since Class available since version 1.5.3 - */ -class Gems_User_Validate_ResetKeyValidator implements Zend_Validate_Interface -{ - /** - * The error message - * - * @var string - */ - private $_message; - - /** - * - * @var Gems_User_Validate_GetUserInterface - */ - private $_userSource; - - /** - * - * @var string - */ - private $fieldName; - - /** - * - * @var Zend_Translate - */ - private $translate; - - /** - * - * @param Gems_User_Validate_GetUserInterface $userSource The source for the user - * @param Zend_Translate $translate - * @param string $fieldName Optional field name (hidden fields are not validated) - */ - public function __construct(Gems_User_Validate_GetUserInterface $userSource, Zend_Translate $translate, $fieldName) - { - $this->_userSource = $userSource; - $this->translate = $translate; - $this->fieldName = $fieldName; - } - - /** - * - * @param string $message Default message for standard login fail. - */ - public function getMessages() - { - return array($this->_message); - } - - /** - * Returns true if and only if $value meets the validation requirements - * - * If $value fails validation, then this method returns false, and - * getMessages() will return an array of messages that explain why the - * validation failed. - * - * @param mixed $value - * @param mixed $content - * @return boolean - * @throws Zend_Validate_Exception If validation of $value is impossible - */ - public function isValid($value, $context = array()) - { - $this->_message = null; - - $user = $this->_userSource->getUser(); - - If ($user->isActive() && $user->canResetPassword()) { - $key = isset($context[$this->fieldName]) ? $context[$this->fieldName] : $valid; - if ($key) { - // Key has been passed by mail - if (! $user->checkPasswordResetKey($key)) { - $this->_message = $this->translate->_('This key timed out or does not belong to this user.'); - } - } - MUtil_Echo::track($key, $context, $this->_message); - } else { - $this->_message = $this->translate->_('No such user found or no e-mail address known or user cannot be reset.'); - } - - return (boolean) ! $this->_message; - } -} Added: trunk/library/classes/Gems/User/Validate/ResetRequestValidator.php =================================================================== --- trunk/library/classes/Gems/User/Validate/ResetRequestValidator.php (rev 0) +++ trunk/library/classes/Gems/User/Validate/ResetRequestValidator.php 2012-04-03 15:27:25 UTC (rev 593) @@ -0,0 +1,112 @@ +<?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 User + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: ResetKeyValidator.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage User + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.3 + */ +class Gems_User_Validate_ResetRequestValidator implements Zend_Validate_Interface +{ + /** + * The error message + * + * @var string + */ + private $_message; + + /** + * + * @var Gems_User_Validate_GetUserInterface + */ + private $_userSource; + + /** + * + * @var Zend_Translate + */ + private $translate; + + /** + * + * @param Gems_User_Validate_GetUserInterface $userSource The source for the user + * @param Zend_Translate $translate + */ + public function __construct(Gems_User_Validate_GetUserInterface $userSource, Zend_Translate $translate) + { + $this->_userSource = $userSource; + $this->translate = $translate; + } + + /** + * + * @param string $message Default message for standard login fail. + */ + public function getMessages() + { + return array($this->_message); + } + + /** + * Returns true if and only if $value meets the validation requirements + * + * If $value fails validation, then this method returns false, and + * getMessages() will return an array of messages that explain why the + * validation failed. + * + * @param mixed $value + * @param mixed $content + * @return boolean + * @throws Zend_Validate_Exception If validation of $value is impossible + */ + public function isValid($value, $context = array()) + { + $this->_message = null; + + $user = $this->_userSource->getUser(); + + If (! ($user->isActive() && $user->canResetPassword() && $user->isAllowedOrganization($context['organization']))) { + $this->_message = $this->translate->_('User not found or no e-mail address known or user cannot be reset.'); + } + + return (boolean) ! $this->_message; + } +} Modified: trunk/library/classes/MUtil/Html/ImgElement.php =================================================================== --- trunk/library/classes/MUtil/Html/ImgElement.php 2012-04-02 17:55:47 UTC (rev 592) +++ trunk/library/classes/MUtil/Html/ImgElement.php 2012-04-03 15:27:25 UTC (rev 593) @@ -225,6 +225,27 @@ } /** + * Remove a directory from the list of search directories. + * + * @param string $dir Directory name. Slashes added when needed. + */ + public static function removeImageDir($dir) + { + if (! $dir) { + $dir = '/'; + } elseif ('/' != $dir[0]) { + $dir = '/' . $dir; + } + if ('/' != $dir[strlen($dir) - 1]) { + $dir .= '/'; + } + + if ($key = array_search($dir, self::$_imageDirs)) { + unset(self::$_imageDirs[$key]); + } + } + + /** * Function to allow overloading of tag rendering only * * Renders the element tag with it's content into a html string Modified: trunk/library/configs/db/patches.sql =================================================================== --- trunk/library/configs/db/patches.sql 2012-04-02 17:55:47 UTC (rev 592) +++ trunk/library/configs/db/patches.sql 2012-04-03 15:27:25 UTC (rev 593) @@ -389,3 +389,6 @@ -- PATCH: logins are sometimes added autmatically as part of outer join ALTER TABLE gems__user_logins CHANGE gul_can_login gul_can_login boolean not null default 0; + +-- PATCH: make reset keys unique so we now whose key it is +ALTER TABLE `pulse`.`gems__user_passwords` ADD UNIQUE (`gup_reset_key`); Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2012-04-02 17:55:47 UTC (rev 592) +++ trunk/library/languages/default-en.po 2012-04-03 15:27:25 UTC (rev 593) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-02 19:39+0100\n" +"POT-Creation-Date: 2012-04-03 17:20+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -1084,65 +1084,78 @@ msgid "Administrative groups" msgstr "Administrative groups" -#: classes/Gems/Default/IndexAction.php:142 +#: classes/Gems/Default/IndexAction.php:153 msgid "Request password reset" msgstr "Request password reset" -#: classes/Gems/Default/IndexAction.php:143 -msgid "We received your password reset request. " -msgstr "We received your password reset request. " - -#: classes/Gems/Default/IndexAction.php:146 -msgid "Please enter the organization and username/e-mail address belonging to this request." -msgstr "Please enter the organization and username/e-mail address belonging to this request." - -#: classes/Gems/Default/IndexAction.php:148 -msgid "Please enter the username or e-mail address belonging to this request." -msgstr "Please enter the username or e-mail address belonging to this request." - -#: classes/Gems/Default/IndexAction.php:151 -msgid "Execute password reset" -msgstr "Execute password reset" - -#: classes/Gems/Default/IndexAction.php:155 +#: classes/Gems/Default/IndexAction.php:157 msgid "Please enter your organization and your username or e-mail address. " msgstr "Please enter your organization and your username or e-mail address. " -#: classes/Gems/Default/IndexAction.php:157 +#: classes/Gems/Default/IndexAction.php:159 msgid "Please enter your username or e-mail address. " msgstr "Please enter your username or e-mail address. " -#: classes/Gems/Default/IndexAction.php:159 +#: classes/Gems/Default/IndexAction.php:161 msgid "We will then send you an e-mail with a link you can use to reset your password." msgstr "We will then send you an e-mail with a link you can use to reset your password." -#: classes/Gems/Default/IndexAction.php:193 +#: classes/Gems/Default/IndexAction.php:165 +msgid "Execute password reset" +msgstr "Execute password reset" + +#: classes/Gems/Default/IndexAction.php:166 +msgid "We received your password reset request." +msgstr "We received your password reset request." + +#: classes/Gems/Default/IndexAction.php:169 +#, php-format +msgid "Welcome to %s" +msgstr "Welcome to %s" + +#: classes/Gems/Default/IndexAction.php:170 +msgid "Welcome to this website." +msgstr "Welcome to this website." + +#: classes/Gems/Default/IndexAction.php:173 +msgid "Please enter your password of choice twice." +msgstr "Please enter your password of choice twice." + +#: classes/Gems/Default/IndexAction.php:207 msgid "Your password must be changed." msgstr "Your password must be changed." -#: classes/Gems/Default/IndexAction.php:205 +#: classes/Gems/Default/IndexAction.php:219 #, php-format msgid "Login successful, welcome %s." msgstr "Login successful, welcome %s." -#: classes/Gems/Default/IndexAction.php:248 +#: classes/Gems/Default/IndexAction.php:262 #, php-format msgid "Good bye: %s." msgstr "Good bye: %s." -#: classes/Gems/Default/IndexAction.php:274 -msgid "Reset accepted, enter your new password." -msgstr "Reset accepted, enter your new password." +#: classes/Gems/Default/IndexAction.php:286 +msgid "Your password reset request is no longer valid, please request a new link." +msgstr "Your password reset request is no longer valid, please request a new link." -#: classes/Gems/Default/IndexAction.php:278 -msgid "This key timed out or does not belong to this user." -msgstr "This key timed out or does not belong to this user." +#: classes/Gems/Default/IndexAction.php:288 +msgid "Your password input request is no longer valid, please request a new link." +msgstr "Your password input request is no longer valid, please request a new link." -#: classes/Gems/Default/IndexAction.php:281 +#: classes/Gems/Default/IndexAction.php:307 +msgid "We sent you an e-mail with a reset link. Click on the link in the e-mail." +msgstr "We sent you an e-mail with a reset link. Click on the link in the e-mail." + +#: classes/Gems/Default/IndexAction.php:315 +msgid "New password is active." +msgstr "New password is active." + +#: classes/Gems/Default/IndexAction.php:335 msgid "Password reset requested" msgstr "Password reset requested" -#: classes/Gems/Default/IndexAction.php:282 +#: classes/Gems/Default/IndexAction.php:336 msgid "" "To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n" "{reset_url}" @@ -1150,14 +1163,6 @@ "To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n" "{reset_url}" -#: classes/Gems/Default/IndexAction.php:287 -msgid "We sent you an e-mail with a reset link. Click on the link in the e-mail." -msgstr "We sent you an e-mail with a reset link. Click on the link in the e-mail." - -#: classes/Gems/Default/IndexAction.php:291 -msgid "No such user found or no e-mail address known or user cannot be reset." -msgstr "No such user found or no e-mail address known or user cannot be reset." - #: classes/Gems/Default/InvitationAction.php:52 msgid "Invite" msgstr "Invite" @@ -1473,10 +1478,6 @@ msgid "You are not allowed to change your password." msgstr "You are not allowed to change your password." -#: classes/Gems/Default/OptionAction.php:94 -msgid "New password is active." -msgstr "New password is active." - #: classes/Gems/Default/OptionAction.php:129 msgid "Login Name" msgstr "Login Name" @@ -3556,6 +3557,10 @@ msgid "- %s" msgstr "- %s" +#: classes/Gems/User/Organization.php:342 +msgid "Cookies must be enabled for this site." +msgstr "Cookies must be enabled for this site." + #: classes/Gems/User/PasswordChecker.php:95 #, php-format msgid "should contain at least one uppercase character" @@ -3617,35 +3622,31 @@ msgid "Shared secret" msgstr "Shared secret" -#: classes/Gems/User/User.php:415 +#: classes/Gems/User/User.php:408 #, php-format msgid "Your account is temporarily blocked, please wait a minute." msgid_plural "Your account is temporarily blocked, please wait %d minutes." msgstr[0] "Your account is temporarily blocked, please wait a minute." msgstr[1] "Your account is temporarily blocked, please wait %d minutes." -#: classes/Gems/User/User.php:450 +#: classes/Gems/User/User.php:443 msgid "You are not allowed to login from this location." msgstr "You are not allowed to login from this location." -#: classes/Gems/User/User.php:1062 +#: classes/Gems/User/User.php:1065 msgid "Trying to send a password reset to a user that cannot be reset." msgstr "Trying to send a password reset to a user that cannot be reset." -#: classes/Gems/User/User.php:1089 +#: classes/Gems/User/User.php:1092 msgid "Unable to send e-mail." msgstr "Unable to send e-mail." -#: classes/Gems/User/User.php:1216 -msgid "Cookies must be enabled for this site." -msgstr "Cookies must be enabled for this site." - -#: classes/Gems/User/UserLoader.php:231 -#: classes/Gems/User/UserLoader.php:245 +#: classes/Gems/User/UserLoader.php:234 +#: classes/Gems/User/UserLoader.php:248 msgid "Db storage" msgstr "Db storage" -#: classes/Gems/User/UserLoader.php:246 +#: classes/Gems/User/UserLoader.php:249 msgid "Radius storage" msgstr "Radius storage" @@ -3695,14 +3696,18 @@ msgid "Username" msgstr "Username" -#: classes/Gems/User/Form/ResetForm.php:77 +#: classes/Gems/User/Form/ResetRequestForm.php:63 msgid "Back to login" msgstr "Back to login" -#: classes/Gems/User/Form/ResetForm.php:131 -msgid "Request password" -msgstr "Request password" +#: classes/Gems/User/Form/ResetRequestForm.php:96 +msgid "Request reset" +msgstr "Request reset" +#: classes/Gems/User/Validate/ResetRequestValidator.php:107 +msgid "User not found or no e-mail address known or user cannot be reset." +msgstr "User not found or no e-mail address known or user cannot be reset." + #: classes/Gems/Util/ReceptionCodeLibrary.php:100 msgid "Yes (forget answers)" msgstr "Yes (forget answers)" @@ -4194,6 +4199,27 @@ msgid "Can access" msgstr "Can access" +#~ msgid "" +#~ "Please enter the organization and username/e-mail address belonging to " +#~ "this request." +#~ msgstr "" +#~ "Please enter the organization and username/e-mail address belonging to " +#~ "this request." + +#~ msgid "" +#~ "Please enter the username or e-mail address belonging to this request." +#~ msgstr "" +#~ "Please enter the username or e-mail address belonging to this request." + +#~ msgid "Reset accepted, enter your new password." +#~ msgstr "Reset accepted, enter your new password." + +#~ msgid "This key timed out or does not belong to this user." +#~ msgstr "This key timed out or does not belong to this user." + +#~ msgid "Request password" +#~ msgstr "Request password" + #~ msgid "Login to %s application" #~ msgstr "Login to %s application" Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2012-04-02 17:55:47 UTC (rev 592) +++ trunk/library/languages/default-nl.po 2012-04-03 15:27:25 UTC (rev 593) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse NL\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-02 19:39+0100\n" +"POT-Creation-Date: 2012-04-03 17:15+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -1084,65 +1084,78 @@ msgid "Administrative groups" msgstr "Beheer groepen" -#: classes/Gems/Default/IndexAction.php:142 +#: classes/Gems/Default/IndexAction.php:153 msgid "Request password reset" msgstr "Wachtwoord vergeten?" -#: classes/Gems/Default/IndexAction.php:143 -msgid "We received your password reset request. " -msgstr "We hebben uw verzoek om een nieuw wachtwoord ontvangen." +#: classes/Gems/Default/IndexAction.php:157 +msgid "Please enter your organization and your username or e-mail address. " +msgstr "Geef uw organisatie en uw email adres of de gebruikersnaam op. " -#: classes/Gems/Default/IndexAction.php:146 -msgid "Please enter the organization and username/e-mail address belonging to this request." -msgstr "Voer de organisatie en de gebruikersnaam of het e-mail adres in die bij dit verzoek horen." +#: classes/Gems/Default/IndexAction.php:159 +msgid "Please enter your username or e-mail address. " +msgstr "Geef uw email adres of gebruikersnaam op. " -#: classes/Gems/Default/IndexAction.php:148 -msgid "Please enter the username or e-mail address belonging to this request." -msgstr "Voer de gebruikersnaam of het e-mail adres in die bij dit verzoek horen." +#: classes/Gems/Default/IndexAction.php:161 +msgid "We will then send you an e-mail with a link you can use to reset your password." +msgstr "Daarna sturen wij een een email met een link waarmee u uw wachtwoord kan vervangen." -#: classes/Gems/Default/IndexAction.php:151 +#: classes/Gems/Default/IndexAction.php:165 msgid "Execute password reset" msgstr "Vervang vergeten passwood" -#: classes/Gems/Default/IndexAction.php:155 -msgid "Please enter your organization and your username or e-mail address. " -msgstr "Geef uw organisatie en uw email adres of de gebruikersnaam op." +#: classes/Gems/Default/IndexAction.php:166 +msgid "We received your password reset request." +msgstr "We hebben uw verzoek om een nieuw wachtwoord ontvangen." -#: classes/Gems/Default/IndexAction.php:157 -msgid "Please enter your username or e-mail address. " -msgstr "Geef uw email adres of gebruikersnaam op." +#: classes/Gems/Default/IndexAction.php:169 +#, php-format +msgid "Welcome to %s" +msgstr "Welkom bij %s" -#: classes/Gems/Default/IndexAction.php:159 -msgid "We will then send you an e-mail with a link you can use to reset your password." -msgstr "Daarna sturen wij een een email met een link waarmee u uw wachtwoord kan vervangen." +#: classes/Gems/Default/IndexAction.php:170 +msgid "Welcome to this website." +msgstr "Welkom op deze website." -#: classes/Gems/Default/IndexAction.php:193 +#: classes/Gems/Default/IndexAction.php:173 +msgid "Please enter your password of choice twice." +msgstr "Geef twee keer een zelfgekozen wachtwoord op." + +#: classes/Gems/Default/IndexAction.php:207 msgid "Your password must be changed." msgstr "Uw wachtwoord moet veranderd worden." -#: classes/Gems/Default/IndexAction.php:205 +#: classes/Gems/Default/IndexAction.php:219 #, php-format msgid "Login successful, welcome %s." msgstr "Login in orde, welkom %s." -#: classes/Gems/Default/IndexAction.php:248 +#: classes/Gems/Default/IndexAction.php:262 #, php-format msgid "Good bye: %s." msgstr "Tot ziens: %s." -#: classes/Gems/Default/IndexAction.php:274 -msgid "Reset accepted, enter your new password." -msgstr "Reset geaccepteerd, voer uw nieuwe wachtwoord in." +#: classes/Gems/Default/IndexAction.php:286 +msgid "Your password reset request is no longer valid, please request a new link." +msgstr "Uw verzoek om een nieuw wachtwoord is niet meer geldig, maar u kan hieronder een nieuwe link aanvragen." -#: classes/Gems/Default/IndexAction.php:278 -msgid "This key timed out or does not belong to this user." -msgstr "Te oude sleutel of sleutel hoort niet bij gebruiker." +#: classes/Gems/Default/IndexAction.php:288 +msgid "Your password input request is no longer valid, please request a new link." +msgstr "Uw link om een wachtwoord in te voeren is niet meer geldig, maar u kan hieronder een nieuwe link aanvragen." -#: classes/Gems/Default/IndexAction.php:281 +#: classes/Gems/Default/IndexAction.php:307 +msgid "We sent you an e-mail with a reset link. Click on the link in the e-mail." +msgstr "We hebben u een email met reset link gestuurd. Klik op de link in de email." + +#: classes/Gems/Default/IndexAction.php:315 +msgid "New passwo... [truncated message content] |
From: <gem...@li...> - 2012-04-02 17:55:53
|
Revision: 592 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=592&view=rev Author: matijsdejong Date: 2012-04-02 17:55:47 +0000 (Mon, 02 Apr 2012) Log Message: ----------- Strings switched Modified Paths: -------------- trunk/library/classes/Gems/Default/IndexAction.php Modified: trunk/library/classes/Gems/Default/IndexAction.php =================================================================== --- trunk/library/classes/Gems/Default/IndexAction.php 2012-04-02 17:52:30 UTC (rev 591) +++ trunk/library/classes/Gems/Default/IndexAction.php 2012-04-02 17:55:47 UTC (rev 592) @@ -139,7 +139,7 @@ protected function displayResetForm(Gems_User_Form_ResetForm $form, $errors) { if ($form->hasResetKey()) { - $this->html->h3($this->_('Request password reset')); + $this->html->h3($this->_('Execute password reset')); $p = $this->html->pInfo($this->_('We received your password reset request. ')); if ($form->getOrganizationIsVisible()) { @@ -148,7 +148,7 @@ $p->append($this->_('Please enter the username or e-mail address belonging to this request.')); } } else { - $this->html->h3($this->_('Execute password reset')); + $this->html->h3($this->_('Request password reset')); $p = $this->html->pInfo(); if ($form->getOrganizationIsVisible()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-04-02 17:52:42
|
Revision: 591 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=591&view=rev Author: matijsdejong Date: 2012-04-02 17:52:30 +0000 (Mon, 02 Apr 2012) Log Message: ----------- Created a separate Password Reset form that can be overruled on the project level New structure of indexAction allows for easy overruling of password display. TODO: validation / follow up actions should be organized better. Modified Paths: -------------- trunk/library/classes/Gems/Default/IndexAction.php trunk/library/classes/Gems/User/Form/LoginForm.php trunk/library/classes/Gems/User/UserLoader.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/User/Form/OrganizationFormAbstract.php trunk/library/classes/Gems/User/Form/ResetForm.php trunk/library/classes/Gems/User/Validate/ResetKeyValidator.php Modified: trunk/library/classes/Gems/Default/IndexAction.php =================================================================== --- trunk/library/classes/Gems/Default/IndexAction.php 2012-04-01 23:54:09 UTC (rev 590) +++ trunk/library/classes/Gems/Default/IndexAction.php 2012-04-02 17:52:30 UTC (rev 591) @@ -55,21 +55,6 @@ protected $labelWidthFactor = null; /** - * @var GemsEscort - */ - public $escort; - - /** - * @var Gems_Menu - */ - public $menu; - - /** - * @var Gems_Project_ProjectSettings - */ - public $project; - - /** * For small numbers of organizations a multiline selectbox will be nice. This * setting handles how many lines will display at once. Use 1 for the normal * dropdown selectbox @@ -93,53 +78,22 @@ protected $showTokenButton = true; /** - * Returns a basic form for this action. - * - * @param $description Optional description, %s is filled with project name. - * @return Gems_Form - */ - protected function _getBasicForm($description = null) - { - Gems_Html::init(); - - $form = new Gems_Form(array('labelWidthFactor' => $this->labelWidthFactor)); - $form->setMethod('post'); - if ($description) { - $form->setDescription(sprintf($description, $this->project->getName())); - } - - return $form; - } - - /** - * Returns an element for keeping a reset key. - * - * @return Zend_Form_Element_Hidden - */ - protected function _getKeyElement() - { - return new Zend_Form_Element_Hidden('key'); - } - - /** * Returns a login form * * @param boolean $showToken Optional, show 'Ask token' button, $this->showTokenButton is used when not specified * @param boolean $showPasswordLost Optional, show 'Lost password' button, $this->showPasswordLostButton is used when not specified * @return Gems_User_Form_LoginForm */ - protected function _getLoginForm($showToken = null, $showPasswordLost = null) + protected function createLoginForm($showToken = null, $showPasswordLost = null) { $args = MUtil_Ra::args(func_get_args(), array( 'showToken' => 'is_boolean', 'showPasswordLost' => 'is_boolean', - 'description' => 'is_string', ), array( 'showToken' => $this->showTokenButton, 'showPasswordLost' => $this->showPasswordLostButton, - 'description' => $this->_('Login to %s application'), 'labelWidthFactor' => $this->labelWidthFactor, )); @@ -149,121 +103,67 @@ } /** - * Returns a link to the login page + * Gets a reset password form. * - * @return MUtil_Form_Element_Html + * @return Gems_User_Form_ResetForm */ - protected function _getLoginLinkElement() + protected function createResetForm() { - // Reset password - $element = new MUtil_Form_Element_Html('resetPassword'); - $element->br(); - $element->actionLink(array('controller' => 'index', 'action' => 'login'), $this->_('Back to login')); + $args = MUtil_Ra::args(func_get_args(), + array(), + array( + 'labelWidthFactor' => $this->labelWidthFactor, + )); - return $element; - } + $this->initHtml(); - /** - * Returns an element for determining / selecting the organization. - * - * @return Zend_Form_Element_Xhtml - */ - protected function _getOrganizationElement() - { - $hidden = $this->escort instanceof Gems_Project_Organization_SingleOrganizationInterface; - if ($hidden) { - $org = $this->escort->getRespondentOrganization(); - } else { - $org = $this->loader->getCurrentUser()->getCurrentOrganizationId(); - $orgs = $this->util->getDbLookup()->getOrganizationsForLogin(); - $hidden = count($orgs) < 2; - if ($hidden) { - $org = array_shift(array_keys($orgs)); - } - } - - if ($hidden) { - $element = new Zend_Form_Element_Hidden('organization'); - $element->setValue($org); - } else { - $element = new Zend_Form_Element_Select('organization'); - $element->setLabel($this->_('Organization')); - $element->setMultiOptions($orgs); - $element->setRequired(true); - if ($this->organizationMaxLines > 1) { - $element->setAttrib('size', max(count($orgs) + 1, $this->organizationMaxLines)); - } - - if (! $this->_request->isPost()) { - $element->setValue($org); - } - } - - return $element; + return $this->loader->getUserLoader()->getResetForm($args); } /** - * Gets a reset password form. + * Function for overruling the display of the login form. * - * @return Gems_Form + * @param Gems_User_Form_LoginForm $form */ - protected function _getResetForm() + protected function displayLoginForm(Gems_User_Form_LoginForm $form) { - $form = $this->_getBasicForm($this->_('Reset password for %s application')); - $form->addElement($this->_getKeyElement()); - $form->addElement($this->_getOrganizationElement()); - $form->addElement($this->_getUserLoginElement()); - $form->addElement($this->_getSubmitButton($this->_('Reset password'))); - $form->addElement($this->_getLoginLinkElement()); - - return $form; + $this->view->form = $form; } /** - * Returns a link to the reset password page + * Function for overruling the display of the reset form. * - * @return MUtil_Form_Element_Html + * @param Gems_User_Form_ResetForm $form + * @param mixed $errors */ - protected function _getResetLinkElement() + protected function displayResetForm(Gems_User_Form_ResetForm $form, $errors) { - // Reset password - $element = new MUtil_Form_Element_Html('resetPassword'); - $element->br(); - $element->actionLink(array('controller' => 'index', 'action' => 'resetpassword'), $this->_('Lost password')); + if ($form->hasResetKey()) { + $this->html->h3($this->_('Request password reset')); + $p = $this->html->pInfo($this->_('We received your password reset request. ')); - return $element; - } + if ($form->getOrganizationIsVisible()) { + $p->append($this->_('Please enter the organization and username/e-mail address belonging to this request.')); + } else { + $p->append($this->_('Please enter the username or e-mail address belonging to this request.')); + } + } else { + $this->html->h3($this->_('Execute password reset')); - /** - * Returns a submit button. - * - * @param string $label - * @return Zend_Form_Element_Submit - */ - protected function _getSubmitButton($label) - { - // Submit knop - $element = new Zend_Form_Element_Submit('button'); - $element->setLabel($label); - $element->setAttrib('class', 'button'); + $p = $this->html->pInfo(); + if ($form->getOrganizationIsVisible()) { + $p->append($this->_('Please enter your organization and your username or e-mail address. ')); + } else { + $p->append($this->_('Please enter your username or e-mail address. ')); + } + $p->append($this->_('We will then send you an e-mail with a link you can use to reset your password.')); + } - return $element; - } + if ($errors) { + $this->addMessage($errors); + } - /** - * Returns a login name element. - * - * @return Zend_Form_Element_Text - */ - protected function _getUserLoginElement() - { - // Veld inlognaam - $element = new Zend_Form_Element_Text('userlogin'); - $element->setLabel($this->_('Username')); - $element->setAttrib('size', 40); - $element->setRequired(true); - - return $element; + $this->html->append($form); } /** @@ -277,7 +177,7 @@ public function loginAction() { $request = $this->getRequest(); - $form = $this->_getLoginForm(); + $form = $this->createLoginForm(); if ($request->isPost()) { if ($form->isValid($request->getPost(), false)) { @@ -334,7 +234,8 @@ $log->log('loginFail', $this->getRequest(), $msg, null, true); } // */ } - $this->view->form = $form; + + $this->displayLoginForm($form); } /** @@ -358,10 +259,11 @@ $this->view->setScriptPath(GEMS_LIBRARY_DIR . '/views/scripts' ); $request = $this->getRequest(); - $form = $this->_getResetForm(); - if ($request->isPost() && $form->isValid($request->getPost())) { + $errors = array(); + $form = $this->createResetForm(); + if ($request->isPost() && $form->isValid($request->getParams())) { - $user = $this->loader->getUser($request->getParam('userlogin'), $request->getParam('organization')); + $user = $form->getUser(); If ($user->canResetPassword()) { if ($key = $request->getParam('key')) { @@ -373,27 +275,23 @@ $user->gotoStartPage($this->menu, $request); return; } else { - $this->addMessage($this->_('This key timed out or does not belong to this user.')); + $errors[] = $this->_('This key timed out or does not belong to this user.'); } } else { $subjectTemplate = $this->_('Password reset requested'); $bbBodyTemplate = $this->_("To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n{reset_url}"); - $messages = $user->sendMail($subjectTemplate, $bbBodyTemplate, true); - if (! $messages) { + $errors = $user->sendMail($subjectTemplate, $bbBodyTemplate, true); + if (! $errors) { // Everything went OK! - $messages = $this->_('We sent you an e-mail with a reset link. Click on the link in the e-mail.'); + $errors[] = $this->_('We sent you an e-mail with a reset link. Click on the link in the e-mail.'); } - $this->addMessage($messages); } } else { - $this->addMessage($this->_('No such user found or no e-mail address known or user cannot be reset.')); + $errors[] = $this->_('No such user found or no e-mail address known or user cannot be reset.'); } } - if ($request->getParam('key')) { - $this->addMessage($this->_('We received your password reset key.')); - $this->addMessage($this->_('Please enter the organization and username belonging to this key.')); - } - $this->view->form = $form; + + $this->displayResetForm($form, $errors); } } Modified: trunk/library/classes/Gems/User/Form/LoginForm.php =================================================================== --- trunk/library/classes/Gems/User/Form/LoginForm.php 2012-04-01 23:54:09 UTC (rev 590) +++ trunk/library/classes/Gems/User/Form/LoginForm.php 2012-04-02 17:52:30 UTC (rev 591) @@ -44,7 +44,7 @@ * @license New BSD License * @since Class available since version 1.5 */ -class Gems_User_Form_LoginForm extends Gems_Form_AutoLoadFormAbstract implements Gems_User_Validate_GetUserInterface +class Gems_User_Form_LoginForm extends Gems_User_Form_OrganizationFormAbstract { /** * The field name for the lost password element. @@ -54,20 +54,6 @@ protected $_lostPasswordFieldName = 'lost_password'; /** - * When true the organization was derived from the the url - * - * @var boolean - */ - protected $_organizationFromUrl = false; - - /** - * The field name for the submit element. - * - * @var string - */ - protected $_submitFieldName = 'button'; - - /** * The field name for the token element. * * @var string @@ -75,34 +61,6 @@ protected $_tokenFieldName = 'token_link'; /** - * - * @var Gems_User_User - */ - protected $_user; - - /** - * - * @var Gems_Loader - */ - protected $loader; - - /** - * The field name for the organization element. - * - * @var string - */ - public $organizationFieldName = 'organization'; - - /** - * For small numbers of organizations a multiline selectbox will be nice. This - * setting handles how many lines will display at once. Use 1 for the normal - * dropdown selectbox - * - * @var int - */ - protected $organizationMaxLines = 6; - - /** * The field name for the password element. * * @var string @@ -110,12 +68,6 @@ public $passwordFieldName = 'password'; /** - * - * @var Zend_Controller_Request_Abstract - */ - protected $request; - - /** * The default behaviour for showing a lost password button * * @var boolean @@ -130,59 +82,6 @@ protected $showToken = true; /** - * - * @var Zend_Translate - */ - protected $translate; - - /** - * The field name for the username element. - * - * @var string - */ - public $usernameFieldName = 'userlogin'; - - /** - * - * @var Zend_Util - */ - protected $util; - - /** - * Returns the organization id that should currently be used for this form. - * - * @return int Returns the current organization id, if any - */ - public function getCurrentOrganizationId() - { - $userLoader = $this->loader->getUserLoader(); - - // Url determines organization first. - if ($orgId = $userLoader->getOrganizationIdByUrl()) { - $this->_organizationFromUrl = true; - $userLoader->getCurrentUser()->setCurrentOrganization($orgId); - return $orgId; - } - - $request = $this->getRequest(); - if ($request->isPost() && ($orgId = $request->getParam($this->organizationFieldName))) { - return $orgId; - } - - return $userLoader->getCurrentUser()->getCurrentOrganizationId(); - } - - /** - * Returns a list with the organizations the user can select for login. - * - * @return array orgId => Name - */ - public function getLoginOrganizations() - { - return $this->util->getDbLookup()->getOrganizationsForLogin(); - } - - /** * Returns/sets a link to the reset password page * * @return MUtil_Form_Element_Html @@ -214,47 +113,6 @@ } /** - * Returns/sets an element for determining / selecting the organization. - * - * @return Zend_Form_Element_Xhtml - */ - public function getOrganizationElement() - { - $element = $this->getElement($this->organizationFieldName); - $orgId = $this->getCurrentOrganizationId(); - $orgs = $this->getLoginOrganizations(); - $hidden = $this->_organizationFromUrl || (count($orgs) < 2); - - if ($hidden) { - if (! $element instanceof Zend_Form_Element_Hidden) { - $element = new Zend_Form_Element_Hidden($this->organizationFieldName); - - $this->addElement($element); - } - - if (! $this->_organizationFromUrl) { - $orgIds = array_keys($orgs); - $orgId = reset($orgIds); - } - - } elseif (! $element instanceof Zend_Form_Element_Select) { - $element = new Zend_Form_Element_Select($this->organizationFieldName); - $element->setLabel($this->translate->_('Organization')); - $element->setRequired(true); - $element->setMultiOptions($orgs); - - if ($this->organizationMaxLines > 1) { - $element->setAttrib('size', max(count($orgs) + 1, $this->organizationMaxLines)); - } - $this->addElement($element); - - } - $element->setValue($orgId); - - return $element; - } - - /** * Returns/sets a password element. * * @return Zend_Form_Element_Password @@ -284,41 +142,16 @@ } /** - * Return the Request object + * Returns the label for the submitbutton * - * @return Zend_Controller_Request_Abstract + * @return string */ - public function getRequest() + public function getSubmitButtonLabel() { - if (! $this->request) { - $this->request = Zend_Controller_Front::getInstance()->getRequest(); - } - return $this->request; + return $this->translate->_('Login'); } /** - * Returns/sets a submit button. - * - * @param string $label - * @return Zend_Form_Element_Submit - */ - public function getSubmitButton($label = null) - { - $element = $this->getElement($this->_submitFieldName); - - if (! $element) { - // Submit knop - $element = new Zend_Form_Element_Submit($this->_submitFieldName); - $element->setLabel(null === $label ? $this->translate->_('Login') : $label); - $element->setAttrib('class', 'button'); - - $this->addElement($element); - } - - return $element; - } - - /** * Returns/sets a link for the token input page. * * @return MUtil_Form_Element_Html @@ -350,58 +183,6 @@ } /** - * Returns a user - * - * @return Gems_User_User - */ - public function getUser() - { - return $this->_user; - } - - /** - * Returns/sets a login name element. - * - * @return Zend_Form_Element_Text - */ - public function getUserNameElement() - { - $element = $this->getElement($this->usernameFieldName); - - if (! $element) { - // Veld inlognaam - $element = new Zend_Form_Element_Text($this->usernameFieldName); - $element->setLabel($this->translate->_('Username')); - $element->setAttrib('size', 40); - $element->setRequired(true); - - $this->addElement($element); - } - - return $element; - } - - /** - * Validate the form - * - * As it is better for translation utilities to set the labels etc. translated, - * the MUtil default is to disable translation. - * - * However, this also disables the translation of validation messages, which we - * cannot set translated. The MUtil form is extended so it can make this switch. - * - * @param array $data - * @param boolean $disableTranslateValidators Extra switch - * @return boolean - */ - public function isValid($data, $disableTranslateValidators = null) - { - $this->_user = $this->loader->getUser($data[$this->usernameFieldName], $data[$this->organizationFieldName]); - - return parent::isValid($data, $disableTranslateValidators); - } - - /** * The function that determines the element load order * * @return Gems_User_Form_LoginForm (continuation pattern) @@ -424,23 +205,6 @@ } /** - * For small numbers of organizations a multiline selectbox will be nice. This - * setting handles how many lines will display at once. Use 1 for the normal - * dropdown selectbox - * - * Enables loading of parameter through Zend_Form::__construct() - * - * @param int $organizationMaxLines - * @return Gems_User_Form_LoginForm (continuation pattern) - */ - public function setOrganizationMaxLines($organizationMaxLines) - { - $this->organizationMaxLines = $organizationMaxLines; - - return $this; - } - - /** * The behaviour for showing a lost password button * * Enables loading of parameter through Zend_Form::__construct() @@ -469,14 +233,4 @@ return $this; } - - /** - * True when this form was submitted. - * - * @return boolean - */ - public function wasSubmitted() - { - return $this->getSubmitButton()->isChecked(); - } } Added: trunk/library/classes/Gems/User/Form/OrganizationFormAbstract.php =================================================================== --- trunk/library/classes/Gems/User/Form/OrganizationFormAbstract.php (rev 0) +++ trunk/library/classes/Gems/User/Form/OrganizationFormAbstract.php 2012-04-02 17:52:30 UTC (rev 591) @@ -0,0 +1,327 @@ +<?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 User + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: OrganizationFormAbstract.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage User + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.3 + */ +abstract class Gems_User_Form_OrganizationFormAbstract extends Gems_Form_AutoLoadFormAbstract implements Gems_User_Validate_GetUserInterface +{ + /** + * When true the organization was derived from the the url + * + * @var boolean + */ + protected $_organizationFromUrl = false; + + /** + * The field name for the submit element. + * + * @var string + */ + protected $_submitFieldName = 'button'; + + /** + * + * @var Gems_User_User + */ + protected $_user; + + /** + * + * @var Gems_Loader + */ + protected $loader; + + /** + * The field name for the organization element. + * + * @var string + */ + public $organizationFieldName = 'organization'; + + /** + * For small numbers of organizations a multiline selectbox will be nice. This + * setting handles how many lines will display at once. Use 1 for the normal + * dropdown selectbox + * + * @var int + */ + protected $organizationMaxLines = 6; + + /** + * + * @var Zend_Controller_Request_Abstract + */ + protected $request; + + /** + * + * @var Zend_Translate + */ + protected $translate; + + /** + * The field name for the username element. + * + * @var string + */ + public $usernameFieldName = 'userlogin'; + + /** + * + * @var Zend_Util + */ + protected $util; + + + /** + * Returns the organization id that should currently be used for this form. + * + * @return int Returns the current organization id, if any + */ + public function getCurrentOrganizationId() + { + $userLoader = $this->loader->getUserLoader(); + + // Url determines organization first. + if ($orgId = $userLoader->getOrganizationIdByUrl()) { + $this->_organizationFromUrl = true; + $userLoader->getCurrentUser()->setCurrentOrganization($orgId); + return $orgId; + } + + $request = $this->getRequest(); + if ($request->isPost() && ($orgId = $request->getParam($this->organizationFieldName))) { + return $orgId; + } + + return $userLoader->getCurrentUser()->getCurrentOrganizationId(); + } + + /** + * Returns a list with the organizations the user can select for login. + * + * @return array orgId => Name + */ + public function getLoginOrganizations() + { + return $this->util->getDbLookup()->getOrganizationsForLogin(); + } + + + /** + * Returns/sets an element for determining / selecting the organization. + * + * @return Zend_Form_Element_Xhtml + */ + public function getOrganizationElement() + { + $element = $this->getElement($this->organizationFieldName); + $orgId = $this->getCurrentOrganizationId(); + $orgs = $this->getLoginOrganizations(); + $hidden = $this->_organizationFromUrl || (count($orgs) < 2); + + if ($hidden) { + if (! $element instanceof Zend_Form_Element_Hidden) { + $element = new Zend_Form_Element_Hidden($this->organizationFieldName); + + $this->addElement($element); + } + + if (! $this->_organizationFromUrl) { + $orgIds = array_keys($orgs); + $orgId = reset($orgIds); + } + + } elseif (! $element instanceof Zend_Form_Element_Select) { + $element = new Zend_Form_Element_Select($this->organizationFieldName); + $element->setLabel($this->translate->_('Organization')); + $element->setRequired(true); + $element->setMultiOptions($orgs); + + if ($this->organizationMaxLines > 1) { + $element->setAttrib('size', max(count($orgs) + 1, $this->organizationMaxLines)); + } + $this->addElement($element); + + } + $element->setValue($orgId); + + return $element; + } + + /** + * Returns true when the organization element is visible to the user. + * + * @return boolean + */ + public function getOrganizationIsVisible() + { + return ! $this->getOrganizationElement() instanceof Zend_Form_Element_Hidden; + } + + /** + * Return the Request object + * + * @return Zend_Controller_Request_Abstract + */ + public function getRequest() + { + if (! $this->request) { + $this->request = Zend_Controller_Front::getInstance()->getRequest(); + } + return $this->request; + } + + /** + * Returns/sets a submit button. + * + * @return Zend_Form_Element_Submit + */ + public function getSubmitButton() + { + $element = $this->getElement($this->_submitFieldName); + + if (! $element) { + // Submit knop + $element = new Zend_Form_Element_Submit($this->_submitFieldName); + $element->setLabel($this->getSubmitButtonLabel()); + $element->setAttrib('class', 'button'); + + $this->addElement($element); + } + + return $element; + } + + /** + * Returns the label for the submitbutton + * + * @return string + */ + abstract public function getSubmitButtonLabel(); + + /** + * Returns a user + * + * @return Gems_User_User + */ + public function getUser() + { + if (! $this->_user) { + $request = $this->getRequest(); + + $this->_user = $this->loader->getUser($request->getParam($this->usernameFieldName), $request->getParam($this->organizationFieldName)); + } + return $this->_user; + } + + /** + * Returns/sets a login name element. + * + * @return Zend_Form_Element_Text + */ + public function getUserNameElement() + { + $element = $this->getElement($this->usernameFieldName); + + if (! $element) { + // Veld inlognaam + $element = new Zend_Form_Element_Text($this->usernameFieldName); + $element->setLabel($this->translate->_('Username')); + $element->setAttrib('size', 40); + $element->setRequired(true); + + $this->addElement($element); + } + + return $element; + } + + /** + * Validate the form + * + * As it is better for translation utilities to set the labels etc. translated, + * the MUtil default is to disable translation. + * + * However, this also disables the translation of validation messages, which we + * cannot set translated. The MUtil form is extended so it can make this switch. + * + * @param array $data + * @param boolean $disableTranslateValidators Extra switch + * @return boolean + */ + public function isValid($data, $disableTranslateValidators = null) + { + $this->_user = $this->loader->getUser($data[$this->usernameFieldName], $data[$this->organizationFieldName]); + + return parent::isValid($data, $disableTranslateValidators); + } + + /** + * For small numbers of organizations a multiline selectbox will be nice. This + * setting handles how many lines will display at once. Use 1 for the normal + * dropdown selectbox + * + * Enables loading of parameter through Zend_Form::__construct() + * + * @param int $organizationMaxLines + * @return Gems_User_Form_LoginForm (continuation pattern) + */ + public function setOrganizationMaxLines($organizationMaxLines) + { + $this->organizationMaxLines = $organizationMaxLines; + + return $this; + } + + /** + * True when this form was submitted. + * + * @return boolean + */ + public function wasSubmitted() + { + return $this->getSubmitButton()->isChecked(); + } +} Added: trunk/library/classes/Gems/User/Form/ResetForm.php =================================================================== --- trunk/library/classes/Gems/User/Form/ResetForm.php (rev 0) +++ trunk/library/classes/Gems/User/Form/ResetForm.php 2012-04-02 17:52:30 UTC (rev 591) @@ -0,0 +1,201 @@ +<?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 User + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: ResetForm.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage User + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.3 + */ +class Gems_User_Form_ResetForm extends Gems_User_Form_OrganizationFormAbstract +{ + /** + * The field name for the login link element + * + * @var string + */ + protected $_loginLinkFieldName = 'loginlink'; + + /** + * The field name for the reset key element. + * + * @var string + */ + protected $_resetKeyFieldName = 'key'; + + /** + * First the password reset is requested (= false), then the reset key is passed (= true) + * + * @var boolean Calculated when null + */ + protected $hasResetKey = null; + + /** + * Returns an html link for the login page. + * + * @return MUtil_Html_AElement + */ + public function getLoginLink() + { + return MUtil_Html::create('a', array('controller' => 'index', 'action' => 'login'), $this->translate->_('Back to login'), array('class' => 'actionlink')); + } + + /** + * Returns a link to the login page + * + * @return MUtil_Form_Element_Html + */ + public function getLoginLinkElement() + { + $element = $this->getElement($this->_tokenFieldName); + + if (! $element) { + // Login link + if ($link = $this->getLoginLink()) { + $element = new MUtil_Form_Element_Html($this->_loginLinkFieldName); + // $element->br(); + $element->setValue($link); + + $this->addElement($element); + } + + return $element; + } + } + + /** + * Returns an element for keeping a reset key. + * + * @return Zend_Form_Element_Hidden + */ + public function getResetKeyElement() + { + $element = $this->getElement($this->_resetKeyFieldName); + + if (! $element) { + $element = new Zend_Form_Element_Hidden($this->_resetKeyFieldName); + + $this->addElement($element); + } + + return $element; + } + + /** + * Returns the label for the submitbutton + * + * @return string + */ + public function getSubmitButtonLabel() + { + if ($this->hasResetKey()) { + return $this->translate->_('Reset password'); + } else { + return $this->translate->_('Request password'); + } + } + + /** + * Returns/sets a login name element. + * + * @return Zend_Form_Element_Text + * / + public function getUserNameElement() + { + $element = $this->getElement($this->usernameFieldName); + + if (! $element) { + $element = parent::getUserNameElement(); + + $element->addValidator(new Gems_User_Validate_ResetKeyValidator($this, $this->translate, $this->_resetKeyFieldName)); + } + + return $element; + } + + /** + * Is the form working in reset mode or not + * + * @return boolean + */ + public function hasResetKey() + { + if (null === $this->hasResetKey) { + $request = $this->getRequest(); + + $this->hasResetKey = (boolean) $request->getParam($this->_resetKeyFieldName, false); + } + + return $this->hasResetKey; + } + + /** + * The function that determines the element load order + * + * @return Gems_User_Form_LoginForm (continuation pattern) + */ + public function loadDefaultElements() + { + if ($this->hasResetKey()) { + $this->getResetKeyElement(); + } + $this->getOrganizationElement(); + $this->getUserNameElement(); + $this->getSubmitButton(); + $this->getLoginLinkElement(); + + return $this; + } + + /** + * Is the form working in reset mode or not + * + * Enables loading of parameter through Zend_Form::__construct() + * + * @param boolean $hasKey + * @return Gems_User_Form_ResetForm (continuation pattern) + */ + public function setHasResetKey($hasKey = true) + { + $this->hasResetKey = $hasKey; + + return $this; + } +} Modified: trunk/library/classes/Gems/User/UserLoader.php =================================================================== --- trunk/library/classes/Gems/User/UserLoader.php 2012-04-01 23:54:09 UTC (rev 590) +++ trunk/library/classes/Gems/User/UserLoader.php 2012-04-02 17:52:30 UTC (rev 591) @@ -301,10 +301,6 @@ { $args = MUtil_Ra::args(func_get_args()); - if (isset($args['description'])) { - $args['description'] = sprintf($args['description'], $this->project->getName()); - } - $form = $this->_loadClass('Form_LoginForm', true, array($args)); return $form; @@ -394,6 +390,25 @@ } /** + * Returns a reset form for handling both the incoming request and the outgoing reset request + * + * @param mixed $args_array MUtil_Ra::args array for LoginForm initiation. + * @return Gems_User_Form_ResetForm + */ + public function getResetForm($args_array = null) + { + $args = MUtil_Ra::args(func_get_args()); + + if (isset($args['description'])) { + $args['description'] = sprintf($args['description'], $this->project->getName()); + } + + $form = $this->_loadClass('Form_ResetForm', true, array($args)); + + return $form; + } + + /** * Returns a user object, that may be empty if no user exist. * * @param string $login_name Added: trunk/library/classes/Gems/User/Validate/ResetKeyValidator.php =================================================================== --- trunk/library/classes/Gems/User/Validate/ResetKeyValidator.php (rev 0) +++ trunk/library/classes/Gems/User/Validate/ResetKeyValidator.php 2012-04-02 17:52:30 UTC (rev 591) @@ -0,0 +1,129 @@ +<?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 User + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: ResetKeyValidator.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage User + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5.3 + */ +class Gems_User_Validate_ResetKeyValidator implements Zend_Validate_Interface +{ + /** + * The error message + * + * @var string + */ + private $_message; + + /** + * + * @var Gems_User_Validate_GetUserInterface + */ + private $_userSource; + + /** + * + * @var string + */ + private $fieldName; + + /** + * + * @var Zend_Translate + */ + private $translate; + + /** + * + * @param Gems_User_Validate_GetUserInterface $userSource The source for the user + * @param Zend_Translate $translate + * @param string $fieldName Optional field name (hidden fields are not validated) + */ + public function __construct(Gems_User_Validate_GetUserInterface $userSource, Zend_Translate $translate, $fieldName) + { + $this->_userSource = $userSource; + $this->translate = $translate; + $this->fieldName = $fieldName; + } + + /** + * + * @param string $message Default message for standard login fail. + */ + public function getMessages() + { + return array($this->_message); + } + + /** + * Returns true if and only if $value meets the validation requirements + * + * If $value fails validation, then this method returns false, and + * getMessages() will return an array of messages that explain why the + * validation failed. + * + * @param mixed $value + * @param mixed $content + * @return boolean + * @throws Zend_Validate_Exception If validation of $value is impossible + */ + public function isValid($value, $context = array()) + { + $this->_message = null; + + $user = $this->_userSource->getUser(); + + If ($user->isActive() && $user->canResetPassword()) { + $key = isset($context[$this->fieldName]) ? $context[$this->fieldName] : $valid; + if ($key) { + // Key has been passed by mail + if (! $user->checkPasswordResetKey($key)) { + $this->_message = $this->translate->_('This key timed out or does not belong to this user.'); + } + } + MUtil_Echo::track($key, $context, $this->_message); + } else { + $this->_message = $this->translate->_('No such user found or no e-mail address known or user cannot be reset.'); + } + + return (boolean) ! $this->_message; + } +} Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2012-04-01 23:54:09 UTC (rev 590) +++ trunk/library/languages/default-en.po 2012-04-02 17:52:30 UTC (rev 591) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-03-30 22:04+0100\n" +"POT-Creation-Date: 2012-04-02 19:39+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -1049,7 +1049,6 @@ msgstr "%s records found." #: classes/Gems/Default/ExportAction.php:172 -#: classes/Gems/Default/IndexAction.php:190 #: classes/Gems/Default/LogAction.php:197 msgid "Organization" msgstr "Organization" @@ -1086,54 +1085,64 @@ msgstr "Administrative groups" #: classes/Gems/Default/IndexAction.php:142 -#, php-format -msgid "Login to %s application" -msgstr "Login to %s application" +msgid "Request password reset" +msgstr "Request password reset" -#: classes/Gems/Default/IndexAction.php:161 -msgid "Back to login" -msgstr "Back to login" +#: classes/Gems/Default/IndexAction.php:143 +msgid "We received your password reset request. " +msgstr "We received your password reset request. " -#: classes/Gems/Default/IndexAction.php:212 -#, php-format -msgid "Reset password for %s application" -msgstr "Reset password for %s application" +#: classes/Gems/Default/IndexAction.php:146 +msgid "Please enter the organization and username/e-mail address belonging to this request." +msgstr "Please enter the organization and username/e-mail address belonging to this request." -#: classes/Gems/Default/IndexAction.php:216 -msgid "Reset password" -msgstr "Reset password" +#: classes/Gems/Default/IndexAction.php:148 +msgid "Please enter the username or e-mail address belonging to this request." +msgstr "Please enter the username or e-mail address belonging to this request." -#: classes/Gems/Default/IndexAction.php:262 -msgid "Username" -msgstr "Username" +#: classes/Gems/Default/IndexAction.php:151 +msgid "Execute password reset" +msgstr "Execute password reset" -#: classes/Gems/Default/IndexAction.php:294 +#: classes/Gems/Default/IndexAction.php:155 +msgid "Please enter your organization and your username or e-mail address. " +msgstr "Please enter your organization and your username or e-mail address. " + +#: classes/Gems/Default/IndexAction.php:157 +msgid "Please enter your username or e-mail address. " +msgstr "Please enter your username or e-mail address. " + +#: classes/Gems/Default/IndexAction.php:159 +msgid "We will then send you an e-mail with a link you can use to reset your password." +msgstr "We will then send you an e-mail with a link you can use to reset your password." + +#: classes/Gems/Default/IndexAction.php:193 msgid "Your password must be changed." msgstr "Your password must be changed." -#: classes/Gems/Default/IndexAction.php:306 +#: classes/Gems/Default/IndexAction.php:205 #, php-format msgid "Login successful, welcome %s." msgstr "Login successful, welcome %s." -#: classes/Gems/Default/IndexAction.php:348 +#: classes/Gems/Default/IndexAction.php:248 #, php-format msgid "Good bye: %s." msgstr "Good bye: %s." -#: classes/Gems/Default/IndexAction.php:373 +#: classes/Gems/Default/IndexAction.php:274 msgid "Reset accepted, enter your new password." msgstr "Reset accepted, enter your new password." -#: classes/Gems/Default/IndexAction.php:377 +#: classes/Gems/Default/IndexAction.php:278 msgid "This key timed out or does not belong to this user." msgstr "This key timed out or does not belong to this user." -#: classes/Gems/Default/IndexAction.php:380 +#: classes/Gems/Default/IndexAction.php:281 msgid "Password reset requested" msgstr "Password reset requested" -#: classes/Gems/Default/IndexAction.php:381 +#: classes/Gems/Default/IndexAction.php:282 msgid "" "To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n" "{reset_url}" @@ -1141,22 +1150,14 @@ "To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n" "{reset_url}" -#: classes/Gems/Default/IndexAction.php:386 +#: classes/Gems/Default/IndexAction.php:287 msgid "We sent you an e-mail with a reset link. Click on the link in the e-mail." msgstr "We sent you an e-mail with a reset link. Click on the link in the e-mail." -#: classes/Gems/Default/IndexAction.php:391 +#: classes/Gems/Default/IndexAction.php:291 msgid "No such user found or no e-mail address known or user cannot be reset." msgstr "No such user found or no e-mail address known or user cannot be reset." -#: classes/Gems/Default/IndexAction.php:395 -msgid "We received your password reset key." -msgstr "We received your password reset key." - -#: classes/Gems/Default/IndexAction.php:396 -msgid "Please enter the organization and username belonging to this key." -msgstr "Please enter the organization and username belonging to this key." - #: classes/Gems/Default/InvitationAction.php:52 msgid "Invite" msgstr "Invite" @@ -1476,30 +1477,30 @@ msgid "New password is active." msgstr "New password is active." -#: classes/Gems/Default/OptionAction.php:128 +#: classes/Gems/Default/OptionAction.php:129 msgid "Login Name" msgstr "Login Name" -#: classes/Gems/Default/OptionAction.php:135 +#: classes/Gems/Default/OptionAction.php:136 #: classes/Gems/Default/OrganizationAction.php:132 #: classes/Gems/Default/RespondentAction.php:175 msgid "Language" msgstr "Language" -#: classes/Gems/Default/OptionAction.php:145 +#: classes/Gems/Default/OptionAction.php:146 #, php-format msgid "Options" msgstr "Options" -#: classes/Gems/Default/OptionAction.php:154 +#: classes/Gems/Default/OptionAction.php:155 msgid "This overview provides information about the last login activity on your account." msgstr "This overview provides information about the last login activity on your account." -#: classes/Gems/Default/OptionAction.php:174 +#: classes/Gems/Default/OptionAction.php:175 msgid "Date / time" msgstr "Date / time" -#: classes/Gems/Default/OptionAction.php:185 +#: classes/Gems/Default/OptionAction.php:186 msgid "Item" msgstr "Item" @@ -2852,6 +2853,10 @@ msgid "Clean cache" msgstr "Clean cache" +#: classes/Gems/Menu/MenuAbstract.php:390 +msgid "Reset password" +msgstr "Reset password" + #: classes/Gems/Menu/MenuAbstract.php:416 msgid "Check status" msgstr "Check status" @@ -3674,18 +3679,30 @@ msgid "Caps Lock seems to be on!" msgstr "Caps Lock seems to be on!" -#: classes/Gems/User/Form/LoginForm.php:274 +#: classes/Gems/User/Form/LoginForm.php:132 msgid "Combination of user and password not found." msgstr "Combination of user and password not found." -#: classes/Gems/User/Form/LoginForm.php:276 +#: classes/Gems/User/Form/LoginForm.php:134 msgid "Combination of user and password not found for this organization." msgstr "Combination of user and password not found for this organization." -#: classes/Gems/User/Form/LoginForm.php:349 +#: classes/Gems/User/Form/LoginForm.php:182 msgid "Enter your token..." msgstr "Enter your token..." +#: classes/Gems/User/Form/OrganizationFormAbstract.php:271 +msgid "Username" +msgstr "Username" + +#: classes/Gems/User/Form/ResetForm.php:77 +msgid "Back to login" +msgstr "Back to login" + +#: classes/Gems/User/Form/ResetForm.php:131 +msgid "Request password" +msgstr "Request password" + #: classes/Gems/Util/ReceptionCodeLibrary.php:100 msgid "Yes (forget answers)" msgstr "Yes (forget answers)" @@ -4039,6 +4056,7 @@ msgstr "Lists choices changed." #: snippets/EditSingleSurveyTokenSnippet.php:132 +#: snippets/ShowSingleSurveyTokenSnippet.php:150 msgid "Show survey" msgstr "Show survey" @@ -4176,6 +4194,12 @@ msgid "Can access" msgstr "Can access" +#~ msgid "Login to %s application" +#~ msgstr "Login to %s application" + +#~ msgid "Reset password for %s application" +#~ msgstr "Reset password for %s application" + #~ msgid "To reset your password for %s, please click this link: %s" #~ msgstr "To reset your password for %s, please click this link: %s" Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2012-04-01 23:54:09 UTC (rev 590) +++ trunk/library/languages/default-nl.po 2012-04-02 17:52:30 UTC (rev 591) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse NL\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-03-30 22:04+0100\n" +"POT-Creation-Date: 2012-04-02 19:39+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -1049,7 +1049,6 @@ msgstr "%s records gevonden." #: classes/Gems/Default/ExportAction.php:172 -#: classes/Gems/Default/IndexAction.php:190 #: classes/Gems/Default/LogAction.php:197 msgid "Organization" msgstr "Organisatie" @@ -1086,54 +1085,64 @@ msgstr "Beheer groepen" #: classes/Gems/Default/IndexAction.php:142 -#, php-format -msgid "Login to %s application" -msgstr "%s login" +msgid "Request password reset" +msgstr "Wachtwoord vergeten?" -#: classes/Gems/Default/IndexAction.php:161 -msgid "Back to login" -msgstr "Terug naar de login" +#: classes/Gems/Default/IndexAction.php:143 +msgid "We received your password reset request. " +msgstr "We hebben uw verzoek om een nieuw wachtwoord ontvangen." -#: classes/Gems/Default/IndexAction.php:212 -#, php-format -msgid "Reset password for %s application" -msgstr "Reset wachtwoord voor %s" +#: classes/Gems/Default/IndexAction.php:146 +msgid "Please enter the organization and username/e-mail address belonging to this request." +msgstr "Voer de organisatie en de gebruikersnaam of het e-mail adres in die bij dit verzoek horen." -#: classes/Gems/Default/IndexAction.php:216 -msgid "Reset password" -msgstr "Reset wachtwoord" +#: classes/Gems/Default/IndexAction.php:148 +msgid "Please enter the username or e-mail address belonging to this request." +msgstr "Voer de gebruikersnaam of het e-mail adres in die bij dit verzoek horen." -#: classes/Gems/Default/IndexAction.php:262 -msgid "Username" -msgstr "Gebruikersnaam" +#: classes/Gems/Default/IndexAction.php:151 +msgid "Execute password reset" +msgstr "Vervang vergeten passwood" -#: classes/Gems/Default/IndexAction.php:294 +#: classes/Gems/Default/IndexAction.php:155 +msgid "Please enter your organization and your username or e-mail address. " +msgstr "Geef uw organisatie en uw email adres of de gebruikersnaam op." + +#: classes/Gems/Default/IndexAction.php:157 +msgid "Please enter your username or e-mail address. " +msgstr "Geef uw email adres of gebruikersnaam op." + +#: classes/Gems/Default/IndexAction.php:159 +msgid "We will then send you an e-mail with a link you can use to reset your password." +msgstr "Daarna sturen wij een een email met een link waarmee u uw wachtwoord kan vervangen." + +#: classes/Gems/Default/IndexAction.php:193 msgid "Your password must be changed." msgstr "Uw wachtwoord moet veranderd worden." -#: classes/Gems/Default/IndexAction.php:306 +#: classes/Gems/Default/IndexAction.php:205 #, php-format msgid "Login successful, welcome %s." msgstr "Login in orde, welkom %s." -#: classes/Gems/Default/IndexAction.php:348 +#: classes/Gems/Default/IndexAction.php:248 #, php-format msgid "Good bye: %s." msgstr "Tot ziens: %s." -#: classes/Gems/Default/IndexAction.php:373 +#: classes/Gems/Default/IndexAction.php:274 msgid "Reset accepted, enter your new password." msgstr "Reset geaccepteerd, voer uw nieuwe wachtwoord in." -#: classes/Gems/Default/IndexAction.php:377 +#: classes/Gems/Default/IndexAction.php:278 msgid "This key timed out or does not belong to this user." msgstr "Te oude sleutel of sleutel hoort niet bij gebruiker." -#: classes/Gems/Default/IndexAction.php:380 +#: classes/Gems/Default/IndexAction.php:281 msgid "Password reset requested" msgstr "Wachtwoord reset aangevraagd" -#: classes/Gems/Default/IndexAction.php:381 +#: classes/Gems/Default/IndexAction.php:282 msgid "" "To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n" "{reset_url}" @@ -1141,22 +1150,14 @@ "Om een nieuw wachtwoord in te stellen voor de [b]{organization}[/b] site [b]{project}[/b], klik op deze link:\n" "{reset_url}" -#: classes/Gems/Default/IndexAction.php:386 +#: classes/Gems/Default/IndexAction.php:287 msgid "We sent you an e-mail with a reset link. Click on the link in the e-mail." msgstr "We hebben u een email met reset link gestuurd. Klik op de link in de email." -#: classes/Gems/Default/IndexAction.php:391 +#: classes/Gems/Default/IndexAction.php:291 msgid "No such user found or no e-mail address known or user cannot be reset." msgstr "Gebruiker niet gevonden of e-mail adres onbekend of gebruiker kan niet gereset worden." -#: classes/Gems/Default/IndexAction.php:395 -msgid "We received your password reset key." -msgstr "Wachtwoord resetsleutel ontvangen." - -#: classes/Gems/Default/IndexAction.php:396 -msgid "Please enter the organization and username belonging to this key." -msgstr "Geef de organisatie en gebruikersnaam die bij deze sleutel horen op." - #: classes/Gems/Default/InvitationAction.php:52 msgid "Invite" msgstr "Uitnodigen" @@ -1476,30 +1477,30 @@ msgid "New password is active." msgstr "Nieuwe wachtwoord geactiveerd." -#: classes/Gems/Default/OptionAction.php:128 +#: classes/Gems/Default/OptionAction.php:129 msgid "Login Name" msgstr "Login Naam" -#: classes/Gems/Default/OptionAction.php:135 +#: classes/Gems/Default/OptionAction.php:136 #: classes/Gems/Default/OrganizationAction.php:132 #: classes/Gems/Default/RespondentAction.php:175 msgid "Language" msgstr "Taal" -#: classes/Gems/Default/OptionAction.php:145 +#: classes/Gems/Default/OptionAction.php:146 #, php-format msgid "Options" msgstr "Instellingen" -#: classes/Gems/Default/OptionAction.php:154 +#: classes/Gems/Default/OptionAction.php:155 msgid "This overview provides information about the last login activity on your account." msgstr "Dit overzicht geeft informatie over de recente inlog activiteit op uw account." -#: classes/Gems/Default/OptionAction.php:174 +#: classes/Gems/Default/OptionAction.php:175 msgid "Date / time" msgstr "Datum / tijd" -#: classes/Gems/Default/OptionAction.php:185 +#: classes/Gems/Default/OptionAction.php:186 msgid "Item" msgstr "Item" @@ -2852,6 +2853,10 @@ msgid "Clean cache" msgstr "Cache opruimen" +#: classes/Gems/Menu/MenuAbstract.php:390 +msgid "Reset password" +msgstr "Reset wachtwoord" + #: classes/Gems/Menu/MenuAbstract.php:416 msgid "Check status" msgstr "Status controle" @@ -3674,18 +3679,30 @@ msgid "Caps Lock seems to be on!" msgstr "De Caps Lock toets lijkt aan te staan!" -#: classes/Gems/User/Form/LoginForm.php:274 +#: classes/Gems/User/Form/LoginForm.php:132 msgid "Combination of user and password not found." msgstr "Combinatie van gebruikersnaam en wachtwoord niet gevonden." -#: classes/Gems/User/Form/LoginForm.php:276 +#: classes/Gems/User/Form/LoginForm.php:134 msgid "Combination of user and password not found for this organization." msgstr "Combinatie van organisatie, gebruikersnaam en wachtwoord niet gevonden." -#: classes/Gems/User/Form/LoginForm.php:349 +#: classes/Gems/User/Form/LoginForm.php:182 msgid "Enter your token..." msgstr "Voer uw kenmerk in..." +#: classes/Gems/User/Form/OrganizationFormAbstract.php:271 +msgid "Username" +msgs... [truncated message content] |
From: <gem...@li...> - 2012-04-01 23:54:15
|
Revision: 590 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=590&view=rev Author: matijsdejong Date: 2012-04-01 23:54:09 +0000 (Sun, 01 Apr 2012) Log Message: ----------- By matijsdejong on account michiel - quick fixes for reset password key procedure Modified Paths: -------------- trunk/library/classes/Gems/Default/IndexAction.php trunk/library/classes/Gems/Default/OptionAction.php Modified: trunk/library/classes/Gems/Default/IndexAction.php =================================================================== --- trunk/library/classes/Gems/Default/IndexAction.php 2012-03-30 21:03:38 UTC (rev 589) +++ trunk/library/classes/Gems/Default/IndexAction.php 2012-04-01 23:54:09 UTC (rev 590) @@ -260,8 +260,7 @@ // Veld inlognaam $element = new Zend_Form_Element_Text('userlogin'); $element->setLabel($this->_('Username')); - $element->setAttrib('size', 10); - $element->setAttrib('maxlength', 20); + $element->setAttrib('size', 40); $element->setRequired(true); return $element; Modified: trunk/library/classes/Gems/Default/OptionAction.php =================================================================== --- trunk/library/classes/Gems/Default/OptionAction.php 2012-03-30 21:03:38 UTC (rev 589) +++ trunk/library/classes/Gems/Default/OptionAction.php 2012-04-01 23:54:09 UTC (rev 590) @@ -92,6 +92,7 @@ ****************/ if ($this->_request->isPost() && $form->isValid($_POST, false)) { $this->addMessage($this->_('New password is active.')); + $user->gotoStartPage($this->menu, $this->getRequest()); $this->_reroute(array($this->getRequest()->getActionKey() => 'edit')); } else { $this->addMessage($form->getErrorMessages()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-03-30 21:03:44
|
Revision: 589 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=589&view=rev Author: matijsdejong Date: 2012-03-30 21:03:38 +0000 (Fri, 30 Mar 2012) Log Message: ----------- Whoops mistake Modified Paths: -------------- trunk/library/classes/Gems/Project/ProjectSettings.php Modified: trunk/library/classes/Gems/Project/ProjectSettings.php =================================================================== --- trunk/library/classes/Gems/Project/ProjectSettings.php 2012-03-30 20:36:44 UTC (rev 588) +++ trunk/library/classes/Gems/Project/ProjectSettings.php 2012-03-30 21:03:38 UTC (rev 589) @@ -285,7 +285,7 @@ */ public function getInitialPassword() { - if (isset($this['password']['initialPassword'])) { + if (isset($this['password'], $this['password']['initialPassword'])) { return $this['password']['initialPassword']; } else { return null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-03-30 20:36:51
|
Revision: 588 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=588&view=rev Author: matijsdejong Date: 2012-03-30 20:36:44 +0000 (Fri, 30 Mar 2012) Log Message: ----------- Added Title to actionLinks made from menu items Modified Paths: -------------- trunk/library/classes/Gems/Menu/SubMenuItem.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/Menu/SubMenuItem.php =================================================================== --- trunk/library/classes/Gems/Menu/SubMenuItem.php 2012-03-30 14:46:53 UTC (rev 587) +++ trunk/library/classes/Gems/Menu/SubMenuItem.php 2012-03-30 20:36:44 UTC (rev 588) @@ -875,6 +875,9 @@ } else { $element = MUtil_Html::create()->actionLink($href, $label); } + if ($title = $this->get('title')) { + $element->title = $title; + } // and make sure nothing shows when empty $element->setOnEmpty(null); Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2012-03-30 14:46:53 UTC (rev 587) +++ trunk/library/languages/default-en.po 2012-03-30 20:36:44 UTC (rev 588) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-03-30 14:21+0100\n" +"POT-Creation-Date: 2012-03-30 22:04+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -3975,22 +3975,22 @@ msgid "One or more IPs are illegal." msgstr "One or more IPs are illegal." -#: snippets/AddTracksSnippet.php:117 +#: snippets/AddTracksSnippet.php:198 +msgid "info" +msgstr "info" + +#: snippets/AddTracksSnippet.php:203 +msgid "None available" +msgstr "None available" + +#: snippets/AddTracksSnippet.php:218 msgid "by Respondents" msgstr "by Patients" -#: snippets/AddTracksSnippet.php:121 +#: snippets/AddTracksSnippet.php:221 msgid "by Staff" msgstr "by Staff" -#: snippets/AddTracksSnippet.php:195 -msgid "info" -msgstr "info" - -#: snippets/AddTracksSnippet.php:200 -msgid "None available" -msgstr "None available" - #: snippets/DeleteInSourceTrackSnippet.php:130 msgid "Edit track" msgstr "Edit track" Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2012-03-30 14:46:53 UTC (rev 587) +++ trunk/library/languages/default-nl.po 2012-03-30 20:36:44 UTC (rev 588) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse NL\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-03-30 14:21+0100\n" +"POT-Creation-Date: 2012-03-30 22:04+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -3975,22 +3975,22 @@ msgid "One or more IPs are illegal." msgstr "Een of meer IP adressen zijn incorrect." -#: snippets/AddTracksSnippet.php:117 +#: snippets/AddTracksSnippet.php:198 +msgid "info" +msgstr "info" + +#: snippets/AddTracksSnippet.php:203 +msgid "None available" +msgstr "Niet beschikbaar" + +#: snippets/AddTracksSnippet.php:218 msgid "by Respondents" msgstr "voor Patiënten" -#: snippets/AddTracksSnippet.php:121 +#: snippets/AddTracksSnippet.php:221 msgid "by Staff" msgstr "voor Medewerkers" -#: snippets/AddTracksSnippet.php:195 -msgid "info" -msgstr "info" - -#: snippets/AddTracksSnippet.php:200 -msgid "None available" -msgstr "Niet beschikbaar" - #: snippets/DeleteInSourceTrackSnippet.php:130 msgid "Edit track" msgstr "Bewerk traject" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-03-30 14:47:04
|
Revision: 587 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=587&view=rev Author: matijsdejong Date: 2012-03-30 14:46:53 +0000 (Fri, 30 Mar 2012) Log Message: ----------- Number not according to standard Added Paths: ----------- tags/1.5.3-pulse-20120303/ Removed Paths: ------------- tags/153-pulse-20120303/ Property changes on: tags/1.5.3-pulse-20120303 ___________________________________________________________________ Added: svn:ignore + nbproject Added: svn:mergeinfo + /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472,475-481 /tags/1.5.0beta1:305 /tags/1.5.1:485,489,509-510 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-03-30 14:40:46
|
Revision: 586 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=586&view=rev Author: matijsdejong Date: 2012-03-30 14:40:37 +0000 (Fri, 30 Mar 2012) Log Message: ----------- Added Paths: ----------- tags/153-pulse-20120303/ Property changes on: tags/153-pulse-20120303 ___________________________________________________________________ Added: svn:ignore + nbproject Added: svn:mergeinfo + /branches/1.5.0-pulse:306-430,467 /branches/1.5.x:426-455,458-472,475-481 /tags/1.5.0beta1:305 /tags/1.5.1:485,489,509-510 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-03-30 14:14:18
|
Revision: 585 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=585&view=rev Author: matijsdejong Date: 2012-03-30 14:14:12 +0000 (Fri, 30 Mar 2012) Log Message: ----------- Extended usage by making titles passable as parameters Modified Paths: -------------- trunk/library/snippets/AddTracksSnippet.php Modified: trunk/library/snippets/AddTracksSnippet.php =================================================================== --- trunk/library/snippets/AddTracksSnippet.php 2012-03-30 12:24:12 UTC (rev 584) +++ trunk/library/snippets/AddTracksSnippet.php 2012-03-30 14:14:12 UTC (rev 585) @@ -87,14 +87,14 @@ /** * Switch to set display of respondent dropdown on or off * - * @var boolean + * @var mixed When string, string is used for display, when false, nothing is displayed */ public $showForRespondents = true; /** * Switch to set display of staff dropdown on or off * - * @var boolean + * @var mixed When string, string is used for display, when false, nothing is displayed */ public $showForStaff = true; @@ -102,23 +102,26 @@ /** * Switch to set display of track dropdown on or off * - * @var boolean + * @var mixed When string, string is used for display, when false, nothing is displayed */ public $showForTracks = true; - protected function _getTracks($trackType, $pageRef) + /** + * + * @var mixed When string, string is used for display, when false, nothing is displayed + */ + public $showTitle = true; + + protected function _getTracks($trackType, $pageRef, $trackTypeDescription) { switch ($trackType) { case 'T': - $trackTypeDescription = $this->_('Tracks'); $trackController = 'track'; break; case 'S': - $trackTypeDescription = $this->_('by Respondents'); $trackController = 'survey'; break; case 'M': - $trackTypeDescription = $this->_('by Staff'); $trackController = 'survey'; break; default: @@ -204,6 +207,30 @@ } /** + * Should be called after answering the request to allow the Target + * to check if all required registry values have been set correctly. + * + * @return boolean False if required are missing. + */ + public function checkRegistryRequestsAnswers() + { + if ($this->showForRespondents && is_bool($this->showForRespondents)) { + $this->showForRespondents = $this->_('by Respondents'); + } + if ($this->showForStaff && is_bool($this->showForStaff)) { + $this->showForStaff = $this->_('by Staff'); + } + if ($this->showForTracks && is_bool($this->showForTracks)) { + $this->showForTracks = $this->_('Tracks'); + } + if ($this->showTitle && is_bool($this->showTitle)) { + $this->showTitle = $this->_('Add'); + } + + return parent::checkRegistryRequestsAnswers(); + } + + /** * Allow manual assignment of surveys/tracks to a patient * * If project uses the Gems_Project_Tracks_MultiTracksInterface, show a track drowpdown @@ -225,16 +252,18 @@ $pageRef = array(MUtil_Model::REQUEST_ID => $this->request->getParam(MUtil_Model::REQUEST_ID)); $addToLists = MUtil_Html::create()->div(array('class' => 'tooldock')); - $addToLists->strong($this->_('Add')); + if ($this->showTitle) { + $addToLists->strong($this->showTitle); + } if ($this->showForTracks && ($this->escort instanceof Gems_Project_Tracks_MultiTracksInterface)) { - $addToLists[] = $this->_getTracks('T', $pageRef); + $addToLists[] = $this->_getTracks('T', $pageRef, $this->showForTracks); } if ($this->escort instanceof Gems_Project_Tracks_StandAloneSurveysInterface) { if ($this->showForRespondents) { - $addToLists[] = $this->_getTracks('S', $pageRef); + $addToLists[] = $this->_getTracks('S', $pageRef, $this->showForRespondents); } if ($this->showForStaff) { - $addToLists[] = $this->_getTracks('M', $pageRef); + $addToLists[] = $this->_getTracks('M', $pageRef, $this->showForStaff); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-03-30 12:24:23
|
Revision: 584 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=584&view=rev Author: matijsdejong Date: 2012-03-30 12:24:12 +0000 (Fri, 30 Mar 2012) Log Message: ----------- When specified the users mail contains links to the first of the Default Url's of the organization the user belongs to. Modified Paths: -------------- trunk/library/classes/Gems/User/Organization.php trunk/library/classes/Gems/User/User.php trunk/library/classes/GemsEscort.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/User/Organization.php =================================================================== --- trunk/library/classes/Gems/User/Organization.php 2012-03-30 11:12:07 UTC (rev 583) +++ trunk/library/classes/Gems/User/Organization.php 2012-03-30 12:24:12 UTC (rev 584) @@ -77,6 +77,12 @@ protected $db; /** + * + * @var Gems_Util + */ + protected $util; + + /** * When true respondents of this organization may login * * @return boolean @@ -184,6 +190,20 @@ } /** + * Return org dependent login url + * + * @return string + */ + public function getLoginUrl() + { + if ($base = $this->_get('base_url')) { + return $base; + } else { + return $this->util->getCurrentURI(); + } + } + + /** * Array of field name => values for sending E-Mail * * @return array @@ -192,6 +212,7 @@ { $result['organization'] = $this->getName(); $result['organization_location'] = $this->_get('gor_location'); + $result['organization_login_url'] = $this->getLoginUrl(); $result['organization_reply_name'] = $this->_get('gor_contact_name'); $result['organization_reply_to'] = $this->_get('gor_contact_email'); $result['organization_signature'] = $this->getSignature(); @@ -274,6 +295,10 @@ } // MUtil_Echo::track($sql, $data['can_access']); + + if ($baseUrls = explode(' ', $data['gor_url_base'])) { + $data['base_url'] = reset($baseUrls); + } } else { $data = $this->_noOrganization; } Modified: trunk/library/classes/Gems/User/User.php =================================================================== --- trunk/library/classes/Gems/User/User.php 2012-03-30 11:12:07 UTC (rev 583) +++ trunk/library/classes/Gems/User/User.php 2012-03-30 12:24:12 UTC (rev 584) @@ -766,7 +766,8 @@ */ public function getMailFields($locale = null) { - $orgResults = $this->getBaseOrganization()->getMailFields(); + $org = $this->getBaseOrganization(); + $orgResults = $org->getMailFields(); $projResults = $this->project->getMailFields(); $result['bcc'] = $projResults['project_bcc']; @@ -776,12 +777,12 @@ $result['full_name'] = trim($this->getGenderHello($locale) . ' ' . $this->getFullName()); $result['greeting'] = $this->getGreeting($locale); $result['last_name'] = ltrim($this->_getVar('user_surname_prefix') . ' ') . $this->_getVar('user_last_name'); - $result['login_url'] = $this->util->getCurrentURI(); + $result['login_url'] = $orgResults['organization_login_url']; $result['name'] = $this->getFullName(); $result = $result + $orgResults + $projResults; - $result['reset_ask'] = $this->util->getCurrentURI('index/resetpassword'); + $result['reset_ask'] = $orgResults['organization_login_url'] . '/index/resetpassword'; $result['reply_to'] = $result['from']; $result['to'] = $result['email']; @@ -820,7 +821,7 @@ public function getResetPasswordMailFields($locale = null) { $result['reset_key'] = $this->getPasswordResetKey(); - $result['reset_url'] = $this->util->getCurrentURI('index/resetpassword/key/' . $result['reset_key']); + $result['reset_url'] = $this->getBaseOrganization()->getLoginUrl() . '/index/resetpassword/key/' . $result['reset_key']; return $result + $this->getMailFields($locale); } @@ -1058,7 +1059,7 @@ public function sendMail($subjectTemplate, $bbBodyTemplate, $useResetFields = false, $locale = null) { if ($useResetFields && (! $this->canResetPassword())) { - return $this->_('Trying to send a password reset to a user that cannot be reset.'); + return $this->translate->_('Trying to send a password reset to a user that cannot be reset.'); } $mail = new Gems_Mail(); Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2012-03-30 11:12:07 UTC (rev 583) +++ trunk/library/classes/GemsEscort.php 2012-03-30 12:24:12 UTC (rev 584) @@ -1658,6 +1658,8 @@ { $locale = isset($tokenData['grs_iso_lang']) ? $tokenData['grs_iso_lang'] : $this->locale; + $orgResults = $this->getLoader()->getOrganization($tokenData['gor_id_organization'])->getMailFields(); + // Prepare values $genderHello = $this->getUtil()->getTranslated()->getGenderHello($locale); $hello[] = $genderHello[$tokenData['grs_gender']]; @@ -1693,19 +1695,13 @@ array_shift($hello); $result['{name}'] = implode(' ', $hello); - $result['{organization}'] = $tokenData['gor_name']; - $result['{organization_location}'] = $tokenData['gor_location']; - $result['{organization_reply_name}'] = $tokenData['gor_contact_name']; - $result['{organization_reply_to}'] = $tokenData['gor_contact_email']; - $result['{organization_signature}'] = $tokenData['gor_signature']; - $result['{organization_url}'] = $tokenData['gor_url']; - $result['{organization_welcome}'] = $tokenData['gor_welcome']; + $result = $result + MUtil_Ra::braceKeys($orgResults, '{', '}'); $result['{round}'] = $tokenData['gto_round_description']; - $result['{site_ask_url}'] = $this->util->getCurrentURI('ask/'); + $result['{site_ask_url}'] = $orgResults['organization_login_url'] . '/ask/'; // Url's - $url = $this->util->getCurrentURI('ask/forward/' . MUtil_Model::REQUEST_ID . '/' . $tokenData['gto_id_token']); + $url = $orgResults['organization_login_url'] . '/ask/forward/' . MUtil_Model::REQUEST_ID . '/' . $tokenData['gto_id_token']; $url_input = $result['{site_ask_url}'] . 'index/' . MUtil_Model::REQUEST_ID . '/' . $tokenData['gto_id_token']; $result['{survey}'] = $tokenData['gsu_survey_name']; Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2012-03-30 11:12:07 UTC (rev 583) +++ trunk/library/languages/default-en.po 2012-03-30 12:24:12 UTC (rev 584) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-03-30 13:10+0100\n" +"POT-Creation-Date: 2012-03-30 14:21+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -87,8 +87,8 @@ msgid "You must login to access this page." msgstr "You must login to access this page." -#: classes/GemsEscort.php:1713 -#: classes/GemsEscort.php:1715 +#: classes/GemsEscort.php:1709 +#: classes/GemsEscort.php:1711 #, php-format msgid "%d survey" msgid_plural "%d surveys" @@ -3623,15 +3623,15 @@ msgid "You are not allowed to login from this location." msgstr "You are not allowed to login from this location." -#: classes/Gems/User/User.php:1061 +#: classes/Gems/User/User.php:1062 msgid "Trying to send a password reset to a user that cannot be reset." msgstr "Trying to send a password reset to a user that cannot be reset." -#: classes/Gems/User/User.php:1088 +#: classes/Gems/User/User.php:1089 msgid "Unable to send e-mail." msgstr "Unable to send e-mail." -#: classes/Gems/User/User.php:1215 +#: classes/Gems/User/User.php:1216 msgid "Cookies must be enabled for this site." msgstr "Cookies must be enabled for this site." Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2012-03-30 11:12:07 UTC (rev 583) +++ trunk/library/languages/default-nl.po 2012-03-30 12:24:12 UTC (rev 584) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse NL\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-03-30 13:11+0100\n" +"POT-Creation-Date: 2012-03-30 14:21+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -87,8 +87,8 @@ msgid "You must login to access this page." msgstr "U moet ingelogd zijn voor toegang tot deze pagina." -#: classes/GemsEscort.php:1713 -#: classes/GemsEscort.php:1715 +#: classes/GemsEscort.php:1709 +#: classes/GemsEscort.php:1711 #, php-format msgid "%d survey" msgid_plural "%d surveys" @@ -3623,15 +3623,15 @@ msgid "You are not allowed to login from this location." msgstr "U kunt vanaf deze locatie niet inloggen." -#: classes/Gems/User/User.php:1061 +#: classes/Gems/User/User.php:1062 msgid "Trying to send a password reset to a user that cannot be reset." msgstr "Het wachtwoord voor deze gebruiker kan niet gewijzigd worden." -#: classes/Gems/User/User.php:1088 +#: classes/Gems/User/User.php:1089 msgid "Unable to send e-mail." msgstr "Verzenden e-mail mislukt." -#: classes/Gems/User/User.php:1215 +#: classes/Gems/User/User.php:1216 msgid "Cookies must be enabled for this site." msgstr "Zonder cookies heeft u geen toegang tot deze site." This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-03-30 11:12:19
|
Revision: 583 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=583&view=rev Author: matijsdejong Date: 2012-03-30 11:12:07 +0000 (Fri, 30 Mar 2012) Log Message: ----------- Translations updated Modified Paths: -------------- 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/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2012-03-30 11:07:16 UTC (rev 582) +++ trunk/library/languages/default-en.po 2012-03-30 11:12:07 UTC (rev 583) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-03-30 11:34+0100\n" +"POT-Creation-Date: 2012-03-30 13:10+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -3623,15 +3623,15 @@ msgid "You are not allowed to login from this location." msgstr "You are not allowed to login from this location." -#: classes/Gems/User/User.php:1060 +#: classes/Gems/User/User.php:1061 msgid "Trying to send a password reset to a user that cannot be reset." msgstr "Trying to send a password reset to a user that cannot be reset." -#: classes/Gems/User/User.php:1087 +#: classes/Gems/User/User.php:1088 msgid "Unable to send e-mail." msgstr "Unable to send e-mail." -#: classes/Gems/User/User.php:1214 +#: classes/Gems/User/User.php:1215 msgid "Cookies must be enabled for this site." msgstr "Cookies must be enabled for this site." @@ -4169,6 +4169,10 @@ msgstr "Access" #: snippets/Organization/OrganizationEditSnippet.php:113 +msgid "No access to other organizations." +msgstr "No access to other organizations." + +#: snippets/Organization/OrganizationEditSnippet.php:115 msgid "Can access" msgstr "Can access" Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2012-03-30 11:07:16 UTC (rev 582) +++ trunk/library/languages/default-nl.po 2012-03-30 11:12:07 UTC (rev 583) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse NL\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-03-30 11:38+0100\n" +"POT-Creation-Date: 2012-03-30 13:11+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -3623,15 +3623,15 @@ msgid "You are not allowed to login from this location." msgstr "U kunt vanaf deze locatie niet inloggen." -#: classes/Gems/User/User.php:1060 +#: classes/Gems/User/User.php:1061 msgid "Trying to send a password reset to a user that cannot be reset." msgstr "Het wachtwoord voor deze gebruiker kan niet gewijzigd worden." -#: classes/Gems/User/User.php:1087 +#: classes/Gems/User/User.php:1088 msgid "Unable to send e-mail." msgstr "Verzenden e-mail mislukt." -#: classes/Gems/User/User.php:1214 +#: classes/Gems/User/User.php:1215 msgid "Cookies must be enabled for this site." msgstr "Zonder cookies heeft u geen toegang tot deze site." @@ -4169,6 +4169,10 @@ msgstr "Toegang" #: snippets/Organization/OrganizationEditSnippet.php:113 +msgid "No access to other organizations." +msgstr "Geen toegang tot andere organisaties." + +#: snippets/Organization/OrganizationEditSnippet.php:115 msgid "Can access" msgstr "Toegang tot" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-03-30 11:07:26
|
Revision: 582 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=582&view=rev Author: matijsdejong Date: 2012-03-30 11:07:16 +0000 (Fri, 30 Mar 2012) Log Message: ----------- Updated display of 'Can access' Modified Paths: -------------- trunk/library/classes/Gems/User/User.php trunk/library/snippets/Organization/OrganizationEditSnippet.php Modified: trunk/library/classes/Gems/User/User.php =================================================================== --- trunk/library/classes/Gems/User/User.php 2012-03-30 09:56:07 UTC (rev 581) +++ trunk/library/classes/Gems/User/User.php 2012-03-30 11:07:16 UTC (rev 582) @@ -541,6 +541,7 @@ if (! $this->_hasVar('__allowedOrgs')) { $this->refreshAllowedOrganizations(); } + // MUtil_Echo::track($this->_getVar('__allowedOrgs')); return $this->_getVar('__allowedOrgs'); } Modified: trunk/library/snippets/Organization/OrganizationEditSnippet.php =================================================================== --- trunk/library/snippets/Organization/OrganizationEditSnippet.php 2012-03-30 09:56:07 UTC (rev 581) +++ trunk/library/snippets/Organization/OrganizationEditSnippet.php 2012-03-30 11:07:16 UTC (rev 582) @@ -109,9 +109,10 @@ //Strip self unset($allowedOrgs[$this->formData['gor_id_organization']]); $display = join(', ', $allowedOrgs); - if ($display) { - $bridge->addExhibitor('allowed', 'value', $display, 'label', $this->_('Can access')); + if (! $display) { + $display = MUtil_Html::create('em', $this->_('No access to other organizations.')); } + $bridge->addExhibitor('allowed', 'value', $display, 'label', $this->_('Can access')); } $this->addItems($bridge, 'gor_user_class'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-03-30 09:56:17
|
Revision: 581 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=581&view=rev Author: matijsdejong Date: 2012-03-30 09:56:07 +0000 (Fri, 30 Mar 2012) Log Message: ----------- Translations updated Removed debug code Made MUtil_Date and Translated faster when comparing in days from today. Modified Paths: -------------- trunk/library/classes/Gems/Default/IndexAction.php trunk/library/classes/Gems/Util/Translated.php trunk/library/classes/MUtil/Date.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/IndexAction.php =================================================================== --- trunk/library/classes/Gems/Default/IndexAction.php 2012-03-29 21:16:55 UTC (rev 580) +++ trunk/library/classes/Gems/Default/IndexAction.php 2012-03-30 09:56:07 UTC (rev 581) @@ -298,7 +298,6 @@ /** * Fix current locale in cookies */ - MUtil_Echo::track($user->getLocale(), $this->basepath->getBasePath()); Gems_Cookies::setLocale($user->getLocale(), $this->basepath->getBasePath()); /** Modified: trunk/library/classes/Gems/Util/Translated.php =================================================================== --- trunk/library/classes/Gems/Util/Translated.php 2012-03-29 21:16:55 UTC (rev 580) +++ trunk/library/classes/Gems/Util/Translated.php 2012-03-30 09:56:07 UTC (rev 581) @@ -132,7 +132,7 @@ // 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()); + $days = $dateTime->diffDays(); switch ($days) { case -2: Modified: trunk/library/classes/MUtil/Date.php =================================================================== --- trunk/library/classes/MUtil/Date.php 2012-03-29 21:16:55 UTC (rev 580) +++ trunk/library/classes/MUtil/Date.php 2012-03-30 09:56:07 UTC (rev 581) @@ -61,16 +61,20 @@ * @param Zend_Locale $locale optional (not used) * @return type */ - public function diffDays(Zend_Date $date, $locale = null) + public function diffDays(Zend_Date $date = null, $locale = null) { $day1 = clone $this; - $day2 = clone $date; $day1->setTime(0); - $day2->setTime(0); - $val1 = intval($day1->getUnixTimestamp() / self::DAY_SECONDS); - $val2 = intval($day2->getUnixTimestamp() / self::DAY_SECONDS); + if (null === $date) { + $val2 = intval(time() / self::DAY_SECONDS); + } else { + $day2 = clone $date; + $day2->setTime(0); + $val2 = intval($day2->getUnixTimestamp() / self::DAY_SECONDS); + } + return $val1 - $val2; } @@ -215,11 +219,11 @@ $difference = -$difference; $ending = $translate->_("%s to go"); } - + for ($j = 0; $j < 7 && $difference >= $lengths[$j]; $j++) { $difference /= $lengths[$j]; } - + $difference = round($difference); switch ($j) { Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2012-03-29 21:16:55 UTC (rev 580) +++ trunk/library/languages/default-en.po 2012-03-30 09:56:07 UTC (rev 581) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-03-22 16:35+0100\n" +"POT-Creation-Date: 2012-03-30 11:34+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -23,72 +23,72 @@ msgid "Path %s not writable" msgstr "Path %s not writable" -#: classes/GemsEscort.php:743 +#: classes/GemsEscort.php:745 #, php-format msgid "You are logged in as %s" msgstr "You are logged in as %s" -#: classes/GemsEscort.php:745 +#: classes/GemsEscort.php:747 #: classes/Gems/Menu.php:248 msgid "Logoff" msgstr "Logoff" -#: classes/GemsEscort.php:748 +#: classes/GemsEscort.php:750 msgid "You are not logged in" msgstr "You are not logged in" -#: classes/GemsEscort.php:931 +#: classes/GemsEscort.php:934 #, php-format msgid "User: %s" msgstr "User: %s" -#: classes/GemsEscort.php:956 +#: classes/GemsEscort.php:959 msgid "version" msgstr "version" -#: classes/GemsEscort.php:1387 +#: classes/GemsEscort.php:1390 msgid "Take note: your session has expired, your inputs were not saved. Please check the input data and try again" msgstr "Take note: your session has expired, your inputs were not saved. Please check the input data and try again" -#: classes/GemsEscort.php:1518 +#: classes/GemsEscort.php:1521 msgid "Please check back later." msgstr "Please check back later." -#: classes/GemsEscort.php:1520 -#: classes/GemsEscort.php:1524 -#: classes/GemsEscort.php:1525 +#: classes/GemsEscort.php:1523 +#: classes/GemsEscort.php:1527 +#: classes/GemsEscort.php:1528 msgid "System is in maintenance mode" msgstr "System is in maintenance mode" -#: classes/GemsEscort.php:1535 +#: classes/GemsEscort.php:1538 msgid "No access to site." msgstr "No access to site." -#: classes/GemsEscort.php:1537 -#: classes/GemsEscort.php:1579 +#: classes/GemsEscort.php:1540 +#: classes/GemsEscort.php:1582 msgid "You have no access to this site." msgstr "You have no access to this site." -#: classes/GemsEscort.php:1553 +#: classes/GemsEscort.php:1556 msgid "No access to page" msgstr "No access to page" -#: classes/GemsEscort.php:1555 +#: classes/GemsEscort.php:1558 #, 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:1565 -#: classes/GemsEscort.php:1577 +#: classes/GemsEscort.php:1568 +#: classes/GemsEscort.php:1580 msgid "You are no longer logged in." msgstr "You are no longer logged in." -#: classes/GemsEscort.php:1566 +#: classes/GemsEscort.php:1569 msgid "You must login to access this page." msgstr "You must login to access this page." -#: classes/GemsEscort.php:1710 -#: classes/GemsEscort.php:1712 +#: classes/GemsEscort.php:1713 +#: classes/GemsEscort.php:1715 #, php-format msgid "%d survey" msgid_plural "%d surveys" @@ -99,7 +99,7 @@ msgid "Database needs to be updated!" msgstr "Database needs to be updated!" -#: classes/Gems/Auth.php:242 +#: classes/Gems/Auth.php:235 msgid "Combination of organization, username and password not found." msgstr "Combination of organization, username and password not found." @@ -450,11 +450,13 @@ msgstr "Trying upgrade for %s to level %s: %s" #: classes/Gems/Controller/BrowseEditAction.php:354 +#: classes/Gems/Controller/ModelSnippetActionAbstract.php:226 #, php-format msgid "New %s..." msgstr "New %s..." #: classes/Gems/Controller/BrowseEditAction.php:387 +#: classes/Gems/Controller/ModelSnippetActionAbstract.php:246 #, php-format msgid "Delete %s" msgstr "Delete %s" @@ -483,6 +485,7 @@ msgstr "No %s found" #: classes/Gems/Controller/BrowseEditAction.php:662 +#: classes/Gems/Default/ExportAction.php:234 #, php-format msgid "No %s found." msgstr "No %s found." @@ -492,10 +495,14 @@ msgstr "Are you sure?" #: classes/Gems/Controller/BrowseEditAction.php:796 +#: classes/Gems/Default/DatabaseAction.php:171 +#: classes/Gems/Default/DatabaseAction.php:484 msgid "Yes" msgstr "Yes" #: classes/Gems/Controller/BrowseEditAction.php:797 +#: classes/Gems/Default/DatabaseAction.php:172 +#: classes/Gems/Default/DatabaseAction.php:485 msgid "No" msgstr "No" @@ -1042,7 +1049,7 @@ msgstr "%s records found." #: classes/Gems/Default/ExportAction.php:172 -#: classes/Gems/Default/IndexAction.php:220 +#: classes/Gems/Default/IndexAction.php:190 #: classes/Gems/Default/LogAction.php:197 msgid "Organization" msgstr "Organization" @@ -1078,88 +1085,75 @@ msgid "Administrative groups" msgstr "Administrative groups" -#: classes/Gems/Default/IndexAction.php:105 -msgid "Enter your token..." -msgstr "Enter your token..." - -#: classes/Gems/Default/IndexAction.php:157 +#: classes/Gems/Default/IndexAction.php:142 #, php-format msgid "Login to %s application" msgstr "Login to %s application" -#: classes/Gems/Default/IndexAction.php:169 -msgid "Login" -msgstr "Login" - -#: classes/Gems/Default/IndexAction.php:191 +#: classes/Gems/Default/IndexAction.php:161 msgid "Back to login" msgstr "Back to login" -#: classes/Gems/Default/IndexAction.php:244 -msgid "Password" -msgstr "Password" - -#: classes/Gems/Default/IndexAction.php:259 +#: classes/Gems/Default/IndexAction.php:212 #, php-format msgid "Reset password for %s application" msgstr "Reset password for %s application" -#: classes/Gems/Default/IndexAction.php:263 +#: classes/Gems/Default/IndexAction.php:216 msgid "Reset password" msgstr "Reset password" -#: classes/Gems/Default/IndexAction.php:309 +#: classes/Gems/Default/IndexAction.php:262 msgid "Username" msgstr "Username" -#: classes/Gems/Default/IndexAction.php:351 +#: classes/Gems/Default/IndexAction.php:294 msgid "Your password must be changed." msgstr "Your password must be changed." -#: classes/Gems/Default/IndexAction.php:363 +#: classes/Gems/Default/IndexAction.php:306 #, php-format msgid "Login successful, welcome %s." msgstr "Login successful, welcome %s." -#: classes/Gems/Default/IndexAction.php:403 +#: classes/Gems/Default/IndexAction.php:348 #, php-format msgid "Good bye: %s." msgstr "Good bye: %s." -#: classes/Gems/Default/IndexAction.php:428 +#: classes/Gems/Default/IndexAction.php:373 msgid "Reset accepted, enter your new password." msgstr "Reset accepted, enter your new password." -#: classes/Gems/Default/IndexAction.php:432 +#: classes/Gems/Default/IndexAction.php:377 msgid "This key timed out or does not belong to this user." msgstr "This key timed out or does not belong to this user." -#: classes/Gems/Default/IndexAction.php:455 +#: classes/Gems/Default/IndexAction.php:380 msgid "Password reset requested" msgstr "Password reset requested" -#: classes/Gems/Default/IndexAction.php:456 -#, php-format -msgid "To reset your password for %s, please click this link: %s" -msgstr "To reset your password for %s, please click this link: %s" +#: classes/Gems/Default/IndexAction.php:381 +msgid "" +"To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n" +"{reset_url}" +msgstr "" +"To set a new password for the [b]{organization}[/b] site [b]{project}[/b], please click on this link:\n" +"{reset_url}" -#: classes/Gems/Default/IndexAction.php:461 +#: classes/Gems/Default/IndexAction.php:386 msgid "We sent you an e-mail with a reset link. Click on the link in the e-mail." msgstr "We sent you an e-mail with a reset link. Click on the link in the e-mail." -#: classes/Gems/Default/IndexAction.php:463 -msgid "Unable to send e-mail." -msgstr "Unable to send e-mail." - -#: classes/Gems/Default/IndexAction.php:468 +#: classes/Gems/Default/IndexAction.php:391 msgid "No such user found or no e-mail address known or user cannot be reset." msgstr "No such user found or no e-mail address known or user cannot be reset." -#: classes/Gems/Default/IndexAction.php:472 +#: classes/Gems/Default/IndexAction.php:395 msgid "We received your password reset key." msgstr "We received your password reset key." -#: classes/Gems/Default/IndexAction.php:473 +#: classes/Gems/Default/IndexAction.php:396 msgid "Please enter the organization and username belonging to this key." msgstr "Please enter the organization and username belonging to this key." @@ -1236,7 +1230,6 @@ msgstr "Date" #: classes/Gems/Default/LogAction.php:191 -#: classes/Gems/Default/LogMaintenanceAction.php:52 msgid "Action" msgstr "Action" @@ -1253,7 +1246,6 @@ msgstr "IP address" #: classes/Gems/Default/LogAction.php:209 -#: classes/Gems/Default/LogMaintenanceAction.php:53 msgid "Log" msgstr "Log" @@ -1438,6 +1430,10 @@ msgid "User ID" msgstr "User ID" +#: classes/Gems/Default/MailServerAction.php:88 +msgid "Password" +msgstr "Password" + #: classes/Gems/Default/MailServerAction.php:90 #: classes/Gems/Default/SourceAction.php:95 msgid "Repeat password" @@ -1459,8 +1455,6 @@ msgstr "Email servers" #: classes/Gems/Default/MailTemplateAction.php:76 -#: classes/Gems/Default/StaffAction.php:278 -#: classes/Gems/Default/StaffAction.php:311 msgid "(all organizations)" msgstr "(all organizations)" @@ -1479,7 +1473,6 @@ msgstr "You are not allowed to change your password." #: classes/Gems/Default/OptionAction.php:94 -#: classes/Gems/Default/StaffAction.php:419 msgid "New password is active." msgstr "New password is active." @@ -1488,9 +1481,8 @@ msgstr "Login Name" #: classes/Gems/Default/OptionAction.php:135 -#: classes/Gems/Default/OrganizationAction.php:129 +#: classes/Gems/Default/OrganizationAction.php:132 #: classes/Gems/Default/RespondentAction.php:175 -#: classes/Gems/Default/StaffAction.php:294 msgid "Language" msgstr "Language" @@ -1536,85 +1528,88 @@ msgstr "Style" #: classes/Gems/Default/OrganizationAction.php:123 -msgid "Default url" -msgstr "Default url" +msgid "Default url's" +msgstr "Default url's" #: classes/Gems/Default/OrganizationAction.php:125 #, php-format -msgid "Always switch to this organization when %s is accessed from this url" -msgstr "Always switch to this organization when %s is accessed from this url" +msgid "Always switch to this organization when %s is accessed from one of these space separated url's. The first is used for mails." +msgstr "Always switch to this organization when %s is accessed from one of these space separated url's. The first is used for mails." -#: classes/Gems/Default/OrganizationAction.php:133 +#: classes/Gems/Default/OrganizationAction.php:136 msgid "Can the organization be used?" msgstr "Can the organization be used?" -#: classes/Gems/Default/OrganizationAction.php:134 +#: classes/Gems/Default/OrganizationAction.php:137 +msgid "Login" +msgstr "Login" + +#: classes/Gems/Default/OrganizationAction.php:137 msgid "Can people login for this organization?" msgstr "Can people login for this organization?" -#: classes/Gems/Default/OrganizationAction.php:135 +#: classes/Gems/Default/OrganizationAction.php:138 msgid "Accepting" msgstr "Accepting" -#: classes/Gems/Default/OrganizationAction.php:135 +#: classes/Gems/Default/OrganizationAction.php:138 msgid "Can new respondents be added to the organization?" msgstr "Can new patients be added to the organization?" -#: classes/Gems/Default/OrganizationAction.php:136 +#: classes/Gems/Default/OrganizationAction.php:139 msgid "Does the organization have respondents?" msgstr "Does the organization have patients?" -#: classes/Gems/Default/OrganizationAction.php:137 +#: classes/Gems/Default/OrganizationAction.php:140 msgid "Respondent group" msgstr "Patient group" -#: classes/Gems/Default/OrganizationAction.php:137 +#: classes/Gems/Default/OrganizationAction.php:140 msgid "Allows respondents to login." msgstr "Allow patients to login." -#: classes/Gems/Default/OrganizationAction.php:141 +#: classes/Gems/Default/OrganizationAction.php:144 msgid "Greeting" msgstr "Greeting" -#: classes/Gems/Default/OrganizationAction.php:141 -#: classes/Gems/Default/OrganizationAction.php:142 +#: classes/Gems/Default/OrganizationAction.php:144 +#: classes/Gems/Default/OrganizationAction.php:145 msgid "For emails and token forward screen." msgstr "For emails and token forward screen." -#: classes/Gems/Default/OrganizationAction.php:142 +#: classes/Gems/Default/OrganizationAction.php:145 msgid "Signature" msgstr "Signature" -#: classes/Gems/Default/OrganizationAction.php:144 +#: classes/Gems/Default/OrganizationAction.php:147 msgid "Accessible by" msgstr "Accessible by" -#: classes/Gems/Default/OrganizationAction.php:144 +#: classes/Gems/Default/OrganizationAction.php:147 msgid "Checked organizations see this organizations respondents." msgstr "Checked organizations see this organizations patients." -#: classes/Gems/Default/OrganizationAction.php:154 +#: classes/Gems/Default/OrganizationAction.php:157 msgid "Code name" msgstr "Code name" -#: classes/Gems/Default/OrganizationAction.php:154 +#: classes/Gems/Default/OrganizationAction.php:157 msgid "Only for programmers." msgstr "Only for programmers." -#: classes/Gems/Default/OrganizationAction.php:164 +#: classes/Gems/Default/OrganizationAction.php:167 msgid "This can not be changed yet" msgstr "This can not be changed yet" -#: classes/Gems/Default/OrganizationAction.php:166 -#: classes/Gems/Default/StaffAction.php:119 +#: classes/Gems/Default/OrganizationAction.php:169 msgid "User Definition" msgstr "User Definition" -#: classes/Gems/Default/OrganizationAction.php:186 +#: classes/Gems/Default/OrganizationAction.php:189 msgid "Participating organizations" msgstr "Participating organizations" -#: classes/Gems/Default/OrganizationAction.php:197 +#: classes/Gems/Default/OrganizationAction.php:200 msgid "organization" msgid_plural "organizations" msgstr[0] "organization" @@ -3082,16 +3077,19 @@ msgstr "Executing patchlevel %d" #: classes/Gems/Task/Tracker/CheckTokenCompletion.php:74 +#: classes/Gems/Tracker/ChangeTracker.php:72 #, php-format msgid "Answers changed by survey completion event for %d tokens." msgstr "Answers changed by survey completion event for %d tokens." #: classes/Gems/Task/Tracker/CheckTokenCompletion.php:78 +#: classes/Gems/Tracker/ChangeTracker.php:75 #, php-format msgid "Results and timing changed for %d tokens." msgstr "Results and timing changed for %d tokens." #: classes/Gems/Task/Tracker/CheckTokenCompletion.php:81 +#: classes/Gems/Tracker/ChangeTracker.php:67 #, php-format msgid "Checked %d tokens." msgstr "Checked %d tokens." @@ -3610,27 +3608,42 @@ msgid "may not contain numbers" msgstr "may not contain numbers" -#: classes/Gems/User/RadiusUserDefinition.php:178 +#: classes/Gems/User/RadiusUserDefinition.php:177 msgid "Shared secret" msgstr "Shared secret" -#: classes/Gems/User/User.php:843 +#: classes/Gems/User/User.php:415 +#, php-format +msgid "Your account is temporarily blocked, please wait a minute." +msgid_plural "Your account is temporarily blocked, please wait %d minutes." +msgstr[0] "Your account is temporarily blocked, please wait a minute." +msgstr[1] "Your account is temporarily blocked, please wait %d minutes." + +#: classes/Gems/User/User.php:450 +msgid "You are not allowed to login from this location." +msgstr "You are not allowed to login from this location." + +#: classes/Gems/User/User.php:1060 +msgid "Trying to send a password reset to a user that cannot be reset." +msgstr "Trying to send a password reset to a user that cannot be reset." + +#: classes/Gems/User/User.php:1087 +msgid "Unable to send e-mail." +msgstr "Unable to send e-mail." + +#: classes/Gems/User/User.php:1214 msgid "Cookies must be enabled for this site." msgstr "Cookies must be enabled for this site." -#: classes/Gems/User/UserLoader.php:181 -#: classes/Gems/User/UserLoader.php:195 +#: classes/Gems/User/UserLoader.php:231 +#: classes/Gems/User/UserLoader.php:245 msgid "Db storage" msgstr "Db storage" -#: classes/Gems/User/UserLoader.php:196 +#: classes/Gems/User/UserLoader.php:246 msgid "Radius storage" msgstr "Radius storage" -#: classes/Gems/User/UserPasswordValidator.php:115 -msgid "Wrong password." -msgstr "Wrong password." - #: classes/Gems/User/Form/ChangePasswordForm.php:166 #: classes/Gems/User/Form/ChangePasswordForm.php:222 msgid "New password" @@ -3640,6 +3653,10 @@ msgid "Current password" msgstr "Current password" +#: classes/Gems/User/Form/ChangePasswordForm.php:197 +msgid "Wrong password." +msgstr "Wrong password." + #: classes/Gems/User/Form/ChangePasswordForm.php:243 msgid "Password rules" msgstr "Password rules" @@ -3657,6 +3674,18 @@ msgid "Caps Lock seems to be on!" msgstr "Caps Lock seems to be on!" +#: classes/Gems/User/Form/LoginForm.php:274 +msgid "Combination of user and password not found." +msgstr "Combination of user and password not found." + +#: classes/Gems/User/Form/LoginForm.php:276 +msgid "Combination of user and password not found for this organization." +msgstr "Combination of user and password not found for this organization." + +#: classes/Gems/User/Form/LoginForm.php:349 +msgid "Enter your token..." +msgstr "Enter your token..." + #: classes/Gems/Util/ReceptionCodeLibrary.php:100 msgid "Yes (forget answers)" msgstr "Yes (forget answers)" @@ -3673,6 +3702,10 @@ msgid "Stop (per respondent or track only)" msgstr "Stop (per patient or track only)" +#: classes/Gems/Util/TrackData.php:132 +msgid "Inactive" +msgstr "Inactive" + #: classes/Gems/Util/Translated.php:96 msgid "forever" msgstr "forever" @@ -3727,87 +3760,87 @@ msgid "Send one mail per respondent, mark only mailed tokens as send." msgstr "Send one mail per patient, mark only mailed tokens as send." -#: classes/Gems/Util/Translated.php:198 +#: classes/Gems/Util/Translated.php:204 msgid "Unknown" msgstr "Unknown" -#: classes/Gems/Util/Translated.php:203 +#: classes/Gems/Util/Translated.php:217 msgid "mr." msgstr "Mr." -#: classes/Gems/Util/Translated.php:203 +#: classes/Gems/Util/Translated.php:217 msgid "mrs." msgstr "Mrs." -#: classes/Gems/Util/Translated.php:203 +#: classes/Gems/Util/Translated.php:217 msgid "mr./mrs." msgstr "Mr./Mrs." -#: classes/Gems/Util/Translated.php:208 +#: classes/Gems/Util/Translated.php:230 msgid "Mr." msgstr "Mr." -#: classes/Gems/Util/Translated.php:208 +#: classes/Gems/Util/Translated.php:230 msgid "Mrs." msgstr "Mrs." -#: classes/Gems/Util/Translated.php:208 +#: classes/Gems/Util/Translated.php:230 msgid "Mr./Mrs." msgstr "Mr./Mrs." -#: classes/MUtil/Date.php:213 +#: classes/MUtil/Date.php:217 #, php-format msgid "%s ago" msgstr "%s ago" -#: classes/MUtil/Date.php:216 +#: classes/MUtil/Date.php:220 #, php-format msgid "%s to go" msgstr "%s to go" -#: classes/MUtil/Date.php:227 +#: classes/MUtil/Date.php:231 msgid "second" msgid_plural "seconds" msgstr[0] "second" msgstr[1] "seconds" -#: classes/MUtil/Date.php:230 +#: classes/MUtil/Date.php:234 msgid "minute" msgid_plural "minutes" msgstr[0] "minute" msgstr[1] "minutes" -#: classes/MUtil/Date.php:233 +#: classes/MUtil/Date.php:237 msgid "hour" msgid_plural "hours" msgstr[0] "hour" msgstr[1] "hours" -#: classes/MUtil/Date.php:236 +#: classes/MUtil/Date.php:240 msgid "day" msgid_plural "days" msgstr[0] "day" msgstr[1] "days" -#: classes/MUtil/Date.php:239 +#: classes/MUtil/Date.php:243 msgid "week" msgid_plural "weeks" msgstr[0] "week" msgstr[1] "weeks" -#: classes/MUtil/Date.php:242 +#: classes/MUtil/Date.php:246 msgid "month" msgid_plural "months" msgstr[0] "month" msgstr[1] "months" -#: classes/MUtil/Date.php:245 +#: classes/MUtil/Date.php:249 msgid "year" msgid_plural "years" msgstr[0] "year" msgstr[1] "years" -#: classes/MUtil/Date.php:248 +#: classes/MUtil/Date.php:252 msgid "decade" msgid_plural "decades" msgstr[0] "decade" @@ -3848,10 +3881,6 @@ msgid "Your account is temporarily blocked, please wait %s minutes" msgstr "Your account is temporarily blocked, please wait %s minutes" -#: languages/FakeTranslations.php:47 -msgid "You are not allowed to login from this location." -msgstr "You are not allowed to login from this location." - #: languages/FakeTranslations.php:50 msgid "Not a valid token. The format for valid tokens is: %tokenFormat%." msgstr "Not a valid token. The format for valid tokens is: %tokenFormat%." @@ -3999,7 +4028,6 @@ msgstr "Deleted token %s for survey %s." #: snippets/DeleteTrackTokenSnippet.php:286 -#: snippets/EditTrackTokenSnippet.php:174 #, php-format msgid "%d token changed by recalculation." msgid_plural "%d tokens changed by recalculation." @@ -4124,26 +4152,29 @@ msgid "This organization cannot have any respondents." msgstr "This organization cannot have any patients." -#: snippets/Organization/OrganizationEditSnippet.php:71 +#: snippets/Organization/OrganizationEditSnippet.php:77 msgid "General" msgstr "General" -#: snippets/Organization/OrganizationEditSnippet.php:77 +#: snippets/Organization/OrganizationEditSnippet.php:83 msgid "The contact details for this organization, used for emailing." msgstr "The contact details for this organization, used for emailing." -#: snippets/Organization/OrganizationEditSnippet.php:83 +#: snippets/Organization/OrganizationEditSnippet.php:89 msgid "Email" msgstr "Email" -#: snippets/Organization/OrganizationEditSnippet.php:88 +#: snippets/Organization/OrganizationEditSnippet.php:94 msgid "Access" msgstr "Access" -#: snippets/Organization/OrganizationEditSnippet.php:106 +#: snippets/Organization/OrganizationEditSnippet.php:113 msgid "Can access" msgstr "Can access" +#~ msgid "To reset your password for %s, please click this link: %s" +#~ msgstr "To reset your password for %s, please click this link: %s" + #~ msgid "Check %s surveys" #~ msgstr "Check %s surveys" Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2012-03-29 21:16:55 UTC (rev 580) +++ trunk/library/languages/default-nl.po 2012-03-30 09:56:07 UTC (rev 581) @@ -1,4819 +1,4842 @@ -msgid "" -msgstr "" -"Project-Id-Version: Pulse NL\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-03-29 16:34+0100\n" -"PO-Revision-Date: \n" -"Last-Translator: Michiel Rook <in...@to...>\n" -"Language-Team: Erasmus MGZ <mat...@ma...>\n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Poedit-Language: Dutch\n" -"X-Poedit-Country: NETHERLANDS\n" -"X-Poedit-SourceCharset: iso-8859-1\n" -"X-Poedit-Basepath: ../\n" -"X-Poedit-KeywordsList: plural:1,2\n" -"X-Poedit-SearchPath-0: .\n" - -#: classes/GemsEscort.php:211 -#, php-format -msgid "Path %s not writable" -msgstr "Path %s niet schrijfbaar" - -#: classes/GemsEscort.php:745 -#, php-format -msgid "You are logged in as %s" -msgstr "Ingelogd als %s" - -#: classes/GemsEscort.php:747 -msgid "Logoff" -msgstr "Uitloggen" - -#: classes/GemsEscort.php:750 -msgid "You are not logged in" -msgstr "U bent niet ingelogd" - -#: classes/GemsEscort.php:934 -#, php-format -msgid "User: %s" -msgstr "Login: %s" - -#: classes/GemsEscort.php:959 -msgid "version" -msgstr "versie" - -#: classes/GemsEscort.php:1390 -msgid "Take note: your session has expired, your inputs were not saved. Please check the input data and try again" -msgstr "Let op: uw sessie is verlopen, uw invoer is niet opgeslagen. Controleer uw gegevens en probeer a.u.b. opnieuw." - -#: classes/GemsEscort.php:1521 -msgid "Please check back later." -msgstr "Probeer het later opnieuw." - -#: classes/GemsEscort.php:1523 -#: classes/GemsEscort.php:1528 -msgid "System is in maintenance mode" -msgstr "Systeem is in onderhoudsmodus" - -#: classes/GemsEscort.php:1538 -msgid "No access to site." -msgstr "Geen toegang tot website." - -#: classes/GemsEscort.php:1540 -msgid "You have no access to this site." -msgstr "U heeft geen toegang tot deze website." - -#: classes/GemsEscort.php:1556 -msgid "No access to page" -msgstr "Geen toegang tot pagina" - -#: classes/GemsEscort.php:1558 -#, 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:1568 -msgid "You are no longer logged in." -msgstr "U bent niet meer ingelogd." - -#: classes/GemsEscort.php:1569 -msgid "You must login to access this page." -msgstr "U moet ingelogd zijn voor toegang tot deze pagina." - -#: classes/GemsEscort.php:1713 -#, php-format -msgid "%d survey" -msgid_plural "%d surveys" -msgstr[0] "%d vragenlijst" -msgstr[1] "%d vragenlijsten" - -#: classes/Gems/Pdf.php:198 -#, php-format -msgid "PDF Source File '%s' not found!" -msgstr "PDF bron bestand %s niet gevonden!" - -#: classes/Gems/Pdf.php:240 -#, php-format -msgid "Could not create '%s' directory." -msgstr "Kon de directory '%s' niet aanmaken." - -#: classes/Gems/Pdf.php:283 -#, php-format -msgid " The error message is: %s" -msgstr "De foutmelding is: %s" - -#: classes/Gems/Tracker.php:761 -msgid "Checks performed" -msgstr "Controle uitgevoerd" - -#: classes/Gems/Upgrades.php:76 -msgid "Syncing surveys for all sources" -msgstr "Vragenlijsten synchroniseren voor alle bronnen." - -#: classes/Gems/AccessLog.php:236 -msgid "Database needs to be updated!" -msgstr "Database dient ververst te worden!" - -#: classes/Gems/Html.php:154 -msgid "<< First" -msgstr "<< Eerste" - -#: classes/Gems/Html.php:155 -msgid "< Previous" -msgstr "< Terug" - -#: classes/Gems/Html.php:156 -msgid "Next >" -msgstr "Verder >" - -#: classes/Gems/Html.php:157 -msgid "Last >>" -msgstr "Laatste >>" - -#: classes/Gems/Html.php:158 -msgid " | " -msgstr " | " - -#: classes/Gems/Html.php:162 -msgid "to" -msgstr "tot" - -#: classes/Gems/Html.php:163 -msgid "of" -msgstr "van" - -#: classes/Gems/Menu.php:139 -#, php-format -msgid "About %s" -msgstr "Over %s" - -#: classes/Gems/Menu.php:143 -msgid "Reporting bugs" -msgstr "Meld een bug" - -#: classes/Gems/Menu.php:146 -msgid "Support" -msgstr "Ondersteuning" - -#: classes/Gems/Menu.php:166 -msgid "Project setup" -msgstr "Projectinfo" - -#: classes/Gems/Menu.php:169 -msgid "Database" -msgstr "Database" - -#: classes/Gems/Menu.php:173 -msgid "Content" -msgstr "Inhoud" - -#: classes/Gems/Menu.php:176 -msgid "Execute" -msgstr "Uitvoeren" - -#: classes/Gems/Menu.php:181 -msgid "Patches" -msgstr "Patches" - -#: classes/Gems/Menu.php:182 -msgid "Execute new" -msgstr "Nieuwe aanmaken" - -#: classes/Gems/Menu.php:184 -msgid "Refresh translateables" -msgstr "Ververs vertaalbaren" - -#: classes/Gems/Menu.php:186 -msgid "Run SQL" -msgstr "SQL uitvoeren" - -#: classes/Gems/Menu.php:189 -msgid "Reception codes" -msgstr "Ontvangst codes" - -#: classes/Gems/Menu.php:192 -msgid "Consents" -msgstr "Toestemmingen" - -#: classes/Gems/Menu.php:195 -msgid "Roles" -msgstr "Rollen" - -#: classes/Gems/Menu.php:196 -msgid "Assigned" -msgstr "Toegewezen" - -#: classes/Gems/Menu.php:197 -msgid "Privileges" -msgstr "Priviléges" - -#: classes/Gems/Menu.php:200 -msgid "Groups" -msgstr "Groepen" - -#: classes/Gems/Menu.php:203 -msgid "Organizations" -msgstr "Organisaties" - -#: classes/Gems/Menu.php:206 -msgid "Staff" -msgstr "Medewerkers" - -#: classes/Gems/Menu.php:209 -msgid "Logging" -msgstr "Logboek" - -#: classes/Gems/Menu.php:213 -msgid "Maintenance" -msgstr "Onderhoud" - -#: classes/Gems/Menu.php:218 -msgid "Upgrade" -msgstr "Upgrade" - -#: classes/Gems/Menu.php:219 -msgid "Show" -msgstr "Toon" - -#: classes/Gems/Menu.php:220 -msgid "Execute all" -msgstr "Alles uitvoeren" - -#: classes/Gems/Menu.php:221 -msgid "Execute this" -msgstr "Dit uitvoeren" - -#: classes/Gems/Menu.php:222 -msgid "Execute from here" -msgstr "Uitvoeren vanaf hier" - -#: classes/Gems/Menu.php:223 -msgid "Execute to here" -msgstr "Uitvoeren tot hier" - -#: classes/Gems/Menu.php:235 -#, php-format -msgid "Stand-alone privilige: %s" -msgstr "Zelfstandig privilege: %s" - -#: classes/Gems/Menu.php:242 -msgid "Logon" -msgstr "Login" - -#: classes/Gems/Menu.php:243 -msgid "Lost password" -msgstr "Wachtwoord vergeten" - -#: classes/Gems/Menu.php:244 -msgid "Your account" -msgstr "Uw account" - -#: classes/Gems/Menu.php:245 -msgid "Activity overview" -msgstr "Activiteiten overzicht" - -#: classes/Gems/Menu.php:246 -msgid "Change password" -msgstr "Uw wachtwoord" - -#: classes/Gems/Menu.php:247 -#: classes/Gems/Menu.php:322 -msgid "Token" -msgstr "Kenmerk" - -#: classes/Gems/Menu.php:283 -msgid "Track" -msgstr "Traject" - -#: classes/Gems/Menu.php:290 -#: classes/Gems/Menu.php:341 -msgid "Add" -msgstr "Voeg toe" - -#: classes/Gems/Menu.php:294 -msgid "Preview" -msgstr "Preview" - -#: classes/Gems/Menu.php:301 -msgid "Tracks" -msgstr "Trajecten" - -#: classes/Gems/Menu.php:314 -msgid "Assignments" -msgstr "Toewijzingen" - -#: classes/Gems/Menu.php:326 -msgid "Edit" -msgstr "Wijzig" - -#: classes/Gems/Menu.php:330 -msgid "Delete" -msgstr "Verwijder" - -#: classes/Gems/Menu.php:335 -msgid "Surveys" -msgstr "Vragenlijsten" - -#: classes/Gems/Menu.php:367 -msgid "Fill in" -msgstr "Vul in" - -#: classes/Gems/Menu.php:371 -msgid "Print PDF" -msgstr "Print PDF" - -#: classes/Gems/Menu.php:374 -msgid "E-Mail now!" -msgstr "Email nu!" - -#: classes/Gems/Menu.php:380 -msgid "Answers" -msgstr "Antwoorden" - -#: classes/Gems/Menu.php:530 -msgid "Respondents" -msgstr "Patiënten" - -#: classes/Gems/Menu.php:538 -msgid "Overview" -msgstr "Overzicht" - -#: classes/Gems/Menu.php:545 -msgid "Project" -msgstr "Project" - -#: classes/Gems/Menu.php:548 -msgid "Setup" -msgstr "Beheer" - -#: classes/Gems/Menu.php:551 -msgid "Mail" -msgstr "Email" - -#: classes/Gems/Menu.php:554 -msgid "Track Builder" -msgstr "Traject bouwer" - -#: classes/Gems/Menu.php:563 -msgid "Contact" -msgstr "Contact" - -#: classes/Gems/Menu.php:576 -msgid "Changelog" -msgstr "Changelog" - -#: classes/Gems/Model.php:205 -msgid "Respondent nr" -msgstr "Patiënt nr" - -#: classes/Gems/Model.php:206 -msgid "Opened" -msgstr "Bekeken op" - -#: classes/Gems/Model.php:207 -msgid "Consent" -msgstr "Toestemming" - -#: classes/Gems/Model.php:209 -msgid "E-Mail" -msgstr "Email" - -#: classes/Gems/Model.php:214 -msgid "Gender" -msgstr "Geslacht" - -#: classes/Gems/Model.php:215 -msgid "First name" -msgstr "Voornaam" - -#: classes/Gems/Model.php:216 -msgid "Surname prefix" -msgstr "Tussenvoegsel" - -#: classes/Gems/Model.php:217 -msgid "Last name" -msgstr "Achternaam" - -#: classes/Gems/Model.php:219 -msgid "Name" -msgstr "Naam" - -#: classes/Gems/Model.php:222 -msgid "Street" -msgstr "Straat" - -#: classes/Gems/Model.php:223 -msgid "Zipcode" -msgstr "Postcode" - -#: classes/Gems/Model.php:224 -msgid "City" -msgstr "Woonplaats" - -#: classes/Gems/Model.php:226 -msgid "Phone" -msgstr "Telefoon" - -#: classes/Gems/Model.php:228 -msgid "Birthday" -msgstr "Geboren op" - -#: classes/Gems/UpgradesAbstract.php:154 -msgid "Already at max. level." -msgstr "Al op het hoogste niveau." - -#: classes/Gems/UpgradesAbstract.php:161 -#, php-format -msgid "Trying upgrade for %s from level %s to level %s" -msgstr "Probeert upgrade voor %s van niveau %s naar niveau %s uit te voeren" - -#: classes/Gems/UpgradesAbstract.php:169 -#, php-format -msgid "Trying upgrade for %s to level %s: %s" -msgstr "Probeert upgrade voor %s naar niveau %s: %s" - -#: classes/Gems/Auth.php:235 -msgid "Combination of organization, username and password not found." -msgstr "Combinatie van organisatie, gebruikersnaam en wachtwoord niet gevonden." - -#: classes/Gems/Model/DbaModel.php:97 -msgid "created" -msgstr "bestaat" - -#: classes/Gems/Model/DbaModel.php:98 -msgid "not created" -msgstr "niet aanwezig" - -#: classes/Gems/Model/DbaModel.php:99 -msgid "unknown" -msgstr "onbekend" - -#: classes/Gems/Model/DbaModel.php:420 -#, php-format -msgid "Executed %2$s creation script %1$s:" -msgstr "Uitvoerresultaat %2$s script %1$s:" - -#: classes/Gems/Model/DbaModel.php:430 -#, php-format -msgid "%d record(s) returned as result set %d in step %d of %d." -msgstr "%d rij(en) in resultaat %d in stap %d van %d." - -#: classes/Gems/Model/DbaModel.php:434 -#, php-format -msgid "%d record(s) updated in step %d of %d." -msgstr "In stap %2$d van %3$d zijn %1$d rij(en) aangepast." - -#: classes/Gems/Model/DbaModel.php:437 -#, php-format -msgid "Script ran step %d of %d succesfully." -msgstr "Stap %d van %d in het script met succes uitgevoerd." - -#: classes/Gems/Model/DbaModel.php:440 -msgid " in step " -msgstr " in stap " - -#: classes/Gems/Model/DbaModel.php:445 -#, php-format -msgid "No script for %1$s." -msgstr "Geen script voor %1$s:" - -#: classes/Gems/Export/Spss.php:59 -msgid "Which file" -msgstr "Kies bestand" - -#: classes/Gems/Export/Spss.php:60 -msgid "syntax" -msgstr "syntax" - -#: classes/Gems/Export/Spss.php:61 -msgid "data" -msgstr "data" - -#: classes/Gems/Export/Spss.php:66 -msgid "Some help for this export" -msgstr "Uitleg over deze export mogelijkheid" - -#: classes/Gems/Export/Excel.php:60 -msgid "Excel options" -msgstr "Excel opties" - -#: classes/Gems/Export/Excel.php:62 -msgid "Export questions instead of variable names" -msgstr "Exporteer vragen in plaats van variabele namen" - -#: classes/Gems/Export/Excel.php:63 -msgid "Format answers" -msgstr "Antwoorden opmaken" - -#: classes/Gems/Util/Translated.php:81 -msgid "-" -msgstr "n.v.t." - -#: classes/Gems/Util/Translated.php:96 -msgid "forever" -msgstr "altijd" - -#: classes/Gems/Util/Translated.php:105 -msgid "n/a" -msgstr "n.v.t." - -#: classes/Gems/Util/Translated.php:114 -msgid "never" -msgstr "nooit" - -#: classes/Gems/Util/Translated.php:139 -msgid "2 days ago" -msgstr "Eergisteren" - -#: classes/Gems/Util/Translated.php:142 -msgid "Yesterday" -msgstr "Gisteren" - -#: classes/Gems/Util/Translated.php:145 -msgid "Today" -msgstr "Vandaag" - -#: classes/Gems/Util/Translated.php:148 -msgid "Tomorrow" -msgstr "Morgen" - -#: classes/Gems/Util/Translated.php:151 -msgid "Over 2 days" -msgstr "Overmorgen" - -#: classes/Gems/Util/Translated.php:156 -#, php-format -msgid "Over %d days" -msgstr "Over %d dagen" - -#: classes/Gems/Util/Translated.php:158 -#, php-format -msgid "%d days ago" -msgstr "%d dagen terug" - -#: classes/Gems/Util/Translated.php:177 -msgid "Send multiple mails per respondent, one for each checked token." -msgstr "Verstuur meerdere emails per patiënt, één per gekozen kenmerk." - -#: classes/Gems/Util/Translated.php:178 -msgid "Send one mail per respondent, mark all checked tokens as send." -msgstr "Verstuur één email per patiënt, zet alle gekozen kenmerken op verzonden." - -#: classes/Gems/Util/Translated.php:179 -msgid "Send one mail per respondent, mark only mailed tokens as send." -msgstr "Verstuur één email per patiënt, zet alleen de verzonden kenmerken op verzonden." - -#: classes/Gems/Util/Translated.php:204 -msgid "Male" -msgstr "Man" - -#: classes/Gems/Util/Translated.php:204 -msgid "Female" -msgstr "Vrouw" - -#: classes/Gems/Util/Translated.php:204 -msgid "Unknown" -msgstr "Onbekend" - -#: classes/Gems/Util/Translated.php:217 -msgid "mr." -msgstr "meneer" - -#: classes/Gems/Util/Translated.php:217 -msgid "mrs." -msgstr "mevrouw" - -#: classes/Gems/Util/Translated.php:217 -msgid "mr./mrs." -msgstr "de heer/mevrouw" - -#: classes/Gems/Util/Translated.php:230 -msgid "Mr." -msgstr "De heer" - -#: classes/Gems/Util/Translated.php:230 -msgid "Mrs." -msgstr "Mevrouw" - -#: classes/Gems/Util/Translated.php:230 -msgid "Mr./Mrs." -msgstr "De heer/Mevrouw" - -#: classes/Gems/Util/Translated.php:238 -msgid "Yes" -msgstr "Ja" - -#: classes/Gems/Util/Translated.php:238 -#: classes/Gems/Util/ReceptionCodeLibrary.php:99 -#: classes/Gems/Util/ReceptionCodeLibrary.php:123 -msgid "No" -msgstr "Nee" - -#: classes/Gems/Util/TrackData.php:132 -msgid "Active" -msgstr "Actief" - -#: classes/Gems/Util/TrackData.php:132 -msgid "Inactive" -msgstr "Inactief" - -#: classes/Gems/Util/ReceptionCodeLibrary.php:100 -msgid "Yes (forget answers)" -msgstr "Ja (vergeet antwoorden)" - -#: classes/Gems/Util/ReceptionCodeLibrary.php:101 -msgid "Yes (keep answers)" -msgstr "Ja (met behoud van antwoorden)" - -#: classes/Gems/Util/ReceptionCodeLibrary.php:124 -msgid "Yes (individual surveys only)" -msgstr "Ja (alleen zelfstandige vragenlijsten)" - -#: classes/Gems/Util/ReceptionCodeLibrary.php:125 -msgid "Stop (per respondent or track only)" -msgstr "Stop (alleen per patiënt og traject)" - -#: classes/Gems/Controller/ModelActionAbstract.php:97 -msgid "Cancel" -msgstr "Annuleren" - -#: classes/Gems/Controller/ModelSnippetActionAbstract.php:226 -#: classes/Gems/Controller/BrowseEditAction.php:354 -#, php-format -msgid "New %s..." -msgstr "Nieuwe %s..." - -#: classes/Gems/Controller/ModelSnippetActionAbstract.php:236 -#, php-format -msgid "Do you want to delete this %s?" -msgstr "Weet je zeker dat deze %s verwijderd moet worden?" - -#: classes/Gems/Controller/ModelSnippetActionAbstract.php:246 -#: classes/Gems/Controller/BrowseEditAction.php:387 -#, php-format -msgid "Delete %s" -msgstr "Verwijder %s" - -#: classes/Gems/Controller/ModelSnippetActionAbstract.php:256 -#, php-format -msgid "Edit %s..." -msgstr "Bewerk %s..." - -#: classes/Gems/Controller/ModelSnippetActionAbstract.php:269 -msgid "No data found." -msgstr "Geen gegevens gevonden." - -#: classes/Gems/Controller/ModelSnippetActionAbstract.php:331 -#, php-format -msgid "No %s found..." -msgstr "Geen %s gevonden..." - -#: classes/Gems/Controller/ModelSnippetActionAbstract.php:341 -#, php-format -msgid "Showing %s" -msgstr "Toon %s" - -#: classes/Gems/Controller/ModelSnippetActionAbstract.php:377 -msgid "item" -msgid_plural "items" -msgstr[0] "item" -msgstr[1] "items" - -#: classes/Gems/Controller/BrowseEditAction.php:391 -#, php-format -msgid "%2$u %1$s deleted" -msgstr "%2$u %1$s verwijderd" - -#: classes/Gems/Controller/BrowseEditAction.php:405 -#, php-format -msgid "Edit %s" -msgstr "Bewerk %s" - -#: classes/Gems/Controller/BrowseEditAction.php:502 -msgid "Free search text" -msgstr "Vrije zoek tekst" - -#: classes/Gems/Controller/BrowseEditAction.php:573 -msgid "Search" -msgstr "Zoeken" - -#: classes/Gems/Controller/BrowseEditAction.php:589 -#, php-format -msgid "No %s found" -msgstr "Geen %s gevonden" - -#: classes/Gems/Controller/BrowseEditAction.php:662 -#, php-format -msgid "No %s found." -msgstr "Geen %s gevonden." - -#: classes/Gems/Controller/BrowseEditAction.php:780 -msgid "Are you sure?" -msgstr "Weet u het zeker?" - -#: classes/Gems/Controller/BrowseEditAction.php:850 -#, php-format -msgid "Unknown %s requested" -msgstr "Onjuist %s verzoek" - -#: classes/Gems/Controller/BrowseEditAction.php:873 -#, php-format -msgid "New %1$s..." -msgstr "Nieuwe %1$s..." - -#: classes/Gems/Controller/BrowseEditAction.php:881 -msgid "Save" -msgstr "Opslaan" - -#: classes/Gems/Controller/BrowseEditAction.php:917 -#, php-format -msgid "%2$u %1$s saved" -msgstr "%2$u %1$s opgeslagen" - -#: classes/Gems/Controller/BrowseEditAction.php:920 -msgid "No changes to save." -msgstr "Geen verandering om op te slaan." - -#: classes/Gems/Controller/BrowseEditAction.php:929 -msgid "Input error! No changes saved!" -msgstr "Invoer fout! Veranderingen niet opgeslagen!" - -#: classes/Gems/Controller/BrowseEditAction.php:957 -#, php-format -msgid "Show %s" -msgstr "Toon %s" - -#: classes/Gems/Controller/BrowseEditAction.php:964 -#, php-format -msgid "Unknown %s." -msgstr "%s is onbekend." - -#: classes/Gems/Controller/Action/Helper/BatchRunner.php:65 -msgid "Prepare recheck" -msgstr "Hercontrole voorbereiden" - -#: classes/Gems/Controller/Action/Helper/BatchRunner.php:68 -#, php-format -msgid "Start %s jobs" -msgstr "Start %s opdrachten" - -#: classes/Gems/Controller/Action/Helper/BatchRunner.php:71 -msgid "Nothing to do." -msgstr "Niets te doen." - -#: classes/Gems/Snippets/TokenModelSnippetAbstract.php:59 -msgid "+" -msgstr "+" - -#: classes/Gems/Email/MailTemplateForm.php:56 -msgid "Send (test)" -msgstr "Verstuur (test)" - -#: classes/Gems/Email/MailTemplateForm.php:81 -#: classes/Gems/Email/EmailFormAbstract.php:193 -#: classes/Gems/Email/EmailFormAbstract.php:251 -msgid "From" -msgstr "Van" - -#: classes/Gems/Email/MailTemplateForm.php:95 -msgid "Test using" -msgstr "Test met" - -#: classes/Gems/Email/MailTemplateForm.php:124 -msgid "To (test)" -msgstr "Aan (test)" - -#: classes/Gems/Email/MailTemplateForm.php:168 -msgid "Test mail send, changes not saved!" -msgstr "Test email verstuurd. De veranderingen zijn nog niet opgeslagen!" - -#: classes/Gems/Email/EmailFormAbstract.php:101 -msgid "no email adress" -msgstr "geen email adres" - -#: classes/Gems/Email/EmailFormAbstract.php:145 -msgid "Available fields" -msgstr "Beschikbare velden" - -#: classes/Gems/Email/EmailFormAbstract.php:153 -msgid "BBCode" -msgstr "BBCode" - -#: classes/Gems/Email/EmailFormAbstract.php:168 -msgid "Message" -msgstr "Bericht" - -#: classes/Gems/Email/EmailFormAbstract.php:216 -msgid "Organization does not have an e-mail address." -msgstr "Organisatie heeft geen email adres." - -#: classes/Gems/Email/EmailFormAbstract.php:231 -msgid "You do not have an e-mail address." -msgstr "U heeft geen email adres." - -#: classes/Gems/Email/EmailFormAbstract.php:291 -msgid "Preview HTML" -msgstr "Html voorbeeld" - -#: classes/Gems/Email/EmailFormAbstract.php:300 -msgid "Preview text" -msgstr "Tekstvoorbeeld" - -#: classes/Gems/Email/EmailFormAbstract.php:308 -msgid "Template" -msgstr "Sjabloon" - -#: classes/Gems/Email/EmailFormAbstract.php:332 -msgid "Send" -msgstr "Verstuur" - -#: classes/Gems/Email/EmailFormAbstract.php:349 -msgid "Subject" -msgstr "Onderwerp" - -#: classes/Gems/Email/EmailFormAbstract.php:429 -msgid "Input error! No changes made!" -msgstr "Invoer fout! Veranderingen niet uitgevoerd!" - -#: classes/Gems/Email/EmailFormAbstract.php:446 -msgid "Subject:" -msgstr "Onderwerp:" - -#: classes/Gems/Email/EmailFormAbstract.php:474 -msgid "Field" -msgstr "Veld" - -#: classes/Gems/Email/EmailFormAbstract.php:475 -msgid "Value" -msgstr "waarde" - -#: classes/Gems/Email/EmailFormAbstract.php:478 -msgid "BBCode info page" -msgstr "BBCode info pagina" - -#: classes/Gems/Email/OneMailForm.php:47 -#: classes/Gems/Email/MultiMailForm.php:49 -msgid "On this test system all mail will be delivered to the from address." -msgstr "Op dit test systeem worden alle emails gestuurd naar het \"van\" adres." - -#: classes/Gems/Email/OneMailForm.php:55 -msgid "Round" -msgstr "Ronde" - -#: classes/Gems/Email/OneMailForm.php:57 -msgid "Survey" -msgstr "Vragenlijst" - -#: classes/Gems/Email/OneMailForm.php:58 -msgid "Last contact" -msgstr "Contactdatum" - -#: classes/Gems/Email/OneMailForm.php:87 -#: classes/Gems/Email/MultiMailForm.php:101 -msgid "To" -msgstr "Aan" - -#: classes/Gems/Email/OneMailForm.php:131 -#: classes/Gems/Email/TemplateMailer.php:217 -msgid "The sending of emails was blocked for this installation." -msgstr "Het versturen van emails is geblokkeerd in deze installatie." - -#: classes/Gems/Email/OneMailForm.php:141 -#: classes/Gems/Email/TemplateMailer.php:250 -msgid "Mail failed to send." -msgstr "Mail sturen mislukt." - -#: classes/Gems/Email/OneMailForm.php:145 -#, php-format -msgid "Sent email to %s." -msgstr "Email naar %s verzonden." - -#: classes/Gems/Email/TemplateMailer.php:266 -#, php-format -msgid "Sent %d e-mails, updated %d tokens." -msgstr "%d emails verzonden en %d kenmerken bijgewerkt." - -#: classes/Gems/Email/MultiMailForm.php:75 -msgid "Method" -msgstr "Methode" - -#: classes/Gems/Email/MultiMailForm.php:122 -msgid "Survey has been taken." -msgstr "Vragenlijsten is al afgenomen" - -#: classes/Gems/Email/MultiMailForm.php:125 -msgid "Respondent does not have an e-mail address." -msgstr "Patiënt heeft geen email adres" - -#: classes/Gems/Email/MultiMailForm.php:128 -msgid "Survey cannot be taken by a respondent." -msgstr "Deze vragenlijst kan niet door een patiënt ingevuld worden." - -#: classes/Gems/Email/MultiMailForm.php:130 -msgid "Survey cannot be taken at this moment." -msgstr "Deze vragenlijst kan op dit moment niet afgenomen worden." - -#: classes/Gems/Tracker/ChangeTracker.php:64 -#, php-format -msgid "Checked %d tracks." -msgstr "%d trajecten gecontroleerd." - -#: classes/Gems/Tracker/ChangeTracker.php:67 -#, php-format -msgid "Checked %d tokens." -msgstr "%d kenmerken gecontroleerd." - -#: classes/Gems/Tracker/ChangeTracker.php:72 -#, php-format -msgid "Answers changed by survey completion event for %d tokens." -msgstr "Bij %d kenmerken zijn de antwoorden aangepast door vragenlijst afrondingscode." - -#: classes/Gems/Tracker/ChangeTracker.php:75 -#, php-format -msgid "Results and timing changed for %d tokens." -msgstr "Bij %d kenmerken zijn de resultaten en/of de tijdstippen aangepast." - -#: classes/Gems/Tracker/ChangeTracker.php:78 -#, php-format -msgid "%d token round completion events caused changed to %d tokens." -msgstr "%2$d kenmerken zijn aangepast vanwege %1$d ronde voltooiingen." - -#: classes/Gems/Tracker/ChangeTracker.php:81 -#, php-format -msgid "%2$d token date changes in %1$d tracks." -msgstr "De datum van %2$d kenmerken is aangepast in %1$d trajecten." - -#: classes/Gems/Tracker/ChangeTracker.php:84 -#, php-format -msgid "Round changes propagated to %d tokens." -msgstr "%d kenmerken veranderd door ronde aanpassingen." - -#: classes/Gems/Tracker/ChangeTracker.php:87 -#, php-format -msgid "%d tokens deleted by round changes." -msgstr "Vanwege ronde aanpassingen zijn %d kenmerken verwijderd." - -#: classes/Gems/Tracker/ChangeTracker.php:90 -#, php-format -msgid "%d tokens created to by round changes." -msgstr "Vanwege ronde aanpassingen zijn nieuwe %d kenmerken gecreëerd." - -#: classes/Gems/Tracker/ChangeTracker.php:93 -msgid "No tokens were changed." -msgstr "Geen kenmerken veranderd." - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:370 -msgid "Track start" -msgstr "Traject start" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:371 -msgid "Track end" -msgstr "Traject einde" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:385 -msgid "Valid from" -msgstr "Geldig vanaf" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:386 -#: classes/Gems/Tracker/Model/StandardTokenModel.php:217 -msgid "Valid until" -msgstr "Geldig tot" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:387 -msgid "Start time" -msgstr "Starten tijd" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:388 -msgid "Completion time" -msgstr "Datum invullen" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:403 -msgid "Minutes" -msgstr "Minuten" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:404 -msgid "Hours" -msgstr "Uren" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:405 -msgid "Days" -msgstr "Dagen" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:406 -msgid "Weeks" -msgstr "Weken" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:407 -msgid "Months" -msgstr "Maanden" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:408 -msgid "Quarters" -msgstr "Kwartieren" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:409 -msgid "Years" -msgstr "Jaren" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:444 -msgid "Valid from calculation" -msgstr "Berekening datum geldig vanaf" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:445 -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:453 -msgid "Date source" -msgstr "Datum bron" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:446 -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:454 -msgid "Round used" -msgstr "Gebruikte ronde" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:447 -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:455 -msgid "Date used" -msgstr "Gebruikte datum" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:448 -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:456 -msgid "Add to date" -msgstr "Optellen bij datum" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:449 -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:457 -msgid "Add to date unit" -msgstr "Datumoptel eenheid" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:452 -msgid "Valid for calculation" -msgstr "Berekening datum geldig tot" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:486 -msgid "Does not expire" -msgstr "Blijft altijd geldig" - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:489 -msgid "Use an answer from a survey." -msgstr "Gebruikt een antwoord uit een vragenlijst." - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:490 -msgid "Use a standard token date." -msgstr "Gebruik een datum uit een kenmerk." - -#: classes/Gems/Tracker/Engine/StepEngineAbstract.php:492 -msgid "Use a track level date." -msgstr "Gebruik een op traject niveau ingestelde datum." - -#: classes/Gems/Tracker/Engine/AnyStepEngine.php:95 -#: classes/Gems/Tracker/Engine/NextStepEngine.php:92 -msgid "This round" -msgstr "Deze ronde" - -#: classes/Gems/Tracker/Engine/AnyStepEngine.php:106 -msgid "Engine for tracks where a rounds activation can depend on any previous survey." -msgstr "Een traject type waar de activatie van een ronde van elke willekeurige eerdere ronde afhankelijk kan zijn." - -#: classes/Gems/Tracker/Engine/AnyStepEngine.php:116 -msgid "Previous Survey" -msgstr "Eerdere vragenlijst" - -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:445 -#, php-format -msgid "%s track engines cannot be converted to %s track engines." -msgstr "Traject type %s kan niet geconverteerd worden naar %s." - -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:688 -#, php-format -msgid "%d: %s - %s" -msgstr "%d: %s - %s" - -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:691 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:694 -#, php-format -msgid "%d: %s" -msgstr "%d: %s" - -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:697 -#, php-format -msgid "%s - %s" -msgstr "%s - %s" - -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:737 -msgid "Icon" -msgstr "Icoon" - -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:738 -msgid "Order" -msgstr "Volgorde" - -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:739 -#: classes/Gems/Tracker/Model/StandardTokenModel.php:233 -msgid "Description" -msgstr "Omschrijving" - -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:740 -msgid "After change" -msgstr "Ronde veranderingscode" - -#: classes/Gems/Tracker/Engine/SingleSurveyEngine.php:117 -msgid "Engine for tracks containing a single survey." -msgstr "Een traject type voor trajecten die bestaan uit een enkele vragenlijst." - -#: classes/Gems/Tracker/Engine/SingleSurveyEngine.php:127 -msgid "Single Survey" -msgstr "Losse vragenlijst" - -#: classes/Gems/Tracker/Engine/SingleSurveyEngine.php:149 -msgid "This track type does not allow the creation of new rounds." -msgstr "Dit type traject staat het niet toe dat nieuwe rondes aangemaakt worden." - -#: classes/Gems/Tracker/Engine/NextStepEngine.php:147 -msgid "Engine for tracks where the next round is always dependent on the previous step." -msgstr "Een traject type waar de activatie van een volgende ronde alleen afhangt van de ronde ervoor." - -#: classes/Gems/Tracker/Engine/NextStepEngine.php:158 -msgid "Next Step" -msgstr "Stap voor stap" - -#: classes/Gems/Tracker/Model/StandardTokenModel.php:216 -msgid "Measure(d) on" -msgstr "Afname op" - -#: classes/Gems/Tracker/Model/StandardTokenModel.php:219 -msgid "Completed" -msgstr "Ingevuld" - -#: classes/Gems/Tracker/Model/StandardTokenModel.php:220 -msgid "Duration in seconds" -msgstr "Antwoordtijd (in sec.)" - -#: classes/Gems/Tracker/Model/StandardTokenModel.php:221 -msgid "Score" -msgstr "Score" - -#: classes/Gems/Tracker/Model/StandardTokenModel.php:222 -msgid "Comments" -msgstr "Opmerkingen" - -#: classes/Gems/Tracker/Model/StandardTokenModel.php:223 -msgid "Changed on" -msgstr "Veranderd op" - -#: classes/Gems/Tracker/Model/StandardTokenModel.php:226 -msgid "Assigned by" -msgstr "Toewijzer" - -#: classes/Gems/Tracker/Model/StandardTokenModel.php:227 -msgid "Respondent name" -msgstr "Patiënt naam" - -#: classes/Gems/Tracker/Model/StandardTokenModel.php:230 -msgid "Assigned to" -msgstr "invuller" - -#: classes/Gems/Tracker/Model/StandardTokenModel.php:231 -msgid "Rejection code" -msgstr "Afkeuringscode" - -#: classes/Gems/Tracker/Model/TrackModel.php:118 -msgid "Track Engine" -msgstr "Traject type" - -#: classes/Gems/Tracker/Model/TrackModel.php:123 -msgid "Use until" -msgstr "Geldig tot" - -#: classes/Gems/Tracker/Model/TrackModel.php:127 -msgid "After completion" -msgstr "Na afronding" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:149 -msgid "Uncertain" -msgstr "Weet niet" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:152 -msgid "Increase" -msgstr "Toenemend" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:153 -msgid "Same" -msgstr "Zelfde" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:154 -msgid "Decrease" -msgstr "Afnemend" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:162 -msgid "Checked" -msgstr "Aangevinkt" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:163 -msgid "Not checked" -msgstr "Niet aangevinkt" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:259 -#, php-format -msgid "Rank %d" -msgstr "Schaal %d" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:278 -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:300 -msgid "Comment" -msgstr "Opmerkingen" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:278 -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:300 -msgid " (comment)" -msgstr " (opmerkingen)" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:290 -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:338 -msgid "Other" -msgstr "Overige" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:472 -msgid "Date" -msgstr "Datum" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:475 -msgid "Free number" -msgstr "Vrij getal" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:481 -msgid "Free text (long)" -msgstr "Vrije tekst (lang)" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:484 -msgid "Free text (very long)" -msgstr "Vrije tekst (zeer lang)" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:487 -msgid "Free text" -msgstr "Vrije tekst" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:628 -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:678 -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:732 -#, php-format -msgid "%s: %s" -msgstr "%s: %s" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:752 -#, php-format -msgid "- %s" -msgstr "- %s" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:376 -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1154 -#, php-format -msgid "The '%s' survey is no longer active. The survey was removed from LimeSurvey!" -msgstr "De vragenlijst '%s' is niet meer actief. De vragenlijst is verwijderd uit LimeSurvey!" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:407 -#, php-format -msgid "Corrected anonymization for survey '%s'" -msgstr "Anonimizatie gecorrigeerd van vragenlijst '%s'" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:431 -msgid ", " -msgstr ", " - -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:435 -#, php-format -msgid "Added to token table '%s' the field(s): %s" -msgstr "Toegevoegd aan kenmerk tabel '%s', de velden: %s" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:440 -#, php-format -msgid "Attribute fields not created for token table for '%s'" -msgstr "Attribuut velden voor de kenmerk tabel '%s' zijn niet toegevoegd." - -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:441 -#, php-format -msgid "Required fields: %s" -msgstr "Verplicht veld: %s" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:466 -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1307 -#, php-format -msgid "The status of the '%s' survey has changed." -msgstr "De status van de vragenlijst '%s' is veranderd." - -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:472 -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1313 -#, php-format -msgid "Survey '%s' IS NO LONGER ACTIVE!!!" -msgstr "De vragenlijst '%s' IS NIET MEER ACTIEF!!!" - -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:478 -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1319 -#, php-format -msgid "The status of the '%s' survey has changed to '%s'." -msgstr "De status van de vragenlijst '%s' is veranderd naar '%s'." - -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:481 -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1322 -#, php-f... [truncated message content] |