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-03-29 21:17:01
|
Revision: 580
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=580&view=rev
Author: matijsdejong
Date: 2012-03-29 21:16:55 +0000 (Thu, 29 Mar 2012)
Log Message:
-----------
Login input field to short for email addresses
Modified Paths:
--------------
trunk/library/classes/Gems/User/Form/LoginForm.php
Modified: trunk/library/classes/Gems/User/Form/LoginForm.php
===================================================================
--- trunk/library/classes/Gems/User/Form/LoginForm.php 2012-03-29 21:03:04 UTC (rev 579)
+++ trunk/library/classes/Gems/User/Form/LoginForm.php 2012-03-29 21:16:55 UTC (rev 580)
@@ -267,8 +267,7 @@
// Veld password
$element = new Zend_Form_Element_Password($this->passwordFieldName);
$element->setLabel($this->translate->_('Password'));
- $element->setAttrib('size', 10);
- $element->setAttrib('maxlength', 20);
+ $element->setAttrib('size', 40);
$element->setRequired(true);
if ($this->getOrganizationElement() instanceof Zend_Form_Element_Hidden) {
@@ -373,8 +372,7 @@
// Veld inlognaam
$element = new Zend_Form_Element_Text($this->usernameFieldName);
$element->setLabel($this->translate->_('Username'));
- $element->setAttrib('size', 10);
- $element->setAttrib('maxlength', 20);
+ $element->setAttrib('size', 40);
$element->setRequired(true);
$this->addElement($element);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-29 21:03:11
|
Revision: 579
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=579&view=rev
Author: matijsdejong
Date: 2012-03-29 21:03:04 +0000 (Thu, 29 Mar 2012)
Log Message:
-----------
More extension. andTracks() added plus $groupBy param for some functions
Modified Paths:
--------------
trunk/library/classes/Gems/Tracker/Token/TokenSelect.php
Modified: trunk/library/classes/Gems/Tracker/Token/TokenSelect.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Token/TokenSelect.php 2012-03-29 19:57:58 UTC (rev 578)
+++ trunk/library/classes/Gems/Tracker/Token/TokenSelect.php 2012-03-29 21:03:04 UTC (rev 579)
@@ -139,13 +139,18 @@
* Add Respondent Track info to the select statement
*
* @param string|array $fields
+ * @param boolean $groupBy Optional, add these fields to group by statement
* @return Gems_Tracker_Token_TokenSelect
*/
- public function andRespondentTracks($fields = '*') {
+ public function andRespondentTracks($fields = '*', $groupBy = false) {
$this->sql_select->join('gems__respondent2track',
'gto_id_respondent_track = gr2t_id_respondent_track',
$fields);
+ if ($groupBy && is_array($fields)) {
+ $this->sql_select->group($fields);
+ }
+
return $this;
}
@@ -178,6 +183,25 @@
}
/**
+ * Add track info to the select statement
+ *
+ * @param string|array $fields
+ * @param boolean $groupBy Optional, add these fields to group by statement
+ * @return Gems_Tracker_Token_TokenSelect
+ */
+ public function andTracks($fields = '*', $groupBy = false) {
+ $this->sql_select->join('gems__tracks',
+ 'gr2t_id_track = gtr_id_track',
+ $fields);
+
+ if ($groupBy && is_array($fields)) {
+ $this->sql_select->group($fields);
+ }
+
+ return $this;
+ }
+
+ /**
* @return array
*/
public function fetchAll()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-29 19:58:04
|
Revision: 578
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=578&view=rev
Author: matijsdejong
Date: 2012-03-29 19:57:58 +0000 (Thu, 29 Mar 2012)
Log Message:
-----------
Implement generic return mechanism for ask/return
Added tables to TokenSelect.php
Modified Paths:
--------------
trunk/library/classes/Gems/Default/AskAction.php
trunk/library/classes/Gems/Tracker/Token/TokenSelect.php
Modified: trunk/library/classes/Gems/Default/AskAction.php
===================================================================
--- trunk/library/classes/Gems/Default/AskAction.php 2012-03-29 17:08:31 UTC (rev 577)
+++ trunk/library/classes/Gems/Default/AskAction.php 2012-03-29 19:57:58 UTC (rev 578)
@@ -303,7 +303,13 @@
return;
default:
- $parameters['controller'] = 'respondent';
+ // 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);
} else {
Modified: trunk/library/classes/Gems/Tracker/Token/TokenSelect.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Token/TokenSelect.php 2012-03-29 17:08:31 UTC (rev 577)
+++ trunk/library/classes/Gems/Tracker/Token/TokenSelect.php 2012-03-29 19:57:58 UTC (rev 578)
@@ -136,6 +136,20 @@
}
/**
+ * Add Respondent Track info to the select statement
+ *
+ * @param string|array $fields
+ * @return Gems_Tracker_Token_TokenSelect
+ */
+ public function andRespondentTracks($fields = '*') {
+ $this->sql_select->join('gems__respondent2track',
+ 'gto_id_respondent_track = gr2t_id_respondent_track',
+ $fields);
+
+ return $this;
+ }
+
+ /**
* Adds round info to the select statement
*
* @param string|array $fields
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-29 17:08:41
|
Revision: 577
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=577&view=rev
Author: matijsdejong
Date: 2012-03-29 17:08:31 +0000 (Thu, 29 Mar 2012)
Log Message:
-----------
Organization base url now determines the layout when not logged in and url confirms
Temp error messages out in IndexAction.php needs different solution
updated fields from gems__organizations.20.sql (not all earlier patches came through to this definition)
Added filters to FormBridge
Added documentation
Modified Paths:
--------------
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/Default/OrganizationAction.php
trunk/library/classes/Gems/Filter/DutchZipcode.php
trunk/library/classes/Gems/User/Form/LoginForm.php
trunk/library/classes/Gems/User/UserLoader.php
trunk/library/classes/Gems/Util/DbLookup.php
trunk/library/classes/MUtil/Form.php
trunk/library/classes/MUtil/Model/FormBridge.php
trunk/library/classes/MUtil/Model/Type/ConcatenatedRow.php
trunk/library/configs/db/tables/gems__organizations.20.sql
trunk/library/snippets/Organization/OrganizationEditSnippet.php
Added Paths:
-----------
trunk/library/classes/Gems/Filter/TrailingSlash.php
Modified: trunk/library/classes/Gems/Default/IndexAction.php
===================================================================
--- trunk/library/classes/Gems/Default/IndexAction.php 2012-03-29 14:39:03 UTC (rev 576)
+++ trunk/library/classes/Gems/Default/IndexAction.php 2012-03-29 17:08:31 UTC (rev 577)
@@ -298,6 +298,7 @@
/**
* Fix current locale in cookies
*/
+ MUtil_Echo::track($user->getLocale(), $this->basepath->getBasePath());
Gems_Cookies::setLocale($user->getLocale(), $this->basepath->getBasePath());
/**
@@ -320,10 +321,12 @@
$this->_reroute(array('controller' => null, 'action' => null), true);
}
return;
- } else {
+ } /*
+ else {
//Now present the user with an error message
- $errors = $form->getErrorMessages();
- $this->addMessage($errors);
+ // $errors = MUtil_Ra::flatten($form->getMessages());
+ // $this->addMessage($errors);
+ MUtil_Echo::track($errors);
//Also log the error to the log table
//when the project has logging enabled
@@ -331,7 +334,7 @@
$msg = sprintf('Failed login for : %s (%s) - %s', $request->getParam($form->usernameFieldName), $request->getParam($form->organizationFieldName), $logErrors);
$log = Gems_AccessLog::getLog();
$log->log('loginFail', $this->getRequest(), $msg, null, true);
- }
+ } // */
}
$this->view->form = $form;
}
Modified: trunk/library/classes/Gems/Default/OrganizationAction.php
===================================================================
--- trunk/library/classes/Gems/Default/OrganizationAction.php 2012-03-29 14:39:03 UTC (rev 576)
+++ trunk/library/classes/Gems/Default/OrganizationAction.php 2012-03-29 17:08:31 UTC (rev 577)
@@ -115,15 +115,18 @@
$model->set('gor_contact_name', 'label', $this->_('Contact name'), 'size', 25);
$model->set('gor_contact_email', 'label', $this->_('Contact email'), 'size', 50, 'validator', 'SimpleEmail');
if ($this->escort instanceof Gems_Project_Layout_MultiLayoutInterface) {
- $model->setIfExists(
- 'gor_style', 'label', $this->_('Style'),
+ $model->setIfExists('gor_style',
+ 'label', $this->_('Style'),
'multiOptions', MUtil_Lazy::call(array($this->escort, 'getStyles'))
);
- $model->setIfExists(
- 'gor_url_base', 'label', $this->_('Default url'),
+ $model->setIfExists('gor_url_base',
+ 'label', $this->_("Default url's"),
'size', 50,
- 'description', sprintf($this->_('Always switch to this organization when %s is accessed from this url'), $this->project->getName())
+ 'description', sprintf($this->_("Always switch to this organization when %s is accessed from one of these space separated url's. The first is used for mails."), $this->project->getName())
);
+ if ($detailed) {
+ $model->setIfExists('gor_url_base', 'filter', 'TrailingSlash');
+ }
}
$model->set(
'gor_iso_lang', 'label', $this->_('Language'),
Modified: trunk/library/classes/Gems/Filter/DutchZipcode.php
===================================================================
--- trunk/library/classes/Gems/Filter/DutchZipcode.php 2012-03-29 14:39:03 UTC (rev 576)
+++ trunk/library/classes/Gems/Filter/DutchZipcode.php 2012-03-29 17:08:31 UTC (rev 577)
@@ -1,31 +1,31 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* @version $Id$
* @package Gems
* @subpackage Filter
@@ -39,9 +39,16 @@
* @subpackage Filter
* @copyright Copyright (c) 2011 Erasmus MC
* @license New BSD License
- */
+ */
class Gems_Filter_DutchZipcode implements Zend_Filter_Interface
{
+ /**
+ * Returns the result of filtering $value
+ *
+ * @param mixed $value
+ * @throws Zend_Filter_Exception If filtering $value is impossible
+ * @return mixed
+ */
public function filter($value)
{
// perform some transformation upon $value to arrive on $valueFiltered
@@ -51,7 +58,7 @@
$valueFiltered = substr_replace($valueFiltered, ' ', 4, 0);
}
}
-
+
return $valueFiltered;
}
}
Added: trunk/library/classes/Gems/Filter/TrailingSlash.php
===================================================================
--- trunk/library/classes/Gems/Filter/TrailingSlash.php (rev 0)
+++ trunk/library/classes/Gems/Filter/TrailingSlash.php 2012-03-29 17:08:31 UTC (rev 577)
@@ -0,0 +1,68 @@
+<?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 Filter
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @version $id: TrailingSlash.php 203 2012-01-01t 12:51:32Z matijs $
+ */
+
+/**
+ * Removes slashes from both the end of string and words
+ *
+ * @package Gems
+ * @subpackage Filter
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class Gems_Filter_TrailingSlash implements Zend_Filter_Interface
+{
+ /**
+ * Returns the result of filtering $value
+ *
+ * @param mixed $value
+ * @throws Zend_Filter_Exception If filtering $value is impossible
+ * @return mixed
+ */
+ public function filter($value)
+ {
+ $values = explode(' ', $value);
+
+ foreach ($values as &$val) {
+ if (substr($val, -1) === '/') {
+ $val = substr($val, 0, -1);
+ }
+ }
+
+ return implode(' ', $values);
+ }
+}
Modified: trunk/library/classes/Gems/User/Form/LoginForm.php
===================================================================
--- trunk/library/classes/Gems/User/Form/LoginForm.php 2012-03-29 14:39:03 UTC (rev 576)
+++ trunk/library/classes/Gems/User/Form/LoginForm.php 2012-03-29 17:08:31 UTC (rev 577)
@@ -155,13 +155,12 @@
*/
public function getCurrentOrganizationId()
{
- // Url determines organization first.
- $uri = $this->util->getCurrentURI();
- // MUtil_Echo::track($uri);
+ $userLoader = $this->loader->getUserLoader();
- if ($orgId = $this->util->getDbLookup()->getOrganizationForUrl($uri)) {
+ // Url determines organization first.
+ if ($orgId = $userLoader->getOrganizationIdByUrl()) {
$this->_organizationFromUrl = true;
- $this->loader->getCurrentUser()->setCurrentOrganization($orgId);
+ $userLoader->getCurrentUser()->setCurrentOrganization($orgId);
return $orgId;
}
@@ -170,7 +169,7 @@
return $orgId;
}
- return $this->loader->getCurrentUser()->getCurrentOrganizationId();
+ return $userLoader->getCurrentUser()->getCurrentOrganizationId();
}
/**
Modified: trunk/library/classes/Gems/User/UserLoader.php
===================================================================
--- trunk/library/classes/Gems/User/UserLoader.php 2012-03-29 14:39:03 UTC (rev 576)
+++ trunk/library/classes/Gems/User/UserLoader.php 2012-03-29 17:08:31 UTC (rev 577)
@@ -68,6 +68,12 @@
public $allowStaffEmailLogin = true;
/**
+ *
+ * @var Zend_Cache_Core
+ */
+ protected $cache;
+
+ /**
* Allows sub classes of Gems_Loader_LoaderAbstract to specify the subdirectory where to look for.
*
* @var string $cascade An optional subdirectory where this subclass always loads from.
@@ -104,6 +110,12 @@
protected $translate;
/**
+ *
+ * @var Gems_Util
+ */
+ protected $util;
+
+ /**
* There can be only one, current user that is.
*
* @var Gems_User_User
@@ -268,7 +280,7 @@
if (substr($defName, -10, 10) != 'Definition') {
$defName .= 'Definition';
}
-
+
self::$currentUser = $this->_loadClass('User', true, array($this->session, $this->_getClass($defName)));
} else {
self::$currentUser = $this->getUser(null, null);
@@ -302,7 +314,7 @@
* Returns an organization object, initiated from the database or from
* self::$_noOrganization when the database does not yet exist.
*
- * @param int $organizationId Optional, uses current user when empty
+ * @param int $organizationId Optional, uses current user or url when empty
* @return Gems_User_Organization
*/
public function getOrganization($organizationId = null)
@@ -310,7 +322,15 @@
static $organizations = array();
if (null === $organizationId) {
- $organizationId = intval(self::getCurrentUser()->getCurrentOrganizationId());
+ $user = $this->getCurrentUser();
+
+ if (! $user->isActive()) {
+ $organizationId = $this->getOrganizationIdByUrl();
+ }
+
+ if (! $organizationId) {
+ $organizationId = intval($user->getCurrentOrganizationId());
+ }
}
if (! isset($organizations[$organizationId])) {
@@ -321,6 +341,49 @@
}
/**
+ * Returns the current organization according to the current site url.
+ *
+ * @static array $url An array of url => orgId values
+ * @return int An organization id or null
+ */
+ public function getOrganizationIdByUrl()
+ {
+ static $urls;
+
+ if (! is_array($urls)) {
+ if ($this->cache) {
+ $cacheId = GEMS_PROJECT_NAME . '__' . get_class($this) . '__organizations_url';
+ $urls = $this->cache->load($cacheId);
+ } else {
+ $cacheId = false;
+ }
+
+ if (! $urls) {
+ $data = $this->db->fetchPairs("SELECT gor_id_organization, gor_url_base FROM gems__organizations WHERE gor_active=1 AND gor_url_base IS NOT NULL");
+ $urls = array();
+ foreach ($data as $orgId => $urlsBase) {
+ foreach (explode(' ', $urlsBase) as $url) {
+ if ($url) {
+ $urls[$url] = $orgId;
+ }
+ }
+ }
+
+ if ($cacheId) {
+ $this->cache->save($urls, $cacheId, array('organization', 'organizations'));
+ }
+ }
+ // MUtil_Echo::track($urls);
+ }
+
+ $current = $this->util->getCurrentURI();
+
+ if (isset($urls[$current])) {
+ return $urls[$current];
+ }
+ }
+
+ /**
* Get password weakness checker.
*
* @return Gems_User_PasswordChecker
Modified: trunk/library/classes/Gems/Util/DbLookup.php
===================================================================
--- trunk/library/classes/Gems/Util/DbLookup.php 2012-03-29 14:39:03 UTC (rev 576)
+++ trunk/library/classes/Gems/Util/DbLookup.php 2012-03-29 17:08:31 UTC (rev 577)
@@ -280,21 +280,6 @@
return $organizations;
}
- /**
- * Returns the organization
- * @param string $url
- * @return int|null the organization
- */
- public function getOrganizationForUrl($url)
- {
- try {
- $url = trim($this->db->quote($url), "'");
- return $this->db->fetchOne("SELECT gor_id_organization FROM gems__organizations WHERE gor_active=1 AND CONCAT(' ', gor_url_base, ' ') LIKE '% $url %'");
- } catch (Exception $e) {
- return null;
- }
- }
-
public function getRoles()
{
$roles = array();
Modified: trunk/library/classes/MUtil/Form.php
===================================================================
--- trunk/library/classes/MUtil/Form.php 2012-03-29 14:39:03 UTC (rev 576)
+++ trunk/library/classes/MUtil/Form.php 2012-03-29 17:08:31 UTC (rev 577)
@@ -35,7 +35,7 @@
*/
/**
- *
+ *
* @package MUtil
* @subpackage Form
* @copyright Copyright (c) 2011 Erasmus MC
Modified: trunk/library/classes/MUtil/Model/FormBridge.php
===================================================================
--- trunk/library/classes/MUtil/Model/FormBridge.php 2012-03-29 14:39:03 UTC (rev 576)
+++ trunk/library/classes/MUtil/Model/FormBridge.php 2012-03-29 17:08:31 UTC (rev 577)
@@ -107,9 +107,17 @@
}
}
+ /**
+ * Add the element to the for and apply any filters & validators
+ *
+ * @param string $name
+ * @param Zend_Form_Element $element
+ * @return Zend_Form_Element
+ */
protected function _addToForm($name, Zend_Form_Element $element)
{
$this->form->addElement($element);
+ $this->_applyFilters($name, $element);
$this->_applyValidators($name, $element);
// MUtil_Echo::r($element->getOrder(), $element->getName());
@@ -117,6 +125,41 @@
return $element;
}
+ /**
+ * Apply the filters for element $name to the element
+ *
+ * @param string $name
+ * @param Zend_Form_Element $element
+ */
+ protected function _applyFilters($name, Zend_Form_Element $element)
+ {
+ $filters = $this->model->get($name, 'filters');
+
+ if ($filter = $this->model->get($name, 'filter')) {
+ if ($filters) {
+ array_unshift($filters, $filter);
+ } else {
+ $filters = array($filter);
+ }
+ }
+
+ if ($filters) {
+ foreach ($filters as $filter) {
+ if (is_array($filter)) {
+ call_user_func_array(array($element, 'addFilter'), $filter);
+ } else {
+ $element->addFilter($filter);
+ }
+ }
+ }
+ }
+
+ /**
+ * Apply the validators for element $name to the element
+ *
+ * @param string $name
+ * @param Zend_Form_Element $element
+ */
protected function _applyValidators($name, Zend_Form_Element $element)
{
$validators = $this->model->get($name, 'validators');
@@ -505,6 +548,7 @@
}
$element = new Zend_Form_Element_Password($name, $options);
+ $this->_applyFilters($name, $element);
$this->_applyValidators($name, $element);
$this->form->addElement($element);
@@ -515,6 +559,7 @@
if (isset($repeatLabel)) {
$repeatElement = new Zend_Form_Element_Password($repeatName, $repeatOptions);
$this->form->addElement($repeatElement);
+ $this->_applyFilters($name, $repeatElement);
if ($stringlength) {
$repeatElement->addValidator('StringLength', true, $stringlength);
Modified: trunk/library/classes/MUtil/Model/Type/ConcatenatedRow.php
===================================================================
--- trunk/library/classes/MUtil/Model/Type/ConcatenatedRow.php 2012-03-29 14:39:03 UTC (rev 576)
+++ trunk/library/classes/MUtil/Model/Type/ConcatenatedRow.php 2012-03-29 17:08:31 UTC (rev 577)
@@ -110,6 +110,13 @@
return $this;
}
+
+ /**
+ * Displays the content
+ *
+ * @param string $value
+ * @return string
+ */
public function format($value)
{
// MUtil_Echo::track($value);
Modified: trunk/library/configs/db/tables/gems__organizations.20.sql
===================================================================
--- trunk/library/configs/db/tables/gems__organizations.20.sql 2012-03-29 14:39:03 UTC (rev 576)
+++ trunk/library/configs/db/tables/gems__organizations.20.sql 2012-03-29 17:08:31 UTC (rev 577)
@@ -2,11 +2,13 @@
CREATE TABLE if not exists gems__organizations (
gor_id_organization bigint unsigned not null auto_increment,
- gor_name varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
- gor_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
- gor_location varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
- gor_url varchar(127) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
- gor_task varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gor_name varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
+ gor_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gor_user_class varchar(30) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'StaffUser'
+ gor_location varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gor_url varchar(127) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gor_url_base varchar(1270) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gor_task varchar(50) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
-- A commy separated list of organization numbers that can look at respondents in this organization
gor_accessible_by text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
Modified: trunk/library/snippets/Organization/OrganizationEditSnippet.php
===================================================================
--- trunk/library/snippets/Organization/OrganizationEditSnippet.php 2012-03-29 14:39:03 UTC (rev 576)
+++ trunk/library/snippets/Organization/OrganizationEditSnippet.php 2012-03-29 17:08:31 UTC (rev 577)
@@ -48,6 +48,12 @@
{
/**
*
+ * @var Zend_Cache_Core
+ */
+ protected $cache;
+
+ /**
+ *
* @var Gems_Loader
*/
protected $loader;
@@ -72,7 +78,7 @@
}
//Need the first two together for validation
$bridge->addHtml('org')->b($this->_('Organization'));
- $this->addItems($bridge, 'gor_name', 'gor_id_organization', 'gor_location', 'gor_url', 'gor_active');
+ $this->addItems($bridge, 'gor_name', 'gor_id_organization', 'gor_location', 'gor_url', 'gor_url_base', 'gor_active');
$bridge->addHtml('contact')->b($this->_('Contact'));
$bridge->addHtml('contact_desc')->i($this->_('The contact details for this organization, used for emailing.'));
$this->addItems($bridge, 'gor_contact_name', 'gor_contact_email');
@@ -103,7 +109,9 @@
//Strip self
unset($allowedOrgs[$this->formData['gor_id_organization']]);
$display = join(', ', $allowedOrgs);
- $bridge->addExhibitor('allowed', 'value', $display, 'label', $this->_('Can access'));
+ if ($display) {
+ $bridge->addExhibitor('allowed', 'value', $display, 'label', $this->_('Can access'));
+ }
}
$this->addItems($bridge, 'gor_user_class');
@@ -126,8 +134,7 @@
public function afterSave($changed)
{
- $org = $this->loader->getOrganization($changed['gor_id_organization']);
- $org->invalidateCache();
+ $this->cache->clean('all', array('organization', 'organizations'));
// Make sure any changes in the allowed list are reflected.
$this->loader->getCurrentUser()->refreshAllowedOrganizations();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-29 14:39:17
|
Revision: 576
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=576&view=rev
Author: michieltcs
Date: 2012-03-29 14:39:03 +0000 (Thu, 29 Mar 2012)
Log Message:
-----------
Update translations
Modified Paths:
--------------
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
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 11:44:15 UTC (rev 575)
+++ trunk/library/languages/default-nl.po 2012-03-29 14:39:03 UTC (rev 576)
@@ -1,4811 +1,4819 @@
-msgid ""
-msgstr ""
-"Project-Id-Version: Pulse NL\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-03-22 16:35+0100\n"
-"PO-Revision-Date: \n"
-"Last-Translator: Matijs de Jong <mj...@ma...>\n"
-"Language-Team: Erasmus MGZ <mat...@ma...>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Language: \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:743
-#, php-format
-msgid "You are logged in as %s"
-msgstr "Ingelogd als %s"
-
-#: classes/GemsEscort.php:745
-#: classes/Gems/Menu.php:248
-msgid "Logoff"
-msgstr "Uitloggen"
-
-#: classes/GemsEscort.php:748
-msgid "You are not logged in"
-msgstr "U bent niet ingelogd"
-
-#: classes/GemsEscort.php:931
-#, php-format
-msgid "User: %s"
-msgstr "Login: %s"
-
-#: classes/GemsEscort.php:956
-msgid "version"
-msgstr "versie"
-
-#: classes/GemsEscort.php:1387
-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:1518
-msgid "Please check back later."
-msgstr "Probeer het later opnieuw."
-
-#: classes/GemsEscort.php:1520
-#: classes/GemsEscort.php:1524
-#: classes/GemsEscort.php:1525
-msgid "System is in maintenance mode"
-msgstr "Systeem is in onderhoudsmodus"
-
-#: classes/GemsEscort.php:1535
-msgid "No access to site."
-msgstr "Geen toegang tot website."
-
-#: classes/GemsEscort.php:1537
-#: classes/GemsEscort.php:1579
-msgid "You have no access to this site."
-msgstr "U heeft geen toegang tot deze website."
-
-#: classes/GemsEscort.php:1553
-msgid "No access to page"
-msgstr "Geen toegang tot pagina"
-
-#: classes/GemsEscort.php:1555
-#, 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:1565
-#: classes/GemsEscort.php:1577
-msgid "You are no longer logged in."
-msgstr "U bent niet meer ingelogd."
-
-#: classes/GemsEscort.php:1566
-msgid "You must login to access this page."
-msgstr "U moet ingelogd zijn voor toegang tot deze pagina."
-
-#: classes/GemsEscort.php:1710
-#: classes/GemsEscort.php:1712
-#, php-format
-msgid "%d survey"
-msgid_plural "%d surveys"
-msgstr[0] "%d vragenlijst"
-msgstr[1] "%d vragenlijsten"
-
-#: classes/Gems/AccessLog.php:236
-msgid "Database needs to be updated!"
-msgstr "Database dient ververst te worden!"
-
-#: classes/Gems/Auth.php:242
-msgid "Combination of organization, username and password not found."
-msgstr "Combinatie van organisatie, gebruikersnaam en wachtwoord niet gevonden."
-
-#: 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
-#: classes/Gems/Menu.php:345
-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
-#: classes/Gems/Menu.php:318
-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:287
-#: 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:310
-#: classes/Gems/Menu.php:341
-msgid "Add"
-msgstr "Voeg toe"
-
-#: classes/Gems/Menu.php:294
-#: classes/Gems/Menu.php:377
-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/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/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/Controller/BrowseEditAction.php:354
-#, php-format
-msgid "New %s..."
-msgstr "Nieuwe %s..."
-
-#: classes/Gems/Controller/BrowseEditAction.php:387
-#, php-format
-msgid "Delete %s"
-msgstr "Verwijder %s"
-
-#: 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:796
-msgid "Yes"
-msgstr "Ja"
-
-#: classes/Gems/Controller/BrowseEditAction.php:797
-msgid "No"
-msgstr "Nee"
-
-#: 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/ModelActionAbstract.php:97
-#: classes/Gems/Default/AskAction.php:150
-#: classes/Gems/Default/DatabaseAction.php:488
-msgid "Cancel"
-msgstr "Annuleren"
-
-#: 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: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/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/Default/AskAction.php:128
-#, php-format
-msgid "Welcome %s,"
-msgstr "Welkom %s,"
-
-#: classes/Gems/Default/AskAction.php:131
-#, php-format
-msgid "Thank you for answering the survey for token %s."
-msgstr "Dank u voor het invullen van de vragenlijst voor kenmerk %s."
-
-#: classes/Gems/Default/AskAction.php:132
-msgid "Please click the button below to answer the next survey."
-msgstr "Klik op de onderstaande knop om de volgende vragenlijst in te vullen."
-
-#: classes/Gems/Default/AskAction.php:137
-#, php-format
-msgid "Please click the button below to answer the survey for token %s."
-msgstr "Klik op de onderstaande knop om de vragenlijst behorende bij kenmerk %s in te vullen."
-
-#: classes/Gems/Default/AskAction.php:141
-#, php-format
-msgid "Wait one second to open the survey automatically or click on Cancel to stop."
-msgid_plural "Wait %d seconds to open the survey automatically or click on Cancel to stop."
-msgstr[0] "Over één seconde start de vragenlijst automatisch. Klik op annuleren om dit te onderbreken."
-msgstr[1] "Over %d seconden start de vragenlijst automatisch. Klik op annuleren om dit te onderbreken."
-
-#: classes/Gems/Default/AskAction.php:156
-#, php-format
-msgid "After this survey there is one other survey we would like you to answer."
-msgid_plural "After this survey there are another %d surveys we would like you to answer."
-msgstr[0] "Na deze vragenlijst hebben we nog één andere vragenlijst voor u."
-msgstr[1] "Na deze vragenlijst hebben we nog %d andere vragenlijsten voor u."
-
-#: classes/Gems/Default/AskAction.php:166
-#, php-format
-msgid "The survey for token %s is no longer active."
-msgstr "De vragenlijst voor kenmerk %s is niet meer in gebruik."
-
-#: classes/Gems/Default/AskAction.php:170
-#, php-format
-msgid "The token %s does not exist."
-msgstr "Het kenmerk %s bestaat niet."
-
-#: classes/Gems/Default/AskAction.php:172
-#, php-format
-msgid "Thank you for answering. At the moment we have no further surveys for you to take."
-msgstr "Dank u voor uw antwoorden. Op dit moment hebben we geen vragenlijsten meer voor u."
-
-#: classes/Gems/Default/AskAction.php:174
-#, php-format
-msgid "The survey for token %s has been answered and no further surveys are open."
-msgstr "De vragenlijst met het kenmerk %s is beantwoord en er staan verder geen vragenlijsten open."
-
-#: classes/Gems/Default/AskAction.php:181
-#, php-format
-msgid "The token %s does not exist (any more)."
-msgstr "Het kenmerk %s bestaat niet (meer)."
-
-#: classes/Gems/Default/AskAction.php:198
-#, php-format
-msgid "Enter your %s token"
-msgstr "Voer uw %s kenmerk in"
-
-#: classes/Gems/Default/AskAction.php:203
-#, php-format
-msgid "Enter tokens as %s."
-msgstr "Kenmerk invoeren als %s."
-
-#: classes/Gems/Default/AskAction.php:213
-msgid "OK"
-msgstr "OK"
-
-#: classes/Gems/Default/AskAction.php:233
-msgid "The server is currently busy, please wait a while and try again."
-msgstr "De server is bezet, wacht u alstublieft een moment en probeer het dan nogmaals."
-
-#: classes/Gems/Default/AskAction.php:255
-msgid "Tokens identify a survey that was assigned to you personally."
-msgstr "Elk kenmerk verwijst naar een specifiek aan u toegekende vragenlijst."
-
-#: classes/Gems/Default/AskAction.php:255
-msgid "Entering the token and pressing OK will open that survey."
-msgstr "Vul uw kenmerk in en druk op OK om die vragenlijst te openen."
-
-#: classes/Gems/Default/AskAction.php:259
-msgid "After answering the survey you will be logged off automatically."
-msgstr "Na het invullen wordt u automatisch uitgelogd."
-
-#: classes/Gems/Default/AskAction.php:261
-msgid "After answering the survey you will return to the respondent overview screen."
-msgstr "Na het invullen van de vragenlijst komt u terug in het patient scherm."
-
-#: classes/Gems/Default/AskAction.php:268
-msgid "A token consists of two groups of four letters and numbers, separated by an optional hyphen. Tokens are case insensitive."
-msgstr "Een kenmerk bestaat uit twee groepen van vier cijfers en letters met een (niet verplicht) streepje ertussen. Hoofdletters of gewone letters maakt niets uit."
-
-#: classes/Gems/Default/AskAction.php:269
-msgid "The number zero and the letter O are treated as the same; the same goes for the number one and the letter L."
-msgstr "Er wordt geen verschil gemaakt tussen het getal nul en de letter O en ook niet tussen het getal één en de letter L."
-
-#: classes/Gems/Default/ConsentAction.php:68
-#: classes/Gems/Default/GroupAction.php:88
-msgid "Description"
-msgstr "Omschrijving"
-
-#: classes/Gems/Default/ConsentAction.php:70
-#: classes/Gems/Default/DatabaseAction.php:123
-msgid "Order"
-msgstr "Volgorde"
-
-#: classes/Gems/Default/ConsentAction.php:71
-msgid "Determines order of presentation in interface."
-msgstr "Bepaald de presentatie volgorde."
-
-#: classes/Gems/Default/ConsentAction.php:73
-msgid "Consent code"
-msgstr "Consent code"
-
-#: classes/Gems/Default/ConsentAction.php:75
-msgid "Internal code, not visible to users, copied with the token information to the source."
-msgstr "Interne code, niet zichtbaar voor gebruikers maar wordt met de token informatie aan de bron doorgegeven."
-
-#: classes/Gems/Default/ConsentAction.php:92
-msgid "respondent consent"
-msgid_plural "respondent consents"
-msgstr[0] "patiënt toestemming"
-msgstr[1] "patiënt toestemmingen"
-
-#: classes/Gems/Default/ConsentAction.php:97
-msgid "Respondent consents"
-msgstr "Patiënt toestemming"
-
-#: classes/Gems/Default/ContactAction.php:71
-#, php-format
-msgid "%s is a web application."
-msgstr "%s is een web applicatie."
-
-#: classes/Gems/Default/ContactAction.php:76
-#, php-format
-msgid "The %s project is run by: "
-msgstr "%s is een project van: "
-
-#: classes/Gems/Default/ContactAction.php:82
-#, php-format
-msgid "%s is a collaboration of these organizations:"
-msgstr "Deze organisaties werken samen voor het %s project:"
-
-#: classes/Gems/Default/ContactAction.php:103
-#, php-format
-msgid "The %s project"
-msgstr "Het %s project"
-
-#: classes/Gems/Default/ContactAction.php:106
-msgid "Information on this application"
-msgstr "Information over deze website"
-
-#: classes/Gems/Default/ContactAction.php:107
-msgid "Links concerning this web application:"
-msgstr "Links met informatie over deze website:"
-
-#: classes/Gems/Default/CronAction.php:148
-msgid "Cron jobs turned off."
-msgstr "Cron opdrachten uitgezet."
-
-#: classes/Gems/Default/CronAction.php:221
-msgid "No mails sent."
-msgstr "Geen mail verzonden."
-
-#: classes/Gems/Default/CronAction.php:224
-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/Default/DatabaseAction.php:89
-#, php-format
-msgid "No rows in %s."
-msgstr "Geen gegevens in %s."
-
-#: classes/Gems/Default/DatabaseAction.php:118
-msgid "Type"
-msgstr "Type"
-
-#: classes/Gems/Default/DatabaseAction.php:122
-msgid "Group"
-msgstr "Groep"
-
-#: classes/Gems/Default/DatabaseAction.php:124
-msgid "Location"
-msgstr "Locatie"
-
-#: classes/Gems/Default/DatabaseAction.php:127
-msgid "Status"
-msgstr "Status"
-
-#: classes/Gems/Default/DatabaseAction.php:130
-msgid "Script"
-msgstr "Script"
-
-#: classes/Gems/Default/DatabaseAction.php:132
-msgid "Changed on"
-msgstr "Veranderd op"
-
-#: classes/Gems/Default/DatabaseAction.php:151
-msgid "This database object does not exist. You cannot delete it."
-msgstr "Dit database object bestaat. Het kan dus ook niet verwijderd worden."
-
-#: classes/Gems/Default/DatabaseAction.php:156
-#, php-format
-msgid "Drop %s"
-msgstr "Verwijder %s"
-
-#: classes/Gems/Default/DatabaseAction.php:164
-#, php-format
-msgid "There are %d rows in the table."
-msgstr "Er zijn %d rijen in deze tabel."
-
-#: classes/Gems/Default/DatabaseAction.php:166
-#, php-format
-msgid "Drop table with %d rows"
-msgstr "Tabel met %d rijen aan data verwijderen"
-
-#: classes/Gems/Default/DatabaseAction.php:167
-msgid "Are you really sure?"
-msgstr "Weet u het heel erg zeker?"
-
-#: classes/Gems/Default/DatabaseAction.php:183
-#, php-format
-msgid "%1$s %2$s dropped"
-msgstr "%1$s %2$s verwijderd"
-
-#: classes/Gems/Default/DatabaseAction.php:188
-msgid " during statement "
-msgstr " tijdens het commando "
-
-#: classes/Gems/Default/DatabaseAction.php:199
-#, php-format
-msgid "%s no longer exists in the database."
-msgstr "%s bestaat niet meer in de database."
-
-#: classes/Gems/Default/DatabaseAction.php:202
-#, php-format
-msgid "%s does not yet exist in the database."
-msgstr "%s bestaat nog niet in de database."
-
-#: classes/Gems/Default/DatabaseAction.php:205
-#, php-format
-msgid "%s object does exist."
-msgstr "%s object bestaat."
-
-#: classes/Gems/Default/DatabaseAction.php:223
-msgid "Object is not a table."
-msgstr "Niet een tabel object."
-
-#: classes/Gems/Default/DatabaseAction.php:247
-msgid "Structure"
-msgstr "Structuur"
-
-#: classes/Gems/Default/DatabaseAction.php:256
-msgid "database object"
-msgid_plural "database objects"
-msgstr[0] "database object"
-msgstr[1] "database objects"
-
-#: classes/Gems/Default/DatabaseAction.php:261
-msgid "Database object overview"
-msgstr "Database object overzicht"
-
-#: classes/Gems/Default/DatabaseAction.php:270
-#: classes/Gems/Default/DatabaseAction.php:322
-msgid "Level"
-msgstr "Niveau"
-
-#: classes/Gems/Default/DatabaseAction.php:271
-#: classes/Gems/Default/DatabaseAction.php:323
-msgid "Subtype"
-msgstr "Subtype"
-
-#: classes/Gems/Default/DatabaseAction.php:273
-msgid "To be executed"
-msgstr "Uit te voeren"
-
-#: classes/Gems/Default/DatabaseAction.php:274
-#: classes/Gems/Default/DatabaseAction.php:326
-msgid "Executed"
-msgstr "Uitgevoerd"
-
-#: classes/Gems/Default/DatabaseAction.php:275
-#: classes/Gems/Default/DatabaseAction.php:327
-msgid "Finished"
-msgstr "Afgerond"
-
-#: classes/Gems/Default/DatabaseAction.php:278
-msgid "Create the patch table!"
-msgstr "De patch tabel bestaat nog niet!"
-
-#: classes/Gems/Default/DatabaseAction.php:280
-#, php-format
-msgid "%d new or changed patch(es)."
-msgstr "%d nieuwe of veranderde patch(es)."
-
-#: classes/Gems/Default/DatabaseAction.php:285
-msgid "Gems build"
-msgstr "Gems bouwnummer"
-
-#: classes/Gems/Default/DatabaseAction.php:286
-msgid "Database build"
-msgstr "Database versie"
-
-#: classes/Gems/Default/DatabaseAction.php:288
-msgid "Execute level"
-msgstr "Uit te voeren versie"
-
-#: classes/Gems/Default/DatabaseAction.php:292
-msgid "Ignore finished"
-msgstr "Afgeronde patches overslaan"
-
-#: classes/Gems/Default/DatabaseAction.php:293
-msgid "Ignore executed"
-msgstr "Uitgevoerde patches overslaan"
-
-#: classes/Gems/Default/DatabaseAction.php:294
-msgid "Show patches"
-msgstr "Toon patches"
-
-#: classes/Gems/Default/DatabaseAction.php:308
-#, php-format
-msgid "%d patch(es) executed."
-msgstr "%d patch(es) uitgevoerd."
-
-#: classes/Gems/Default/DatabaseAction.php:315
-msgid "Cache cleaned"
-msgstr "Cache opgeschoond"
-
-#: classes/Gems/Default/DatabaseAction.php:321
-msgid "Patch"
-msgstr "Patch"
-
-#: classes/Gems/Default/DatabaseAction.php:325
-msgid "Query"
-msgstr "Query"
-
-#: classes/Gems/Default/DatabaseAction.php:328
-msgid "Result"
-msgstr "Resultaat"
-
-#: classes/Gems/Default/DatabaseAction.php:352
-msgid "Patch maintenance"
-msgstr "Patch onderhoud"
-
-#: classes/Gems/Default/DatabaseAction.php:356
-msgid "Patch overview"
-msgstr "Patch overzicht"
-
-#: classes/Gems/Default/DatabaseAction.php:418
-msgid "This database object does not exist. You cannot create it."
-msgstr "Dit database object bestaat niet en kan ook niet aangemaakt worden."
-
-#: classes/Gems/Default/DatabaseAction.php:424
-msgid "This database object has no script. You cannot execute it."
-msgstr "Dit database object heeft geen script. Het kan dus ook niet uitgevoerd worden."
-
-#: classes/Gems/Default/DatabaseAction.php:435
-#, php-format
-msgid "Run %s"
-msgstr "Voer %s script uit"
-
-#: classes/Gems/Default/DatabaseAction.php:455
-#, php-format
-msgid "Starting %d object creation scripts."
-msgstr "Aanvang %d object aanmaak scripts."
-
-#: classes/Gems/Default/DatabaseAction.php:461
-#, php-format
-msgid "Finished %s creation script for object %d of %d"
-msgstr "Klaar %s met aanmaak script voor object %d van %d"
-
-#: classes/Gems/Default/DatabaseAction.php:465
-msgid "All objects exist. Nothing was executed."
-msgstr "Alle objects bestaan. Niets was uitgevoerd."
-
-#: classes/Gems/Default/DatabaseAction.php:471
-msgid "Create not-existing database objects"
-msgstr "Aanmaak van database objecten die nog niet bestaan"
-
-#: classes/Gems/Default/DatabaseAction.php:473
-#, php-format
-msgid "One database object does not exist."
-msgid_plural "These %d database objects do not exist."
-msgstr[0] "Één object bestaat nog niet in de database."
-msgstr[1] "%d objecten bestaan nog niet in de database."
-
-#: classes/Gems/Default/DatabaseAction.php:474
-msgid "Are you sure you want to create it?"
-msgid_plural "Are you sure you want to create them all?"
-msgstr[0] "Weet je zeker dat je dat object wil aanmaken?"
-msgstr[1] "Weet je zeker dat je ze allemaal wil aanmaken?"
-
-#: classes/Gems/Default/DatabaseAction.php:487
-msgid "All database objects exist. There is nothing to create."
-msgstr "Alle database objecten bestaan. Er valt niets te maken."
-
-#: classes/Gems/Default/DatabaseAction.php:500
-msgid "Separate multiple commands with semicolons (;)."
-msgstr "Scheidt meerdere commando's met punt-comma's (;)."
-
-#: classes/Gems/Default/DatabaseAction.php:507
-msgid "Run"
-msgstr "Uitvoeren"
-
-#: classes/Gems/Default/DatabaseAction.php:516
-msgid "raw"
-msgstr "rauw"
-
-#: classes/Gems/Default/DatabaseAction.php:526
-#, php-format
-msgid "Result set %s."
-msgstr "Resultaat %s."
-
-#: classes/Gems/Default/DatabaseAction.php:549
-msgid "Execute raw SQL"
-msgstr "SQL direct uitvoeren"
-
-#: classes/Gems/Default/DatabaseAction.php:552
-msgid "Result sets"
-msgstr "Resultaten"
-
-#: classes/Gems/Default/DatabaseAction.php:577
-msgid "This database object does not exist. You cannot view it."
-msgstr "Dit database object bestaat. Het kan dus ook niet bekeken worden."
-
-#: classes/Gems/Default/DatabaseAction.php:582
-#, php-format
-msgid "The data in table %s"
-msgstr "De gegevens in tabel %s"
-
-#: classes/Gems/Default/DatabaseAction.php:583
-#, php-format
-msgid "Contents of %s %s"
-msgstr "De inhoud van %s %s"
-
-#: classes/Gems/Default/ExportAction.php:69
-msgid "Data"
-msgstr "Data"
-
-#: classes/Gems/Default/ExportAction.php:74
-msgid "Export data"
-msgstr "Exporteer gegevens"
-
-#: classes/Gems/Default/ExportAction.php:153
-msgid "Survey"
-msgstr "Vragenlijst"
-
-#: classes/Gems/Default/ExportAction.php:168
-#, php-format
-msgid "%s records found."
-msgstr "%s records gevonden."
-
-#: classes/Gems/Default/ExportAction.php:172
-#: classes/Gems/Default/IndexAction.php:220
-#: classes/Gems/Default/LogAction.php:197
-msgid "Organization"
-msgstr "Organisatie"
-
-#: classes/Gems/Default/ExportAction.php:181
-msgid "Export to"
-msgstr "Exporteer naar"
-
-#: classes/Gems/Default/GroupAction.php:89
-#: classes/Gems/Default/LogAction.php:201
-msgid "Role"
-msgstr "Rol"
-
-#: classes/Gems/Default/GroupAction.php:92
-msgid "Active"
-msgstr "Actief"
-
-#: classes/Gems/Default/GroupAction.php:97
-msgid "Allowed IP Ranges"
-msgstr "Toegestane IP adres reeksen"
-
-#: classes/Gems/Default/GroupAction.php:98
-msgid "Separate with | example: 10.0.0.0-10.0.0.255 (subnet masks are not supported)"
-msgstr "Scheiden met | voorbeeld: 10.0.0.0-10.0.0.255 (subnet masks worden niet ondersteund)"
-
-#: classes/Gems/Default/GroupAction.php:108
-msgid "group"
-msgid_plural "groups"
-msgstr[0] "groep"
-msgstr[1] "groepen"
-
-#: classes/Gems/Default/GroupAction.php:113
-msgid "Administrative groups"
-msgstr "Beheer groepen"
-
-#: classes/Gems/Default/IndexAction.php:105
-msgid "Enter your token..."
-msgstr "Voer uw kenmerk in..."
-
-#: classes/Gems/Default/IndexAction.php:157
-#, php-format
-msgid "Login to %s application"
-msgstr "%s login"
-
-#: classes/Gems/Default/IndexAction.php:169
-msgid "Login"
-msgstr "Inloggen"
-
-#: classes/Gems/Default/IndexAction.php:191
-msgid "Back to login"
-msgstr "Terug naar de login"
-
-#: classes/Gems/Default/IndexAction.php:244
-msgid "Password"
-msgstr "Wachtwoord"
-
-#: classes/Gems/Default/IndexAction.php:259
-#, php-format
-msgid "Reset password for %s application"
-msgstr "Reset wachtwoord voor %s"
-
-#: classes/Gems/Default/IndexAction.php:263
-msgid "Reset password"
-msgstr "Reset wachtwoord"
-
-#: classes/Gems/Default/IndexAction.php:309
-msgid "Username"
-msgstr "Gebruikersnaam"
-
-#: classes/Gems/Default/IndexAction.php:351
-msgid "Your password must be changed."
-msgstr "Uw wachtwoord moet veranderd worden."
-
-#: classes/Gems/Default/IndexAction.php:363
-#, php-format
-msgid "Login successful, welcome %s."
-msgstr "Login in orde, welkom %s."
-
-#: classes/Gems/Default/IndexAction.php:403
-#, php-format
-msgid "Good bye: %s."
-msgstr "Tot ziens: %s."
-
-#: classes/Gems/Default/IndexAction.php:428
-msgid "Reset accepted, enter your new password."
-msgstr "Reset geaccepteerd, voer uw nieuwe wachtwoord in."
-
-#: classes/Gems/Default/IndexAction.php:432
-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:455
-msgid "Password reset requested"
-msgstr "Wachtwoord reset aangevraagd"
-
-#: classes/Gems/Default/IndexAction.php:456
-#, php-format
-msgid "To reset your password for %s, please click this link: %s"
-msgstr "Om uw wachtwoord voor %s te resetten, klik op deze link: %s"
-
-#: classes/Gems/Default/IndexAction.php:461
-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:463
-msgid "Unable to send e-mail."
-msgstr "Verzenden e-mail mislukt."
-
-#: classes/Gems/Default/IndexAction.php:468
-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:472
-msgid "We received your password reset key."
-msgstr "Wachtwoord resetsleutel ontvangen."
-
-#: classes/Gems/Default/IndexAction.php:473
-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"
-
-#: classes/Gems/Default/LanguageAction.php:63
-msgid "Cookies must be enabled for setting the language."
-msgstr "Zonder cookies kan de taal niet ingesteld worden."
-
-#: classes/Gems/Default/LanguageAction.php:66
-msgid "Invalid language setting."
-msgstr "Ongeldige taal instelling."
-
-#: classes/Gems/Default/LogAction.php:78
-msgid "from"
-msgstr "vanaf"
-
-#: classes/Gems/Default/LogAction.php:83
-msgid "until"
-msgstr "tot"
-
-#: classes/Gems/Default/LogAction.php:89
-msgid "days"
-msgstr "dagen"
-
-#: classes/Gems/Default/LogAction.php:90
-msgid "weeks"
-msgstr "weken"
-
-#: classes/Gems/Default/LogAction.php:91
-msgid "months"
-msgstr "maanden"
-
-#: classes/Gems/Default/LogAction.php:92
-msgid "years"
-msgstr "jaren"
-
-#: classes/Gems/Default/LogAction.php:113
-msgid "Organization:"
-msgstr "Organisatie:"
-
-#: classes/Gems/Default/LogAction.php:115
-msgid "All organizations"
-msgstr "Alle organisaties"
-
-#: classes/Gems/Default/LogAction.php:117
-msgid "Staff:"
-msgstr "Medewerkers:"
-
-#: classes/Gems/Default/LogAction.php:124
-msgid "All staff"
-msgstr "Alle medewerkers"
-
-#: classes/Gems/Default/LogAction.php:127
-msgid "Patient:"
-msgstr "Patiënt:"
-
-#: classes/Gems/Default/LogAction.php:134
-msgid "All patients"
-msgstr "Alle patiënten"
-
-#: classes/Gems/Default/LogAction.php:136
-msgid "Action:"
-msgstr "Actie:"
-
-#: classes/Gems/Default/LogAction.php:139
-msgid "All actions"
-msgstr "Alle acties"
-
-#: classes/Gems/Default/LogAction.php:190
-msgid "Date"
-msgstr "Datum"
-
-#: classes/Gems/Default/LogAction.php:191
-#: classes/Gems/Default/LogMaintenanceAction.php:52
-msgid "Action"
-msgstr "Actie"
-
-#: classes/Gems/Default/LogAction.php:192
-msgid "Message"
-msgstr "Bericht"
-
-#: classes/Gems/Default/LogAction.php:198
-msgid "Respondent"
-msgstr "Patiënt"
-
-#: classes/Gems/Default/LogAction.php:202
-msgid "IP address"
-msgstr "IP adres"
-
-#: classes/Gems/Default/LogAction.php:209
-#: classes/Gems/Default/LogMaintenanceAction.php:53
-msgid "Log"
-msgstr "Logboek"
-
-#: classes/Gems/Default/LogMaintenanceAction.php:71
-msgid "Log:"
-msgstr "Logboek:"
-
-#: classes/Gems/Default/LogMaintenanceAction.php:72
-msgid "All"
-msgstr "Alles"
-
-#: classes/Gems/Default/LogMaintenanceAction.php:78
-msgid "Log action"
-msgstr "Logboek actie"
-
-#: classes/Gems/Default/LogMaintenanceAction.php:82
-msgid "Log maintenance"
-msgstr "Logboek onderhoud"
-
-#: classes/Gems/Default/MailJobAction.php:78
-#: classes/Gems/Default/MailLogAction.php:118
-msgid "Template"
-msgstr "Sjabloon"
-
-#: classes/Gems/Default/MailJobAction.php:79
-msgid "By staff member"
-msgstr "Door medewerke"
-
-#: classes/Gems/Default/MailJobAction.php:81
-msgid "Used for logging and possibly from address."
-msgstr "Gebruikt voor activiteiten log en eventueel voor vanaf adres."
-
-#: classes/Gems/Default/MailJobAction.php:84
-msgid "Job is only run when active."
-msgstr "Een opdracht wordt alleen uitgevoerd als deze actief is."
-
-#: classes/Gems/Default/MailJobAction.php:87
-msgid "From address used"
-msgstr "Gebruikte vanaf adres"
-
-#: classes/Gems/Default/MailJobAction.php:89
-msgid "From other"
-msgstr "Vanaf overig"
-
-#: classes/Gems/Default/MailJobAction.php:90
-#, php-format
-msgid "Only when '%s' is '%s'."
-msgstr "Aleen als '%s' is '%s'."
-
-#: classes/Gems/Default/MailJobAction.php:92
-msgid "Processing Method"
-msgstr "Verwerkings methode"
-
-#: classes/Gems/Default/MailJobAction.php:93
-msgid "Filter for"
-msgstr "Selecteer op"
-
-#: classes/Gems/Default/MailJobAction.php:94
-msgid "Days between reminders"
-msgstr "Aantal dagen tussen herinneringen"
-
-#: classes/Gems/Default/MailJobAction.php:113
-msgid "First mail"
-msgstr "Eerste mail"
-
-#: classes/Gems/Default/MailJobAction.php:114
-msgid "Reminder"
-msgstr "Herinnering"
-
-#: classes/Gems/Default/MailJobAction.php:125
-msgid "Use organizational from address"
-msgstr "Gebruik vanaf adres van organisatie"
-
-#: classes/Gems/Default/MailJobAction.php:128
-#, php-format
-msgid "Use site %s address"
-msgstr "Gebruik %s adres van de site"
-
-#: classes/Gems/Default/MailJobAction.php:131
-msgid "Use the 'By staff member' address"
-msgstr "Gebruik 'Door medewerker' adres"
-
-#: classes/Gems/Default/MailJobAction.php:132
-msgid "Other"
-msgstr "Overige"
-
-#: classes/Gems/Default/MailJobAction.php:144
-msgid "Automatic mail jobs"
-msgstr "Automatische mail opdrachten "
-
-#: classes/Gems/Default/MailJobAction.php:155
-msgid "automatic mail job"
-msgid_plural "automatic mail jobs"
-msgstr[0] "automatische mail opdracht"
-msgstr[1] "automatische mail opdrachten"
-
-#: classes/Gems/Default/MailJobAction.php:165
-#, php-format
-msgid "Automatic mails have been turned off since %s."
-msgstr "Automatische mail opdrachten staan sinds %s uit."
-
-#: classes/Gems/Default/MailJobAction.php:169
-msgid "Turn Automatic Mail Jobs ON"
-msgstr "Automatische mail opdrachten AANzetten"
-
-#: classes/Gems/Default/MailJobAction.php:175
-msgid "With automatic mail jobs and a cron job on the server, mails can be sent without manual user action."
-msgstr "Met automatische mail opdrachten en een cron opdracht op de server, kunnen mails verstuurd worden zonder dat een gebruiker actie hoeft te ondernemen."
-
-#: classes/Gems/Default/MailLogAction.php:109
-msgid "Date sent"
-msgstr "Verzend datum"
-
-#: classes/Gems/Default/MailLogAction.php:110
-msgid "Receiver"
-msgstr "Ontvanger"
-
-#: classes/Gems/Default/MailLogAction.php:111
-msgid "To address"
-msgstr "Adres aan"
-
-#: classes/Gems/Default/MailLogAction.php:112
-msgid "Sender"
-msgstr "Verzender"
-
-#: classes/Gems/Default/MailLogAction.php:113
-msgid "From address"
-msgstr "Adres van"
-
-#: classes/Gems/Default/MailLogAction.php:115
-#: classes/Gems/Default/MailTemplateAction.php:62
-msgid "Subject"
-msgstr "Onderwerp"
-
-#: classes/Gems/Default/MailLogAction.php:143
-msgid "Mail Activity Log"
-msgstr "Logboek Mail Activiteit"
-
-#: classes/Gems/Default/MailLogAction.php:154
-msgid "mail activity"
-msgid_plural "mail activities"
-msgstr[0] "mail activiteit"
-msgstr[1] "mail activiteiten"
-
-#: classes/Gems/Default/MailServerAction.php:68
-msgid "From address [part]"
-msgstr "Vanaf adres [gedeelte]"
-
-#: classes/Gems/Default/MailServerAction.php:70
-msgid "E.g.: '%', '%.org' or '%@gemstracker.org' or 'ro...@ge...'."
-msgstr "Bijvoorbeeld: '%', '%.nl' of '%@gemstracker.nl' of 'ro...@ge...'."
-
-#: classes/Gems/Default/MailServerAction.php:71
-msgid "Server"
-msgstr "Server"
-
-#: classes/Gems/Default/MailServerAction.php:73
-msgid "Encryption"
-msgstr "Encryptie"
-
-#: classes/Gems/Default/MailServerAction.php:76
-msgid "None"
-msgstr "Geen"
-
-#: classes/Gems/Default/MailServerAction.php:77
-msgid "SSL"
-msgstr "SSL"
-
-#: classes/Gems/Default/MailServerAction.php:78
-msgid "TLS"
-msgstr "TLS"
-
-#: classes/Gems/Default/MailServerAction.php:80
-msgid "Port"
-msgstr "Poort"
-
-#: classes/Gems/Default/MailServerAction.php:82
-msgid "Normal values: 25 for TLS and no encryption, 465 for SSL"
-msgstr "Standaard waardes: 25 voor TLS en voor geen encryptie, 465 voor SSL"
-
-#: classes/Gems/Default/MailServerAction.php:84
-msgid "User ID"
-msgstr "Gebruikers ID"
-
-#: classes/Gems/Default/MailServerAction.php:90
-#: classes/Gems/Default/SourceAction.php:95
-msgid "Repeat password"
-msgstr "Herhaal wachtwoord"
-
-#: classes/Gems/Default/MailServerAction.php:91
-#: classes/Gems/Default/SourceAction.php:74
-msgid "Enter only when changing"
-msgstr "Alleen invoeren om het wachtwoord te wijzigen"
-
-#: classes/Gems/Default/MailServerAction.php:100
-msgid "email server"
-msgid_plural "email servers"
-msgstr[0] "email server"
-msgstr[1] "email servers"
-
-#: classes/Gems/Default/MailServerAction.php:105
-msgid "Email servers"
-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 "(alle organisaties)"
-
-#: classes/Gems/Default/MailTemplateAction.php:95
-msgid "email template"
-msgid_plural "email templates"
-msgstr[0] "email sjabloon"
-msgstr[1] "email sjablonen"
-
-#: classes/Gems/Default/MailTemplateAction.php:100
-msgid "Email templates"
-msgstr "Email sjabloon"
-
-#: classes/Gems/Default/OptionAction.php:81
-msgid "You are not allowed to change your password."
-msgstr "U mag uw wachtwoord niet wijzigen."
-
-#: classes/Gems/Default/OptionAction.php:94
-#: classes/Gems/Default/StaffAction.php:419
-msgid "New password is active."
-msgstr "Nieuwe wachtwoord geactiveerd."
-
-#: classes/Gems/Default/OptionAction.php:128
-msgid "Login Name"
-msgstr "Login Naam"
-
-#: classes/Gems/Default/OptionAction.php:135
-#: classes/Gems/Default/OrganizationAction.php:129
-#: classes/Gems/Default/RespondentAction.php:175
-#: classes/Gems/Default/StaffAction.php:294
-msgid "Language"
-msgstr "Taal"
-
-#: classes/Gems/Default/OptionAction.php:145
-#, php-format
-msgid "Options"
-msgstr "Instellingen"
-
-#: classes/Gems/Default/OptionAction.php:154
-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
-msgid "Date / time"
-msgstr "Datum / tijd"
-
-#: classes/Gems/Default/OptionAction.php:185
-msgid "Item"
-msgstr "Item"
-
-#: classes/Gems/Default/OrganizationAction.php:91
-msgid "Invalid organization."
-msgstr "Ongeldige organisatie."
-
-#: classes/Gems/Default/OrganizationAction.php:113
-msgid "Url"
-msgstr "Url"
-
-#: classes/Gems/Default/OrganizationAction.php:114
-msgid "Task"
-msgstr "Taak"
-
-#: classes/Gems/Default/OrganizationAction.php:115
-msgid "Contact name"
-msgstr "Contact naam"
-
-#: classes/Gems/Default/OrganizationAction.php:116
-msgid "Contact email"
-msgstr "Contact email"
-
-#: classes/Gems/Default/OrganizationAction.php:119
-msgid "Style"
-msgstr "Stijl"
-
-#: classes/Gems/Default/OrganizationAction.php:123
-msgid "Default url"
-msgstr "Standaard url"
-
-#: classes/Gems/Default/OrganizationAction.php:125
-#, php-format
-msgid "Always switch to this organization when %s is accessed from this url"
-msgstr "Altijd naar deze organisatie overschakelen als %s vanaf deze url wordt aangeroepen"
-
-#: classes/Gems/Default/OrganizationAction.php:133
-msgid "Can the organization be used?"
-msgstr "Is de organisatie in gebruik?"
-
-#: classes/Gems/Default/OrganizationAction.php:134
-msgid "Can people login for this organization?"
-msgstr "Kunnen personen inloggen voor deze organisatie?"
-
-#: classes/Gems/Default/OrganizationAction.php:135
-msgid "Accepting"
-msgstr "Accepteert"
-
-#: classes/Gems/Default/OrganizationAction.php:135
-msgid "Can new respondents be added to the organization?"
-msgstr "Accepteert de organisatie nieuwe patiënten?"
-
-#: classes/Gems/Default/OrganizationAction.php:136
-msgid "Does the organization have respondents?"
-msgstr "Heeft de organisatie patiënten?"
-
-#: classes/Gems/Default/OrganizationAction.php:137
-msgid "Respondent group"
-msgstr "Patiënt groep"
-
-#: classes/Gems/Default/OrganizationAction.php:137
-msgid "Allows respondents to login."
-msgstr "Patiënten toestaan in te loggen."
-
-#: classes/Gems/Default/OrganizationAction.php:141
-msgid "Greeting"
-msgstr "Begroeting"
-
-#: classes/Gems/Default/OrganizationAction.php:141
-#: classes/Gems/Default/OrganizationAction.php:142
-msgid "For emails and token forward screen."
-msgstr "Voor emails en kenmerk scherm."
-
-#: classes/Gems/Default/OrganizationAction.php:142
-msgid "Signature"
-msgstr "Handtekening"
-
-#: classes/Gems/Default/OrganizationAction.php:144
-msgid "Accessible by"
-msgstr "Toegankelijk voor"
-
-#: classes/Gems/Default/OrganizationAction.php:144
-msgid "Checked organizations see this organizations respondents."
-msgstr "Geselecteerde organizaties kunnen de patiënten van deze organisatie bekijken."
-
-#: classes/Gems/Default/OrganizationAction.php:154
-msgid "Code name"
-msgstr "Code naam"
-
-#: classes/Gems/Default/OrganizationAction.php:154
-msgid "Only for programmers."
-msgstr "Uitsluitend voor programmeurs."
-
-#: classes/Gems/Default/OrganizationAction.php:164
-msgid "This can not be changed yet"
-msgstr "Dit kan nog niet gewijzigd worden"
-
-#: classes/Gems/Default/OrganizationAction.php:166
-#: classes/Gems/Default/StaffAction.php:119
-msgid "User Definition"
-msgstr "User Definition"
-
-#: classes/Gems/Default/OrganizationAction.php:186
-msgid "Participating organizations"
-msgstr "Deelnemende organisaties"
-
-#: classes/Gems/Default/OrganizationAction.php:197
-msgid "organization"
-msgid_plural "organizations"
-msgstr[0] "organisatie"
-msgstr[1] "organisaties"
-
-#: classes/Gems/Default/OverviewPlanAction.php:115
-#: classes/Gems/Default/ProjectSurveysAction.php:88
-msgid "survey"
-msgid_plural "surveys"
-msgstr[0] "vragenlijst"
-msgstr[1] "vragenlijsten"
-
-#: classes/Gems/Default/OverviewPlanAction.php:120
-msgid "Planning overview"
-msgstr "Planning overzicht"
-
-#: classes/Gems/Default/ProjectInformationAction.php:83
-msgid "empty file"
-msgstr "leeg bestand"
-
-#: classes/Gems/Default/ProjectInformationAction.php:87
-msgid "file not found"
-msgstr "bestand niet gevonden"
-
-#: classes/Gems/Default/ProjectInformationAction.php:120
-msgid "Logged errors"
-msgstr "Opgeslagen foutmeldingen"
-
-#: classes/Gems/Default/ProjectInformationAction.php:120
-msgid "Empty logfile"
-msgstr "Verwijder alle foutmeldingen"
-
-#: classes/Gems/Default/ProjectInformationAction.php:125
-msgid "Project information"
-msgstr "Project informatie"
-
-#: classes/Gems/Default/ProjectInformationAction.php:129
-msgid "Project name"
-msgstr "Project naam"
-
-#: classes/Gems/Default/ProjectInformationAction.php:130
-msgid "Project version"
-msgstr "Project versie"
-
-#: classes/Gems/Default/ProjectInformationAction.php:131
-msgid "Gems version"
-msgstr "Gems versie"
-
-#: classes/Gems/Default/ProjectInformationAction.php:133
-msgid "Gems project"
-msgstr "Gems project"
-
-#: classes/Gems/Default/ProjectInformationAction.php:134
-msgid "Gems web directory"
-msgstr "Gems web folder"
-
-#: classes/Gems/Default/ProjectInformationAction.php:135
-msgid "Gems code directory"
-msgstr "Gems code folder"
-
-#: classes/Gems/Default/ProjectInformationAction.php:136
-msgid "Gems project path"
-msgstr "Gems project folder"
-
-#: classes/Gems/Default/ProjectInformationAction.php:137
-msgid "MUtil version"
-msgstr "MUtil versie"
-
-#: classes/Gems/Default/ProjectInformationAction.php:138
-msgid "Zend version"
-msgstr "Zend versie"
-
-#: classes/Gems/Default/ProjectInformationAction.php:139
-msgid "Application environment"
-msgstr "Applicatie omgeving"
-
-#: classes/Gems/Default/ProjectInformationAction.php:140
-msgid "Application baseuri"
-msgstr "Applicatie baseuri"
-
-#: classes/Gems/Default/ProjectInformationAction.php:141
-msgid "Application directory"
-msgstr "Applicatie folder"
-
-#: classes/Gems/Default/ProjectInformationAction.php:142
-msgid "PHP version"
-msgstr "PHP versie"
-
-#: classes/Gems/Default/ProjectInformationAction.php:143
-msgid "Server Hostname"
-msgstr "Webserver naam"
-
-#: classes/Gems/Default/ProjectInformationAction.php:144
-msgid "Server OS"
-msgstr "Server besturingssysteem"
-
-#: classes/Gems/Default/ProjectInformationAction.php:145
-msgid "Time on server"
-msgstr "De tijd op de server"
-
-#: classes/Gems/Default/ProjectInformationAction.php:149
-msgid "Turn Maintenance Mode OFF"
-msgstr "Onderhoudsmodus UITzetten"
-
-#: classes/Gems/Default/ProjectInformationAction.php:151
-msgid "Turn Maintenance Mode ON"
-msgstr "Onderhoudsmodus AANzetten"
-
-#: classes/Gems/Default/ProjectInformationAction.php:161
-msgid "Version information"
-msgstr "Versie informatie"
-
-#: classes/Gems/Default/ProjectInformationAction.php:195
-msgid "Server PHP Info"
-msgstr "Server PHP Info"
-
-#: classes/Gems/Default/ProjectInformationAction.php:212
-msgid "Project settings"
-msgstr "Project instellingen"
-
-#: classes/Gems/Default/ProjectInformationAction.php:219
-msgid "Session content"
-msgstr "Sessie inhoud"
-
-#: classes/Gems/Default/ProjectInformationAction.php:220
-msgid "Session"
-msgstr "Sessie"
-
-#: classes/Gems/Default/ProjectSurveysAction.php:68
-msgid "By"
-msgstr "Door"
-
-#: classes/Gems/Default/ProjectSurveysAction.php:69
-#: classes/Gems/Default/ProjectTracksAction.php:67
-msgid "From"
-msgstr "Van"
-
-#: classes/Gems/Default/ProjectSurveysAction.php:70
-#: classes/Gems/Default/ProjectTracksAction.php:68
-msgid "Until"
-msgstr "Tot"
-
-#: classes/Gems/Default/ProjectSurveysAction.php:93
-msgid "Active surveys"
-msgstr "Beschikbare vragenlijsten"
-
-#: classes/Gems/Default/ProjectTracksAction.php:65
-msgid "Survey #"
-msgstr "Vragenlijsten"
-
-#: classes/Gems/Default/ProjectTracksAction.php:85
-msgid "track"
-msgid_plural "tracks"
-msgstr[0] "traject"
-msgstr[1] "trajecten"
-
-#: classes/Gems/Default/ProjectTracksAction.php:90
-msgid "Active tracks"
-msgstr "Beschikbare trajecten"
-
-#: classes/Gems/Default/ProjectTracksAction.php:110
-#, php-format
-msgid "Questions in survey %s"
-msgstr "Vragen in vragenlijsten %s"
-
-#: classes/Gems/Default/ProjectTracksAction.php:118
-#, php-format
-msgid "Survey %s does not exist."
-msgstr "Vragenlijst %s bestaat niet."
-
-#: classes/Gems/Default/ProjectTracksAction.php:121
-msgid "Survey not specified."
-msgstr "Vragenlijst niet opgegeven."
-
-#: classes/Gems/Default/ProjectTracksAction.php:132
-#, php-format
-msgid "Track %s does not exist."
-msgstr "Trajectnummer %s bestaat niet."
-
-#: classes/Gems/Default/ReceptionAction.php:55
-msgid "Can be assigned to"
-msgstr "Kan toegewezen worden aan"
-
-#: classes/Gems/Default/ReceptionAction.php:56
-msgid "Additional action"
-msgstr "Aanvullende actie"
-
-#: classes/Gems/Default/ReceptionAction.php:80
-msgid "Code"
-msgstr "Code"
-
-#: classes/Gems/Default/ReceptionAction.php:83
-msgid "Is success code"
-msgstr "Is succes code"
-
-#: classes/Gems/Default/ReceptionAction.php:87
-msgid "This reception code is a success code."
-msgstr "Aanzetten als deze ontvangst code positief is."
-
-#: classes/Gems/Default/ReceptionAction.php:91
-msgid "Only active codes can be selected."
-msgstr "Alleen actieve codes kunnen geselecteerd worden."
-
-#: classes/Gems/Default/ReceptionAction.php:92
-msgid "For respondents"
-msgstr "Voor patiënten"
-
-#: classes/Gems/Default/ReceptionAction.php:95
-msgid "This reception code can be assigned to a respondent."
-msgstr "Deze ontvangstcode kan aan een patiënt toegewezen worden."
-
-#: classes/Gems/Default/ReceptionAction.php:96
-msgid "For tracks"
-msgstr "Voor trajecten"
-
-#: classes/Gems/Default/ReceptionAction.php:99
-msgid "This reception code can be assigned to a track."
-msgstr "Deze ontvangstcode kan aan een traject toegewezen worden."
-
-#: classes/Gems/Default/ReceptionAction.php:100
-msgid "For surveys"
-msgstr "Voor vragenlijsten"
-
-#: classes/Gems/Default/ReceptionAction.php:102
-msgid "This reception code can be assigned to a survey."
-msgstr "Deze ontvangstcode kan aan een vragenlijst toegewezen worden."
-
-#: classes/Gems/Default/ReceptionAction.php:103
-msgid "Redo survey"
-msgstr "Vragenlijsten herhalen"
-
-#: classes/Gems/Default/ReceptionAction.php:105
-msgid "Redo a survey on this reception code."
-msgstr "Herhaal vragenlijst bij deze ontvangstcode."
-
-#: classes/Gems/Default/ReceptionAction.php:106
-msgid "Overwrite ansers"
-msgstr "Overschrijf bestaande antwoorden"
-
-#: classes/Gems/Default/ReceptionAction.php:109
-msgid "Remove the consent from already answered surveys."
-msgstr "Verwijder \"informed consent\" van beantwoorde vragenlijsten"
-
-#: classes/Gems/Default/ReceptionAction.php:127
-msgid "reception code"
-msgid_plural "reception codes"
-msgstr[0] "Ontvangst code"
-msgstr[1] "Ontvangst code"
-
-#: classes/Gems/Default/RespondentAction.php:119
-#, php-format
-msgid "Random Example BSN: %s"
-msgstr "Willekeurig voorbeeld BSN: %s"
-
-#: classes/Gems/Default/RespondentAction.php:122
-msgid "Enter a 9-digit SSN number."
-msgstr "Voer een BSN nummer van 9 cijfers in."
-
-#: classes/Gems/Default/RespondentAction.php:127
-msgid "Identification"
-msgstr "Identificatie"
-
-#: classes/Gems/Default/RespondentAction.php:134
-msgid "SSN"
-msgstr "SSN"
-
-#: classes/Gems/Default/RespondentAction.php:138
-msgid "Patient number"
-msgstr "Patiënt nummer"
-
-#: classes/Gems/Default/RespondentAction.php:147
-msgid "Medical data"
-msgstr "Medische gegevens"
-
-#: classes/Gems/Default/RespondentAction.php:154
-msgid "DBC's, etc..."
-msgstr "DBC's, etc..."
-
-#: classes/Gems/Default/RespondentAction.php:157
-msgid "Contact information"
-msgstr "Contact informatie"
-
-#: classes/Gems/Default/RespondentAction.php:162
-msgid "Respondent has no e-mail"
-msgstr "Patiënt zonder e-mail"
-
-#: classes/Gems/Default/RespondentAction.php:163
-msgid "With housenumber"
-msgstr "Met huisnummer"
-
-#: classes/Gems/Default/RespondentAction.php:170
-msgid "Country"
-msgstr "Land"
-
-#: classes/Gems/Default/RespondentAction.php:174
-msgid "Settings"
-msgstr "Instellingen"
-
-#: classes/Gems/Default/RespondentAction.php:176
-msgid "Has the respondent signed the informed consent letter?"
-msgstr "Heeft de patiënt het \"informed consent\" formulier ondertekend?"
-
-#: classes/Gems/Default/RespondentAction.php:206
-msgid "Comments"
-msgstr "Opmerkingen"
-
-#: classes/Gems/Default/RespondentAction.php:207
-msgid "Treatment"
-msgstr "Behandeling"
-
-#: classes/Gems/Default/RespondentAction.php:235
-msgid "Rejection code"
-msgstr "Afkeuringscode"
-
-#: classes/Gems/Default/RespondentAction.php:242
-msgid "Delete respondent"
-msgstr "Verwijder patiënt"
-
-#: classes/Gems/Default/RespondentAction.php:274
-msgid "Respondent deleted."
-msgstr "Patiënt verwijderd"
-
-#: classes/Gems/Default/RespondentAction.php:278
-msgid "Respondent tracks stopped."
-msgstr "Trajecten van patiënt zijn gestopt."
-
-#: classes/Gems/Default/RespondentAction.php:282
-msgid "Choose a reception code to delete."
-msgstr "Kies een ontvangst code om te verwijderen."
-
-#: classes/Gems/Default/RespondentAction.php:326
-msgid "respondent"
-msgid_plural "respondents"
-msgstr[0] "patiënt"
-msgstr[1] "patiënten"
-
-#: classes/Gems/Default/RespondentAction.php:398
-msgid "Please settle the informed consent form for this respondent."
-msgstr "A.u.b. het informed consent formulier doornemen met deze patiënt"
-
-#: classes/Gems/Default/RespondentPlanAction.php:67
-msgid "Show respondent"
-msgstr "Toon patiënt"
-
-#: classes/Gems/Default/RespondentPlanAction.php:73
-msgid "Show track"
-msgstr "Toon traject"
-
-#: classes/Gems/Default/RespondentPlanAction.php:136
-msgid " of "
-msgstr " van "
-
-#: classes/Gems/Default/RespondentPlanAction.php:137
-msgid "Progress"
-msgstr "Voortgang"
-
-#: classes/Gems/Default/RespondentPlanAction.php:144
-msgid "Respondent planning"
-msgstr "Per patiënt plannen"
-
-#: classes/Gems/Default/RoleAction.php:175
-msgid "Illegal name"
-msgstr "Naam niet toegestaan"
-
-#: classes/Gems/Default/RoleAction.php:199
-#: classes/Gems/Default/RoleAction.php:258
-msgid "Parents"
-msgstr "Afgeleid van"
-
-#: classes/Gems/Default/RoleAction.php:214
-msgid "Editing `master` is not allowed"
-msgstr "Het wijzigen van `master` is niet toegestaan"
-
-#: classes/Gems/Default/RoleAction.php:232
-msgid "role"
-msgid_plural "roles"
-msgstr[0] "Rol"
-msgstr[1] "Rollen"
-
-#: classes/Gems/Default/RoleAction.php:237
-msgid "Administrative roles"
-msgstr "Beheer rollen en rechten"
-
-#: classes/Gems/Default/RoleAction.php:259
-#: classes/Gems/Default/RoleAction.php:275
-msgid "Allowed"
-msgstr "Toegestaan"
-
-#: classes/Gems/Default/RoleAction.php:260
-#: classes/Gems/Default/RoleAction.php:276
-msgid "Denied"
-msgstr "Geweigerd"
-
-#: classes/Gems/Default/RoleAction.php:264
-msgid "Project role overview"
-msgstr "Project rollen"
-
-#: classes/Gems/Default/RoleAction.php:274
-msgid "Privilege"
-msgstr "Privilége"
-
-#: classes/Gems/Default/RoleAction.php:280
-msgid "Project privileges"
-msgstr "Project priviléges"
-
-#: classes/Gems/Default/SourceAction.php:69
-msgid "Leave empty for the Gems database."
-msgstr "Leeglaten bij gebruik van de Gems database."
-
-#: classes/Gems/Default/SourceAction.php:79
-msgid "E.g. the name of the project - for single source projects."
-msgstr "Bijvoorbeeld de project naam - bij projecten met maar één bron."
-
-#: classes/Gems/Default/SourceAction.php:81
-msgid "For creating token-survey url."
-msgstr "Voor kenmerk-vragenlijst url."
-
-#: classes/Gems/Default/SourceAction.php:86
-msgid "The database server used by the source."
-msgstr "Het merk database server gebruikt door deze bron."
-
-#: classes/Gems/Default/SourceAction.php:88
-msgid "Do not forget the underscores."
-msgstr "Vergeet de underscores niet."
-
-#: classes/Gems/Default/SourceAction.php:91
-msgid "Database Username"
-msgstr "Database gebruikersnaam"
-
-#: classes/Gems/Default/SourceAction.php:93
-msgid "Database Password"
-msgstr "Database wachtwoord"
-
-#: classes/Gems/Default/SourceAction.php:116
-#, php-format
-msgid "Refreshing token attributes for %s source."
-msgstr "Kenmerk attributen verversing voor %s bron."
-
-#: classes/Gems/Default/SourceAction.php:132
-#, php-format
-msgid "Checking survey results for %s source."
-msgstr "Controle vragenlijstresultaten voor %s bron."
-
-#: classes/Gems/Default/SourceAction.php:144
-msgid "Checking survey results for all sources."
-msgstr "Controle vragenlijstresultaten voor alle bronnen."
-
-#: classes/Gems/Default/SourceAction.php:165
-msgid "Source Url"
-msgstr "Bron Url"
-
-#: classes/Gems/Default/SourceAction.php:167
-msgid "Adaptor class"
-msgstr "Adaptor klasse"
-
-#: classes/Gems/Default/SourceAction.php:169
-msgid "Database Server"
-msgstr "Database Server"
-
-#: classes/Gems/Default/SourceAction.php:171
-msgid "Database host"
-msgstr "Database machine"
-
-#: classes/Gems/Default/SourceAction.php:173
-msgid "Charset"
-msgstr "Tekenset"
-
-#: classes/Gems/Default/SourceAction.php:176
-msgid "Table prefix"
-msgstr "Voorvoegsel tabel"
-
-#: classes/Gems/Default/SourceAction.php:180
-msgid "Last check"
-msgstr "Laatste controle"
-
-#: classes/Gems/Default/SourceAction.php:213
-msgid "source"
-msgid_plural "sources"
-msgstr[0] "bron"
-msgstr[1] "bronnen"
-
-#: classes/Gems/Default/SourceAction.php:218
-msgid "Survey Sources"
-msgstr "Bronnen"
-
-#: classes/Gems/Default/SourceAction.php:226
-msgid "This installation is active."
-msgstr "Deze installatie is actief"
-
-#: classes/Gems/Default/SourceAction.php:228
-msgid "Inactive installation."
-msgstr "Deze installatie is inactief"
-
-#: classes/Gems/Default/SourceAction.php:243
-#, php-format
-msgid "Synchronize the %s source."
-msgstr "Synchroniseer de %s bron"
-
-#: classes/Gems/Default/SourceAction.php:256
-msgid "Synchronize all sources."
-msgstr "Synchroniseer alle bronnen."
-
-#: classes/Gems/Default/StaffAction.php:125
-msgid "Unsupported User Definition"
-msgstr "Onbekende User Definition"
-
-#: classes/Gems/Default/StaffAction.php:154
-msgid "Users can only login when this box is checked."
-msgstr "Gebruikers kunnen alleen inloggen als dit is aangevinkt."
-
-#: classes/Gems/Default/StaffAction.php:155
-msgid "If checked the user will logoff when answering a survey."
-msgstr "Indien actief, dan logt de gebruiker uit voor het beantwoorden van een vragenlijst."
-
-#: classes/Gems/Default/StaffAction.php:172
-msgid "You are not allowed to edit this staff member."
-msgstr "U mag deze medewerker niet wijzigen."
-
-#: classes/Gems/Default/StaffAction.php:229
-#, php-format
-msgid "User with id %s already exists but is deleted, do you want to reactivate the account?"
-msgstr "Gebruiker met inlognaam %s bestaat al maar is verwijderd, wilt u het account opnieuw activeren?"
-
-#: classes/Gems/Default/StaffAction.php:285
-msgid "Primary function"
-msgstr "Primaire functie"
-
-#: classes/Gems/Default/StaffAction.php:295
-msgid "Can login"
-msgstr "Kan inloggen"
-
-#: classes/Gems/Default/StaffAction.php:296
-msgid "Logout on survey"
-msgstr "Logout bij beantwoor...
[truncated message content] |
|
From: <gem...@li...> - 2012-03-29 11:44:23
|
Revision: 575
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=575&view=rev
Author: matijsdejong
Date: 2012-03-29 11:44:15 +0000 (Thu, 29 Mar 2012)
Log Message:
-----------
New methods for mailings
UserLoader should no longer fold during transition to 1.5.3
New MUtil_Ra::braceKeys
A lot of docblocks
Modified Paths:
--------------
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/Email/TemplateMailer.php
trunk/library/classes/Gems/Menu/MenuList.php
trunk/library/classes/Gems/Project/ProjectSettings.php
trunk/library/classes/Gems/User/Organization.php
trunk/library/classes/Gems/User/User.php
trunk/library/classes/Gems/User/UserLoader.php
trunk/library/classes/Gems/Util/Translated.php
trunk/library/classes/MUtil/Mail.php
trunk/library/classes/MUtil/Ra.php
Added Paths:
-----------
trunk/library/classes/Gems/Mail.php
Modified: trunk/library/classes/Gems/Default/IndexAction.php
===================================================================
--- trunk/library/classes/Gems/Default/IndexAction.php 2012-03-29 10:01:28 UTC (rev 574)
+++ trunk/library/classes/Gems/Default/IndexAction.php 2012-03-29 11:44:15 UTC (rev 575)
@@ -93,21 +93,6 @@
protected $showTokenButton = true;
/**
- * Returns a link for the token input page.
- *
- * @return MUtil_Form_Element_Html
- */
- protected function _getAskTokenLinkElement()
- {
- // Veld token
- $element = new MUtil_Form_Element_Html('askToken');
- $element->br();
- $element->actionLink(array('controller' => 'ask', 'action' => 'token'), $this->_('Enter your token...'));
-
- return $element;
- }
-
- /**
* Returns a basic form for this action.
*
* @param $description Optional description, %s is filled with project name.
@@ -161,21 +146,6 @@
Gems_Html::init();
return $this->loader->getUserLoader()->getLoginForm($args);
- /*
- $form = $this->_getBasicForm();
- $form->addElement($this->_getOrganizationElement());
- $form->addElement($this->_getUserLoginElement());
- $form->addElement($this->_getPasswordElement());
- $form->addElement($this->_getSubmitButton($this->_('Login')));
-
- if (null === $showToken ? $this->showTokenButton : $showToken) {
- $form->addElement($this->_getAskTokenLinkElement());
- }
- if (null === $showPasswordLost ? $this->showPasswordLostButton : $showPasswordLost) {
- $form->addElement($this->_getResetLinkElement());
- }
-
- return $form; // */
}
/**
@@ -233,23 +203,6 @@
}
/**
- * Returns a password element.
- *
- * @return Zend_Form_Element_Password
- */
- protected function _getPasswordElement()
- {
- // Veld password
- $element = new Zend_Form_Element_Password('password');
- $element->setLabel($this->_('Password'));
- $element->setAttrib('size', 10);
- $element->setAttrib('maxlength', 20);
- $element->setRequired(true);
-
- return $element;
- }
-
- /**
* Gets a reset password form.
*
* @return Gems_Form
@@ -325,13 +278,13 @@
public function loginAction()
{
$request = $this->getRequest();
+ $form = $this->_getLoginForm();
- $form = $this->_getLoginForm();
-
if ($request->isPost()) {
if ($form->isValid($request->getPost(), false)) {
$user = $form->getUser();
+ // Retrieve these before the session is reset
$previousRequestParameters = $this->session->previousRequestParameters;
$user->setAsCurrentUser();
@@ -422,37 +375,15 @@
$this->addMessage($this->_('This key timed out or does not belong to this user.'));
}
} else {
- // Pass mail by key
- $mail = new MUtil_Mail();
- $mail->addTo($user->getEmailAddress(), $user->getFullName());
+ $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}");
- if (isset($this->escort->project->email['site'])) {
- $mail->setFrom($this->escort->project->email['site']);
- } elseif ($from = $user->getCurrentOrganization()->getEmail()) {
- $mail->setFrom($from);
- } elseif ($from = $user->getBaseOrganization()->getEmail()) {
- $mail->setFrom($from);
+ $messages = $user->sendMail($subjectTemplate, $bbBodyTemplate, true);
+ if (! $messages) {
+ // Everything went OK!
+ $messages = $this->_('We sent you an e-mail with a reset link. Click on the link in the e-mail.');
}
- if (isset($this->escort->project->email) && isset($this->escort->project->email['bcc'])) {
- $mail->addBcc($this->escort->project->email['bcc']);
- }
-
-
- $key = $user->getPasswordResetKey();
-
- $url = $this->util->getCurrentURI('index/resetpassword/key/' . $key);
-
- $mail->setSubject($this->_('Password reset requested'));
- $mail->setBodyText(sprintf($this->_('To reset your password for %s, please click this link: %s'), GEMS_PROJECT_NAME_UC, $url));
-
-
- try {
- $mail->send();
- $this->addMessage($this->_('We sent you an e-mail with a reset link. Click on the link in the e-mail.'));
- } catch (Exception $e) {
- $this->addMessage($this->_('Unable to send e-mail.'));
- throw $e;
- }
+ $this->addMessage($messages);
}
} else {
$this->addMessage($this->_('No such user found or no e-mail address known or user cannot be reset.'));
Modified: trunk/library/classes/Gems/Email/TemplateMailer.php
===================================================================
--- trunk/library/classes/Gems/Email/TemplateMailer.php 2012-03-29 10:01:28 UTC (rev 574)
+++ trunk/library/classes/Gems/Email/TemplateMailer.php 2012-03-29 11:44:15 UTC (rev 575)
@@ -117,7 +117,7 @@
*/
public function bounceCheck()
{
- return isset($this->escort->project->email['bounce']) && $this->escort->project->email['bounce'];
+ return $this->escort->project->getEmailBounce();
}
/**
@@ -338,11 +338,9 @@
$this->setTokenData($tokenData);
- $style = isset($tokenData['gor_style']) ? $tokenData['gor_style'] : GEMS_PROJECT_NAME;
+ $mail = new Gems_Mail();
+ $mail->setTemplateStyle($tokenData['gor_style']);
- $mail = new MUtil_Mail();
- $mail->setHtmlTemplateFile(APPLICATION_PATH . '/configs/email/' . $style . '.html');
-
$mail->setFrom($from, $from_name);
$mail->addTo($to, $to_name);
if (isset($this->escort->project->email['bcc'])) {
Added: trunk/library/classes/Gems/Mail.php
===================================================================
--- trunk/library/classes/Gems/Mail.php (rev 0)
+++ trunk/library/classes/Gems/Mail.php 2012-03-29 11:44:15 UTC (rev 575)
@@ -0,0 +1,100 @@
+<?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 Mail
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @version $id: Mail.php 203 2012-01-01t 12:51:32Z matijs $
+ */
+
+/**
+ *
+ *
+ * @package Gems
+ * @subpackage Mail
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5.3
+ */
+class Gems_Mail extends MUtil_Mail
+{
+ /**
+ * Adds To-header and recipient, $email can be an array, or a single string address
+ *
+ * @param string|array $email
+ * @param string $name
+ * @param boolean $bounce When true the e-mail is bounced to the from address
+ * @return Zend_Mail Provides fluent interface
+ */
+ public function addTo($email, $name = '', $bounce = false)
+ {
+ if ($bounce) {
+ $name = str_replace('@', ' at ', $email);
+ $email = $this->getFrom();
+
+ if (! $email) {
+ throw new Gems_Exception_Coding('Adding bounce To address while From is not set.');
+ }
+ }
+
+ return parent::addTo($email, $name);
+ }
+
+ /**
+ * Returns the the current template
+ *
+ * @return string
+ */
+ public function getHtmlTemplate()
+ {
+ if (! $this->_htmlTemplate) {
+ $this->setTemplateStyle();
+ }
+
+ return parent::getHtmlTemplate();
+ }
+
+ /**
+ * Set the template using style as basis
+ *
+ * @param string $style
+ * @return MUtil_Mail (continuation pattern)
+ */
+ public function setTemplateStyle($style = null)
+ {
+ if (null == $style) {
+ $style = GEMS_PROJECT_NAME;
+ }
+ $this->setHtmlTemplateFile(APPLICATION_PATH . '/configs/email/' . $style . '.html');
+
+ return $this;
+ }
+}
Modified: trunk/library/classes/Gems/Menu/MenuList.php
===================================================================
--- trunk/library/classes/Gems/Menu/MenuList.php 2012-03-29 10:01:28 UTC (rev 574)
+++ trunk/library/classes/Gems/Menu/MenuList.php 2012-03-29 11:44:15 UTC (rev 575)
@@ -363,6 +363,6 @@
}
// Call the toActionLink(Lower) function with the sources given.
- return call_user_func_array(array($this->offsetGet($key), $this->linkFunction), $sources);
+ return call_user_func_array(array($this->offsetGet($key), $this->linkFunction), $sources);
}
}
Modified: trunk/library/classes/Gems/Project/ProjectSettings.php
===================================================================
--- trunk/library/classes/Gems/Project/ProjectSettings.php 2012-03-29 10:01:28 UTC (rev 574)
+++ trunk/library/classes/Gems/Project/ProjectSettings.php 2012-03-29 11:44:15 UTC (rev 575)
@@ -230,6 +230,55 @@
/**
+ * Returns the public description of this project.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ if ($this->offsetExists('description')) {
+ return $this->offsetGet('description');
+ } else {
+ return $this->offsetGet('name');
+ }
+ }
+
+ /**
+ * The the email BCC address - if any
+ *
+ * @return string
+ */
+ public function getEmailBcc()
+ {
+ if ($this->offsetExists('email') && isset($this->email['bcc'])) {
+ return trim($this->email['bcc']);
+ }
+ }
+
+ /**
+ * Should all mail be bounced to the sender?
+ *
+ * @return boolean
+ */
+ public function getEmailBounce()
+ {
+ if ($this->offsetExists('email') && isset($this->email['bounce'])) {
+ return (boolean) $this->email['bounce'];
+ }
+ return false;
+ }
+
+ /**
+ * Returns the from address
+ *
+ * @return string E-Mail address
+ */
+ public function getFrom()
+ {
+ return $this->getSiteEmail();
+ }
+
+ /**
* Returns the initial password specified for users - if any.
*
* @return String
@@ -244,7 +293,23 @@
}
/**
+ * Array of field name => values for sending E-Mail
+ *
+ * @return array
+ */
+ public function getMailFields()
+ {
+ $result['project'] = $this->getName();
+ $result['project_bcc'] = $this->getEmailBcc();
+ $result['project_description'] = $this->getDescription();
+ $result['project_from'] = $this->getFrom();
+
+ return $result;
+ }
+
+ /**
* Returns the public name of this project.
+ *
* @return string
*/
public function getName()
@@ -287,6 +352,18 @@
}
/**
+ * The site email address - if any
+ *
+ * @return string
+ */
+ public function getSiteEmail()
+ {
+ if ($this->offsetExists('email') && isset($this->email['site'])) {
+ return trim($this->email['site']);
+ }
+ }
+
+ /**
* Returns the super admin name, if any
*
* @return string
Modified: trunk/library/classes/Gems/User/Organization.php
===================================================================
--- trunk/library/classes/Gems/User/Organization.php 2012-03-29 10:01:28 UTC (rev 574)
+++ trunk/library/classes/Gems/User/Organization.php 2012-03-29 11:44:15 UTC (rev 575)
@@ -164,6 +164,16 @@
}
/**
+ * Returns the from address
+ *
+ * @return string E-Mail address
+ */
+ public function getFrom()
+ {
+ return $this->getEmail();
+ }
+
+ /**
* Get the organization id.
*
* @return int
@@ -174,6 +184,24 @@
}
/**
+ * Array of field name => values for sending E-Mail
+ *
+ * @return array
+ */
+ public function getMailFields()
+ {
+ $result['organization'] = $this->getName();
+ $result['organization_location'] = $this->_get('gor_location');
+ $result['organization_reply_name'] = $this->_get('gor_contact_name');
+ $result['organization_reply_to'] = $this->_get('gor_contact_email');
+ $result['organization_signature'] = $this->getSignature();
+ $result['organization_url'] = $this->_get('gor_url');
+ $result['organization_welcome'] = $this->getWelcome();
+
+ return $result;
+ }
+
+ /**
* Get the name of the organization.
*
* @return string
@@ -204,6 +232,16 @@
}
/**
+ * Has org an email attribute?
+ *
+ * @return boolean
+ */
+ public function hasEmail()
+ {
+ return $this->_has('gor_contact_email');
+ }
+
+ /**
* Load the data when the cache is empty.
*
* @param mixed $id
Modified: trunk/library/classes/Gems/User/User.php
===================================================================
--- trunk/library/classes/Gems/User/User.php 2012-03-29 10:01:28 UTC (rev 574)
+++ trunk/library/classes/Gems/User/User.php 2012-03-29 11:44:15 UTC (rev 575)
@@ -102,6 +102,12 @@
/**
*
+ * @var Gems_Project_ProjectSettings
+ */
+ protected $project;
+
+ /**
+ *
* @var Zend_Controller_Request_Abstract
*/
protected $request;
@@ -611,6 +617,30 @@
}
/**
+ * Returns the from address
+ *
+ * @return string E-Mail address
+ */
+ public function getFrom()
+ {
+ // Gather possible sources of a from address
+ $sources[] = $this->getBaseOrganization();
+ if ($this->getBaseOrganizationId() != $this->getCurrentOrganizationId()) {
+ $sources[] = $this->getCurrentOrganization();
+ }
+ $sources[] = $this->project;
+
+ foreach ($sources as $source) {
+ if ($from = $source->getFrom()) {
+ return $from;
+ }
+ }
+
+ // We really don't like it, but sometimes the only way to get a from address.
+ return $this->getEmailAddress();
+ }
+
+ /**
* Returns the full user name (first, prefix, last).
*
* @return string
@@ -637,29 +667,59 @@
}
/**
+ * Returns the gender for use as part of a sentence, e.g. Dear Mr/Mrs
+ *
+ * In practice: starts lowercase
+ *
+ * @param string $locale
+ * @return array gender => string
+ */
+ protected function getGenderGreeting($locale = null)
+ {
+ $greetings = $this->util->getTranslated()->getGenderGreeting($locale);
+
+ if (isset($greetings[$this->_getVar('user_gender')])) {
+ return $greetings[$this->_getVar('user_gender')];
+ }
+ }
+
+ /**
+ * Returns the gender for use in stand-alone name display
+ *
+ * In practice: starts uppercase
+ *
+ * @param string $locale
+ * @return array gender => string
+ */
+ protected function getGenderHello($locale = null)
+ {
+ $greetings = $this->util->getTranslated()->getGenderHello($locale);
+
+ if (isset($greetings[$this->_getVar('user_gender')])) {
+ return $greetings[$this->_getVar('user_gender')];
+ }
+ }
+
+ /**
* Returns a standard greeting for the current user.
*
+ * @param string $locale
* @return int
*/
- public function getGreeting()
+ public function getGreeting($locale = null)
{
if (! $this->_getVar('user_greeting')) {
- $greeting = array();
- $greetings = $this->util->getTranslated()->getGenderGreeting();
+ $greeting[] = $this->getGenderGreeting($locale);
- if (isset($greetings[$this->_getVar('user_gender')])) {
- $greeting[] = $greetings[$this->_getVar('user_gender')];
- }
if ($this->_getVar('user_last_name')) {
- if ($this->_getVar('user_surname_prefix')) {
- $greeting[] = $this->_getVar('user_surname_prefix');
- }
+ $greeting[] = $this->_getVar('user_surname_prefix');
$greeting[] = $this->_getVar('user_last_name');
} else {
$name = $this->getLoginName();
$name = substr($name, 0, 3) . str_repeat('*', strlen($name) - 2);
$greeting[] = $name;
}
+ array_filter($greeting);
$this->_setVar('user_greeting', implode(' ', $greeting));
}
@@ -698,6 +758,36 @@
}
/**
+ * Array of field name => values for sending E-Mail
+ *
+ * @param string $locale
+ * @return array
+ */
+ public function getMailFields($locale = null)
+ {
+ $orgResults = $this->getBaseOrganization()->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'] = $this->util->getCurrentURI();
+ $result['name'] = $this->getFullName();
+
+ $result = $result + $orgResults + $projResults;
+
+ $result['reset_ask'] = $this->util->getCurrentURI('index/resetpassword');
+ $result['reply_to'] = $result['from'];
+ $result['to'] = $result['email'];
+
+ return $result;
+ }
+
+ /**
* Return a password reset key
*
* @return string
@@ -721,6 +811,20 @@
}
/**
+ * Array of field name => values for sending a reset password E-Mail
+ *
+ * @param string $locale
+ * @return array
+ */
+ public function getResetPasswordMailFields($locale = null)
+ {
+ $result['reset_key'] = $this->getPasswordResetKey();
+ $result['reset_url'] = $this->util->getCurrentURI('index/resetpassword/key/' . $result['reset_key']);
+
+ return $result + $this->getMailFields($locale);
+ }
+
+ /**
* Returns the current user role.
*
* @return string
@@ -942,7 +1046,51 @@
}
/**
+ * Send an e-mail to this user
*
+ * @param string $subjectTemplate A subject template in which {fields} are replaced
+ * @param string $bbBodyTemplate A BB Code body template in which {fields} are replaced
+ * @param boolean $useResetFields When true get a reset key for this user
+ * @param string $locale Optional locale
+ * @return mixed String or array of warnings when something went wrong
+ */
+ 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.');
+ }
+
+ $mail = new Gems_Mail();
+ $mail->setTemplateStyle($this->getBaseOrganization()->getStyle());
+ $mail->setFrom($this->getFrom());
+ $mail->addTo($this->getEmailAddress(), $this->getFullName(), $this->project->getEmailBounce());
+ if ($bcc = $this->project->getEmailBcc()) {
+ $mail->addBcc($bcc);
+ }
+
+ if ($useResetFields) {
+ $fields = $this->getResetPasswordMailFields($locale);
+ } else {
+ $fields = $this->getMailFields($locale);
+ }
+ $fields = MUtil_Ra::braceKeys($fields, '{', '}');
+
+ $mail->setSubject(strtr($subjectTemplate, $fields));
+ $mail->setBodyBBCode(strtr($bbBodyTemplate, $fields));
+
+ try {
+ $mail->send();
+ return null;
+
+ } catch (Exception $e) {
+ return array(
+ $this->_('Unable to send e-mail.'),
+ $e->getMessage());
+ }
+ }
+
+ /**
+ *
* @param string $defName Optional
* @return Gems_User_User (continuation pattern)
*/
Modified: trunk/library/classes/Gems/User/UserLoader.php
===================================================================
--- trunk/library/classes/Gems/User/UserLoader.php 2012-03-29 10:01:28 UTC (rev 574)
+++ trunk/library/classes/Gems/User/UserLoader.php 2012-03-29 11:44:15 UTC (rev 575)
@@ -263,7 +263,13 @@
if (! self::$currentUser) {
if ($this->session->__isset('__user_definition')) {
$defName = $this->session->__get('__user_definition');
- self::$currentUser = $this->_loadClass('User', true, array($this->session, $this->_getClass($defName . 'Definition')));
+
+ // Check for during upgrade. Remove for version 1.6
+ if (substr($defName, -10, 10) != 'Definition') {
+ $defName .= 'Definition';
+ }
+
+ self::$currentUser = $this->_loadClass('User', true, array($this->session, $this->_getClass($defName)));
} else {
self::$currentUser = $this->getUser(null, null);
self::$currentUser->setAsCurrentUser();
@@ -503,7 +509,7 @@
// MUtil_Echo::track($defName, $login_name, $userOrganization, $values);
$values = $this->ensureDefaultUserValues($values, $definition, $defName);
- MUtil_Echo::track($values, $userName, $userOrganization, $defName);
+ // MUtil_Echo::track($values, $userName, $userOrganization, $defName);
return $this->_loadClass('User', true, array($values, $definition));
}
Modified: trunk/library/classes/Gems/Util/Translated.php
===================================================================
--- trunk/library/classes/Gems/Util/Translated.php 2012-03-29 10:01:28 UTC (rev 574)
+++ trunk/library/classes/Gems/Util/Translated.php 2012-03-29 11:44:15 UTC (rev 575)
@@ -193,16 +193,38 @@
return self::$emptyDropdownArray;
}
+ /**
+ * Returns the functional description of a gender for use in e.g. interface elements
+ *
+ * @param string $locale
+ * @return array gender => string
+ */
public function getGenders($locale = null)
{
return array('M' => $this->_('Male', $locale), 'F' => $this->_('Female', $locale), 'U' => $this->_('Unknown', $locale));
}
+ /**
+ * Returns the gender for use as part of a sentence, e.g. Dear Mr/Mrs
+ *
+ * In practice: starts lowercase
+ *
+ * @param string $locale
+ * @return array gender => string
+ */
public function getGenderGreeting($locale = null)
{
return array('M' => $this->_('mr.', $locale), 'F' => $this->_('mrs.', $locale), 'U' => $this->_('mr./mrs.', $locale));
}
+ /**
+ * Returns the gender for use in stand-alone name display
+ *
+ * In practice: starts uppercase
+ *
+ * @param string $locale
+ * @return array gender => string
+ */
public function getGenderHello($locale = null)
{
return array('M' => $this->_('Mr.', $locale), 'F' => $this->_('Mrs.', $locale), 'U' => $this->_('Mr./Mrs.', $locale));
Modified: trunk/library/classes/MUtil/Mail.php
===================================================================
--- trunk/library/classes/MUtil/Mail.php 2012-03-29 10:01:28 UTC (rev 574)
+++ trunk/library/classes/MUtil/Mail.php 2012-03-29 11:44:15 UTC (rev 575)
@@ -1,39 +1,64 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
+
/**
- * @package MUtil
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package MUtil
+ * @subpackage Mail
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @version $id: Mail.php 203 2012-01-01t 12:51:32Z matijs $
*/
+
+/**
+ * Extends standard Zend_Mail with functions for using HTML templates for all mails
+ * and adding content using BB Code text.
+ *
+ * @package MUtil
+ * @subpackage Mail
+ * @copyright Copyright (c) 2012 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.1
+ */
class MUtil_Mail extends Zend_Mail
{
- private $_htmlTemplate;
+ /**
+ * HTML Template for html part of the message
+ *
+ * @var string
+ */
+ protected $_htmlTemplate;
+ /**
+ * Returns the the current template
+ *
+ * @return string
+ */
public function getHtmlTemplate()
{
if (! $this->_htmlTemplate) {
@@ -43,6 +68,12 @@
return $this->_htmlTemplate;
}
+ /**
+ * Set both the Html and Text versions of a message
+ *
+ * @param string $content
+ * @return MUtil_Mail (continuation pattern)
+ */
public function setBodyBBCode($content)
{
$this->setBodyHtml(MUtil_Markup::render($content, 'Bbcode', 'Html'));
@@ -52,12 +83,12 @@
}
/**
- * Sets the HTML body for the message
+ * Sets the HTML body for the message, using a template for html if it exists/
*
* @param string $html
* @param string $charset
* @param string $encoding
- * @return Zend_Mail Provides fluent interface
+ * @return MUtil_Mail (continuation pattern)
*/
public function setBodyHtml($html, $charset = null, $encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE)
{
@@ -68,12 +99,24 @@
return parent::setBodyHtml($html, $charset, $encoding);
}
+ /**
+ * Set's a html template in which the message content is placed.
+ *
+ * @param string $template
+ * @return MUtil_Mail MUtil_Mail (continuation pattern)
+ */
public function setHtmlTemplate($template)
{
$this->_htmlTemplate = $template;
return $this;
}
+ /**
+ * Set the basic html template with the content of a filename
+ *
+ * @param string $filename
+ * @return MUtil_Mail (continuation pattern)
+ */
public function setHtmlTemplateFile($filename)
{
if (file_exists($filename)) {
Modified: trunk/library/classes/MUtil/Ra.php
===================================================================
--- trunk/library/classes/MUtil/Ra.php 2012-03-29 10:01:28 UTC (rev 574)
+++ trunk/library/classes/MUtil/Ra.php 2012-03-29 11:44:15 UTC (rev 575)
@@ -267,7 +267,8 @@
// 1: Not yet set && 2: lax types used
if ((! isset($args[$name])) &&
- ($laxTypes || (null === $ntype))) {
+ ($laxTypes || (null === $ntype)) &&
+ isset($args[$current])) {
$args[$name] = $args[$current];
unset($args[$current]);
@@ -345,6 +346,28 @@
}
/**
+ * Put braces around the array keys.
+ *
+ * @param array $input
+ * @param string $left Brace string, e.g. '%', '{', '[', '"'
+ * @param string $right Optional, when emptu same as left.
+ * @return array Array with the same values but braces around the keys
+ */
+ public static function braceKeys(array $input, $left, $right = null)
+ {
+ if (null === $right) {
+ $right = $left;
+ }
+ $results = array();
+
+ foreach ($input as $key => $value) {
+ $results[$left . $key . $right] = $value;
+ }
+
+ return $results;
+ }
+
+ /**
* Extracts a column from a nested array of values, maintaining index association.
*
* The default RELAXED mode will return only values where these exist and are not null.
@@ -442,7 +465,7 @@
return true;
}
-
+
return is_scalar($value);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-29 10:01:35
|
Revision: 574
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=574&view=rev
Author: michieltcs
Date: 2012-03-29 10:01:28 +0000 (Thu, 29 Mar 2012)
Log Message:
-----------
Show active/inactive status, reformat
Modified Paths:
--------------
trunk/library/classes/Gems/Util/TrackData.php
Modified: trunk/library/classes/Gems/Util/TrackData.php
===================================================================
--- trunk/library/classes/Gems/Util/TrackData.php 2012-03-29 09:42:13 UTC (rev 573)
+++ trunk/library/classes/Gems/Util/TrackData.php 2012-03-29 10:01:28 UTC (rev 574)
@@ -124,7 +124,14 @@
static $surveys;
if (! $surveys) {
- $surveys = $this->db->fetchPairs('SELECT gsu_id_survey, LEFT(CONCAT_WS(" - ", gsu_survey_name, gsu_survey_description),50) FROM gems__surveys ORDER BY gsu_survey_name');
+ $surveys = $this->db->fetchPairs('SELECT gsu_id_survey,
+ CONCAT(
+ LEFT(CONCAT_WS(
+ " - ", gsu_survey_name, CASE WHEN LENGTH(TRIM(gsu_survey_description)) = 0 THEN NULL ELSE gsu_survey_description END
+ ), 50),
+ CASE WHEN gsu_active = 1 THEN " (' . $this->translate->_('Active') . ')" ELSE " (' . $this->translate->_('Inactive') . ')" END
+ )
+ FROM gems__surveys ORDER BY gsu_survey_name');
}
return $surveys;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-29 09:42:23
|
Revision: 573
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=573&view=rev
Author: michieltcs
Date: 2012-03-29 09:42:13 +0000 (Thu, 29 Mar 2012)
Log Message:
-----------
Revert r571 and r572 (going another route)
Revision Links:
--------------
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=571&view=rev
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=572&view=rev
Modified Paths:
--------------
trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php
trunk/library/classes/Gems/Tracker/Snippets/EditRoundSnippetAbstract.php
trunk/library/classes/Gems/Util/TrackData.php
Modified: trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2012-03-28 19:45:36 UTC (rev 572)
+++ trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2012-03-29 09:42:13 UTC (rev 573)
@@ -733,7 +733,7 @@
$model->set('gro_id_track', 'label', $this->_('Track'), 'elementClass', 'exhibitor', 'multiOptions', MUtil_Lazy::call($this->util->getTrackData()->getAllTracks));
}
- $model->set('gro_id_survey', 'label', $this->_('Survey'), 'multiOptions', $this->util->getTrackData()->getActiveSurveysAndDescriptions());
+ $model->set('gro_id_survey', 'label', $this->_('Survey'), 'multiOptions', $this->util->getTrackData()->getAllSurveysAndDescriptions());
$model->set('gro_icon_file', 'label', $this->_('Icon'));
$model->set('gro_id_order', 'label', $this->_('Order'), 'default', 10, 'validators[]', $model->createUniqueValidator(array('gro_id_order', 'gro_id_track')));
$model->set('gro_round_description', 'label', $this->_('Description'), 'size', '30'); //, 'minlength', 4, 'required', true);
Modified: trunk/library/classes/Gems/Tracker/Snippets/EditRoundSnippetAbstract.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Snippets/EditRoundSnippetAbstract.php 2012-03-28 19:45:36 UTC (rev 572)
+++ trunk/library/classes/Gems/Tracker/Snippets/EditRoundSnippetAbstract.php 2012-03-29 09:42:13 UTC (rev 573)
@@ -182,7 +182,7 @@
}
// Check the survey name
- $surveys = $this->util->getTrackData()->getActiveSurveys();
+ $surveys = $this->util->getTrackData()->getAllSurveys();
if (isset($surveys[$this->formData['gro_id_survey']])) {
$this->formData['gro_survey_name'] = $surveys[$this->formData['gro_id_survey']];
} else {
Modified: trunk/library/classes/Gems/Util/TrackData.php
===================================================================
--- trunk/library/classes/Gems/Util/TrackData.php 2012-03-28 19:45:36 UTC (rev 572)
+++ trunk/library/classes/Gems/Util/TrackData.php 2012-03-29 09:42:13 UTC (rev 573)
@@ -82,42 +82,20 @@
return $dates;
} // */
- /**
- * Retrieve an array of key/value pairs for gsu_id_survey and gsu_survey_name
- * only the active surveys
- *
- * @staticvar array $activeSurveys
- * @return array
- */
+ /*
public function getActiveSurveys()
{
- static $activeSurveys;
+ static $surveys;
- if (! $activeSurveys) {
- $activeSurveys = $this->db->fetchPairs('SELECT gsu_id_survey, gsu_survey_name FROM gems__surveys WHERE gsu_active = 1 AND gsu_surveyor_active = 1 ORDER BY gsu_survey_name');
+ if (! $surveys) {
+ $surveys = $this->util->getTranslated()->getEmptyDropdownArray();
+ $surveys = $surveys + $this->db->fetchPairs('SELECT gsu_id_survey, gsu_survey_name FROM gems__surveys WHERE gsu_active = 1 AND gsu_surveyor_active = 1 ORDER BY gsu_survey_name');
}
- return $activeSurveys;
- }
+ return $surveys;
+ } // */
- /**
- * Retrieve an array of key/value pairs for gsu_id_survey and gsu_survey_name
- * only the active surveys
- *
- * @staticvar array $activeSurveys
- * @return array
- */
- public function getActiveSurveysAndDescriptions()
- {
- static $activeSurveys;
- if (! $activeSurveys) {
- $activeSurveys = $this->db->fetchPairs('SELECT gsu_id_survey, LEFT(CONCAT_WS(" - ", gsu_survey_name, gsu_survey_description),50) FROM gems__surveys WHERE gsu_active = 1 AND gsu_surveyor_active = 1 ORDER BY gsu_survey_name');
- }
-
- return $activeSurveys;
- }
-
/**
* Retrieve an array of key/value pairs for gsu_id_survey and gsu_survey_name
*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-28 19:45:47
|
Revision: 572
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=572&view=rev
Author: michieltcs
Date: 2012-03-28 19:45:36 +0000 (Wed, 28 Mar 2012)
Log Message:
-----------
Also add getActiveSurveysAndDescriptions()
Modified Paths:
--------------
trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php
trunk/library/classes/Gems/Util/TrackData.php
Modified: trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2012-03-28 19:38:24 UTC (rev 571)
+++ trunk/library/classes/Gems/Tracker/Engine/TrackEngineAbstract.php 2012-03-28 19:45:36 UTC (rev 572)
@@ -733,7 +733,7 @@
$model->set('gro_id_track', 'label', $this->_('Track'), 'elementClass', 'exhibitor', 'multiOptions', MUtil_Lazy::call($this->util->getTrackData()->getAllTracks));
}
- $model->set('gro_id_survey', 'label', $this->_('Survey'), 'multiOptions', $this->util->getTrackData()->getAllSurveysAndDescriptions());
+ $model->set('gro_id_survey', 'label', $this->_('Survey'), 'multiOptions', $this->util->getTrackData()->getActiveSurveysAndDescriptions());
$model->set('gro_icon_file', 'label', $this->_('Icon'));
$model->set('gro_id_order', 'label', $this->_('Order'), 'default', 10, 'validators[]', $model->createUniqueValidator(array('gro_id_order', 'gro_id_track')));
$model->set('gro_round_description', 'label', $this->_('Description'), 'size', '30'); //, 'minlength', 4, 'required', true);
Modified: trunk/library/classes/Gems/Util/TrackData.php
===================================================================
--- trunk/library/classes/Gems/Util/TrackData.php 2012-03-28 19:38:24 UTC (rev 571)
+++ trunk/library/classes/Gems/Util/TrackData.php 2012-03-28 19:45:36 UTC (rev 572)
@@ -102,7 +102,25 @@
/**
* Retrieve an array of key/value pairs for gsu_id_survey and gsu_survey_name
+ * only the active surveys
*
+ * @staticvar array $activeSurveys
+ * @return array
+ */
+ public function getActiveSurveysAndDescriptions()
+ {
+ static $activeSurveys;
+
+ if (! $activeSurveys) {
+ $activeSurveys = $this->db->fetchPairs('SELECT gsu_id_survey, LEFT(CONCAT_WS(" - ", gsu_survey_name, gsu_survey_description),50) FROM gems__surveys WHERE gsu_active = 1 AND gsu_surveyor_active = 1 ORDER BY gsu_survey_name');
+ }
+
+ return $activeSurveys;
+ }
+
+ /**
+ * Retrieve an array of key/value pairs for gsu_id_survey and gsu_survey_name
+ *
* @staticvar array $surveys
* @return array
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-28 19:38:30
|
Revision: 571
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=571&view=rev
Author: michieltcs
Date: 2012-03-28 19:38:24 +0000 (Wed, 28 Mar 2012)
Log Message:
-----------
Uncomment/fix/use getActiveSurveys()
Modified Paths:
--------------
trunk/library/classes/Gems/Tracker/Snippets/EditRoundSnippetAbstract.php
trunk/library/classes/Gems/Util/TrackData.php
Modified: trunk/library/classes/Gems/Tracker/Snippets/EditRoundSnippetAbstract.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Snippets/EditRoundSnippetAbstract.php 2012-03-28 12:15:34 UTC (rev 570)
+++ trunk/library/classes/Gems/Tracker/Snippets/EditRoundSnippetAbstract.php 2012-03-28 19:38:24 UTC (rev 571)
@@ -182,7 +182,7 @@
}
// Check the survey name
- $surveys = $this->util->getTrackData()->getAllSurveys();
+ $surveys = $this->util->getTrackData()->getActiveSurveys();
if (isset($surveys[$this->formData['gro_id_survey']])) {
$this->formData['gro_survey_name'] = $surveys[$this->formData['gro_id_survey']];
} else {
Modified: trunk/library/classes/Gems/Util/TrackData.php
===================================================================
--- trunk/library/classes/Gems/Util/TrackData.php 2012-03-28 12:15:34 UTC (rev 570)
+++ trunk/library/classes/Gems/Util/TrackData.php 2012-03-28 19:38:24 UTC (rev 571)
@@ -82,20 +82,24 @@
return $dates;
} // */
- /*
+ /**
+ * Retrieve an array of key/value pairs for gsu_id_survey and gsu_survey_name
+ * only the active surveys
+ *
+ * @staticvar array $activeSurveys
+ * @return array
+ */
public function getActiveSurveys()
{
- static $surveys;
+ static $activeSurveys;
- if (! $surveys) {
- $surveys = $this->util->getTranslated()->getEmptyDropdownArray();
- $surveys = $surveys + $this->db->fetchPairs('SELECT gsu_id_survey, gsu_survey_name FROM gems__surveys WHERE gsu_active = 1 AND gsu_surveyor_active = 1 ORDER BY gsu_survey_name');
+ if (! $activeSurveys) {
+ $activeSurveys = $this->db->fetchPairs('SELECT gsu_id_survey, gsu_survey_name FROM gems__surveys WHERE gsu_active = 1 AND gsu_surveyor_active = 1 ORDER BY gsu_survey_name');
}
- return $surveys;
- } // */
+ return $activeSurveys;
+ }
-
/**
* Retrieve an array of key/value pairs for gsu_id_survey and gsu_survey_name
*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-28 12:15:45
|
Revision: 570
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=570&view=rev
Author: matijsdejong
Date: 2012-03-28 12:15:34 +0000 (Wed, 28 Mar 2012)
Log Message:
-----------
Extra function for Https.php and some extra documentation
Modified Paths:
--------------
trunk/library/classes/Gems/Util.php
trunk/library/classes/MUtil/Https.php
trunk/library/configs/db/tables/gems__user_logins.10.sql
Modified: trunk/library/classes/Gems/Util.php
===================================================================
--- trunk/library/classes/Gems/Util.php 2012-03-28 09:36:53 UTC (rev 569)
+++ trunk/library/classes/Gems/Util.php 2012-03-28 12:15:34 UTC (rev 570)
@@ -161,23 +161,20 @@
return $this->_loadClass('lockFile', true, array(GEMS_ROOT_DIR . '/var/settings/cron_lock.txt'));
}
+ /**
+ * Returns the current 'base site' url, optionally with a subpath.
+ *
+ * @staticvar string $uri
+ * @param string $subpath Optional string
+ * @return string The Url + basePath plus the optional subpath
+ */
public function getCurrentURI($subpath = '')
{
static $uri;
if (! $uri) {
- if(isset($_SERVER['HTTPS'])) {
- $secure = $_SERVER["HTTPS"];
+ $uri = MUtil_Https::on() ? 'https' : 'http';
- if (strtolower($secure) == 'off') {
- $secure = false;
- }
- } else {
- $secure = $_SERVER['SERVER_PORT'] == '443';
- }
-
- $uri = $secure ? 'https' : 'http';
-
$uri .= '://';
$uri .= $_SERVER['SERVER_NAME'];
$uri .= $this->basepath->getBasePath();
Modified: trunk/library/classes/MUtil/Https.php
===================================================================
--- trunk/library/classes/MUtil/Https.php 2012-03-28 09:36:53 UTC (rev 569)
+++ trunk/library/classes/MUtil/Https.php 2012-03-28 12:15:34 UTC (rev 570)
@@ -1,44 +1,80 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
+
/**
- * @package MUtil
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @package MUtil
+ * @subpackage Https
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $id: Html.php 362 2011-12-15 17:21:17Z matijsdejong $
*/
+/**
+ * Static utility function for determining wether https is on.
+ *
+ * @package MUtil
+ * @subpackage Https
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
+ */
class MUtil_Https
{
+ /**
+ * True when the url is a HTTPS url, false when HTTP, null otherwise
+ *
+ * @return boolean True when HTTPS, false when HTTP, null otherwise
+ */
+ public static function isHttps($url)
+ {
+ $url = strtolower(substr($url, 0, 8));
+
+ if ('https://' == $url) {
+ return true;
+ }
+
+ if ('http://' == substr($url, 0, 7)) {
+ return false;
+ }
+ return null;
+ }
+
+ /**
+ * True when https is used.
+ *
+ * @return boolean
+ */
public static function on()
{
if (empty($_SERVER['HTTPS'])) {
return false;
}
- return (($_SERVER['HTTPS'] !== 'off') || ($_SERVER['SERVER_PORT'] == 443));
+ return ((strtolower($_SERVER['HTTPS']) !== 'off') || ($_SERVER['SERVER_PORT'] == 443));
}
}
\ No newline at end of file
Modified: trunk/library/configs/db/tables/gems__user_logins.10.sql
===================================================================
--- trunk/library/configs/db/tables/gems__user_logins.10.sql 2012-03-28 09:36:53 UTC (rev 569)
+++ trunk/library/configs/db/tables/gems__user_logins.10.sql 2012-03-28 12:15:34 UTC (rev 570)
@@ -21,3 +21,21 @@
ENGINE=InnoDB
AUTO_INCREMENT = 10001
CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
+
+/*
+-- Code to restore login codes after failed update. You just never know when we might need it again.
+
+UPDATE gems__user_logins
+ SET gul_user_class =
+ CASE
+ WHEN EXISTS(SELECT gsf_id_user FROM gems__staff WHERE gsf_login = gul_login AND gsf_id_organization = gul_id_organization) THEN
+ CASE
+ WHEN EXISTS(SELECT gup_id_user FROM gems__user_passwords WHERE gup_id_user = gul_id_user) THEN 'StaffUser'
+ ELSE 'OldStaffUser'
+ END
+ WHEN EXISTS(SELECT gr2o_id_user FROM gems__respondent2org WHERE gr2o_patient_nr = gul_login AND gr2o_id_organization = gul_id_organization) THEN 'RespondentUser'
+ ELSE 'NoLogin'
+ END
+ WHERE gul_user_class = 'StaffUser';
+
+*/
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-28 09:37:04
|
Revision: 569
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=569&view=rev
Author: matijsdejong
Date: 2012-03-28 09:36:53 +0000 (Wed, 28 Mar 2012)
Log Message:
-----------
Bug changed all users to RespondentUser
Modified Paths:
--------------
trunk/library/classes/Gems/User/UserLoader.php
Modified: trunk/library/classes/Gems/User/UserLoader.php
===================================================================
--- trunk/library/classes/Gems/User/UserLoader.php 2012-03-28 09:27:38 UTC (rev 568)
+++ trunk/library/classes/Gems/User/UserLoader.php 2012-03-28 09:36:53 UTC (rev 569)
@@ -170,7 +170,7 @@
// Update class definition if it already exists
if ($login_id = $this->db->fetchOne($select)) {
$where = implode(' ', $select->getPart(Zend_Db_Select::WHERE));
- $this->db->update('gems__user_logins', $values);
+ $this->db->update('gems__user_logins', $values, $where);
} else {
$values['gul_login'] = $login_name;
@@ -503,6 +503,7 @@
// MUtil_Echo::track($defName, $login_name, $userOrganization, $values);
$values = $this->ensureDefaultUserValues($values, $definition, $defName);
+ MUtil_Echo::track($values, $userName, $userOrganization, $defName);
return $this->_loadClass('User', true, array($values, $definition));
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-28 09:27:48
|
Revision: 568
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=568&view=rev
Author: matijsdejong
Date: 2012-03-28 09:27:38 +0000 (Wed, 28 Mar 2012)
Log Message:
-----------
Adjusted for case where error reporting went wrong.
Plus patch for situation were users are added with NoLogin but as active.
Modified Paths:
--------------
trunk/library/classes/GemsEscort.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__user_logins.10.sql
Modified: trunk/library/classes/GemsEscort.php
===================================================================
--- trunk/library/classes/GemsEscort.php 2012-03-27 16:39:04 UTC (rev 567)
+++ trunk/library/classes/GemsEscort.php 2012-03-28 09:27:38 UTC (rev 568)
@@ -736,20 +736,23 @@
{
$user = $this->getLoader()->getCurrentUser();
- $div = MUtil_Html::create('div', array('id' => 'login'), $args);
+ // During error reporting the user or menu are not always known.
+ if ($user && $this->menu) {
+ $div = MUtil_Html::create('div', array('id' => 'login'), $args);
- $p = $div->p();
- if ($user->isActive()) {
- $p->append(sprintf($this->_('You are logged in as %s'), $user->getFullName()));
- $item = $this->menu->findController('index', 'logoff');
- $p->a($item->toHRefAttribute(), $this->_('Logoff'), array('class' => 'logout'));
- } else {
- $item = $this->menu->findController('index', 'login');
- $p->a($item->toHRefAttribute(), $this->_('You are not logged in'), array('class' => 'logout'));
+ $p = $div->p();
+ if ($user->isActive()) {
+ $p->append(sprintf($this->_('You are logged in as %s'), $user->getFullName()));
+ $item = $this->menu->findController('index', 'logoff');
+ $p->a($item->toHRefAttribute(), $this->_('Logoff'), array('class' => 'logout'));
+ } else {
+ $item = $this->menu->findController('index', 'login');
+ $p->a($item->toHRefAttribute(), $this->_('You are not logged in'), array('class' => 'logout'));
+ }
+ $item->set('visible', false);
+
+ return $div;
}
- $item->set('visible', false);
-
- return $div;
}
/**
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2012-03-27 16:39:04 UTC (rev 567)
+++ trunk/library/configs/db/patches.sql 2012-03-28 09:27:38 UTC (rev 568)
@@ -386,3 +386,6 @@
-- PATCH: Add block until to
ALTER TABLE gems__user_login_attempts ADD gula_block_until timestamp null AFTER gula_last_failed;
+
+-- 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;
Modified: trunk/library/configs/db/tables/gems__user_logins.10.sql
===================================================================
--- trunk/library/configs/db/tables/gems__user_logins.10.sql 2012-03-27 16:39:04 UTC (rev 567)
+++ trunk/library/configs/db/tables/gems__user_logins.10.sql 2012-03-28 09:27:38 UTC (rev 568)
@@ -8,7 +8,7 @@
gul_id_organization bigint not null references gems__organizations (gor_id_organization),
gul_user_class varchar(30) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'NoLogin',
- gul_can_login boolean not null default 1,
+ gul_can_login boolean not null default 0,
gul_changed timestamp not null default current_timestamp on update current_timestamp,
gul_changed_by bigint unsigned not null,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-27 16:39:15
|
Revision: 567
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=567&view=rev
Author: matijsdejong
Date: 2012-03-27 16:39:04 +0000 (Tue, 27 Mar 2012)
Log Message:
-----------
Active fix in RespondentUserDefinition.php
PhpDoc added to Lazy
Modified Paths:
--------------
trunk/library/classes/Gems/User/RespondentUserDefinition.php
trunk/library/classes/MUtil/Lazy.php
Modified: trunk/library/classes/Gems/User/RespondentUserDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/RespondentUserDefinition.php 2012-03-27 15:07:22 UTC (rev 566)
+++ trunk/library/classes/Gems/User/RespondentUserDefinition.php 2012-03-27 16:39:04 UTC (rev 567)
@@ -59,6 +59,7 @@
$select = new Zend_Db_Select($this->db);
$select->from('gems__user_logins', array(
'user_login_id' => 'gul_id_user',
+ 'user_active' => 'gul_can_login',
))
->join('gems__respondent2org', 'gul_login = gr2o_patient_nr AND gul_id_organization = gr2o_id_organization', array(
'user_login' => 'gr2o_patient_nr',
Modified: trunk/library/classes/MUtil/Lazy.php
===================================================================
--- trunk/library/classes/MUtil/Lazy.php 2012-03-27 15:07:22 UTC (rev 566)
+++ trunk/library/classes/MUtil/Lazy.php 2012-03-27 16:39:04 UTC (rev 567)
@@ -145,7 +145,15 @@
}
}
- public static function method($object, $method, $arg_array = null)
+ /**
+ * Return a lazy callable to an object
+ *
+ * @param Object $object
+ * @param string $method Method of the object
+ * @param mixed $arg_array1 Optional, first of any arguments to the call
+ * @return MUtil_Lazy_Call
+ */
+ public static function method($object, $method, $arg_array1 = null)
{
$args = array_slice(func_get_args(), 2);
return new MUtil_Lazy_Call(array($object, $method), $args);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-27 15:07:33
|
Revision: 566
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=566&view=rev
Author: matijsdejong
Date: 2012-03-27 15:07:22 +0000 (Tue, 27 Mar 2012)
Log Message:
-----------
Fix for handling when user is in database but does not exist
Modified Paths:
--------------
trunk/library/classes/Gems/Model/RespondentModel.php
trunk/library/classes/Gems/User/UserLoader.php
Modified: trunk/library/classes/Gems/Model/RespondentModel.php
===================================================================
--- trunk/library/classes/Gems/Model/RespondentModel.php 2012-03-23 18:30:36 UTC (rev 565)
+++ trunk/library/classes/Gems/Model/RespondentModel.php 2012-03-27 15:07:22 UTC (rev 566)
@@ -123,7 +123,7 @@
public function addLoginCheck()
{
$this->addLeftTable('gems__user_logins', array('gr2o_patient_nr' => 'gul_login', 'gr2o_id_organization' => 'gul_id_organization'), 'gul');
- $this->addColumn('CASE WHEN gul_id_user IS NULL THEN 0 ELSE 1 END', 'has_login');
+ $this->addColumn("CASE WHEN gul_id_user IS NULL OR gul_user_class = 'NoLogin' OR gul_can_login = 0 THEN 0 ELSE 1 END", 'has_login');
return $this;
}
Modified: trunk/library/classes/Gems/User/UserLoader.php
===================================================================
--- trunk/library/classes/Gems/User/UserLoader.php 2012-03-23 18:30:36 UTC (rev 565)
+++ trunk/library/classes/Gems/User/UserLoader.php 2012-03-27 15:07:22 UTC (rev 566)
@@ -156,17 +156,31 @@
{
$now = new Zend_Db_Expr('CURRENT_TIMESTAMP');
- $values['gul_login'] = $login_name;
- $values['gul_id_organization'] = $organization;
- $values['gul_user_class'] = $userClassName;
- $values['gul_can_login'] = 1;
- $values['gul_changed'] = $now;
- $values['gul_changed_by'] = $userId;
- $values['gul_created'] = $now;
- $values['gul_created_by'] = $userId;
+ $values['gul_user_class'] = $userClassName;
+ $values['gul_can_login'] = 1;
+ $values['gul_changed'] = $now;
+ $values['gul_changed_by'] = $userId;
- $this->db->insert('gems__user_logins', $values);
+ $select = $this->db->select();
+ $select->from('gems__user_logins', array('gul_id_user'))
+ ->where('gul_login = ?', $login_name)
+ ->where('gul_id_organization = ?', $organization)
+ ->limit(1);
+ // Update class definition if it already exists
+ if ($login_id = $this->db->fetchOne($select)) {
+ $where = implode(' ', $select->getPart(Zend_Db_Select::WHERE));
+ $this->db->update('gems__user_logins', $values);
+
+ } else {
+ $values['gul_login'] = $login_name;
+ $values['gul_id_organization'] = $organization;
+ $values['gul_created'] = $now;
+ $values['gul_created_by'] = $userId;
+
+ $this->db->insert('gems__user_logins', $values);
+ }
+
return $this->getUser($login_name, $organization);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-23 18:30:42
|
Revision: 565
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=565&view=rev
Author: matijsdejong
Date: 2012-03-23 18:30:36 +0000 (Fri, 23 Mar 2012)
Log Message:
-----------
Authentication easier to extend / adapt
Modified Paths:
--------------
trunk/new_project/application/configs/project.ini
Modified: trunk/new_project/application/configs/project.ini
===================================================================
--- trunk/new_project/application/configs/project.ini 2012-03-23 18:23:04 UTC (rev 564)
+++ trunk/new_project/application/configs/project.ini 2012-03-23 18:30:36 UTC (rev 565)
@@ -35,21 +35,6 @@
databaseFileEncoding = ISO-8859-1
;-------------------------------------------------------
-; ACCOUNT SECTION
-;
-; delayFactor
-;
-; When a user enters a wrong password, each subsequent
-; login attempt will be delayed by an exponentially
-; increasing number of seconds.
-;
-; This delay is calculated as follows:
-; delay = (number_failed_attempts ^ delayFactor)
-;
-;-------------------------------------------------------
-account.delayFactor = 4
-
-;-------------------------------------------------------
; SESSION SECTION
;
; idleTimeout
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-23 18:23:15
|
Revision: 564
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=564&view=rev
Author: matijsdejong
Date: 2012-03-23 18:23:04 +0000 (Fri, 23 Mar 2012)
Log Message:
-----------
Password validated in login form
OldStyle staff users are upgraded to new style staff users during login
Authentication easier to extend / adapt
Fixed temp fix in svn update 552 with callable (in project using it)
Modified Paths:
--------------
trunk/library/changelog.txt
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/Project/ProjectSettings.php
trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php
trunk/library/classes/Gems/User/Form/ChangePasswordForm.php
trunk/library/classes/Gems/User/Form/LoginForm.php
trunk/library/classes/Gems/User/NoLoginDefinition.php
trunk/library/classes/Gems/User/OldStaffUserDefinition.php
trunk/library/classes/Gems/User/ProjectUserDefinition.php
trunk/library/classes/Gems/User/RadiusUserDefinition.php
trunk/library/classes/Gems/User/User.php
trunk/library/classes/Gems/User/UserDefinitionInterface.php
trunk/library/classes/Gems/User/UserLoader.php
trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php
trunk/library/classes/MUtil/Model/TableBridgeAbstract.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__user_login_attempts.10.sql
Added Paths:
-----------
trunk/library/classes/Gems/User/Validate/
trunk/library/classes/Gems/User/Validate/GetUserInterface.php
trunk/library/classes/Gems/User/Validate/GetUserPasswordValidator.php
trunk/library/classes/Gems/User/Validate/NewPasswordValidator.php
trunk/library/classes/Gems/User/Validate/PasswordValidatorAbstract.php
trunk/library/classes/Gems/User/Validate/UserPasswordValidator.php
Removed Paths:
-------------
trunk/library/classes/Gems/User/UserNewPasswordValidator.php
trunk/library/classes/Gems/User/UserPasswordValidator.php
Modified: trunk/library/changelog.txt
===================================================================
--- trunk/library/changelog.txt 2012-03-22 17:05:18 UTC (rev 563)
+++ trunk/library/changelog.txt 2012-03-23 18:23:04 UTC (rev 564)
@@ -1,3 +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.
+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.
+
+
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-03-22 17:05:18 UTC (rev 563)
+++ trunk/library/classes/Gems/Default/IndexAction.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -161,7 +161,7 @@
Gems_Html::init();
return $this->loader->getUserLoader()->getLoginForm($args);
-
+ /*
$form = $this->_getBasicForm();
$form->addElement($this->_getOrganizationElement());
$form->addElement($this->_getUserLoginElement());
@@ -175,7 +175,7 @@
$form->addElement($this->_getResetLinkElement());
}
- return $form;
+ return $form; // */
}
/**
@@ -330,64 +330,54 @@
if ($request->isPost()) {
if ($form->isValid($request->getPost(), false)) {
+ $user = $form->getUser();
- $user = $this->loader->getUser($request->getParam('userlogin'), $request->getParam('organization'));
+ $previousRequestParameters = $this->session->previousRequestParameters;
- // NO!!! DO not test! Otherwise it is easy to test which users exist.
- // if ($user->isActive()) {
- $formValues = $form->getValues();
- $authResult = $user->authenticate($formValues);
+ $user->setAsCurrentUser();
- if ($authResult->isValid()) {
- $previousRequestParameters = $this->session->previousRequestParameters;
+ if ($messages = $user->reportPasswordWeakness($request->getParam($form->passwordFieldName))) {
+ $user->setPasswordResetRequired(true);
+ $this->addMessage($this->_('Your password must be changed.'));
+ $this->addMessage($messages);
+ }
- $user->setAsCurrentUser();
+ /**
+ * Fix current locale in cookies
+ */
+ Gems_Cookies::setLocale($user->getLocale(), $this->basepath->getBasePath());
- $user->afterLogin($form->getValues());
+ /**
+ * Ready
+ */
+ $this->addMessage(sprintf($this->_('Login successful, welcome %s.'), $user->getFullName()));
- //*
- if ($messages = $user->reportPasswordWeakness($request->getParam('password'))) {
- $user->setPasswordResetRequired(true);
- $this->addMessage($this->_('Your password must be changed.'));
- $this->addMessage($messages);
- } // */
+ /**
+ * Log the login
+ */
+ Gems_AccessLog::getLog($this->db)->log("index.login", $this->getRequest(), null, $user->getUserId(), true);
- /**
- * Fix current locale in cookies
- */
- Gems_Cookies::setLocale($user->getLocale(), $this->basepath->getBasePath());
-
- /**
- * Ready
- */
- $this->addMessage(sprintf($this->_('Login successful, welcome %s.'), $user->getFullName()));
-
- /**
- * Log the login
- */
- Gems_AccessLog::getLog($this->db)->log("index.login", $this->getRequest(), null, $user->getUserId(), true);
-
- if ($previousRequestParameters) {
- $this->_reroute(array('controller' => $previousRequestParameters['controller'], 'action' => $previousRequestParameters['action']), false);
- } else {
- // This reroutes to the first available menu page after login.
- //
- // Do not user $user->gotoStartPage() as the menu is still set
- // for no login.
- $this->_reroute(array('controller' => null, 'action' => null), true);
- }
- return;
+ if ($previousRequestParameters) {
+ $this->_reroute(array('controller' => $previousRequestParameters['controller'], 'action' => $previousRequestParameters['action']), false);
} else {
- //Now present the user with an error message
- $errors = $authResult->getMessages();
- $this->addMessage($errors);
-
- //Also log the error to the log table
- //when the project has logging enabled
- $logErrors = join(' - ', $errors);
- $log = Gems_AccessLog::getLog();
- $log->log('loginFail', $this->getRequest(), sprintf('Failed login for : %s (%s) - %s', $formValues['userlogin'], $formValues['organization'], $logErrors), null, true);
+ // This reroutes to the first available menu page after login.
+ //
+ // Do not user $user->gotoStartPage() as the menu is still set
+ // for no login.
+ $this->_reroute(array('controller' => null, 'action' => null), true);
}
+ return;
+ } else {
+ //Now present the user with an error message
+ $errors = $form->getErrorMessages();
+ $this->addMessage($errors);
+
+ //Also log the error to the log table
+ //when the project has logging enabled
+ $logErrors = join(' - ', $errors);
+ $msg = sprintf('Failed login for : %s (%s) - %s', $request->getParam($form->usernameFieldName), $request->getParam($form->organizationFieldName), $logErrors);
+ $log = Gems_AccessLog::getLog();
+ $log->log('loginFail', $this->getRequest(), $msg, null, true);
}
}
$this->view->form = $form;
Modified: trunk/library/classes/Gems/Project/ProjectSettings.php
===================================================================
--- trunk/library/classes/Gems/Project/ProjectSettings.php 2012-03-22 17:05:18 UTC (rev 563)
+++ trunk/library/classes/Gems/Project/ProjectSettings.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -187,20 +187,6 @@
}
/**
- * Returns the factor used to delay account reloading.
- *
- * @return int
- */
- public function getAccountDelayFactor()
- {
- if ($this->offsetExists('account') && isset($this->account['delayFactor'])) {
- return intval($this->account['delayFactor']);
- } else {
- return 4;
- }
- }
-
- /**
* Returns an array with throttling settings for the ask
* controller
*
Modified: trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php
===================================================================
--- trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php 2012-03-22 17:05:18 UTC (rev 563)
+++ trunk/library/classes/Gems/User/DbUserDefinitionAbstract.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -123,12 +123,11 @@
/**
* Returns an initialized Zend_Auth_Adapter_Interface
*
- * @param string $username
- * @param int $organizationId
+ * @param Gems_User_User $user
* @param string $password
* @return Zend_Auth_Adapter_Interface
*/
- public function getAuthAdapter($username, $organizationId, $password)
+ public function getAuthAdapter(Gems_User_User $user, $password)
{
$adapter = new Zend_Auth_Adapter_DbTable($this->db, 'gems__user_passwords', 'gul_login', 'gup_password');
@@ -137,9 +136,9 @@
$select = $adapter->getDbSelect();
$select->join('gems__user_logins', 'gup_id_user = gul_id_user', array())
->where('gul_can_login = 1')
- ->where('gul_id_organization = ?', $organizationId);
+ ->where('gul_id_organization = ?', $user->getBaseOrganizationId());
- $adapter->setIdentity($username)
+ $adapter->setIdentity($user->getLoginName())
->setCredential($pwd_hash);
return $adapter;
Modified: trunk/library/classes/Gems/User/Form/ChangePasswordForm.php
===================================================================
--- trunk/library/classes/Gems/User/Form/ChangePasswordForm.php 2012-03-22 17:05:18 UTC (rev 563)
+++ trunk/library/classes/Gems/User/Form/ChangePasswordForm.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -168,7 +168,7 @@
$element->setAttrib('maxlength', 20);
$element->setRequired(true);
$element->setRenderPassword(true);
- $element->addValidator(new Gems_User_UserNewPasswordValidator($this->user));
+ $element->addValidator(new Gems_User_Validate_NewPasswordValidator($this->user));
$element->addValidator(new MUtil_Validate_IsConfirmed($this->_repeatPasswordFieldName, $this->translate->_('Repeat password')));
$this->addElement($element);
@@ -194,7 +194,7 @@
$element->setAttrib('maxlength', 20);
$element->setRenderPassword(true);
$element->setRequired(true);
- $element->addValidator(new Gems_User_UserPasswordValidator($this->user, $this->translate));
+ $element->addValidator(new Gems_User_Validate_UserPasswordValidator($this->user, $this->translate->_('Wrong password.')));
$this->addElement($element);
}
Modified: trunk/library/classes/Gems/User/Form/LoginForm.php
===================================================================
--- trunk/library/classes/Gems/User/Form/LoginForm.php 2012-03-22 17:05:18 UTC (rev 563)
+++ trunk/library/classes/Gems/User/Form/LoginForm.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -44,7 +44,7 @@
* @license New BSD License
* @since Class available since version 1.5
*/
-class Gems_User_Form_LoginForm extends Gems_Form_AutoLoadFormAbstract
+class Gems_User_Form_LoginForm extends Gems_Form_AutoLoadFormAbstract implements Gems_User_Validate_GetUserInterface
{
/**
* The field name for the lost password element.
@@ -54,14 +54,6 @@
protected $_lostPasswordFieldName = 'lost_password';
/**
- * The field name for the organization element.
- *
- * @var string
- */
- protected $_organizationFieldName = 'organization';
-
-
- /**
* When true the organization was derived from the the url
*
* @var boolean
@@ -69,13 +61,6 @@
protected $_organizationFromUrl = false;
/**
- * The field name for the password element.
- *
- * @var string
- */
- protected $_passwordFieldName = 'password';
-
- /**
* The field name for the submit element.
*
* @var string
@@ -90,11 +75,10 @@
protected $_tokenFieldName = 'token_link';
/**
- * The field name for the username element.
*
- * @var string
+ * @var Gems_User_User
*/
- protected $_usernameFieldName = 'userlogin';
+ protected $_user;
/**
*
@@ -103,6 +87,13 @@
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
@@ -112,7 +103,14 @@
protected $organizationMaxLines = 6;
/**
+ * The field name for the password element.
*
+ * @var string
+ */
+ public $passwordFieldName = 'password';
+
+ /**
+ *
* @var Zend_Controller_Request_Abstract
*/
protected $request;
@@ -138,7 +136,14 @@
protected $translate;
/**
+ * The field name for the username element.
*
+ * @var string
+ */
+ public $usernameFieldName = 'userlogin';
+
+ /**
+ *
* @var Zend_Util
*/
protected $util;
@@ -161,7 +166,7 @@
}
$request = $this->getRequest();
- if ($request->isPost() && ($orgId = $request->getParam($this->_organizationFieldName))) {
+ if ($request->isPost() && ($orgId = $request->getParam($this->organizationFieldName))) {
return $orgId;
}
@@ -216,14 +221,14 @@
*/
public function getOrganizationElement()
{
- $element = $this->getElement($this->_organizationFieldName);
+ $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);
+ $element = new Zend_Form_Element_Hidden($this->organizationFieldName);
$this->addElement($element);
}
@@ -234,7 +239,7 @@
}
} elseif (! $element instanceof Zend_Form_Element_Select) {
- $element = new Zend_Form_Element_Select($this->_organizationFieldName);
+ $element = new Zend_Form_Element_Select($this->organizationFieldName);
$element->setLabel($this->translate->_('Organization'));
$element->setRequired(true);
$element->setMultiOptions($orgs);
@@ -257,16 +262,23 @@
*/
public function getPasswordElement()
{
- $element = $this->getElement($this->_passwordFieldName);
+ $element = $this->getElement($this->passwordFieldName);
if (! $element) {
// Veld password
- $element = new Zend_Form_Element_Password($this->_passwordFieldName);
+ $element = new Zend_Form_Element_Password($this->passwordFieldName);
$element->setLabel($this->translate->_('Password'));
$element->setAttrib('size', 10);
$element->setAttrib('maxlength', 20);
$element->setRequired(true);
+ if ($this->getOrganizationElement() instanceof Zend_Form_Element_Hidden) {
+ $explain = $this->translate->_('Combination of user and password not found.');
+ } else {
+ $explain = $this->translate->_('Combination of user and password not found for this organization.');
+ }
+ $element->addValidator(new Gems_User_Validate_GetUserPasswordValidator($this, $explain));
+
$this->addElement($element);
}
@@ -338,18 +350,29 @@
{
return MUtil_Html::create('a', array('controller' => 'ask', 'action' => 'token'), $this->translate->_('Enter your token...'), array('class' => 'actionlink'));
}
+
/**
+ * 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);
+ $element = $this->getElement($this->usernameFieldName);
if (! $element) {
// Veld inlognaam
- $element = new Zend_Form_Element_Text($this->_usernameFieldName);
+ $element = new Zend_Form_Element_Text($this->usernameFieldName);
$element->setLabel($this->translate->_('Username'));
$element->setAttrib('size', 10);
$element->setAttrib('maxlength', 20);
@@ -362,6 +385,26 @@
}
/**
+ * 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)
Modified: trunk/library/classes/Gems/User/NoLoginDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/NoLoginDefinition.php 2012-03-22 17:05:18 UTC (rev 563)
+++ trunk/library/classes/Gems/User/NoLoginDefinition.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -47,27 +47,15 @@
class Gems_User_NoLoginDefinition extends Gems_User_UserDefinitionAbstract
{
/**
- * Helper method for the case a user tries to authenticate while he is inactive
- *
- * @return boolean
- */
- public function alwaysFalse()
- {
- return false;
- }
-
- /**
* Returns an initialized Zend_Auth_Adapter_Interface
*
- * @param string $username
- * @param int $organizationId
+ * @param Gems_User_User $user
* @param string $password
* @return Zend_Auth_Adapter_Interface
*/
- public function getAuthAdapter($username, $organizationId, $password)
+ public function getAuthAdapter(Gems_User_User $user, $password)
{
- $adapter = new Gems_Auth_Adapter_Callback(array($this,'alwaysFalse'), $username);
- return $adapter;
+ return false;
}
/**
@@ -80,8 +68,11 @@
public function getUserData($login_name, $organization)
{
return array(
- 'user_active' => false,
- 'user_role' => 'nologin',
+ 'user_login' => $login_name,
+ 'user_name' => $login_name,
+ 'user_base_org_id' => $organization,
+ 'user_active' => false,
+ 'user_role' => 'nologin',
);
}
}
Modified: trunk/library/classes/Gems/User/OldStaffUserDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/OldStaffUserDefinition.php 2012-03-22 17:05:18 UTC (rev 563)
+++ trunk/library/classes/Gems/User/OldStaffUserDefinition.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -60,23 +60,6 @@
protected $project;
/**
- * Perform UserDefinition specific post-login logic
- *
- * @param Zend_Auth_Result $authResult
- * @return void
- */
- public function afterLogin(Zend_Auth_Result $authResult, $formValues)
- {
- // MUtil_Echo::track($authResult->isValid(), $formValues);
- if ($authResult->isValid()) {
- $login_name = $formValues['userlogin'];
- $organization = $formValues['organization'];
- $password = $formValues['password'];
- $this->makeNewStaffUser($login_name, $organization, $password);
- }
- }
-
- /**
* Return true if the password can be set.
*
* Returns the setting for the definition whan no user is passed, otherwise
@@ -93,13 +76,25 @@
/**
* Returns an initialized Zend_Auth_Adapter_Interface
*
- * @param string $username
- * @param int $organizationId
+ * @param Gems_User_User $user
* @param string $password
* @return Zend_Auth_Adapter_Interface
*/
- public function getAuthAdapter($username, $organizationId, $password)
+ public function getAuthAdapter(Gems_User_User $user, $password)
{
+ $pwd_hash = $this->hashPassword($password);
+
+ $sql = "SELECT gsf_id_user FROM gems__staff WHERE gsf_active = 1 AND gsf_login = ? AND gsf_id_organization = ? AND gsf_password = ?";
+
+ if ($this->db->fetchOne($sql, array($user->getLoginName(), $user->getBaseOrganizationId(), $pwd_hash))) {
+ $this->makeNewStaffUser($user, $password);
+
+ return true;
+ } else {
+ return false;
+ }
+
+ /*
$adapter = new Zend_Auth_Adapter_DbTable(null, 'gems__staff', 'gsf_login', 'gsf_password');
$pwd_hash = $this->hashPassword($password);
@@ -112,6 +107,7 @@
->setCredential($pwd_hash);
return $adapter;
+ // */
}
/**
@@ -200,15 +196,19 @@
return md5($password);
}
- protected function makeNewStaffUser($login_name, $organization, $password)
+ /**
+ * Sets the user up as a new staff user
+ *
+ * @param Gems_User_User $user
+ * @param string $password
+ */
+ protected function makeNewStaffUser(Gems_User_User $user, $password)
{
- $userData = $this->getUserData($login_name, $organization);
- $staff_id = $userData['user_id'];
+ $staff_id = $user->getUserId();
+ $sql = 'SELECT gul_id_user FROM gems__user_logins WHERE gul_can_login = 1 AND gul_login = ? AND gul_id_organization = ?';
- $sql = 'SELECT gul_id_user FROM gems__user_logins WHERE gul_can_login = 1 AND gul_login = ? AND gul_id_organization = ?';
-
try {
- $user_id = $this->db->fetchOne($sql, array($login_name, $organization));
+ $user_id = $this->db->fetchOne($sql, array($user->getLoginName(), $user->getBaseOrganizationId()));
$currentTimestamp = new Zend_Db_Expr('CURRENT_TIMESTAMP');
@@ -240,6 +240,8 @@
$this->db->update('gems__staff', $values, $this->db->quoteInto('gsf_id_user = ?', $staff_id));
+ $user->refresh(Gems_User_UserLoader::USER_STAFF);
+
} catch (Zend_Db_Exception $e) {
GemsEscort::getInstance()->logger->log($e->getMessage(), Zend_Log::ERR);
// Fall through as this does not work if the database upgrade did not run
@@ -257,7 +259,7 @@
*/
public function setPassword(Gems_User_User $user, $password)
{
- $this->makeNewStaffUser($user->getLoginName(), $user->getBaseOrganizationId(), $password);
+ $this->makeNewStaffUser($user, $password);
return $this;
}
Modified: trunk/library/classes/Gems/User/ProjectUserDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/ProjectUserDefinition.php 2012-03-22 17:05:18 UTC (rev 563)
+++ trunk/library/classes/Gems/User/ProjectUserDefinition.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -55,14 +55,13 @@
/**
* Returns an initialized Zend_Auth_Adapter_Interface
*
- * @param string $username
- * @param int $organizationId
+ * @param Gems_User_User $user
* @param string $password
* @return Zend_Auth_Adapter_Interface
*/
- public function getAuthAdapter($username, $organizationId, $password)
+ public function getAuthAdapter(Gems_User_User $user, $password)
{
- $adapter = new Gems_Auth_Adapter_Callback(array($this->project,'checkSuperAdminPassword'), $username, array($password));
+ $adapter = new Gems_Auth_Adapter_Callback(array($this->project, 'checkSuperAdminPassword'), $user->getLoginName(), array($password));
return $adapter;
}
@@ -76,14 +75,15 @@
public function getUserData($login_name, $organization)
{
return array(
- 'user_id' => 1,
- 'user_login' => $login_name,
- 'user_name' => $login_name,
- 'user_group' => 800,
- 'user_role' => 'master',
- 'user_style' => 'gems',
- 'user_base_org_id' => $organization,
+ 'user_id' => 1,
+ 'user_login' => $login_name,
+ 'user_name' => $login_name,
+ 'user_group' => 800,
+ 'user_role' => 'master',
+ 'user_style' => 'gems',
+ 'user_base_org_id' => $organization,
'user_allowed_ip_ranges' => $this->project->getSuperAdminIPRanges(),
+ 'user_blockable' => false,
);
}
}
\ No newline at end of file
Modified: trunk/library/classes/Gems/User/RadiusUserDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/RadiusUserDefinition.php 2012-03-22 17:05:18 UTC (rev 563)
+++ trunk/library/classes/Gems/User/RadiusUserDefinition.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -128,15 +128,14 @@
/**
* Returns an initialized Zend_Auth_Adapter_Interface
*
- * @param string $username
- * @param int $organizationId
+ * @param Gems_User_User $user
* @param string $password
* @return Zend_Auth_Adapter_Interface
*/
- public function getAuthAdapter($username, $organizationId, $password)
+ public function getAuthAdapter(Gems_User_User $user, $password)
{
//Ok hardcoded for now this needs to be read from the userdefinition
- $configData = $this->loadConfig(array('gor_id_organization' => $organizationId));
+ $configData = $this->loadConfig(array('gor_id_organization' => $user->getBaseOrganizationId()));
$config = array('ip' => $configData['grcfg_ip'],
'authenticationport' => $configData['grcfg_port'],
@@ -150,7 +149,7 @@
}
$adapter = new Gems_User_Adapter_Radius($config);
- $adapter->setIdentity($username)
+ $adapter->setIdentity($user->getLoginName())
->setCredential($password);
return $adapter;
Modified: trunk/library/classes/Gems/User/User.php
===================================================================
--- trunk/library/classes/Gems/User/User.php 2012-03-22 17:05:18 UTC (rev 563)
+++ trunk/library/classes/Gems/User/User.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -87,7 +87,21 @@
protected $definition;
/**
+ * Sets number failed accounts that trigger a block
*
+ * @var int
+ */
+ protected $failureBlockCount = 6;
+
+ /**
+ * Sets number of seconds until a previous failed login can be ignored
+ *
+ * @var int
+ */
+ protected $failureIgnoreTime = 600;
+
+ /**
+ *
* @var Zend_Controller_Request_Abstract
*/
protected $request;
@@ -113,7 +127,16 @@
protected $userLoader;
/**
+ * Use Zend_Auth for authentication
*
+ * Warning: Zend_Auth contains only a partial ID of the current user, the base organization is missing
+ *
+ * @var boolean
+ */
+ protected $useZendAuth = false;
+
+ /**
+ *
* @var Gems_Util
*/
protected $util;
@@ -221,56 +244,205 @@
}
/**
- * Perform project specific after login logic here, can also delegate to the user definition
+ * Process everything after authentication.
*
- * @return void
+ * @param Zend_Auth_Result $result
*/
- public function afterLogin($formValues) {
- if (is_callable(array($this->definition, 'afterLogin'))) {
- // Use the USERS organization, not the one he or she is using currently
- $formValues['organization'] = $this->getBaseOrganizationId();
- $this->definition->afterLogin($this->_authResult, $formValues);
+ protected function afterAuthorization(Zend_Auth_Result $result)
+ {
+ try {
+ $select = $this->db->select();
+ $select->from('gems__user_login_attempts', array('gula_failed_logins', 'gula_last_failed', 'gula_block_until', 'UNIX_TIMESTAMP() - UNIX_TIMESTAMP(gula_last_failed) AS since_last'))
+ ->where('gula_login = ?', $this->getLoginName())
+ ->where('gula_id_organization = ?', $this->getCurrentOrganizationId())
+ ->limit(1);
+
+ $values = $this->db->fetchRow($select);
+
+ // The first login attempt
+ if (! $values) {
+ $values['gula_login'] = $this->getLoginName();
+ $values['gula_id_organization'] = $this->getCurrentOrganizationId();
+ $values['gula_failed_logins'] = 0;
+ $values['gula_last_failed'] = null;
+ $values['gula_block_until'] = null;
+ $values['since_last'] = $this->failureBlockCount + 1;
+ }
+
+ if ($result->isValid()) {
+ // Reset login failures
+ $values['gula_failed_logins'] = 0;
+ $values['gula_last_failed'] = null;
+ $values['gula_block_until'] = null;
+
+ } else {
+
+ // Reset the counters when the last login was longer ago than the delay factor
+ if ($values['since_last'] > $this->failureIgnoreTime) {
+ $values['gula_failed_logins'] = 1;
+ } else {
+ $values['gula_failed_logins'] += 1;
+ }
+
+ // If block is already set
+ if ($values['gula_block_until']) {
+ // Do not change it anymore
+ unset($values['gula_block_until']);
+
+ } else {
+ // Only set the block when needed
+ if ($this->failureBlockCount <= $values['gula_failed_logins']) {
+ $values['gula_block_until'] = new Zend_Db_Expr('DATE_ADD(CURRENT_TIMESTAMP, INTERVAL ' . $this->failureIgnoreTime . ' SECOND)');
+ }
+ }
+
+ // Always record the last fail
+ $values['gula_last_failed'] = new Zend_Db_Expr('CURRENT_TIMESTAMP');
+
+ // Response gets slowly slower
+ $sleepTime = min($values['gula_failed_logins'] - 1, 10) * 2;
+ sleep($sleepTime);
+ // MUtil_Echo::track($sleepTime, $values, $result->getMessages());
+ }
+
+ // Value not saveable
+ unset($values['since_last']);
+
+ if (isset($values['gula_login'])) {
+ $this->db->insert('gems__user_login_attempts', $values);
+ } else {
+ $where = $this->db->quoteInto('gula_login = ? AND ', $this->getLoginName());
+ $where .= $this->db->quoteInto('gula_id_organization = ?', $this->getCurrentOrganizationId());
+ $this->db->update('gems__user_login_attempts', $values, $where);
+ }
+
+ } catch (Zend_Db_Exception $e) {
+ // Fall through as this does not work if the database upgrade did not yet run
+ // MUtil_Echo::r($e);
}
+
}
/**
- * Helper method for the case a user tries to authenticate while he is inactive
+ * Authenticate a users credentials using the submitted form
*
- * @return boolean
+ * @param string $password The password to test
+ * @return Zend_Auth_Result
*/
- public function alwaysFalse()
+ public function authenticate($password)
{
- return false;
+ if ($this->useZendAuth) {
+ $zendAuth = Zend_Auth::getInstance();
+ }
+ $auths = $this->loadAuthorizers($password);
+
+ foreach ($auths as $result) {
+ if (is_callable($result)) {
+ $result = call_user_func($result);
+ }
+
+ if ($result instanceof Zend_Auth_Adapter_Interface) {
+ if ($this->useZendAuth) {
+ $result = $zendAuth->authenticate($result);
+ } else {
+ $result = $result->authenticate();
+ }
+ }
+
+ if ($result instanceof Zend_Auth_Result) {
+ if (! $result->isValid()) {
+ break;
+ }
+ } else {
+ if (true === $result) {
+ $result = new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $this->getLoginName());
+
+ } else {
+ // Always a fail when not true
+ if ($result === false) {
+ $code = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
+ $result = array();
+ } else {
+ $code = Zend_Auth_Result::FAILURE_UNCATEGORIZED;
+ if (is_string($result)) {
+ $result = array($result);
+ }
+ }
+ $result = new Zend_Auth_Result($code, $this->getLoginName(), $result);
+ break;
+ }
+ }
+ }
+
+ $this->afterAuthorization($result);
+
+ // MUtil_Echo::track($result);
+ $this->_authResult = $result;
+
+ return $result;
}
/**
- * Authenticate a users credentials using the submitted form
+ * Checks if the user is allowed to login or is blocked
*
- * @param array $formValues the array containing all formvalues from the login form
- * @return Zend_Auth_Result
+ * An adapter authorizes and if the end resultis boolean, string or array
+ * it is converted into a Zend_Auth_Result.
+ *
+ * @return mixed Zend_Auth_Adapter_Interface|Zend_Auth_Result|boolean|string|array
*/
- public function authenticate($formValues)
+ protected function authorizeBlock()
{
- // Check if the client IP address is within allowed IP ranges
- if (! $this->util->isAllowedIP($_SERVER['REMOTE_ADDR'], $this->getAllowedIPRanges())) {
- return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $this->getLoginName(), array($this->translate->_('You are not allowed to login from this location.')));
- }
+ try {
+ $select = $this->db->select();
+ $select->from('gems__user_login_attempts', array('UNIX_TIMESTAMP(gula_block_until) - UNIX_TIMESTAMP() AS wait'))
+ ->where('gula_block_until is not null')
+ ->where('gula_login = ?', $this->getLoginName())
+ ->where('gula_id_organization = ?', $this->getCurrentOrganizationId())
+ ->limit(1);
- $auth = Gems_Auth::getInstance();
+ // Not the first login
+ if ($block = $this->db->fetchOne($select)) {
+ if ($block > 0) {
+ $minutes = intval($block / 60) + 1;
- $formValues['organization'] = $this->getBaseOrganizationId();
- $formValues['userlogin'] = $this->getLoginName();
+ // Report all is not well
+ return sprintf($this->translate->plural('Your account is temporarily blocked, please wait a minute.', 'Your account is temporarily blocked, please wait %d minutes.', $minutes), $minutes);
- if ($this->isActive()) {
- $adapter = $this->definition->getAuthAdapter($formValues['userlogin'], $formValues['organization'], $formValues['password']);
- } else {
- $adapter = new Gems_Auth_Adapter_Callback(array($this,'alwaysFalse'), $formValues['userlogin']);
+ } else {
+ // Clean the block once it's past
+ $values['gula_failed_logins'] = 0;
+ $values['gula_last_failed'] = null;
+ $values['gula_block_until'] = null;
+ $where = $this->db->quoteInto('gula_login = ? AND ', $this->getLoginName());
+ $where .= $this->db->quoteInto('gula_id_organization = ?', $this->getCurrentOrganizationId());
+
+ $this->db->update('gems__user_login_attempts', $values, $where);
+ }
+ }
+
+ } catch (Zend_Db_Exception $e) {
+ // Fall through as this does not work if the database upgrade did not run
+ // MUtil_Echo::r($e);
}
- $authResult = $auth->authenticate($adapter, $formValues);
- $this->_authResult = $authResult;
+ return true;
+ }
- return $authResult;
+ /**
+ * Checks if the user is allowed to login using the current IP address
+ *
+ * An adapter authorizes and if the end resultis boolean, string or array
+ * it is converted into a Zend_Auth_Result.
+ *
+ * @return mixed Zend_Auth_Adapter_Interface|Zend_Auth_Result|boolean|string|array
+ */
+ protected function authorizeIp()
+ {
+ if ($this->util->isAllowedIP($_SERVER['REMOTE_ADDR'], $this->getAllowedIPRanges())) {
+ return true;
+ } else {
+ return $this->translate->_('You are not allowed to login from this location.');
+ }
}
/**
@@ -439,20 +611,6 @@
}
/**
- * Get the array to use for authenticate()
- *
- * @param string $password
- * @return array
- */
- public function getFormValuesForPassword($password)
- {
- return array(
- 'userlogin' => $this->getLoginName(),
- 'password' => $password,
- 'organization' => $this->getCurrentOrganizationId());
- }
-
- /**
* Returns the full user name (first, prefix, last).
*
* @return string
@@ -704,6 +862,20 @@
}
/**
+ * True when this user must enter a new password.
+ *
+ * @return boolean
+ */
+ public function isBlockable()
+ {
+ if ($this->_hasVar('user_blockable')) {
+ return (boolean) $this->_getVar('user_blockable');
+ } else {
+ return true;
+ }
+ }
+
+ /**
* Checks if this user is the current user
*
* @return boolean
@@ -744,6 +916,53 @@
}
/**
+ * Load the callables | results needed to authenticate/authorize this user
+ *
+ * A callable will be called, then an adapter authorizes and if the end result
+ * is boolean, string or array it is converted into a Zend_Auth_Result.
+ *
+ * @param string $password
+ * @return array Of Callable|Zend_Auth_Adapter_Interface|Zend_Auth_Result|boolean|string|array
+ */
+ protected function loadAuthorizers($password)
+ {
+ $auths['ip'] = array($this, 'authorizeIp');
+
+ if ($this->isBlockable()) {
+ $auths['block'] = array($this, 'authorizeBlock');
+ }
+
+ if ($this->isActive()) {
+ $auths['pwd'] = $this->definition->getAuthAdapter($this, $password);
+ } else {
+ $auths['pwd'] = false;
+ }
+
+ return $auths;
+ }
+
+ /**
+ *
+ * @param string $defName Optional
+ * @return Gems_User_User (continuation pattern)
+ */
+ public function refresh($defName = null)
+ {
+ if ($defName) {
+ $this->definition = $this->userLoader->getUserDefinition($defName);
+ }
+
+ $newData = $this->definition->getUserData($this->getLoginName(), $this->getBaseOrganizationId());
+ $newData = $this->userLoader->ensureDefaultUserValues($newData, $this->definition, $defName);
+
+ foreach ($newData as $key => $value) {
+ $this->_setVar($key, $value);
+ }
+
+ return $this;
+ }
+
+ /**
* Allowes a refresh of the existing list of organizations
* for this user.
*
Modified: trunk/library/classes/Gems/User/UserDefinitionInterface.php
===================================================================
--- trunk/library/classes/Gems/User/UserDefinitionInterface.php 2012-03-22 17:05:18 UTC (rev 563)
+++ trunk/library/classes/Gems/User/UserDefinitionInterface.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -80,12 +80,10 @@
/**
* Returns an initialized Zend_Auth_Adapter_Interface
*
- * @param string $username
- * @param int $organizationId
- * @param string $password
+ * @param Gems_User_User $user
* @return Zend_Auth_Adapter_Interface
*/
- public function getAuthAdapter($username, $organizationId, $password);
+ public function getAuthAdapter(Gems_User_User $user, $password);
/**
* Return a password reset key
Modified: trunk/library/classes/Gems/User/UserLoader.php
===================================================================
--- trunk/library/classes/Gems/User/UserLoader.php 2012-03-22 17:05:18 UTC (rev 563)
+++ trunk/library/classes/Gems/User/UserLoader.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -171,6 +171,30 @@
}
/**
+ * Makes sure default values are set for a user
+ *
+ * @param array $values
+ * @param Gems_User_UserDefinitionInterface $definition
+ * @param string $defName Optional
+ * @return array
+ */
+ public function ensureDefaultUserValues(array $values, Gems_User_UserDefinitionInterface $definition, $defName = null)
+ {
+ if (! isset($values['user_active'])) {
+ $values['user_active'] = true;
+ }
+ if (! isset($values['user_staff'])) {
+ $values['user_staff'] = $definition->isStaff();
+ }
+
+ if ($defName) {
+ $values['__user_definition'] = $defName;
+ }
+
+ return $values;
+ }
+
+ /**
* Get userclass / description array of available UserDefinitions for respondents
*
* @return array
@@ -464,15 +488,8 @@
$values = $definition->getUserData($userName, $userOrganization);
// MUtil_Echo::track($defName, $login_name, $userOrganization, $values);
- if (! isset($values['user_active'])) {
- $values['user_active'] = true;
- }
- if (! isset($values['user_staff'])) {
- $values['user_staff'] = $definition->isStaff();
- }
+ $values = $this->ensureDefaultUserValues($values, $definition, $defName);
- $values['__user_definition'] = $defName;
-
return $this->_loadClass('User', true, array($values, $definition));
}
Deleted: trunk/library/classes/Gems/User/UserNewPasswordValidator.php
===================================================================
--- trunk/library/classes/Gems/User/UserNewPasswordValidator.php 2012-03-22 17:05:18 UTC (rev 563)
+++ trunk/library/classes/Gems/User/UserNewPasswordValidator.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -1,117 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @package Gems
- * @subpackage User
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id$
- */
-
-/**
- *
- *
- * @package Gems
- * @subpackage User
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @since Class available since version 1.5
- */
-class Gems_User_UserNewPasswordValidator implements Zend_Validate_Interface
-{
- /**
- * The reported problems with the password.
- *
- * @var array or null
- */
- private $_report;
-
- /**
- *
- * @var Gems_User_User
- */
- private $_user;
-
- /**
- *
- * @param Gems_User_User $user The user to check
- */
- public function __construct(Gems_User_User $user)
- {
- $this->_user = $user;
- }
-
- /**
- * 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->_report = $this->_user->reportPasswordWeakness($value);
-
- foreach ($this->_report as &$report) {
- $report = ucfirst($report) . '.';
- }
-
- // MUtil_Echo::track($value, $this->_report);
-
- return ! (boolean) $this->_report;
- }
-
- /**
- * 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()
- {
- if ($this->_report) {
- return $this->_report;
-
- } else {
- return array();
- }
-
-
- }
-}
Deleted: trunk/library/classes/Gems/User/UserPasswordValidator.php
===================================================================
--- trunk/library/classes/Gems/User/UserPasswordValidator.php 2012-03-22 17:05:18 UTC (rev 563)
+++ trunk/library/classes/Gems/User/UserPasswordValidator.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -1,120 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * @package Gems
- * @subpackage User
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id$
- */
-
-/**
- *
- *
- * @package Gems
- * @subpackage User
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @since Class available since version 1.5
- */
-class Gems_User_UserPasswordValidator implements Zend_Validate_Interface
-{
- /**
- *
- * @var Gems_User_User
- */
- private $_user;
-
- /**
- *
- * @var Zend_Translate
- */
- private $_translate;
-
- /**
- *
- * @var boolean
- */
- private $_valid = false;
-
- /**
- *
- * @param Gems_User_User $user The user to check
- * @param Zend_Translate $translate Optional translator
- */
- public function __construct(Gems_User_User $user, Zend_Translate $translate = null)
- {
- $this->_user = $user;
- $this->_translate = $translate ? $translate : new MUtil_Translate_Adapter_Potemkin();
- }
-
- /**
- * 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())
- {
- $authResult = $this->_user->authenticate($this->_user->getFormValuesForPassword($value));
-
- $this->_valid = $authResult->isValid();
-
- return $this->_valid;
- }
-
- /**
- * 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()
- {
- if ($this->_valid) {
- return array();
-
- } else {
- return array($this->_translate->_('Wrong password.'));
- }
-
-
- }
-}
Property changes on: trunk/library/classes/Gems/User/Validate
___________________________________________________________________
Added: bugtraq:url
+ http://survey.erasmusmc.nl/support/mantis/view.php?id=%BUGID%
Added: bugtraq:logregex
+ #(\d+)
Added: trunk/library/classes/Gems/User/Validate/GetUserInterface.php
===================================================================
--- trunk/library/classes/Gems/User/Validate/GetUserInterface.php (rev 0)
+++ trunk/library/classes/Gems/User/Validate/GetUserInterface.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -0,0 +1,55 @@
+<?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: GetUserInterface.php 203 2012-01-01 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
+ */
+interface Gems_User_Validate_GetUserInterface
+{
+ /**
+ * Returns a user
+ *
+ * @return Gems_User_User
+ */
+ public function getUser();
+}
Added: trunk/library/classes/Gems/User/Validate/GetUserPasswordValidator.php
===================================================================
--- trunk/library/classes/Gems/User/Validate/GetUserPasswordValidator.php (rev 0)
+++ trunk/library/classes/Gems/User/Validate/GetUserPasswordValidator.php 2012-03-23 18:23:04 UTC (rev 564)
@@ -0,0 +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.
+ *
+ *
+ * @package Gems
+ * @subpackage User
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: UserPasswordValidator.php 370 2011-12-19 09:27:19Z mennodekker $
+ */
+
+/**
+ *
+ *
+ * @package Gems
+ * @subpackage User
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class Gems_User_Validate_GetUserPasswordValidator extends Gems_User_Validate_PasswordValidatorAbstract
+{
+ /**
+ *
+ * @var Gems_User_Validate_GetUserInterface
+ */
+ private $_userSource;
+
+ /**
+ *
+ * @param Gems_User_Validate_GetUserInterface $userSource The source for the user
+ * @param string $message Default message for standard login fail.
+ */
+ public function __construct(Gems_User_Validate_GetUserInterface $userSource, $message)
+ {
+ $this->_userSource = $userSource;
+
+ parent::__construct($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())
+ {
+ $user = $this->_userSource->getUser();
+ if ($user instanceof Gems_User_User) {
+ $result = $user->authenticate($value);
+ } else {
+ $result = new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, null);
+ }
+
+ return $this->setAuthResult($result);
+ }
+}
Added: trunk/library/classes/Gems/User/Validate/NewPassword...
[truncated message content] |
|
From: <gem...@li...> - 2012-03-22 17:05:29
|
Revision: 563
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=563&view=rev
Author: matijsdejong
Date: 2012-03-22 17:05:18 +0000 (Thu, 22 Mar 2012)
Log Message:
-----------
Moved IP check from Gems_Auth() to User->authenticate()
isAllowedIp() is no longer static, allowing per project overloading
Modified Paths:
--------------
trunk/library/classes/Gems/Auth.php
trunk/library/classes/Gems/User/User.php
trunk/library/classes/Gems/Util.php
Modified: trunk/library/classes/Gems/Auth.php
===================================================================
--- trunk/library/classes/Gems/Auth.php 2012-03-22 16:35:44 UTC (rev 562)
+++ trunk/library/classes/Gems/Auth.php 2012-03-22 17:05:18 UTC (rev 563)
@@ -54,7 +54,6 @@
*/
const ERROR_DATABASE_NOT_INSTALLED = -11;
const ERROR_PASSWORD_DELAY = -12;
- const ERROR_INVALID_IP = -13;
/**
* @var array Message templates
@@ -62,7 +61,6 @@
protected $_messageTemplates = array(
self::ERROR_DATABASE_NOT_INSTALLED => 'Installation not complete! Login is not yet possible!',
self::ERROR_PASSWORD_DELAY => 'Your account is temporarily blocked, please wait %s seconds',
- self::ERROR_INVALID_IP => 'You are not allowed to login from this location.'
);
/**
@@ -147,12 +145,7 @@
// We only forward to auth adapter when we have no timeout to prevent hammering the auth system
if (! isset($result) ) {
- // Check if the client IP address is within allowed IP ranges
- if (isset($formValues['allowed_ip_ranges']) && !Gems_Util::isAllowedIP($_SERVER['REMOTE_ADDR'], $formValues['allowed_ip_ranges'])) {
- $result = $this->_error(self::ERROR_INVALID_IP);
- } else {
- $result = parent::authenticate($adapter);
- }
+ $result = parent::authenticate($adapter);
}
if ($result->isValid()) {
Modified: trunk/library/classes/Gems/User/User.php
===================================================================
--- trunk/library/classes/Gems/User/User.php 2012-03-22 16:35:44 UTC (rev 562)
+++ trunk/library/classes/Gems/User/User.php 2012-03-22 17:05:18 UTC (rev 563)
@@ -251,9 +251,13 @@
*/
public function authenticate($formValues)
{
+ // Check if the client IP address is within allowed IP ranges
+ if (! $this->util->isAllowedIP($_SERVER['REMOTE_ADDR'], $this->getAllowedIPRanges())) {
+ return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $this->getLoginName(), array($this->translate->_('You are not allowed to login from this location.')));
+ }
+
$auth = Gems_Auth::getInstance();
- $formValues['allowed_ip_ranges'] = $this->getAllowedIPRanges();
$formValues['organization'] = $this->getBaseOrganizationId();
$formValues['userlogin'] = $this->getLoginName();
Modified: trunk/library/classes/Gems/Util.php
===================================================================
--- trunk/library/classes/Gems/Util.php 2012-03-22 16:35:44 UTC (rev 562)
+++ trunk/library/classes/Gems/Util.php 2012-03-22 17:05:18 UTC (rev 563)
@@ -193,7 +193,7 @@
* Get the default user consent
*
* This is de consent description from gems__consents, not the consentCODE
- *
+ *
* @return string
*/
public function getDefaultConsent()
@@ -306,7 +306,7 @@
* @param string $ipRanges
* @return bool
*/
- public static function isAllowedIP($ip, $ipRanges = "")
+ public function isAllowedIP($ip, $ipRanges = "")
{
if (!strlen($ipRanges)) {
return true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-22 16:35:51
|
Revision: 562
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=562&view=rev
Author: matijsdejong
Date: 2012-03-22 16:35:44 +0000 (Thu, 22 Mar 2012)
Log Message:
-----------
OldStaffUserDefinition.php user can now have a password reset
No more adding . 'Definition' to the end of all calls to getUserDefinition()
Modified Paths:
--------------
trunk/library/classes/Gems/Model/OrganizationModel.php
trunk/library/classes/Gems/User/OldStaffUserDefinition.php
trunk/library/classes/Gems/User/UserLoader.php
trunk/library/snippets/Organization/OrganizationEditSnippet.php
Modified: trunk/library/classes/Gems/Model/OrganizationModel.php
===================================================================
--- trunk/library/classes/Gems/Model/OrganizationModel.php 2012-03-22 15:42:31 UTC (rev 561)
+++ trunk/library/classes/Gems/Model/OrganizationModel.php 2012-03-22 16:35:44 UTC (rev 562)
@@ -128,8 +128,7 @@
//Now check if we need to save config values
if (isset($newValues['gor_user_class']) && !empty($newValues['gor_user_class'])) {
- $class = $newValues['gor_user_class'] . 'Definition';
- $definition = $this->loader->getUserLoader()->getUserDefinition($class);
+ $definition = $this->loader->getUserLoader()->getUserDefinition($newValues['gor_user_class']);
if ($definition instanceof Gems_User_UserDefinitionConfigurableInterface && $definition->hasConfig()) {
$savedValues['config'] = $definition->saveConfig($savedValues,$newValues['config']);
@@ -147,8 +146,7 @@
$data = parent::loadFirst($filter, $sort);
if (isset($data['gor_user_class']) && !empty($data['gor_user_class'])) {
- $class = $data['gor_user_class'] . 'Definition';
- $definition = $this->loader->getUserLoader()->getUserDefinition($class);
+ $definition = $this->loader->getUserLoader()->getUserDefinition($data['gor_user_class']);
if ($definition instanceof Gems_User_UserDefinitionConfigurableInterface && $definition->hasConfig()) {
$data['config'] = $definition->loadConfig($data);
Modified: trunk/library/classes/Gems/User/OldStaffUserDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/OldStaffUserDefinition.php 2012-03-22 15:42:31 UTC (rev 561)
+++ trunk/library/classes/Gems/User/OldStaffUserDefinition.php 2012-03-22 16:35:44 UTC (rev 562)
@@ -72,54 +72,25 @@
$login_name = $formValues['userlogin'];
$organization = $formValues['organization'];
$password = $formValues['password'];
- $userData = $this->getUserData($formValues['userlogin'], $formValues['organization']);
- $staff_id = $userData['user_id'];
-
- $sql = 'SELECT gul_id_user FROM gems__user_logins WHERE gul_can_login = 1 AND gul_login = ? AND gul_id_organization = ?';
-
- try {
- $user_id = $this->db->fetchOne($sql, array($login_name, $organization));
-
- $currentTimestamp = new Zend_Db_Expr('CURRENT_TIMESTAMP');
-
- // Move to USER_STAFF
- $values['gup_id_user'] = $user_id;
- $values['gup_password'] = $this->project->getValueHash($password);
- $values['gup_reset_key'] = null;
- $values['gup_reset_requested'] = null;
- $values['gup_reset_required'] = 0;
- $values['gup_changed'] = $currentTimestamp ;
- $values['gup_changed_by'] = $staff_id;
- $values['gup_created'] = $currentTimestamp ;
- $values['gup_created_by'] = $staff_id;
-
- $this->db->insert('gems__user_passwords', $values);
-
- // Update user class
- $values = array();
- $values['gul_user_class'] = Gems_User_UserLoader::USER_STAFF;
- $values['gul_changed'] = $currentTimestamp ;
- $values['gul_changed_by'] = $staff_id;
- $this->db->update('gems__user_logins', $values, $this->db->quoteInto('gul_id_user = ?', $user_id));
-
- // Remove old password
- $values = array();
- $values['gsf_password'] = null;
- $values['gsf_changed'] = $currentTimestamp ;
- $values['gsf_changed_by'] = $user_id;
-
- $this->db->update('gems__staff', $values, $this->db->quoteInto('gsf_id_user = ?', $staff_id));
-
- } catch (Zend_Db_Exception $e) {
- GemsEscort::getInstance()->logger->log($e->getMessage(), Zend_Log::ERR);
- // Fall through as this does not work if the database upgrade did not run
- // MUtil_Echo::r($e);
-
- }
+ $this->makeNewStaffUser($login_name, $organization, $password);
}
}
/**
+ * Return true if the password can be set.
+ *
+ * Returns the setting for the definition whan no user is passed, otherwise
+ * returns the answer for this specific user.
+ *
+ * @param Gems_User_User $user Optional, the user whose password might change
+ * @return boolean
+ */
+ public function canSetPassword(Gems_User_User $user = null)
+ {
+ return true;
+ }
+
+ /**
* Returns an initialized Zend_Auth_Adapter_Interface
*
* @param string $username
@@ -213,8 +184,81 @@
* @param string $password
* @return string
*/
+ protected function hashNewPassword($password)
+ {
+ return $this->project->getValueHash($password);
+ }
+
+ /**
+ * Allow overruling of password hashing.
+ *
+ * @param string $password
+ * @return string
+ */
protected function hashPassword($password)
{
return md5($password);
}
+
+ protected function makeNewStaffUser($login_name, $organization, $password)
+ {
+ $userData = $this->getUserData($login_name, $organization);
+ $staff_id = $userData['user_id'];
+
+ $sql = 'SELECT gul_id_user FROM gems__user_logins WHERE gul_can_login = 1 AND gul_login = ? AND gul_id_organization = ?';
+
+ try {
+ $user_id = $this->db->fetchOne($sql, array($login_name, $organization));
+
+ $currentTimestamp = new Zend_Db_Expr('CURRENT_TIMESTAMP');
+
+ // Move to USER_STAFF
+ $values['gup_id_user'] = $user_id;
+ $values['gup_password'] = $this->hashNewPassword($password);
+ $values['gup_reset_key'] = null;
+ $values['gup_reset_requested'] = null;
+ $values['gup_reset_required'] = 0;
+ $values['gup_changed'] = $currentTimestamp ;
+ $values['gup_changed_by'] = $staff_id;
+ $values['gup_created'] = $currentTimestamp ;
+ $values['gup_created_by'] = $staff_id;
+
+ $this->db->insert('gems__user_passwords', $values);
+
+ // Update user class
+ $values = array();
+ $values['gul_user_class'] = Gems_User_UserLoader::USER_STAFF;
+ $values['gul_changed'] = $currentTimestamp ;
+ $values['gul_changed_by'] = $staff_id;
+ $this->db->update('gems__user_logins', $values, $this->db->quoteInto('gul_id_user = ?', $user_id));
+
+ // Remove old password
+ $values = array();
+ $values['gsf_password'] = null;
+ $values['gsf_changed'] = $currentTimestamp ;
+ $values['gsf_changed_by'] = $user_id;
+
+ $this->db->update('gems__staff', $values, $this->db->quoteInto('gsf_id_user = ?', $staff_id));
+
+ } catch (Zend_Db_Exception $e) {
+ GemsEscort::getInstance()->logger->log($e->getMessage(), Zend_Log::ERR);
+ // Fall through as this does not work if the database upgrade did not run
+ // MUtil_Echo::r($e);
+
+ }
+ }
+
+ /**
+ * Set the password, if allowed for this user type.
+ *
+ * @param Gems_User_User $user The user whose password to change
+ * @param string $password
+ * @return Gems_User_UserDefinitionInterface (continuation pattern)
+ */
+ public function setPassword(Gems_User_User $user, $password)
+ {
+ $this->makeNewStaffUser($user->getLoginName(), $user->getBaseOrganizationId(), $password);
+
+ return $this;
+ }
}
\ No newline at end of file
Modified: trunk/library/classes/Gems/User/UserLoader.php
===================================================================
--- trunk/library/classes/Gems/User/UserLoader.php 2012-03-22 15:42:31 UTC (rev 561)
+++ trunk/library/classes/Gems/User/UserLoader.php 2012-03-22 16:35:44 UTC (rev 562)
@@ -225,7 +225,7 @@
if (! self::$currentUser) {
if ($this->session->__isset('__user_definition')) {
$defName = $this->session->__get('__user_definition');
- self::$currentUser = $this->_loadClass('User', true, array($this->session, $this->_getClass($defName)));
+ self::$currentUser = $this->_loadClass('User', true, array($this->session, $this->_getClass($defName . 'Definition')));
} else {
self::$currentUser = $this->getUser(null, null);
self::$currentUser->setAsCurrentUser();
@@ -295,13 +295,12 @@
*/
public function getUser($login_name, $currentOrganization)
{
- list($defName, $userOrganization, $userName) = $this->getUserClassInfo($login_name, $currentOrganization);
- $user = $this->loadUser($defName, $userOrganization, $userName);
+ $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])) {
- $user = $this->loadUser(self::USER_NOLOGIN . 'Definition', $currentOrganization, $login_name);
+ $user = $this->loadUser(self::USER_NOLOGIN, $currentOrganization, $login_name);
}
$user->setCurrentOrganization($currentOrganization);
@@ -332,15 +331,15 @@
*
* @param string $login_name
* @param int $organization
- * @return array Containing definitionName, organizationId, (real) userName
+ * @return Gems_User_User But ! ->isActive when the user does not exist
*/
- protected function getUserClassInfo($login_name, $organization)
+ protected function getUserClass($login_name, $organization)
{
if ((null == $login_name) || (null == $organization)) {
- return array(self::USER_NOLOGIN . 'Definition', $organization, $login_name);
+ return $this->loadUser(self::USER_NOLOGIN, $organization, $login_name);
}
if ($this->isProjectUser($login_name)) {
- return array(self::USER_PROJECT . 'Definition', $organization, $login_name);
+ return $this->loadUser(self::USER_PROJECT, $organization, $login_name);
}
try {
@@ -348,7 +347,7 @@
if ($row = $this->db->fetchRow($select, null, Zend_Db::FETCH_NUM)) {
// MUtil_Echo::track($row);
- return $row;
+ return $this->loadUser($row[0], $row[1], $row[2]);
}
} catch (Zend_Db_Exception $e) {
@@ -363,7 +362,7 @@
gems__organizations ON gsf_id_organization = gor_id_organization
WHERE gor_active = 1 AND gsf_active = 1 AND gsf_login = ? AND gsf_id_organization = ?";
- if ($user_id = $this->db->fetchOne($sql, $params)) {
+ if ($user_id = $this->db->fetchOne($sql, array($login_name, $organization))) {
// Move user to new staff.
$values['gul_login'] = $login_name;
$values['gul_id_organization'] = $organization;
@@ -381,10 +380,10 @@
// MUtil_Echo::r($e);
}
- return array(self::USER_OLD_STAFF . 'Definition', $organization, $login_name);
+ return $this->loadUser(self::USER_OLD_STAFF, $organization, $login_name);
}
- return array(self::USER_NOLOGIN . 'Definition', $organization, $login_name);
+ return $this->loadUser(self::USER_NOLOGIN, $organization, $login_name);
}
/**
@@ -398,7 +397,7 @@
{
$select = $this->db->select();
- $select->from('gems__user_logins', array("CONCAT(gul_user_class, 'Definition')", 'gul_id_organization', 'gul_login'))
+ $select->from('gems__user_logins', array("gul_user_class", 'gul_id_organization', 'gul_login'))
->from('gems__organizations', array())
->where('gor_active = 1')
->where('gul_can_login = 1')
@@ -433,7 +432,7 @@
*/
public function getUserDefinition($userClassName)
{
- $definition = $this->_getClass($userClassName);
+ $definition = $this->_getClass($userClassName . 'Definition');
return $definition;
}
Modified: trunk/library/snippets/Organization/OrganizationEditSnippet.php
===================================================================
--- trunk/library/snippets/Organization/OrganizationEditSnippet.php 2012-03-22 15:42:31 UTC (rev 561)
+++ trunk/library/snippets/Organization/OrganizationEditSnippet.php 2012-03-22 16:35:44 UTC (rev 562)
@@ -95,7 +95,7 @@
$model->set('gor_accessible_by', 'multiOptions', $multiOptions);
}
$this->addItems($bridge, 'gor_has_login', 'gor_add_respondents', 'gor_respondent_group', 'gor_accessible_by');
-
+
//Show what organizations we can access
if (isset($this->formData['gor_id_organization']) && !empty($this->formData['gor_id_organization'])) {
$org = $this->loader->getOrganization($this->formData['gor_id_organization']);
@@ -109,8 +109,7 @@
$this->addItems($bridge, 'gor_user_class');
if (isset($this->formData['gor_user_class']) && !empty($this->formData['gor_user_class'])) {
- $class = $this->formData['gor_user_class'] . 'Definition';
- $definition = $this->loader->getUserLoader()->getUserDefinition($class);
+ $definition = $this->loader->getUserLoader()->getUserDefinition($this->formData['gor_user_class']);
if ($definition instanceof Gems_User_UserDefinitionConfigurableInterface && $definition->hasConfig()) {
$definition->appendConfigFields($bridge);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-22 15:42:42
|
Revision: 561
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=561&view=rev
Author: matijsdejong
Date: 2012-03-22 15:42:31 +0000 (Thu, 22 Mar 2012)
Log Message:
-----------
Moved ChangePasswordForm.php to separate Form
Reset password action/button for StaffAction instead of staff in-Form password edit
new AutoLoadFormAbstract.php
Updated translations
Modified Paths:
--------------
trunk/library/classes/Gems/Default/OptionAction.php
trunk/library/classes/Gems/Default/StaffAction.php
trunk/library/classes/Gems/Form.php
trunk/library/classes/Gems/Menu/MenuAbstract.php
trunk/library/classes/Gems/Menu.php
trunk/library/classes/Gems/User/Form/LoginForm.php
trunk/library/classes/Gems/User/User.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/Form/AutoLoadFormAbstract.php
trunk/library/classes/Gems/User/Form/ChangePasswordForm.php
Modified: trunk/library/classes/Gems/Default/OptionAction.php
===================================================================
--- trunk/library/classes/Gems/Default/OptionAction.php 2012-03-22 11:04:04 UTC (rev 560)
+++ trunk/library/classes/Gems/Default/OptionAction.php 2012-03-22 15:42:31 UTC (rev 561)
@@ -75,6 +75,8 @@
{
$user = $this->loader->getCurrentUser();
+ $this->html->h3($this->_('Change password'));
+
if (! $user->canSetPassword()) {
$this->addMessage($this->_('You are not allowed to change your password.'));
return;
@@ -83,59 +85,27 @@
/*************
* Make form *
*************/
- $form = $user->getPasswordChangeForm();
+ $form = $user->getChangePasswordForm(array('showReport' => false));
- // Show password info
- if ($info = $user->reportPasswordWeakness()) {
- $element = new MUtil_Form_Element_Html('rules');
- $element->setLabel($this->_('Password rules'));
-
- if (1 == count($info)) {
- $element->div(sprintf($this->_('A password %s.'), reset($info)));
- } else {
- foreach ($info as &$line) {
- $line .= ',';
- }
- $line[strlen($line) - 1] = '.';
-
- $element->div($this->_('A password:'))->ul($info);
- }
- $form->addElement($element);
- }
-
/****************
* Process form *
****************/
if ($this->_request->isPost() && $form->isValid($_POST, false)) {
- $user->setPassword($_POST['new_password']);
-
$this->addMessage($this->_('New password is active.'));
$this->_reroute(array($this->getRequest()->getActionKey() => 'edit'));
-
} else {
- if (isset($_POST['old_password'])) {
- if ($_POST['old_password'] === strtoupper($_POST['old_password'])) {
- $this->addMessage($this->_('Caps Lock seems to be on!'));
- }
- }
- $form->populate($_POST);
+ $this->addMessage($form->getErrorMessages());
}
/****************
* Display form *
****************/
- $table = new MUtil_Html_TableElement(array('class' => 'formTable'));
- $table->setAsFormLayout($form, true, true);
- $table['tbody'][0][0]->class = 'label'; // Is only one row with formLayout, so all in output fields get class.
-
if ($user->isPasswordResetRequired()) {
$this->menu->setVisible(false);
- } elseif ($links = $this->createMenuLinks()) {
- $table->tf(); // Add empty cell, no label
- $linksCell = $table->tf($links);
+ } else {
+ $form->addButtons($this->createMenuLinks());
}
- $this->html->h3($this->_('Change password'));
$this->html[] = $form;
}
Modified: trunk/library/classes/Gems/Default/StaffAction.php
===================================================================
--- trunk/library/classes/Gems/Default/StaffAction.php 2012-03-22 11:04:04 UTC (rev 560)
+++ trunk/library/classes/Gems/Default/StaffAction.php 2012-03-22 15:42:31 UTC (rev 561)
@@ -1,4 +1,5 @@
<?php
+
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
@@ -103,22 +104,9 @@
}
$dbLookup = $this->util->getDbLookup();
- $passwordField = false;
-
- //@@TODO Like this? should work when user is not saved, but storing the password should be done when
- //we do have a user...
- $definition = $this->loader->getUserLoader()->getUserDefinition($data['gul_user_class'].'Definition');
-
- if ($definition->canSetPassword()) {
- $passwordField = 'fld_password';
- }
-
$model->set('gsf_id_primary_group', 'multiOptions', MUtil_Lazy::call($dbLookup->getAllowedStaffGroups));
if ($new) {
$model->set('gsf_id_primary_group', 'default', $dbLookup->getDefaultGroup());
- } elseif ($passwordField) {
- $model->set($passwordField, 'description', $this->_('Enter only when changing'));
- $model->setSaveWhenNotNull($passwordField);
}
$ucfirst = new Zend_Filter_Callback('ucfirst');
@@ -129,12 +117,12 @@
//@@TODO: Think of a better way to allow multiple methods per organization
if ($this->escort->hasPrivilege('pr.staff.edit.all')) {
$model->set('gul_user_class', 'label', $this->_('User Definition'));
-
+
//Make sure old or experimental userdefinitions don't have to be changed to something that is
//allowed at the moment. For example the oldStaffUser can stay when editing a user.
$options = $model->get('gul_user_class', 'multiOptions');
- if (!array_key_exists($data['gul_user_class'], $options)) {
- $options[$data['gul_user_class']] = $this->_('Unsupported UserDefinition');
+ if (! array_key_exists($data['gul_user_class'], $options)) {
+ $options[$data['gul_user_class']] = $this->_('Unsupported User Definition');
$model->set('gul_user_class', 'multiOptions', $options);
}
$bridge->add('gul_user_class');
@@ -154,19 +142,6 @@
$bridge->addExhibitor('gsf_id_organization');
}
- if ($passwordField) {
- $pwdElem = $bridge->addPassword($passwordField,
- 'label', $this->_('Password'),
- // 'renderPassword', true,
- 'repeatLabel', $this->_('Repeat password'),
- 'required', $new,
- 'size', 15
- );
-
- if ($user instanceof Gems_User_User) {
- $pwdElem->addValidator(new Gems_User_UserNewPasswordValidator($user));
- }
- }
$bridge->addRadio( 'gsf_gender', 'separator', '');
$bridge->addText( 'gsf_first_name', 'label', $this->_('First name'));
$bridge->addFilter( 'gsf_first_name', $ucfirst);
@@ -212,7 +187,7 @@
public function createAction()
{
$this->html->h3(sprintf($this->_('New %s...'), $this->getTopic()));
-
+
$confirmed = $this->getRequest()->getParam('confirmed');
$id = $this->getRequest()->getParam('id');
if (!is_null($confirmed)) {
@@ -364,7 +339,7 @@
if (!isset($filter['gsf_id_organization']) || empty($filter['gsf_id_organization'])) {
$filter['gsf_id_organization'] = $this->loader->getCurrentUser()->getCurrentOrganizationId();
}
-
+
return $filter;
}
@@ -407,7 +382,7 @@
//Make sure the menu always has the gsd_id_organization parameter
$orgId = $this->getRequest()->getParam('gsf_id_organization');
-
+
if (is_null($orgId)) {
//Get the selected gsf_id_organization used in the index
$dataIdx = $this->getCachedRequestData(true, 'index', true);
@@ -416,4 +391,46 @@
$this->menu->getParameterSource()->offsetSet('gsf_id_organization', $orgId);
}
+
+ /**
+ * Action to allow password reset
+ */
+ public function resetAction()
+ {
+ $staff_id = $this->_getIdParam();
+ $user = $this->loader->getUserLoader()->getUserByStaffId($staff_id);
+
+ $this->html->h3(sprintf($this->_('Reset password for: %s'), $user->getFullName()));
+
+ if (! $user->canSetPassword()) {
+ $this->addMessage($this->_('You are not allowed to change this password.'));
+ return;
+ }
+
+ /*************
+ * Make form *
+ *************/
+ $form = $user->getChangePasswordForm(array('askOld' => false));
+
+ /****************
+ * Process form *
+ ****************/
+ if ($this->_request->isPost() && $form->isValid($_POST, false)) {
+ $this->addMessage($this->_('New password is active.'));
+ $this->_reroute(array($this->getRequest()->getActionKey() => 'show'));
+ } else {
+ $this->addMessage($form->getErrorMessages());
+ }
+
+ /****************
+ * Display form *
+ ****************/
+ if ($user->isPasswordResetRequired()) {
+ $this->menu->setVisible(false);
+ } else {
+ $form->addButtons($this->createMenuLinks());
+ }
+
+ $this->html[] = $form;
+ }
}
Added: trunk/library/classes/Gems/Form/AutoLoadFormAbstract.php
===================================================================
--- trunk/library/classes/Gems/Form/AutoLoadFormAbstract.php (rev 0)
+++ trunk/library/classes/Gems/Form/AutoLoadFormAbstract.php 2012-03-22 15:42:31 UTC (rev 561)
@@ -0,0 +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 <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Form
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Adds default element loading to standard form
+ *
+ * @package Gems
+ * @subpackage Form
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5.3
+ */
+abstract class Gems_Form_AutoLoadFormAbstract extends Gems_Form
+{
+ /**
+ * When true all elements are loaded after initiation.
+ *
+ * @var boolean
+ */
+ protected $loadDefault = true;
+
+ /**
+ * Should be called after answering the request to allow the Target
+ * to check if all required registry values have been set correctly.
+ *
+ * @return boolean False if required values are missing.
+ */
+ public function checkRegistryRequestsAnswers()
+ {
+ if ($this->loadDefault) {
+ $this->loadDefaultElements();
+ }
+
+ return true;
+ }
+
+ /**
+ * When true all elements are loaded after initiation.
+ *
+ * @return boolean $loadDefault
+ */
+ public function getLoadDefault($loadDefault = true)
+ {
+ return $this->loadDefault;
+ }
+
+ /**
+ * The function loads the elements for this form
+ *
+ * @return Gems_Form_AutoLoadFormAbstract (continuation pattern)
+ */
+ abstract public function loadDefaultElements();
+
+ /**
+ * When true all elements are loaded after initiation.
+ *
+ * Enables loading of parameter through Zend_Form::__construct()
+ *
+ * @param boolean $loadDefault
+ * @return Gems_User_Form_LoginForm (continuation pattern)
+ */
+ public function setLoadDefault($loadDefault = true)
+ {
+ $this->loadDefault = $loadDefault;
+
+ return $this;
+ }
+}
Modified: trunk/library/classes/Gems/Form.php
===================================================================
--- trunk/library/classes/Gems/Form.php 2012-03-22 11:04:04 UTC (rev 560)
+++ trunk/library/classes/Gems/Form.php 2012-03-22 15:42:31 UTC (rev 561)
@@ -1,4 +1,5 @@
<?php
+
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
@@ -33,7 +34,7 @@
*/
/**
- * Base form class
+ * Base form class with extensions for correct load paths, autosubmit forms and registry use.
*
* @package Gems
* @subpackage Form
Modified: trunk/library/classes/Gems/Menu/MenuAbstract.php
===================================================================
--- trunk/library/classes/Gems/Menu/MenuAbstract.php 2012-03-22 11:04:04 UTC (rev 560)
+++ trunk/library/classes/Gems/Menu/MenuAbstract.php 2012-03-22 15:42:31 UTC (rev 561)
@@ -386,13 +386,14 @@
$page->addAutofilterAction();
$createPage = $page->addCreateAction();
$page->addShowAction();
- $editPage = $page->addEditAction();
- $delPage = $page->addDeleteAction();
+ $pages[] = $page->addEditAction();
+ $pages[] = $page->addAction($this->_('Reset password'), 'pr.staff.edit', 'reset')->setModelParameters(1);
+ $pages[] = $page->addDeleteAction();
if (! $this->escort->hasPrivilege('pr.staff.edit.all')) {
$filter = array_keys($this->escort->loader->getCurrentUser()->getAllowedOrganizations());
- $createPage->setParameterFilter('gsf_id_organization', $filter);
- $editPage->setParameterFilter('gsf_id_organization', $filter);
- $delPage->setParameterFilter('gsf_id_organization', $filter);
+ foreach ($pages as $sub_page) {
+ $sub_page->setParameterFilter('gsf_id_organization', $filter);
+ }
}
return $page;
Modified: trunk/library/classes/Gems/Menu.php
===================================================================
--- trunk/library/classes/Gems/Menu.php 2012-03-22 11:04:04 UTC (rev 560)
+++ trunk/library/classes/Gems/Menu.php 2012-03-22 15:42:31 UTC (rev 561)
@@ -203,7 +203,7 @@
$setup->addBrowsePage($this->_('Organizations'),'pr.organization', 'organization');
// STAFF CONTROLLER
- $setup->addStaffPage($this->_('Staff'));
+ $page = $setup->addStaffPage($this->_('Staff'));
// LOG CONTROLLER
$page = $setup->addPage($this->_('Logging'), 'pr.log', 'log', 'index');
Added: trunk/library/classes/Gems/User/Form/ChangePasswordForm.php
===================================================================
--- trunk/library/classes/Gems/User/Form/ChangePasswordForm.php (rev 0)
+++ trunk/library/classes/Gems/User/Form/ChangePasswordForm.php 2012-03-22 15:42:31 UTC (rev 561)
@@ -0,0 +1,414 @@
+<?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: LoginForm.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
+ */
+class Gems_User_Form_ChangePasswordForm extends Gems_Form_AutoLoadFormAbstract
+{
+ /**
+ * The field name for the new password element.
+ *
+ * @var string
+ */
+ protected $_newPasswordFieldName = 'new_password';
+
+ /**
+ * The field name for the old password element.
+ *
+ * @var string
+ */
+ protected $_oldPasswordFieldName = 'old_password';
+
+ /**
+ * The field name for the repeat password element.
+ *
+ * @var string
+ */
+ protected $_repeatPasswordFieldName = 'repeat_password';
+
+ /**
+ * The field name for the report rules element.
+ *
+ * @var string
+ */
+ protected $_reportRulesFieldName = 'report_rules';
+
+ /**
+ * The field name for the submit element.
+ *
+ * @var string
+ */
+ protected $_submitFieldName = 'submit';
+
+ /**
+ * Layout table
+ *
+ * @var MUtil_Html_TableElements
+ */
+ protected $_table;
+
+ /**
+ * Should the old password be requested.
+ *
+ * Calculated when null
+ *
+ * @var boolean
+ */
+ protected $askOld = null;
+
+ /**
+ * Should the password rules be reported.
+ *
+ * @var boolean
+ */
+ protected $reportRules = true;
+
+ /**
+ *
+ * @var Zend_Translate
+ */
+ protected $translate;
+
+ /**
+ *
+ * @var Gems_User_User
+ */
+ protected $user;
+
+ /**
+ * Use the default form table layout
+ *
+ * @var boolean
+ */
+ protected $useTableLayout = true;
+
+ public function addButtons($links)
+ {
+ if ($links && $this->_table) {
+ $this->_table->tf(); // Add empty cell, no label
+ $this->_table->tf($links);
+ }
+ }
+
+ /**
+ * Should the for asking for an old password
+ *
+ * @return boolean
+ */
+ public function getAskOld()
+ {
+ if (null === $this->askOld) {
+ // By default only ask for the old password if the user just entered
+ // it but is required to change it.
+ $this->askOld = (! $this->user->isPasswordResetRequired());
+ }
+
+ // Never ask for the old password if it does not exist
+ //
+ // A password does not always exist, e.g. when using embedded login in Pulse
+ // or after creating a new user.
+ return $this->askOld && $this->user->hasPassword();
+ }
+
+ /**
+ * Returns/sets a mew password element.
+ *
+ * @return Zend_Form_Element_Password
+ */
+ public function getNewPasswordElement()
+ {
+ $element = $this->getElement($this->_newPasswordFieldName);
+
+ if (! $element) {
+ // Field new password
+ $element = new Zend_Form_Element_Password($this->_newPasswordFieldName);
+ $element->setLabel($this->translate->_('New password'));
+ $element->setAttrib('size', 10);
+ $element->setAttrib('maxlength', 20);
+ $element->setRequired(true);
+ $element->setRenderPassword(true);
+ $element->addValidator(new Gems_User_UserNewPasswordValidator($this->user));
+ $element->addValidator(new MUtil_Validate_IsConfirmed($this->_repeatPasswordFieldName, $this->translate->_('Repeat password')));
+
+ $this->addElement($element);
+ }
+
+ return $element;
+ }
+
+ /**
+ * Returns/sets a check old password element.
+ *
+ * @return Zend_Form_Element_Password
+ */
+ public function getOldPasswordElement()
+ {
+ $element = $this->getElement($this->_oldPasswordFieldName);
+
+ if (! $element) {
+ // Field current password
+ $element = new Zend_Form_Element_Password($this->_oldPasswordFieldName);
+ $element->setLabel($this->translate->_('Current password'));
+ $element->setAttrib('size', 10);
+ $element->setAttrib('maxlength', 20);
+ $element->setRenderPassword(true);
+ $element->setRequired(true);
+ $element->addValidator(new Gems_User_UserPasswordValidator($this->user, $this->translate));
+
+ $this->addElement($element);
+ }
+
+ return $element;
+ }
+
+ /**
+ * Returns/sets a repeat password element.
+ *
+ * @return Zend_Form_Element_Password
+ */
+ public function getRepeatPasswordElement()
+ {
+ $element = $this->getElement($this->_repeatPasswordFieldName);
+
+ if (! $element) {
+ // Field repeat password
+ $element = new Zend_Form_Element_Password($this->_repeatPasswordFieldName);
+ $element->setLabel($this->translate->_('Repeat password'));
+ $element->setAttrib('size', 10);
+ $element->setAttrib('maxlength', 20);
+ $element->setRequired(true);
+ $element->setRenderPassword(true);
+ $element->addValidator(new MUtil_Validate_IsConfirmed($this->_newPasswordFieldName, $this->translate->_('New password')));
+
+ $this->addElement($element);
+ }
+
+ return $element;
+ }
+
+ /**
+ * Returns/sets an element showing the password rules
+ *
+ * @return MUtil_Form_Element_Html
+ */
+ public function getReportRulesElement()
+ {
+ $element = $this->getElement($this->_reportRulesFieldName);
+
+ if (! $element) {
+ // Show password info
+ if ($info = $this->user->reportPasswordWeakness()) {
+ $element = new MUtil_Form_Element_Html($this->_reportRulesFieldName);
+ $element->setLabel($this->translate->_('Password rules'));
+
+ if (1 == count($info)) {
+ $element->div(sprintf($this->translate->_('A password %s.'), reset($info)));
+ } else {
+ foreach ($info as &$line) {
+ $line .= ';';
+ }
+ $line[strlen($line) - 1] = '.';
+
+ $element->div($this->translate->_('A password:'))->ul($info);
+ }
+ $this->addElement($element);
+ }
+ }
+
+ return $element;
+ }
+
+ /**
+ * 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->_('Save') : $label);
+ $element->setAttrib('class', 'button');
+
+ $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)
+ {
+ $valid = parent::isValid($data, $disableTranslateValidators);
+
+ if ($valid) {
+ $this->user->setPassword($data['new_password']);
+
+ } else {
+ if ($this ->getAskOld() && isset($data['old_password'])) {
+ if ($data['old_password'] === strtoupper($data['old_password'])) {
+ $this->addError($this->translate->_('Caps Lock seems to be on!'));
+ }
+ }
+ $this->populate($data);
+ }
+
+ return $valid;
+ }
+
+ /**
+ * The function that determines the element load order
+ *
+ * @return Gems_User_Form_LoginForm (continuation pattern)
+ */
+ public function loadDefaultElements()
+ {
+ if ($this->getAskOld()) {
+ $this->getOldPasswordElement();
+ }
+ $this->getNewPasswordElement();
+ $this->getRepeatPasswordElement();
+ $this->getSubmitButton();
+
+ if ($this->reportRules) {
+ $this->getReportRulesElement();
+ }
+ if ($this->useTableLayout) {
+ /****************
+ * Display form *
+ ****************/
+ $this->_table = new MUtil_Html_TableElement(array('class' => 'formTable'));
+ $this->_table->setAsFormLayout($this, true, true);
+ $this->_table['tbody'][0][0]->class = 'label'; // Is only one row with formLayout, so all in output fields get class.
+ }
+
+ return $this;
+ }
+
+ /**
+ * Should the form ask for an old password
+ *
+ * Enables loading of parameter through Zend_Form::__construct()
+ *
+ * @param boolean $askOld
+ * @return Gems_User_Form_ChangePasswordForm (continuation pattern)
+ */
+ public function setAskOld($askOld = true)
+ {
+ $this->askOld = $askOld;
+
+ return $this;
+ }
+
+ /**
+ * Should the form report the password rules
+ *
+ * Enables loading of parameter through Zend_Form::__construct()
+ *
+ * @param boolean $reportRules
+ * @return Gems_User_Form_ChangePasswordForm (continuation pattern)
+ */
+ public function setReportRules($reportRules = true)
+ {
+ $this->reportRules = $reportRules;
+
+ return $this;
+ }
+
+ /**
+ * The user to change the password for
+ *
+ * Enables loading of parameter through Zend_Form::__construct()
+ *
+ * @param Gems_User_User $user
+ * @return Gems_User_Form_ChangePasswordForm (continuation pattern)
+ */
+ public function setUser(Gems_User_User $user)
+ {
+ $this->user = $user;
+
+ return $this;
+ }
+
+ /**
+ * Should the form report use the default form table layout
+ *
+ * Enables loading of parameter through Zend_Form::__construct()
+ *
+ * @param boolean $useTableLayout
+ * @return Gems_User_Form_ChangePasswordForm (continuation pattern)
+ */
+ public function setUseTableLayout($useTableLayout = true)
+ {
+ $this->useTableLayout = $useTableLayout;
+
+ return $this;
+ }
+
+ /**
+ * True when this form was submitted.
+ *
+ * @return boolean
+ */
+ public function wasSubmitted()
+ {
+ return $this->getSubmitButton()->isChecked();
+ }
+}
Modified: trunk/library/classes/Gems/User/Form/LoginForm.php
===================================================================
--- trunk/library/classes/Gems/User/Form/LoginForm.php 2012-03-22 11:04:04 UTC (rev 560)
+++ trunk/library/classes/Gems/User/Form/LoginForm.php 2012-03-22 15:42:31 UTC (rev 561)
@@ -44,7 +44,7 @@
* @license New BSD License
* @since Class available since version 1.5
*/
-class Gems_User_Form_LoginForm extends Gems_Form
+class Gems_User_Form_LoginForm extends Gems_Form_AutoLoadFormAbstract
{
/**
* The field name for the lost password element.
@@ -97,14 +97,7 @@
protected $_usernameFieldName = 'userlogin';
/**
- * When true all elements are loaded after initiation.
*
- * @var boolean
- */
- protected $loadDefault = true;
-
- /**
- *
* @var Gems_Loader
*/
protected $loader;
@@ -151,21 +144,6 @@
protected $util;
/**
- * 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()
- {
- if ($this->loadDefault) {
- $this->loadDefaultElements();
- }
-
- return true;
- }
-
- /**
* Returns the organization id that should currently be used for this form.
*
* @return int Returns the current organization id, if any
@@ -406,21 +384,6 @@
}
/**
- * When true all elements are loaded after initiation.
- *
- * Enables loading of parameter through Zend_Form::__construct()
- *
- * @param boolean $loadDefault
- * @return Gems_User_Form_LoginForm (continuation pattern)
- */
- public function setLoadDefault($loadDefault = true)
- {
- $this->loadDefault = $loadDefault;
-
- return $this;
- }
-
- /**
* 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
Modified: trunk/library/classes/Gems/User/User.php
===================================================================
--- trunk/library/classes/Gems/User/User.php 2012-03-22 11:04:04 UTC (rev 560)
+++ trunk/library/classes/Gems/User/User.php 2012-03-22 15:42:31 UTC (rev 561)
@@ -384,6 +384,21 @@
}
/**
+ * Returns a form to change the possword for this user.
+ *
+ * @param boolean $askOld Ask for the old password, calculated when not set.
+ * @return Gems_Form
+ */
+ public function getChangePasswordForm($args_array = null)
+ {
+ if (! $this->canSetPassword()) {
+ return;
+ }
+
+ return $this->userLoader->getChangePasswordForm($this, func_get_args());
+ }
+
+ /**
* Returns the organization that is currently used by this user.
*
* @return Gems_User_Organization
@@ -521,72 +536,6 @@
}
/**
- * Returns a form to change the possword for this user.
- *
- * @param boolean $askOld Ask for the old password, calculated when not set.
- * @return Gems_Form
- */
- public function getPasswordChangeForm($askOld = null)
- {
- if (! $this->canSetPassword()) {
- return;
- }
-
- if (null === $askOld) {
- // By default only ask for the old password if the user just entered
- // it but is required to change it.
- $askOld = (! $this->isPasswordResetRequired());
- }
-
- $form = new Gems_Form();
-
- // Never ask for the old password if it does not exist
- //
- // A password does not always exist, e.g. when using embedded login in Pulse
- // or after creating a new user.
- if ($askOld && $this->hasPassword()) {
- // Field current password
- $element = new Zend_Form_Element_Password('old_password');
- $element->setLabel($this->translate->_('Current password'));
- $element->setAttrib('size', 10);
- $element->setAttrib('maxlength', 20);
- $element->setRenderPassword(true);
- $element->setRequired(true);
- $element->addValidator(new Gems_User_UserPasswordValidator($this, $this->translate));
- $form->addElement($element);
- }
-
- // Field new password
- $element = new Zend_Form_Element_Password('new_password');
- $element->setLabel($this->translate->_('New password'));
- $element->setAttrib('size', 10);
- $element->setAttrib('maxlength', 20);
- $element->setRequired(true);
- $element->setRenderPassword(true);
- $element->addValidator(new Gems_User_UserNewPasswordValidator($this));
- $element->addValidator(new MUtil_Validate_IsConfirmed('repeat_password', $this->translate->_('Repeat password')));
- $form->addElement($element);
-
- // Field repeat password
- $element = new Zend_Form_Element_Password('repeat_password');
- $element->setLabel($this->translate->_('Repeat password'));
- $element->setAttrib('size', 10);
- $element->setAttrib('maxlength', 20);
- $element->setRequired(true);
- $element->setRenderPassword(true);
- $element->addValidator(new MUtil_Validate_IsConfirmed('new_password', $this->translate->_('New password')));
- $form->addElement($element);
-
- // Submit button
- $element = new Zend_Form_Element_Submit('submit');
- $element->setAttrib('class', 'button');
- $element->setLabel($this->translate->_('Save'));
- $form->addElement($element);
-
- return $form;
- }
-
- /**
* Return a password reset key
*
* @return string
Modified: trunk/library/classes/Gems/User/UserLoader.php
===================================================================
--- trunk/library/classes/Gems/User/UserLoader.php 2012-03-22 11:04:04 UTC (rev 560)
+++ trunk/library/classes/Gems/User/UserLoader.php 2012-03-22 15:42:31 UTC (rev 561)
@@ -200,6 +200,22 @@
}
/**
+ * Returns a change password form for this user
+ *
+ * @param Gems_user_User $user
+ * @param mixed $args_array MUtil_Ra::args array for LoginForm initiation.
+ * @return Gems_User_Form_ChangePasswordForm
+ */
+ public function getChangePasswordForm($user, $args_array = null)
+ {
+ $args = MUtil_Ra::args(func_get_args(), array('user' => 'Gems_User_User'));
+
+ $form = $this->_loadClass('Form_ChangePasswordForm', true, array($args));
+
+ return $form;
+ }
+
+ /**
* Get the currently loggin in user
*
* @return Gems_User_User
@@ -225,7 +241,7 @@
* @param mixed $args_array MUtil_Ra::args array for LoginForm initiation.
* @return Gems_User_Form_LoginForm
*/
- public function getLoginForm($args_array)
+ public function getLoginForm($args_array = null)
{
$args = MUtil_Ra::args(func_get_args());
@@ -372,7 +388,7 @@
}
/**
- * Returns a select statement to find a corresponding user.
+ * Returns a select statement to find a corresponding user.
*
* @param string $login_name
* @param int $organization
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-22 11:04:04 UTC (rev 560)
+++ trunk/library/languages/default-en.po 2012-03-22 15:42:31 UTC (rev 561)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse EN\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-03-16 16:16+0100\n"
+"POT-Creation-Date: 2012-03-22 16:35+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -1042,7 +1042,7 @@
msgstr "%s records found."
#: classes/Gems/Default/ExportAction.php:172
-#: classes/Gems/Default/IndexAction.php:203
+#: classes/Gems/Default/IndexAction.php:220
#: classes/Gems/Default/LogAction.php:197
msgid "Organization"
msgstr "Organization"
@@ -1082,84 +1082,84 @@
msgid "Enter your token..."
msgstr "Enter your token..."
-#: classes/Gems/Default/IndexAction.php:148
+#: classes/Gems/Default/IndexAction.php:157
#, php-format
msgid "Login to %s application"
msgstr "Login to %s application"
-#: classes/Gems/Default/IndexAction.php:152
+#: classes/Gems/Default/IndexAction.php:169
msgid "Login"
msgstr "Login"
-#: classes/Gems/Default/IndexAction.php:174
+#: classes/Gems/Default/IndexAction.php:191
msgid "Back to login"
msgstr "Back to login"
-#: classes/Gems/Default/IndexAction.php:227
+#: classes/Gems/Default/IndexAction.php:244
msgid "Password"
msgstr "Password"
-#: classes/Gems/Default/IndexAction.php:242
+#: classes/Gems/Default/IndexAction.php:259
#, php-format
msgid "Reset password for %s application"
msgstr "Reset password for %s application"
-#: classes/Gems/Default/IndexAction.php:246
+#: classes/Gems/Default/IndexAction.php:263
msgid "Reset password"
msgstr "Reset password"
-#: classes/Gems/Default/IndexAction.php:292
+#: classes/Gems/Default/IndexAction.php:309
msgid "Username"
msgstr "Username"
-#: classes/Gems/Default/IndexAction.php:358
+#: classes/Gems/Default/IndexAction.php:351
msgid "Your password must be changed."
msgstr "Your password must be changed."
-#: classes/Gems/Default/IndexAction.php:370
+#: classes/Gems/Default/IndexAction.php:363
#, php-format
msgid "Login successful, welcome %s."
msgstr "Login successful, welcome %s."
-#: classes/Gems/Default/IndexAction.php:410
+#: classes/Gems/Default/IndexAction.php:403
#, php-format
msgid "Good bye: %s."
msgstr "Good bye: %s."
-#: classes/Gems/Default/IndexAction.php:435
+#: classes/Gems/Default/IndexAction.php:428
msgid "Reset accepted, enter your new password."
msgstr "Reset accepted, enter your new password."
-#: classes/Gems/Default/IndexAction.php:439
+#: classes/Gems/Default/IndexAction.php:432
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:462
+#: classes/Gems/Default/IndexAction.php:455
msgid "Password reset requested"
msgstr "Password reset requested"
-#: classes/Gems/Default/IndexAction.php:463
+#: 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:468
+#: classes/Gems/Default/IndexAction.php:461
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:470
+#: classes/Gems/Default/IndexAction.php:463
msgid "Unable to send e-mail."
msgstr "Unable to send e-mail."
-#: classes/Gems/Default/IndexAction.php:475
+#: classes/Gems/Default/IndexAction.php:468
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:479
+#: classes/Gems/Default/IndexAction.php:472
msgid "We received your password reset key."
msgstr "We received your password reset key."
-#: classes/Gems/Default/IndexAction.php:480
+#: classes/Gems/Default/IndexAction.php:473
msgid "Please enter the organization and username belonging to this key."
msgstr "Please enter the organization and username belonging to this key."
@@ -1440,13 +1440,11 @@
#: classes/Gems/Default/MailServerAction.php:90
#: classes/Gems/Default/SourceAction.php:95
-#: classes/Gems/Default/StaffAction.php:161
msgid "Repeat password"
msgstr "Repeat password"
#: classes/Gems/Default/MailServerAction.php:91
#: classes/Gems/Default/SourceAction.php:74
-#: classes/Gems/Default/StaffAction.php:120
msgid "Enter only when changing"
msgstr "Enter only when changing the password"
@@ -1461,8 +1459,8 @@
msgstr "Email servers"
#: classes/Gems/Default/MailTemplateAction.php:76
-#: classes/Gems/Default/StaffAction.php:303
-#: classes/Gems/Default/StaffAction.php:336
+#: classes/Gems/Default/StaffAction.php:278
+#: classes/Gems/Default/StaffAction.php:311
msgid "(all organizations)"
msgstr "(all organizations)"
@@ -1476,56 +1474,40 @@
msgid "Email templates"
msgstr "Email templates"
-#: classes/Gems/Default/OptionAction.php:79
+#: classes/Gems/Default/OptionAction.php:81
msgid "You are not allowed to change your password."
msgstr "You are not allowed to change your password."
-#: classes/Gems/Default/OptionAction.php:91
-msgid "Password rules"
-msgstr "Password rules"
-
#: classes/Gems/Default/OptionAction.php:94
-#, php-format
-msgid "A password %s."
-msgstr "A password %s."
-
-#: classes/Gems/Default/OptionAction.php:101
-msgid "A password:"
-msgstr "A password:"
-
-#: classes/Gems/Default/OptionAction.php:112
+#: classes/Gems/Default/StaffAction.php:419
msgid "New password is active."
msgstr "New password is active."
-#: classes/Gems/Default/OptionAction.php:118
-msgid "Caps Lock seems to be on!"
-msgstr "Caps Lock seems to be on!"
-
-#: classes/Gems/Default/OptionAction.php:158
+#: classes/Gems/Default/OptionAction.php:128
msgid "Login Name"
msgstr "Login Name"
-#: classes/Gems/Default/OptionAction.php:165
+#: classes/Gems/Default/OptionAction.php:135
#: classes/Gems/Default/OrganizationAction.php:129
#: classes/Gems/Default/RespondentAction.php:175
-#: classes/Gems/Default/StaffAction.php:319
+#: classes/Gems/Default/StaffAction.php:294
msgid "Language"
msgstr "Language"
-#: classes/Gems/Default/OptionAction.php:175
+#: classes/Gems/Default/OptionAction.php:145
#, php-format
msgid "Options"
msgstr "Options"
-#: classes/Gems/Default/OptionAction.php:184
+#: classes/Gems/Default/OptionAction.php:154
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:204
+#: classes/Gems/Default/OptionAction.php:174
msgid "Date / time"
msgstr "Date / time"
-#: classes/Gems/Default/OptionAction.php:215
+#: classes/Gems/Default/OptionAction.php:185
msgid "Item"
msgstr "Item"
@@ -1624,7 +1606,7 @@
msgstr "This can not be changed yet"
#: classes/Gems/Default/OrganizationAction.php:166
-#: classes/Gems/Default/StaffAction.php:131
+#: classes/Gems/Default/StaffAction.php:119
msgid "User Definition"
msgstr "User Definition"
@@ -2135,45 +2117,54 @@
msgid "Synchronize all sources."
msgstr "Synchronize all sources."
-#: classes/Gems/Default/StaffAction.php:137
-msgid "Unsupported UserDefinition"
-msgstr "Unsupported UserDefinition"
+#: classes/Gems/Default/StaffAction.php:125
+msgid "Unsupported User Definition"
+msgstr "Unsupported User Definition"
-#: classes/Gems/Default/StaffAction.php:179
+#: classes/Gems/Default/StaffAction.php:154
msgid "Users can only login when this box is checked."
msgstr "Users can only login when this box is checked."
-#: classes/Gems/Default/StaffAction.php:180
+#: classes/Gems/Default/StaffAction.php:155
msgid "If checked the user will logoff when answering a survey."
msgstr "If checked the user will logoff when answering a survey."
-#: classes/Gems/Default/StaffAction.php:197
+#: classes/Gems/Default/StaffAction.php:172
msgid "You are not allowed to edit this staff member."
msgstr "You are not allowed to edit this staff member."
-#: classes/Gems/Default/StaffAction.php:254
+#: classes/Gems/Default/StaffAction.php:229
#, php-format
msgid "User with id %s already exists but is deleted, do you want to reactivate the account?"
msgstr "User with id %s already exists but is deleted, do you want to reactivate the account?"
-#: classes/Gems/Default/StaffAction.php:310
+#: classes/Gems/Default/StaffAction.php:285
msgid "Primary function"
msgstr "Primary function"
-#: classes/Gems/Default/StaffAction.php:320
+#: classes/Gems/Default/StaffAction.php:295
msgid "Can login"
msgstr "Can login"
-#: classes/Gems/Default/StaffAction.php:321
+#: classes/Gems/Default/StaffAction.php:296
msgid "Logout on survey"
msgstr "Logout on survey"
-#: classes/Gems/Default/StaffAction.php:396
+#: classes/Gems/Default/StaffAction.php:371
msgid "staff member"
msgid_plural "staff members"
msgstr[0] "staff member"
msgstr[1] "staff members"
+#: classes/Gems/Default/StaffAction.php:403
+#, php-format
+msgid "Reset password for: %s"
+msgstr "Reset password for: %s"
+
+#: classes/Gems/Default/StaffAction.php:406
+msgid "You are not allowed to change this password."
+msgstr "You are not allowed to change this password."
+
#: classes/Gems/Default/SurveyAction.php:64
msgid "Add survey"
msgstr "Add survey"
@@ -2866,41 +2857,41 @@
msgid "Clean cache"
msgstr "Clean cache"
-#: classes/Gems/Menu/MenuAbstract.php:415
+#: classes/Gems/Menu/MenuAbstract.php:416
msgid "Check status"
msgstr "Check status"
-#: classes/Gems/Menu/MenuAbstract.php:416
+#: classes/Gems/Menu/MenuAbstract.php:417
msgid "Synchronize surveys"
msgstr "Synchronize surveys"
-#: classes/Gems/Menu/MenuAbstract.php:417
-#: classes/Gems/Menu/MenuAbstract.php:429
+#: classes/Gems/Menu/MenuAbstract.php:418
+#: classes/Gems/Menu/MenuAbstract.php:430
msgid "Check answers"
msgstr "Check answers"
-#: classes/Gems/Menu/MenuAbstract.php:418
+#: classes/Gems/Menu/MenuAbstract.php:419
msgid "Check attributes"
msgstr "Check attributes"
-#: classes/Gems/Menu/MenuAbstract.php:419
+#: classes/Gems/Menu/MenuAbstract.php:420
msgid "Synchronize all surveys"
msgstr "Synchronize all surveys"
-#: classes/Gems/Menu/MenuAbstract.php:420
-#: classes/Gems/Menu/MenuAbstract.php:430
+#: classes/Gems/Menu/MenuAbstract.php:421
+#: classes/Gems/Menu/MenuAbstract.php:431
msgid "Check all answers"
msgstr "Check all answers"
-#: classes/Gems/Menu/MenuAbstract.php:426
+#: classes/Gems/Menu/MenuAbstract.php:427
msgid "PDF"
msgstr "PDF"
-#: classes/Gems/Menu/MenuAbstract.php:460
+#: classes/Gems/Menu/MenuAbstract.php:461
msgid "Check assignments"
msgstr "Check assignments"
-#: classes/Gems/Menu/MenuAbstract.php:463
+#: classes/Gems/Menu/MenuAbstract.php:464
msgid "Check all assignments"
msgstr "Check all assignments"
@@ -3106,11 +3097,13 @@
msgstr "Checked %d tokens."
#: classes/Gems/Task/Tracker/CheckTrackTokens.php:64
+#: classes/Gems/Tracker/ChangeTracker.php:81
#, php-format
msgid "%2$d token date changes in %1$d tracks."
msgstr "%2$d token date changes in %1$d tracks."
#: classes/Gems/Task/Tracker/CheckTrackTokens.php:67
+#: classes/Gems/Tracker/ChangeTracker.php:64
#, php-format
msgid "Checked %d tracks."
msgstr "Checked %d tracks."
@@ -3617,29 +3610,20 @@
msgid "may not contain numbers"
msgstr "may not contain numbers"
-#: classes/Gems/User/RadiusUserDefinition.php:175
+#: classes/Gems/User/RadiusUserDefinition.php:178
msgid "Shared secret"
msgstr "Shared secret"
-#: classes/Gems/User/User.php:538
-msgid "Current password"
-msgstr "Current password"
-
-#: classes/Gems/User/User.php:549
-#: classes/Gems/User/User.php:565
-msgid "New password"
-msgstr "New password"
-
-#: classes/Gems/User/User.php:893
+#: classes/Gems/User/User.php:843
msgid "Cookies must be enabled for this site."
msgstr "Cookies must be enabled for this site."
-#: classes/Gems/User/UserLoader.php:169
-#: classes/Gems/User/UserLoader.php:183
+#: classes/Gems/User/UserLoader.php:181
+#: classes/Gems/User/UserLoader.php:195
msgid "Db storage"
msgstr "Db storage"
-#: classes/Gems/User/UserLoader.php:184
+#: classes/Gems/User/UserLoader.php:196
msgid "Radius storage"
msgstr "Radius storage"
@@ -3647,6 +3631,32 @@
msgid "Wrong password."
msgstr "Wrong password."
+#: classes/Gems/User/Form/ChangePasswordForm.php:166
+#: classes/Gems/User/Form/ChangePasswordForm.php:222
+msgid "New password"
+msgstr "New password"
+
+#: classes/Gems/User/Form/ChangePasswordForm.php:192
+msgid "Current password"
+msgstr "Current password"
+
+#: classes/Gems/User/Form/ChangePasswordForm.php:243
+msgid "Password rules"
+msgstr "Password rules"
+
+#: classes/Gems/User/Form/ChangePasswordForm.php:246
+#, php-format
+msgid "A password %s."
+msgstr "A password %s."
+
+#: classes/Gems/User/Form/ChangePasswordForm.php:253
+msgid "A password:"
+msgstr "A password:"
+
+#: classes/Gems/User/Form/ChangePasswordForm.php:307
+msgid "Caps Lock seems to be on!"
+msgstr "Caps Lock seems to be on!"
+
#: classes/Gems/Util/ReceptionCodeLibrary.php:100
msgid "Yes (forget answers)"
msgstr "Yes (forget answers)"
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-22 11:04:04 UTC (rev 560)
+++ trunk/library/languages/default-nl.po 2012-03-22 15:42:31 UTC (rev 561)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse NL\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-03-16 16:15+0100\n"
+"POT-Creation-Date: 2012-03-22 16:35+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -1042,7 +1042,7 @@
msgstr "%s records gevonden."
#: classes/Gems/Default/ExportAction.php:172
-#: classes/Gems/Default/IndexAction.php:203
+#: classes/Gems/Default/IndexAction.php:220
#: classes/Gems/Default/LogAction.php:197
msgid "Organization"
msgstr "Organisatie"
@@ -1082,84 +1082,84 @@
msgid "Enter your token..."
msgstr "Voer uw kenmerk in..."
-#: classes/Gems/Default/IndexAction.php:148
+#: classes/Gems/Default/IndexAction.php:157
#, php-format
msgid "Login to %s application"
msgstr "%s login"
-#: classes/Gems/Default/IndexAction.php:152
+#: classes/Gems/Default/IndexAction.php:169
msgid "Login"
msgstr "Inloggen"
-#: classes/Gems/Default/IndexAction.php:174
+#: classes/Gems/Default/IndexAction.php:191
msgid "Back to login"
msgstr "Terug naar de login"
-#: classes/Gems/Default/IndexAction.php:227
+#: classes/Gems/Default/IndexAction.php:244
msgid "Password"
msgstr "Wachtwoord"
-#: classes/Gems/Default/IndexAction.php:242
+#: classes/Gems/Default/IndexAction.php:259
#, php-format
msgid "Reset password for %s application"
msgstr "Reset wachtwoord voor %s"
-#: classes/Gems/Default/IndexAction.php:246
+#: classes/Gems/Default/IndexAction.php:263
msgid "Reset password"
msgstr "Reset wachtwoord"
-#: classes/Gems/Default/IndexAction.php:292
+#: classes/Gems/Default/IndexAction.php:309
msgid "Username"
msgstr "Gebruikersnaam"
-#: classes/Gems/Default/IndexAction.php:358
+#: classes/Gems/Default/IndexAction.php:351
msgid "Your password must be changed."
msgstr "Uw wachtwoord moet veranderd worden."
-#: classes/Gems/Default/IndexAction.php:370
+#: classes/Gems/Default/IndexAction.php:363
#, php-format
msgid "Login successful, welcome %s."
msgstr "Login in orde, welkom %s."
-#: classes/Gems/Default/IndexAction.php:410
+#: classes/Gems/Default/IndexAction.php:403
#, php-format
msgid "Good bye: %s."
msgstr "Tot ziens: %s."
-#: classes/Gems/Default/IndexAction.php:435
+#: classes/Gems/Default/IndexAction.php:428
msgid "Reset accepted, enter your new password."
msgstr "Reset geaccepteerd, voer uw nieuwe wachtwoord in."
-#: classes/Gems/Default/IndexAction.php:439
+#: classes/Gems/Default/IndexAction.php:432
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:462
+#: classes/Gems/Default/IndexAction.php:455
msgid "Password reset requested"
msgstr "Wachtwoord reset aangevraagd"
-#: classes/Gems/Default/IndexAction.php:463
+#: classes/Gems/Default/IndexAction.php:456
#, php-format
msgid "To reset your password for %s, please click this link: %s"
msgstr "Om uw wachtwoord voor %s te resetten, klik op deze link: %s"
-#: classes/Gems/Default/IndexAction.php:468
+#: classes/Gems/Default/IndexAction.php:461
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:470
+#: classes/Gems/Default/IndexAction.php:463
msgid "Unable to send e-mail."
msgstr "Verzenden e-mail mislukt."
-#: classes/Gems/Default/IndexAction.php:475
+#: classes/Gems/Default/IndexAction.php:468
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:479
+#: classes/Gems/Default/IndexAction.php:472
msgid "We received your password reset key."
msgstr "Wachtwoord resetsleutel ontvangen."
-#: classes/Gems/Default/IndexAction.php:480
+#: classes/Gems/Default/IndexAction.php:473
msgid "Please enter the organization and username belonging to this key."
msgstr "Geef de organisatie en gebruikersnaam die bij deze sleutel horen op."
@@ -1440,13 +1440,11 @@
#: classes/Gems/Default/MailServerAction.php:90
#: classes/Gems/Default/SourceAction.php:95
-#: classes/Gems/Default/StaffAction.php:161
msgid "Repeat password"
msgstr "Herhaal wachtwoord"
#: classes/Gems/Default/MailServerAction.php:91
#: classes/Gems/Default/SourceAction.php:74
-#: classes/Gems/Default/StaffAction.php:120
msgid "Enter only when changing"
msgstr "Alleen invoeren om het wachtwoord te wijzigen"
@@ -1461,8 +1459,8 @@
msgstr "Email servers"
#: classes/Gems/Default/MailTemplateAction.php:76
-#: classes/Gems/Default/StaffAction.php:303
-#: classes/Gems/Default/StaffAction.php:336
+#: classes/Gems/Default/StaffAction.php:278
+#: classes/Gems/Default/StaffAction.php:311
msgid "(all organizations)"
msgstr "(alle organisaties)"
@@ -1476,56 +1474,40 @@
msgid "Email templates"
msgstr "Email sjabloon"
-#: classes/Gems/Default/OptionAction.php:79
+#: classes/Gems/Default/OptionAction.php:81
msgid "You are not allowed to change your password."
msgstr "U mag uw wachtwoord niet wijzigen."
-#: classes/Gems/Default/OptionAction.php:91
-msgid "Password rules"
-msgstr "Wachtwoord regels"
-
#: classes/Gems/Default/OptionAction.php:94
-#, php-format
-msgid "A password %s."
-msgstr "Een wachtwoord %s."
-
-#: classes/Gems/Default/OptionAction.php:101
-msgid "A password:"
-msgstr "Een wachtwoord:"
-
-#: classes/Gems/Default/OptionAction.php:112
+#: classes/Gems/Default/StaffAction.php:419
msgid "New password is active."
msgstr "Nieuwe wachtwoord geactiveerd."
-#: classes/Gems/Default/OptionAction.php:118
-msgid "Caps Lock seems to be on!"
-msgstr "De Caps Lock toets lijkt aan te staan!"
-
-#: classes/Gems/Default/OptionAction.php:158
+#: classes/Gems/Default/OptionAction.php:128
msgid "Login Name"
msgstr "Login Naam"
-#: classes/Gems/Default/OptionAction.php:165
+#: classes/Gems/Default/OptionAction.php:135
#: classes/Gems/Default/OrganizationAction.php:129
#: classes/Gems/Default/RespondentAction.php:175
-#: classes/Gems/Default/StaffAction.php:319
+#: classes/Gems/Default/StaffAction.php:294
msgid "Language"
msgstr "Taal"
-#: classes/Gems/Default/OptionAction.php:175
+#: classes/Gems/Default/OptionAction.php:145
#, php-format
msgid "Options"
msgstr "Instellingen"
-#: classes/Gems/Default/OptionAction.php:184
+#: classes/Gems/Default/OptionAction.php:154
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:204
+#: classes/Gems/Default/OptionAction.php:174
msgid "Date / time"
msgstr "Datum / tijd"
-#: classes/Gems/Default/OptionAction.php:215
+#: classes/Gems/Default/OptionAction.php:185
msgid "Item"
msgstr "Item"
@@ -1624,7 +1606,7 @@
msgstr "Dit kan nog niet gewijzigd worden"
#: classes/Gems/Default/OrganizationAction.php:166
-#: classes/Gems/Default/StaffAction.php:131
+#: classes/Gems/Default/StaffAction.php:119
msgid "User Definition"
msgstr "User Definition"
@@ -2135,45 +2117,54 @@
msgid "Synchronize all sources."
msgstr "Synchroniseer alle bronnen."
-#: classes/Gems/Default/StaffAction.php:137
-msgid "Unsupported UserDefinition"
-msgstr "Onebekende UserDefinition"
+#: classes/Gems/Default/StaffAction.php:125
+msgid "Unsupported User Definition"
+msgstr "Onbekende User Definition"
-#: classes/Gems/Default/StaffAction.php:179
+#: classes/Gems/Default/StaffAction.php:154
msgid "Users can only login when this box is checked."
msgstr "Gebruikers kunnen alleen inloggen als dit is aangevinkt."
-#: classes/Gems/Default/StaffAction.php:180
+#: classes/Gems/Default/StaffAction.php:155
msgid "If checked the user will logoff when answering a survey."
msgstr "Indien actief, dan logt de gebruiker uit voor het beantwoorden van een vragenlijst."
-#: classes/Gems/Default/StaffAction.php:197
+#: classes/Gems/Default/StaffAction.php:172
msgid "You are not allowed to edit this staff member."
msgstr "U mag deze medewerker niet wijzigen."
-#: classes/Gems/Default/StaffAction.php:254
+#: classes/Gems/Default/StaffAction.php:229
#, php-format
msgid "User with id %s already exists but is deleted, do you want to reactivate the account?"
msgstr "Gebruiker met inlognaam %s bestaat al maar is verwijderd, wilt u het account opnieuw activeren?"
-#: classes/Gems/Default/StaffAction.php:310
+#: classes/Gems/Default/StaffAction.php:285
msgid "Primary function"
msgstr "Primaire functie"
-#: classes/Gems/Default/StaffAction.php:320
+#: classes/Gems/Default/StaffAction.php:295
msgid "Can login"
msgstr "Kan inloggen"
-#: classes/Gems/Default/StaffAction.php:321
+#: classes/Gems/Default/StaffAction.php:296
msgid "Logout on survey"
msgstr "Logout bij beantwoorden vragenlijst"
-#: classes/Gems/Default/StaffAction.php:396
+#: classes/Gems/Default/StaffAction.php:371
msgid "staff member"
msgid_plural "staff members"
msgstr[0] "medewerker"
msgstr[1] "medewerkers"
+#: classes/Gems/Default/StaffAction.php:403
+#, php-format
+msgid "Reset password for: %s"
+msgstr "Verander het wachtwoord voor: %s"
+
+#: classes/Gems/Default/StaffAction.php:406
+msgid "You are not allowed to change this password."
+msgstr "U mag dit wachtwoord niet wijzigen."
+
#: classes/Gems/Default/SurveyAction.php:64
msgid "Add survey"
msgstr "Vragenlijst toevoegen"
@@ -2866,41 +2857,41 @@
msgid "Clean cache"
msgstr "Cache opruimen"
-#: classes/Gems/Menu/MenuAbstract.php:415
+#: classes/Gems/Menu/MenuAbstract.php:416
msgid "Check status"
msgstr "Status controle"
-#: classes/Gems/Menu/MenuAbstract.php:416
+#: classes/Gems/Menu/MenuAbstract.php:417
msgid "Synchronize surveys"
msgstr "Synchroniseer vragenlijsten"
-#: classes/Gems/Menu/MenuAbstract.php:417
-#: classes/Gems/Menu/MenuAbstract.php:429
+#: classes/Gems/Menu/MenuAbstract.php:418
+#: classes/Gems/Menu/MenuAbstract.php:430
msgid "Check answers"
msgstr "Antwoord controle...
[truncated message content] |
|
From: <gem...@li...> - 2012-03-22 11:04:11
|
Revision: 560
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=560&view=rev
Author: matijsdejong
Date: 2012-03-22 11:04:04 +0000 (Thu, 22 Mar 2012)
Log Message:
-----------
User can login using their e-mail address.
User can login with any organization they are authorized for.
Modified Paths:
--------------
trunk/library/classes/Gems/User/User.php
trunk/library/classes/Gems/User/UserLoader.php
Modified: trunk/library/classes/Gems/User/User.php
===================================================================
--- trunk/library/classes/Gems/User/User.php 2012-03-21 17:26:57 UTC (rev 559)
+++ trunk/library/classes/Gems/User/User.php 2012-03-22 11:04:04 UTC (rev 560)
@@ -255,6 +255,7 @@
$formValues['allowed_ip_ranges'] = $this->getAllowedIPRanges();
$formValues['organization'] = $this->getBaseOrganizationId();
+ $formValues['userlogin'] = $this->getLoginName();
if ($this->isActive()) {
$adapter = $this->definition->getAuthAdapter($formValues['userlogin'], $formValues['organization'], $formValues['password']);
Modified: trunk/library/classes/Gems/User/UserLoader.php
===================================================================
--- trunk/library/classes/Gems/User/UserLoader.php 2012-03-21 17:26:57 UTC (rev 559)
+++ trunk/library/classes/Gems/User/UserLoader.php 2012-03-22 11:04:04 UTC (rev 560)
@@ -56,6 +56,18 @@
const USER_STAFF = 'StaffUser';
/**
+ * When true Respondent members can use their e-mail address as login name
+ * @var boolean
+ */
+ public $allowRespondentEmailLogin = true;
+
+ /**
+ * When true Staff members can use their e-mail address as login name
+ * @var boolean
+ */
+ public $allowStaffEmailLogin = true;
+
+ /**
* Allows sub classes of Gems_Loader_LoaderAbstract to specify the subdirectory where to look for.
*
* @var string $cascade An optional subdirectory where this subclass always loads from.
@@ -268,45 +280,20 @@
public function getUser($login_name, $currentOrganization)
{
list($defName, $userOrganization, $userName) = $this->getUserClassInfo($login_name, $currentOrganization);
- // MUtil_Echo::track($defName, $userOrganization);
+ $user = $this->loadUser($defName, $userOrganization, $userName);
- $definition = $this->getUserDefinition($defName);
-
- $values = $definition->getUserData($userName, $userOrganization);
- // MUtil_Echo::track($defName, $login_name, $userOrganization, $values);
-
- if (! isset($values['user_active'])) {
- $values['user_active'] = true;
+ // Check: can the user log in as this organization, if not load non-existing user
+ $orgs = $user->getAllowedOrganizations();
+ if (! isset($orgs[$currentOrganization])) {
+ $user = $this->loadUser(self::USER_NOLOGIN . 'Definition', $currentOrganization, $login_name);
}
- if (! isset($values['user_staff'])) {
- $values['user_staff'] = $definition->isStaff();
- }
- $values['__user_definition'] = $defName;
-
- $user = $this->_loadClass('User', true, array($values, $definition));
- // MUtil_Echo::track($user->getAllowedOrganizations());
-
$user->setCurrentOrganization($currentOrganization);
return $user;
}
/**
- * Retrieve a userdefinition, so we can check it's capabilities without
- * instantiating a user
- *
- * @param string $userClassName
- * @return Gems_User_UserDefinitionInterface
- */
- public function getUserDefinition($userClassName)
- {
- $definition = $this->_getClass($userClassName);
-
- return $definition;
- }
-
- /**
* Get a staff user using the $staff_id
*
* @param int $staff_id
@@ -341,59 +328,9 @@
}
try {
- /*
$select = $this->getUserClassSelect($login_name, $organization);
- $row = $this->db->fetchRow($select, null, Zend_Db::FETCH_NUM);
- // */
- //*
- $sql = "SELECT CONCAT(gul_user_class, 'Definition'), gul_id_organization
- FROM gems__user_logins INNER JOIN gems__organizations ON gor_id_organization = gul_id_organization
- WHERE gor_active = 1 AND
- gul_can_login = 1 AND
- gul_login = ? AND
- gul_id_organization = ?
- LIMIT 1";
- $params[] = $login_name;
- $params[] = $organization;
- // MUtil_Echo::track($sql, $params);
-
- $row = $this->db->fetchRow($sql, $params, Zend_Db::FETCH_NUM);
-
- if (! $row) {
- // Try to get see if this is another allowed organization for this user
- $sql = "SELECT CONCAT(gul_user_class, 'Definition'), gul_id_organization, gul_login
- FROM gems__user_logins INNER JOIN gems__organizations ON gor_id_organization != gul_id_organization
- WHERE gor_active = 1 AND
- gul_can_login = 1 AND
- gul_login = ? AND
- gor_id_organization = ? AND
- gor_accessible_by LIKE CONCAT('%:', gul_id_organization, ':%')
- LIMIT 1";
-
- // MUtil_Echo::track($sql, $params);
-
- $row = $this->db->fetchRow($sql, $params, Zend_Db::FETCH_NUM);
- }
-
- if ((! $row) && ($organization == $this->project->getDefaultOrganization())) {
- // Check for the current organization being the default one
- //
- // For optimization do set the allowed organizations
- // Try to get see if this is another allowed organization for this user
- $sql = "SELECT CONCAT(gul_user_class, 'Definition'), gul_id_organization, gul_login
- FROM gems__user_logins INNER JOIN gems__organizations ON gor_id_organization != gul_id_organization
- WHERE gor_active = 1 AND
- gul_can_login = 1 AND
- gul_login = ?
- LIMIT 1";
-
- // MUtil_Echo::track($sql, $login_name);
-
- $row = $this->db->fetchRow($sql, $login_name, Zend_Db::FETCH_NUM);
- } // */
-
- if ($row) {
+ if ($row = $this->db->fetchRow($select, null, Zend_Db::FETCH_NUM)) {
// MUtil_Echo::track($row);
return $row;
}
@@ -404,26 +341,13 @@
// Fail over for pre 1.5 projects
//
- // No login as other organization for first login
+ // No login as other organization or with e-mail possible for first login
$sql = "SELECT gsf_id_user
FROM gems__staff INNER JOIN
gems__organizations ON gsf_id_organization = gor_id_organization
WHERE gor_active = 1 AND gsf_active = 1 AND gsf_login = ? AND gsf_id_organization = ?";
- $user_id = $this->db->fetchOne($sql, $params);
-
- if ((! $user_id) && ($organization == $this->project->getDefaultOrganization())) {
- $sql = "SELECT gsf_id_user
- FROM gems__staff INNER JOIN
- gems__organizations ON gsf_id_organization = gor_id_organization
- WHERE gor_active = 1 AND gsf_active = 1 AND gsf_login = ?";
-
- // MUtil_Echo::track($sql, $login_name);
-
- $user_id = $this->db->fetchOne($sql, $login_name);
- }
-
- if ($user_id) {
+ if ($user_id = $this->db->fetchOne($sql, $params)) {
// Move user to new staff.
$values['gul_login'] = $login_name;
$values['gul_id_organization'] = $organization;
@@ -448,6 +372,7 @@
}
/**
+ * Returns a select statement to find a corresponding user.
*
* @param string $login_name
* @param int $organization
@@ -459,26 +384,84 @@
$select->from('gems__user_logins', array("CONCAT(gul_user_class, 'Definition')", 'gul_id_organization', 'gul_login'))
->from('gems__organizations', array())
- ->joinLeft('gems__staff', 'gul_login = gsf_login AND gul_id_organization = gsf_id_organization', array())
- ->joinLeft('gems__respondent2org', 'gul_login = gr2o_patient_nr AND gul_id_organization = gr2o_id_organization', array())
- ->joinLeft('gems__respondents', 'gr2o_id_user = grs_id_user', array())
->where('gor_active = 1')
->where('gul_can_login = 1')
->where('gor_id_organization = ?', $organization)
- ->where('(gul_login = ? OR gsf_email = ? OR grs_email = ?)', $login_name)
->order("CASE WHEN gor_id_organization = gul_id_organization THEN 1 WHEN gor_accessible_by LIKE CONCAT('%:', gul_id_organization, ':%') THEN 2 ELSE 3 END");
- MUtil_Echo::track($select->__toString());
+ $ids[] = 'gul_login';
+ if ($this->allowStaffEmailLogin) {
+ $select->joinLeft('gems__staff', 'gul_login = gsf_login AND gul_id_organization = gsf_id_organization', array());
+ $ids[] = 'gsf_email';
+ }
+ if ($this->allowRespondentEmailLogin) {
+ $select->joinLeft('gems__respondent2org', 'gul_login = gr2o_patient_nr AND gul_id_organization = gr2o_id_organization', array())
+ ->joinLeft('gems__respondents', 'gr2o_id_user = grs_id_user', array());
+ $ids[] = 'grs_email';
+ }
+ // Add search fields
+ $select->where('(' . implode(' = ? OR ', $ids) . ' = ?)', $login_name);
+
+ // MUtil_Echo::track($select->__toString());
+
return $select;
}
+ /**
+ * Retrieve a userdefinition, so we can check it's capabilities without
+ * instantiating a user.
+ *
+ * @param string $userClassName
+ * @return Gems_User_UserDefinitionInterface
+ */
+ public function getUserDefinition($userClassName)
+ {
+ $definition = $this->_getClass($userClassName);
+
+ return $definition;
+ }
+
+ /**
+ * Check: is this user the super user defined
+ * in project.ini?
+ *
+ * @param string $login_name
+ * @return boolean
+ */
protected function isProjectUser($login_name)
{
return $this->project->getSuperAdminName() == $login_name;
}
/**
+ * Returns a loaded user object
+ *
+ * @param string $defName
+ * @param int $userOrganization
+ * @param string $userName
+ * @return Gems_User_User But ! ->isActive when the user does not exist
+ */
+ protected function loadUser($defName, $userOrganization, $userName)
+ {
+ $definition = $this->getUserDefinition($defName);
+
+ $values = $definition->getUserData($userName, $userOrganization);
+ // MUtil_Echo::track($defName, $login_name, $userOrganization, $values);
+
+ if (! isset($values['user_active'])) {
+ $values['user_active'] = true;
+ }
+ if (! isset($values['user_staff'])) {
+ $values['user_staff'] = $definition->isStaff();
+ }
+
+ $values['__user_definition'] = $defName;
+
+ return $this->_loadClass('User', true, array($values, $definition));
+ }
+
+ /**
* Check for password weakness.
*
* @param Gems_User_User $user The user for e.g. name checks
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-21 17:27:08
|
Revision: 559
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=559&view=rev
Author: matijsdejong
Date: 2012-03-21 17:26:57 +0000 (Wed, 21 Mar 2012)
Log Message:
-----------
Start login by e-mail
Extra documentation for form
Modified Paths:
--------------
trunk/library/classes/Gems/User/Form/LoginForm.php
trunk/library/classes/Gems/User/UserLoader.php
trunk/library/classes/MUtil/Form.php
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
Modified: trunk/library/classes/Gems/User/Form/LoginForm.php
===================================================================
--- trunk/library/classes/Gems/User/Form/LoginForm.php 2012-03-21 14:05:39 UTC (rev 558)
+++ trunk/library/classes/Gems/User/Form/LoginForm.php 2012-03-21 17:26:57 UTC (rev 559)
@@ -222,7 +222,7 @@
}
/**
- * Returns/sets a link to the reset password page
+ * Returns an html link to the reset password page
*
* @return MUtil_Html_AElement
*/
@@ -343,7 +343,7 @@
// Veld token
$element = new MUtil_Form_Element_Html($this->_tokenFieldName);
// $element->br();
- $element->a(array('controller' => 'ask', 'action' => 'token'), $this->translate->_('Enter your token...'), array('class' => 'actionlink'));
+ $element->setValue($this->getTokenLink());
$this->addElement($element);
}
@@ -352,6 +352,15 @@
}
/**
+ * Returns an html link for the token input page.
+ *
+ * @return MUtil_Html_AElement
+ */
+ public function getTokenLink()
+ {
+ return MUtil_Html::create('a', array('controller' => 'ask', 'action' => 'token'), $this->translate->_('Enter your token...'), array('class' => 'actionlink'));
+ }
+ /**
* Returns/sets a login name element.
*
* @return Zend_Form_Element_Text
Modified: trunk/library/classes/Gems/User/UserLoader.php
===================================================================
--- trunk/library/classes/Gems/User/UserLoader.php 2012-03-21 14:05:39 UTC (rev 558)
+++ trunk/library/classes/Gems/User/UserLoader.php 2012-03-21 17:26:57 UTC (rev 559)
@@ -267,12 +267,12 @@
*/
public function getUser($login_name, $currentOrganization)
{
- list($defName, $userOrganization) = $this->getUserClassInfo($login_name, $currentOrganization);
+ list($defName, $userOrganization, $userName) = $this->getUserClassInfo($login_name, $currentOrganization);
// MUtil_Echo::track($defName, $userOrganization);
$definition = $this->getUserDefinition($defName);
- $values = $definition->getUserData($login_name, $userOrganization);
+ $values = $definition->getUserData($userName, $userOrganization);
// MUtil_Echo::track($defName, $login_name, $userOrganization, $values);
if (! isset($values['user_active'])) {
@@ -285,6 +285,7 @@
$values['__user_definition'] = $defName;
$user = $this->_loadClass('User', true, array($values, $definition));
+ // MUtil_Echo::track($user->getAllowedOrganizations());
$user->setCurrentOrganization($currentOrganization);
@@ -328,18 +329,23 @@
*
* @param string $login_name
* @param int $organization
- * @return array Containing definitionName, organizationId
+ * @return array Containing definitionName, organizationId, (real) userName
*/
protected function getUserClassInfo($login_name, $organization)
{
if ((null == $login_name) || (null == $organization)) {
- return array(self::USER_NOLOGIN . 'Definition', $organization);
+ return array(self::USER_NOLOGIN . 'Definition', $organization, $login_name);
}
if ($this->isProjectUser($login_name)) {
- return array(self::USER_PROJECT . 'Definition', $organization);
+ return array(self::USER_PROJECT . 'Definition', $organization, $login_name);
}
try {
+ /*
+ $select = $this->getUserClassSelect($login_name, $organization);
+ $row = $this->db->fetchRow($select, null, Zend_Db::FETCH_NUM);
+ // */
+ //*
$sql = "SELECT CONCAT(gul_user_class, 'Definition'), gul_id_organization
FROM gems__user_logins INNER JOIN gems__organizations ON gor_id_organization = gul_id_organization
WHERE gor_active = 1 AND
@@ -356,7 +362,7 @@
if (! $row) {
// Try to get see if this is another allowed organization for this user
- $sql = "SELECT CONCAT(gul_user_class, 'Definition'), gul_id_organization
+ $sql = "SELECT CONCAT(gul_user_class, 'Definition'), gul_id_organization, gul_login
FROM gems__user_logins INNER JOIN gems__organizations ON gor_id_organization != gul_id_organization
WHERE gor_active = 1 AND
gul_can_login = 1 AND
@@ -375,7 +381,7 @@
//
// For optimization do set the allowed organizations
// Try to get see if this is another allowed organization for this user
- $sql = "SELECT CONCAT(gul_user_class, 'Definition'), gul_id_organization
+ $sql = "SELECT CONCAT(gul_user_class, 'Definition'), gul_id_organization, gul_login
FROM gems__user_logins INNER JOIN gems__organizations ON gor_id_organization != gul_id_organization
WHERE gor_active = 1 AND
gul_can_login = 1 AND
@@ -385,7 +391,7 @@
// MUtil_Echo::track($sql, $login_name);
$row = $this->db->fetchRow($sql, $login_name, Zend_Db::FETCH_NUM);
- }
+ } // */
if ($row) {
// MUtil_Echo::track($row);
@@ -435,12 +441,38 @@
// MUtil_Echo::r($e);
}
- return array(self::USER_OLD_STAFF . 'Definition', $organization);
+ return array(self::USER_OLD_STAFF . 'Definition', $organization, $login_name);
}
- return array(self::USER_NOLOGIN . 'Definition', $organization);
+ return array(self::USER_NOLOGIN . 'Definition', $organization, $login_name);
}
+ /**
+ *
+ * @param string $login_name
+ * @param int $organization
+ * @return Zend_Db_Select
+ */
+ protected function getUserClassSelect($login_name, $organization)
+ {
+ $select = $this->db->select();
+
+ $select->from('gems__user_logins', array("CONCAT(gul_user_class, 'Definition')", 'gul_id_organization', 'gul_login'))
+ ->from('gems__organizations', array())
+ ->joinLeft('gems__staff', 'gul_login = gsf_login AND gul_id_organization = gsf_id_organization', array())
+ ->joinLeft('gems__respondent2org', 'gul_login = gr2o_patient_nr AND gul_id_organization = gr2o_id_organization', array())
+ ->joinLeft('gems__respondents', 'gr2o_id_user = grs_id_user', array())
+ ->where('gor_active = 1')
+ ->where('gul_can_login = 1')
+ ->where('gor_id_organization = ?', $organization)
+ ->where('(gul_login = ? OR gsf_email = ? OR grs_email = ?)', $login_name)
+ ->order("CASE WHEN gor_id_organization = gul_id_organization THEN 1 WHEN gor_accessible_by LIKE CONCAT('%:', gul_id_organization, ':%') THEN 2 ELSE 3 END");
+
+ MUtil_Echo::track($select->__toString());
+
+ return $select;
+ }
+
protected function isProjectUser($login_name)
{
return $this->project->getSuperAdminName() == $login_name;
Modified: trunk/library/classes/MUtil/Form.php
===================================================================
--- trunk/library/classes/MUtil/Form.php 2012-03-21 14:05:39 UTC (rev 558)
+++ trunk/library/classes/MUtil/Form.php 2012-03-21 17:26:57 UTC (rev 559)
@@ -3,7 +3,7 @@
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@@ -14,7 +14,7 @@
* * Neither the name of Erasmus MC nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -25,19 +25,22 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @version $Id$
+ *
* @package MUtil
- * @subpackage Acl
+ * @subpackage Form
+ * @author Matijs de Jong <mj...@ma...>
* @copyright Copyright (c) 2011 Erasmus MC
* @license New BSD License
+ * @version $Id$
*/
/**
+ *
* @package MUtil
* @subpackage Form
* @copyright Copyright (c) 2011 Erasmus MC
* @license New BSD License
+ * @since Class available since version 1.0
*/
class MUtil_Form extends Zend_Form
{
@@ -96,9 +99,9 @@
return;
}
}
-
+
ZendX_JQuery::enableView($view);
-
+
if (false === $view->getPluginLoader('helper')->getPaths('MUtil_JQuery_View_Helper')) {
$view->addHelperPath('MUtil/JQuery/View/Helper', 'MUtil_JQuery_View_Helper');
}
@@ -157,7 +160,11 @@
return $this->_displayOrder;
}
- public function getHtml()
+ /**
+ *
+ * @return MUtil_Html_HtmlElement
+ */
+ public function getHtml()
{
return $this->_html_element;
}
@@ -176,12 +183,12 @@
/**
* Validate the form
*
- * As it is better for translation utilities to set the labels etc. translated,
- * the MUtil default is to disable translation.
- *
+ * 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
@@ -253,6 +260,15 @@
return $this;
}
+ /**
+ * Sets the layout to the use of html elements
+ *
+ * @see MUtil_Html
+ *
+ * @param string $html HtmlTag for element or empty sequence when empty
+ * @param string $args MUtil_Ra::args additional arguments for element
+ * @return MUtil_Form (continuation pattern)
+ */
public function setHtml($html = null, $args = null)
{
$options = MUtil_Ra::args(func_get_args(), 1);
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-21 14:05:39 UTC (rev 558)
+++ trunk/library/languages/default-nl.po 2012-03-21 17:26:57 UTC (rev 559)
@@ -1089,7 +1089,7 @@
#: classes/Gems/Default/IndexAction.php:152
msgid "Login"
-msgstr "Login"
+msgstr "Inloggen"
#: classes/Gems/Default/IndexAction.php:174
msgid "Back to login"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-21 14:05:49
|
Revision: 558
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=558&view=rev
Author: matijsdejong
Date: 2012-03-21 14:05:39 +0000 (Wed, 21 Mar 2012)
Log Message:
-----------
Reverting changes from 557, iframe not needed
Modified Paths:
--------------
trunk/new_project/htdocs/gems/css/gems.css
Modified: trunk/new_project/htdocs/gems/css/gems.css
===================================================================
--- trunk/new_project/htdocs/gems/css/gems.css 2012-03-21 12:56:31 UTC (rev 557)
+++ trunk/new_project/htdocs/gems/css/gems.css 2012-03-21 14:05:39 UTC (rev 558)
@@ -211,17 +211,17 @@
padding: 10px 5px 0 5px;
}
-#main form dd, #iframe form dd {
+#main form dd {
display: inline-block;
*display: inline;
margin: 0 10px;
}
-#main form dt, #iframe form dt {
+#main form dt {
margin: 0;
}
-#main form dt label, #iframe form dt label {
+#main form dt label {
clear: left;
float: left;
margin: 0 0.25em 0 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-21 12:56:40
|
Revision: 557
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=557&view=rev
Author: matijsdejong
Date: 2012-03-21 12:56:31 +0000 (Wed, 21 Mar 2012)
Log Message:
-----------
Added support for iframed login
Modified Paths:
--------------
trunk/new_project/htdocs/gems/css/gems.css
Modified: trunk/new_project/htdocs/gems/css/gems.css
===================================================================
--- trunk/new_project/htdocs/gems/css/gems.css 2012-03-21 12:55:59 UTC (rev 556)
+++ trunk/new_project/htdocs/gems/css/gems.css 2012-03-21 12:56:31 UTC (rev 557)
@@ -211,17 +211,17 @@
padding: 10px 5px 0 5px;
}
-#main form dd {
+#main form dd, #iframe form dd {
display: inline-block;
*display: inline;
margin: 0 10px;
}
-#main form dt {
+#main form dt, #iframe form dt {
margin: 0;
}
-#main form dt label {
+#main form dt label, #iframe form dt label {
clear: left;
float: left;
margin: 0 0.25em 0 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-21 12:56:08
|
Revision: 556
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=556&view=rev
Author: matijsdejong
Date: 2012-03-21 12:55:59 +0000 (Wed, 21 Mar 2012)
Log Message:
-----------
Separation for Link & Element
Modified Paths:
--------------
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/User/Form/LoginForm.php
Modified: trunk/library/classes/Gems/Default/IndexAction.php
===================================================================
--- trunk/library/classes/Gems/Default/IndexAction.php 2012-03-19 18:34:45 UTC (rev 555)
+++ trunk/library/classes/Gems/Default/IndexAction.php 2012-03-21 12:55:59 UTC (rev 556)
@@ -141,7 +141,7 @@
*
* @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_Form
+ * @return Gems_User_Form_LoginForm
*/
protected function _getLoginForm($showToken = null, $showPasswordLost = null)
{
Modified: trunk/library/classes/Gems/User/Form/LoginForm.php
===================================================================
--- trunk/library/classes/Gems/User/Form/LoginForm.php 2012-03-19 18:34:45 UTC (rev 555)
+++ trunk/library/classes/Gems/User/Form/LoginForm.php 2012-03-21 12:55:59 UTC (rev 556)
@@ -213,7 +213,7 @@
// Reset password
$element = new MUtil_Form_Element_Html($this->_lostPasswordFieldName);
// $element->br();
- $element->a(array('controller' => 'index', 'action' => 'resetpassword'), $this->translate->_('Lost password'), array('class' => 'actionlink'));
+ $element->setValue($this->getLostPasswordLink());
$this->addElement($element);
}
@@ -222,6 +222,16 @@
}
/**
+ * Returns/sets a link to the reset password page
+ *
+ * @return MUtil_Html_AElement
+ */
+ public function getLostPasswordLink()
+ {
+ return new MUtil_Html_AElement(array('controller' => 'index', 'action' => 'resetpassword'), $this->translate->_('Lost password'), array('class' => 'actionlink'));
+ }
+
+ /**
* Returns/sets an element for determining / selecting the organization.
*
* @return Zend_Form_Element_Xhtml
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|