|
From: <gem...@li...> - 2011-11-03 10:55:47
|
Revision: 166
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=166&view=rev
Author: matijsdejong
Date: 2011-11-03 10:55:39 +0000 (Thu, 03 Nov 2011)
Log Message:
-----------
Added creation of gems__users to patches.sql
Concluded #36: _initProject now returns Gems_Project_ProjectSettings object, this can be overrule on a per project basis
Redefined all project variables to Gems_Project_ProjectSettings
Modified Paths:
--------------
trunk/library/changelog.txt
trunk/library/classes/Gems/Default/MailJobAction.php
trunk/library/classes/Gems/Pdf.php
trunk/library/classes/Gems/Tracker/Token/TokenLibrary.php
trunk/library/classes/Gems/User/ProjectSuperUser.php
trunk/library/classes/Gems/User/UserLoader.php
trunk/library/classes/Gems/Util/Localized.php
trunk/library/classes/Gems/Util.php
trunk/library/classes/GemsEscort.php
trunk/library/configs/db/patches.sql
Added Paths:
-----------
trunk/library/classes/Gems/Project/ProjectSettings.php
Modified: trunk/library/changelog.txt
===================================================================
--- trunk/library/changelog.txt 2011-11-02 12:34:57 UTC (rev 165)
+++ trunk/library/changelog.txt 2011-11-03 10:55:39 UTC (rev 166)
@@ -1,7 +1,7 @@
Important changes from 1.4.3 => 1.5
============================================================
The table gems__staff is split into gems__staff and gems__user with all login data in gems__users
-Passwords should be set with a project.ini->salt
+Passwords should be set with a project.ini->salt. Salt is now a required project setting!
MailController is now called MailTemplateController
EmailController is now called CronController (with stub for compatibility)
Modified: trunk/library/classes/Gems/Default/MailJobAction.php
===================================================================
--- trunk/library/classes/Gems/Default/MailJobAction.php 2011-11-02 12:34:57 UTC (rev 165)
+++ trunk/library/classes/Gems/Default/MailJobAction.php 2011-11-03 10:55:39 UTC (rev 166)
@@ -48,11 +48,10 @@
{
/**
*
- * @var ArrayObject
+ * @var Gems_Project_ProjectSettings
*/
public $project;
-
/**
* The automatically filtered result
*
Modified: trunk/library/classes/Gems/Pdf.php
===================================================================
--- trunk/library/classes/Gems/Pdf.php 2011-11-02 12:34:57 UTC (rev 165)
+++ trunk/library/classes/Gems/Pdf.php 2011-11-03 10:55:39 UTC (rev 166)
@@ -4,7 +4,7 @@
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@@ -15,7 +15,7 @@
* * Neither the name of Erasmus MC nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -62,7 +62,7 @@
/**
*
- * @var ArrayObject
+ * @var Gems_Project_ProjectSettings
*/
protected $project;
Added: trunk/library/classes/Gems/Project/ProjectSettings.php
===================================================================
--- trunk/library/classes/Gems/Project/ProjectSettings.php (rev 0)
+++ trunk/library/classes/Gems/Project/ProjectSettings.php 2011-11-03 10:55:39 UTC (rev 166)
@@ -0,0 +1,149 @@
+<?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 Project
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Class that extends Array object to add Gems specific functions.
+ *
+ * @package Gems
+ * @subpackage Project
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class Gems_Project_ProjectSettings extends ArrayObject
+{
+ /**
+ * Array of required keys. Give a string value for root keys
+ * or name => array() values for required subs keys.
+ *
+ * Deeper levels are not supported at the moment.
+ *
+ * @see checkRequiredValues()
+ *
+ * @var array
+ */
+ protected $requiredKeys = array(
+ 'css' => array('gems'),
+ 'locale' => array('default'),
+ 'salt',
+ );
+
+ /**
+ * Creates the object and checks for required values.
+ *
+ * @param mixed $array
+ */
+ public function __construct($array)
+ {
+ // Convert to array when needed
+ if ($array instanceof Zend_Config) {
+ $array = $array->toArray();
+ } elseif ($array instanceof ArrayObject) {
+ $array = $array->getArrayCopy();
+ } elseif (! is_array($array)) {
+ $array = (array) $array;
+ }
+
+ parent::__construct($array, ArrayObject::ARRAY_AS_PROPS);
+
+ $this->checkRequiredValues();
+ }
+
+ /**
+ * This function checks for the required project settings.
+ *
+ * Overrule this function or the $requiredParameters to add extra required settings.
+ *
+ * @see $requiredParameters
+ *
+ * @return void
+ */
+ protected function checkRequiredValues()
+ {
+ $missing = array();
+ foreach ($this->requiredKeys as $key => $names) {
+ if (is_array($names)) {
+ if (! ($this->offsetExists($key) && $this->offsetGet($key))) {
+ $subarray = array();
+ } else {
+ $subarray = $this->offsetGet($key);
+ }
+ foreach ($names as $name) {
+ if (! isset($subarray[$name])) {
+ $missing[] = $key . '.' . $name;
+ }
+ }
+ } else {
+ if (! ($this->offsetExists($names) && $this->offsetGet($names))) {
+ $missing[] = $names;
+ }
+ }
+ }
+
+ if ($missing) {
+ if (count($missing) == 1) {
+ $error = sprintf("Missing required project setting: '%s'.", reset($missing));
+ } else {
+ $error = sprintf("Missing required project settings: '%s'.", implode("', '", $missing));
+ }
+ throw new Gems_Exception_Coding($error);
+ }
+
+ if (! ($this->offsetExists('name') && $this->offsetGet('name'))) {
+ $this->offsetSet('name', GEMS_PROJECT_NAME);
+ }
+
+ $this->offsetSet('multiLocale', isset($project->locales) && (count($project->locales) > 1));
+ }
+
+ /**
+ * Returns a salted hash on the
+ *
+ * @param string $value The value to hash
+ * @return string The salted hash as a 32-character hexadecimal number.
+ */
+ public function getValueHash($value)
+ {
+ $salt = $this->offsetExists('salt') ? $this->offsetGet('salt') : '';
+
+ if (false === strpos($salt, '%s')) {
+ return md5(sprintf($salt, $value), false);
+ } else {
+ return md5($salt . $value, false);
+ }
+ }
+}
Modified: trunk/library/classes/Gems/Tracker/Token/TokenLibrary.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Token/TokenLibrary.php 2011-11-02 12:34:57 UTC (rev 165)
+++ trunk/library/classes/Gems/Tracker/Token/TokenLibrary.php 2011-11-03 10:55:39 UTC (rev 166)
@@ -53,7 +53,7 @@
/**
*
- * @var ArrayObject
+ * @var Gems_Project_ProjectSettings
*/
protected $project;
Modified: trunk/library/classes/Gems/User/ProjectSuperUser.php
===================================================================
--- trunk/library/classes/Gems/User/ProjectSuperUser.php 2011-11-02 12:34:57 UTC (rev 165)
+++ trunk/library/classes/Gems/User/ProjectSuperUser.php 2011-11-03 10:55:39 UTC (rev 166)
@@ -50,7 +50,7 @@
/**
*
- * @var ArrayObject
+ * @var Gems_Project_ProjectSettings
*/
protected $project;
Modified: trunk/library/classes/Gems/User/UserLoader.php
===================================================================
--- trunk/library/classes/Gems/User/UserLoader.php 2011-11-02 12:34:57 UTC (rev 165)
+++ trunk/library/classes/Gems/User/UserLoader.php 2011-11-03 10:55:39 UTC (rev 166)
@@ -55,7 +55,7 @@
/**
*
- * @var ArrayObject
+ * @var Gems_Project_ProjectSettings
*/
protected $project;
Modified: trunk/library/classes/Gems/Util/Localized.php
===================================================================
--- trunk/library/classes/Gems/Util/Localized.php 2011-11-02 12:34:57 UTC (rev 165)
+++ trunk/library/classes/Gems/Util/Localized.php 2011-11-03 10:55:39 UTC (rev 166)
@@ -54,7 +54,7 @@
/**
*
- * @var ArrayObject
+ * @var Gems_Project_ProjectSettings
*/
protected $project;
Modified: trunk/library/classes/Gems/Util.php
===================================================================
--- trunk/library/classes/Gems/Util.php 2011-11-02 12:34:57 UTC (rev 165)
+++ trunk/library/classes/Gems/Util.php 2011-11-03 10:55:39 UTC (rev 166)
@@ -73,7 +73,7 @@
/**
*
- * @var ArrayObject
+ * @var Gems_Project_ProjectSettings
*/
protected $project;
Modified: trunk/library/classes/GemsEscort.php
===================================================================
--- trunk/library/classes/GemsEscort.php 2011-11-02 12:34:57 UTC (rev 165)
+++ trunk/library/classes/GemsEscort.php 2011-11-03 10:55:39 UTC (rev 166)
@@ -329,29 +329,18 @@
*
* Use $this->project to access afterwards
*
- * @return ArrayObject
+ * @return Gems_Project_ProjectSettings
*/
protected function _initProject()
{
- $project = $this->includeProjectFile('project.ini');
+ $projectArray = $this->includeFile(APPLICATION_PATH . '/configs/project');
- if (false === $project) {
- $project['css']['gems'] = 'gems.css';
- $project['version'] = '0.0';
- $project['locale']['default'] = 'en';
- $project['locales']['en'] = 'en';
+ if ($projectArray instanceof Gems_Project_ProjectSettings) {
+ $project = $projectArray;
+ } else {
+ $project = $this->createProjectClass('Project_ProjectSettings', $projectArray);
}
- if (! array_key_exists('name', $project)) {
- $project['name'] = GEMS_PROJECT_NAME;
- }
-
- if (is_array($project)) {
- $project = new ArrayObject($project, ArrayObject::ARRAY_AS_PROPS);
- }
-
- $project->multiLocale = isset($project->locales) && (count($project->locales) > 1);
-
return $project;
}
@@ -1228,7 +1217,7 @@
* @param string $fileName A filename in the include path
* @return mixed false if nothing was returned
*/
- public function includeFile($fileName)
+ protected function includeFile($fileName)
{
$extension = pathinfo($fileName, PATHINFO_EXTENSION);
@@ -1268,36 +1257,6 @@
return false;
}
- /**
- * Searches and loads ini, xml, php or inc file in application/configs and project/configs.
- *
- * When no extension is specified the system looks for a file with the right extension.
- *
- * .php and .inc files run within the context of this object and thus can access all
- * $this-> variables and functions.
- *
- * @param string $fileName_args One or more filenames, looks for the first to return a value
- * @return mixed false if nothing was returned
- */
- public function includeProjectFile($fileName_args)
- {
- foreach (func_get_args() as $fileName) {
- // First check in the project configs directory
- $result = $this->includeFile(APPLICATION_PATH . '/configs/' . $fileName);
-
- if (! $result) {
- // Then check in the gems configs directory
- $result = $this->includeFile(GEMS_LIBRARY_DIR . '/configs/' . $fileName);
- }
-
- if ($result) {
- return $result;
- }
- }
-
- return false;
- }
-
public function loadLoginInfo($userName)
{
/**
@@ -1344,13 +1303,17 @@
}
}
+ /**
+ * Return a hashed of the string.
+ *
+ * @param string $name Optional name, is here for ModelAbstract setOnSave compatibility
+ * @param string $value The value to hash.
+ * @param boolean $new Optional is new, is here for ModelAbstract setOnSave compatibility
+ * @return string The salted hash as a 32-character hexadecimal number.
+ */
public function passwordHash($name, $value, $new)
{
- if (isset($this->project->salt)) {
- return md5($this->project->salt . $value, false);
- } else {
- return md5($value, false);
- }
+ return $this->project->getValueHash($value);
}
/**
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-11-02 12:34:57 UTC (rev 165)
+++ trunk/library/configs/db/patches.sql 2011-11-03 10:55:39 UTC (rev 166)
@@ -218,6 +218,35 @@
CHANGE `grp_valid_for_unit` `grp_valid_for_unit` CHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'D';
-- PATCH: New user login structure
+CREATE TABLE if not exists gems__users (
+ gsu_id_user bigint unsigned not null,
+ gsu_id_organization bigint not null references gems__organizations (gor_id_organization),
+
+ gsu_login varchar(30) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
+
+ gsu_user_class varchar(30) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
+ gsu_active boolean not null default 1,
+
+ -- Common fields for standard 'store password in Gems' logins
+ -- Not every gsu_user_class will use them
+ gsu_password varchar(32) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gsu_failed_logins int(11) unsigned not null default 0,
+ gsu_last_failed timestamp null,
+ gsu_reset_key varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null,
+ gsu_reset_requested timestamp null,
+ gsu_reset_required boolean not null default 0,
+
+ gsu_changed timestamp not null default current_timestamp on update current_timestamp,
+ gsu_changed_by bigint unsigned not null,
+ gsu_created timestamp not null,
+ gsu_created_by bigint unsigned not null,
+
+ PRIMARY KEY (gsu_id_user, gsu_id_organization),
+ UNIQUE (gsu_login, gsu_id_organization)
+ )
+ ENGINE=InnoDB
+ CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
+
INSERT INTO gems__users (gsu_id_user, gsu_login, gsu_id_organization, gsu_user_class, gsu_active,
gsu_password, gsu_failed_logins, gsu_last_failed, gsu_reset_key, gsu_reset_requested, gsu_reset_required,
gsu_changed, gsu_changed_by, gsu_created, gsu_created_by)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-11-03 12:05:55
|
Revision: 168
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=168&view=rev
Author: matijsdejong
Date: 2011-11-03 12:05:46 +0000 (Thu, 03 Nov 2011)
Log Message:
-----------
Fix for #33 Burger Service Number is now Social Security Number
Made HiddenOrganizationModel.php instance of MUtil_Registry_TargetInterface
Adapted translations
Modified Paths:
--------------
trunk/library/changelog.txt
trunk/library/classes/Gems/Communication/RespondentModelWriter.php
trunk/library/classes/Gems/Default/RespondentAction.php
trunk/library/classes/Gems/Model/HiddenOrganizationModel.php
trunk/library/classes/Gems/Model/RespondentModel.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__respondents.30.sql
trunk/library/languages/default-en.mo
trunk/library/languages/default-en.po
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
Modified: trunk/library/changelog.txt
===================================================================
--- trunk/library/changelog.txt 2011-11-03 10:59:34 UTC (rev 167)
+++ trunk/library/changelog.txt 2011-11-03 12:05:46 UTC (rev 168)
@@ -1,9 +1,10 @@
Important changes from 1.4.3 => 1.5
============================================================
-The table gems__staff is split into gems__staff and gems__user with all login data in gems__users
Passwords should be set with a project.ini->salt. Salt is now a required project setting!
-MailController is now called MailTemplateController
-EmailController is now called CronController (with stub for compatibility)
+The table gems__staff is split into gems__staff and gems__user with all login data in gems__users.
+The gems__respondent.grs_bsn has been renamed to grs_ssn, to make the code more international.
+MailController is now called MailTemplateController.
+EmailController is now called CronController (with stub for compatibility).
Important changes from 1.4.2 => 1.4.3
============================================================
Modified: trunk/library/classes/Gems/Communication/RespondentModelWriter.php
===================================================================
--- trunk/library/classes/Gems/Communication/RespondentModelWriter.php 2011-11-03 10:59:34 UTC (rev 167)
+++ trunk/library/classes/Gems/Communication/RespondentModelWriter.php 2011-11-03 12:05:46 UTC (rev 168)
@@ -65,7 +65,7 @@
{
$parameters = $this->_model->applyParameters(
array(
- 'grs_bsn' => $respondent->getBsn(),
+ 'grs_ssn' => $respondent->getBsn(),
'gr2o_reception_code' => GemsEscort::RECEPTION_OK,
'gr2o_patient_nr' => $respondent->getPatientId()
)
@@ -85,7 +85,7 @@
$data['grs_first_name'] = $respondent->getFirstName();
$data['grs_last_name'] = $respondent->getLastName();
$data['grs_surname_prefix'] = $respondent->getSurnamePrefix();
- $data['grs_bsn'] = $respondent->getBsn();
+ $data['grs_ssn'] = $respondent->getBsn();
$data['grs_gender'] = $respondent->getGender();
$data['grs_birthday'] = $respondent->getBirthday();
Modified: trunk/library/classes/Gems/Default/RespondentAction.php
===================================================================
--- trunk/library/classes/Gems/Default/RespondentAction.php 2011-11-03 10:59:34 UTC (rev 167)
+++ trunk/library/classes/Gems/Default/RespondentAction.php 2011-11-03 12:05:46 UTC (rev 168)
@@ -116,10 +116,10 @@
$num++;
}
- $model->set('grs_bsn', 'description', 'Willekeurig voorbeeld BSN: ' . $num);
+ $model->set('grs_ssn', 'description', sprintf($this->_('Random Example BSN: %s'), $num));
} else {
- $model->set('grs_bsn', 'description', $this->_('Enter a 9-digit BSN number.'));
+ $model->set('grs_ssn', 'description', $this->_('Enter a 9-digit SSN number.'));
}
$ucfirst = new Zend_Filter_Callback('ucfirst');
@@ -129,9 +129,9 @@
$bridge->addHidden( $model->getKeyCopyName('gr2o_patient_nr'));
$bridge->addTab( 'caption1')->h4($this->_('Identification'));
- $bridge->addText( 'grs_bsn', 'label', $this->_('BSN'), 'size', 10, 'maxlength', 12)
+ $bridge->addText( 'grs_ssn', 'label', $this->_('SSN'), 'size', 10, 'maxlength', 12)
->addValidator( new MUtil_Validate_Dutch_Burgerservicenummer())
- ->addValidator( $model->createUniqueValidator('grs_bsn'))
+ ->addValidator( $model->createUniqueValidator('grs_ssn'))
->addFilter( 'Digits');
$bridge->addText( 'gr2o_patient_nr', 'label', $this->_('Patient number'), 'size', 15, 'minlength', 4)
->addValidator( $model->createUniqueValidator(array('gr2o_patient_nr', 'gr2o_id_organization'), array('gr2o_id_user' => 'grs_id_user', 'gr2o_id_organization')));
Modified: trunk/library/classes/Gems/Model/HiddenOrganizationModel.php
===================================================================
--- trunk/library/classes/Gems/Model/HiddenOrganizationModel.php 2011-11-03 10:59:34 UTC (rev 167)
+++ trunk/library/classes/Gems/Model/HiddenOrganizationModel.php 2011-11-03 12:05:46 UTC (rev 168)
@@ -45,9 +45,23 @@
* @license New BSD License
* @since Class available since version 1.0
*/
-class Gems_Model_HiddenOrganizationModel extends Gems_Model_JoinModel
+class Gems_Model_HiddenOrganizationModel extends Gems_Model_JoinModel implements MUtil_Registry_TargetInterface
{
/**
+ * Allows the loader to set resources.
+ *
+ * @param string $name Name of resource to set
+ * @param mixed $resource The resource.
+ * @return boolean True if $resource was OK
+ */
+ public function answerRegistryRequest($name, $resource)
+ {
+ $this->$name = $resource;
+
+ return true;
+ }
+
+ /**
* Stores the fields that can be used for sorting or filtering in the
* sort / filter objects attached to this model.
*
@@ -80,6 +94,30 @@
return array();
}
+ /**
+ * 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()
+ {
+ return true;
+ }
+
+ /**
+ * Filters the names that should not be requested.
+ *
+ * Can be overriden.
+ *
+ * @param string $name
+ * @return boolean
+ */
+ protected function filterRequestNames($name)
+ {
+ return '_' !== $name[0];
+ }
+
public function getCurrentOrganization()
{
return GemsEscort::getInstance()->getCurrentOrganization();
@@ -110,4 +148,18 @@
return $href;
}
+
+ /**
+ * Allows the loader to know the resources to set.
+ *
+ * Returns those object variables defined by the subclass but not at the level of this definition.
+ *
+ * Can be overruled.
+ *
+ * @return array of string names
+ */
+ public function getRegistryRequests()
+ {
+ return array_filter(array_keys(get_object_vars($this)), array($this, 'filterRequestNames'));
+ }
}
Modified: trunk/library/classes/Gems/Model/RespondentModel.php
===================================================================
--- trunk/library/classes/Gems/Model/RespondentModel.php 2011-11-03 10:59:34 UTC (rev 167)
+++ trunk/library/classes/Gems/Model/RespondentModel.php 2011-11-03 12:05:46 UTC (rev 168)
@@ -68,8 +68,8 @@
$this->setSaveOnChange('gr2o_opened_by');
if ($this->hashBsn) {
- $this->setSaveWhenNotNull('grs_bsn');
- $this->setOnSave('grs_bsn', array($this, 'formatBSN'));
+ $this->setSaveWhenNotNull('grs_ssn');
+ $this->setOnSave('grs_ssn', array($this, 'formatBSN'));
}
}
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-11-03 10:59:34 UTC (rev 167)
+++ trunk/library/configs/db/patches.sql 2011-11-03 12:05:46 UTC (rev 168)
@@ -266,4 +266,7 @@
-- PATCH: Extra information for track fields
ALTER TABLE gems__track_fields ADD gtf_field_code varchar(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER gtf_field_name,
ADD gtf_field_description varchar(200) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER gtf_field_code,
- ADD gtf_readonly boolean not null default false AFTER gtf_required;
\ No newline at end of file
+ ADD gtf_readonly boolean not null default false AFTER gtf_required;
+
+-- PATCH: Change Burger Service Nummer to Social Security Number
+ALTER TABLE `gems__respondents` CHANGE `grs_bsn` `grs_ssn` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
Modified: trunk/library/configs/db/tables/gems__respondents.30.sql
===================================================================
--- trunk/library/configs/db/tables/gems__respondents.30.sql 2011-11-03 10:59:34 UTC (rev 167)
+++ trunk/library/configs/db/tables/gems__respondents.30.sql 2011-11-03 12:05:46 UTC (rev 168)
@@ -6,7 +6,7 @@
-- null unique key,
-- grs_password varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null,
- grs_bsn varchar(32) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'
+ grs_ssn varchar(32) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'
null unique key,
-- Naam
Modified: trunk/library/languages/default-en.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-en.po
===================================================================
--- trunk/library/languages/default-en.po 2011-11-03 10:59:34 UTC (rev 167)
+++ trunk/library/languages/default-en.po 2011-11-03 12:05:46 UTC (rev 168)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse EN\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-10-25 13:52+0100\n"
+"POT-Creation-Date: 2011-11-03 12:50+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -18,58 +18,58 @@
"X-Poedit-KeywordsList: plural:1,2\n"
"X-Poedit-SearchPath-0: .\n"
-#: classes/GemsEscort.php:155
+#: classes/GemsEscort.php:186
#, php-format
msgid "Path %s not writable"
msgstr "Path %s not writable"
-#: classes/GemsEscort.php:840
+#: classes/GemsEscort.php:860
#, php-format
msgid "User: %s"
msgstr "User: %s"
-#: classes/GemsEscort.php:864
+#: classes/GemsEscort.php:884
msgid "version"
msgstr "version"
-#: classes/GemsEscort.php:1419
+#: classes/GemsEscort.php:1405
msgid "Take note: your session has expired, your inputs where not saved. Please check the input data and try again"
msgstr "Take note: your session has expired, your inputs where not saved. Please check the input data and try again"
-#: classes/GemsEscort.php:1540
+#: classes/GemsEscort.php:1526
msgid "Please check back later."
msgstr "Please check back later."
-#: classes/GemsEscort.php:1542
-#: classes/GemsEscort.php:1545
-#: classes/GemsEscort.php:1546
+#: classes/GemsEscort.php:1528
+#: classes/GemsEscort.php:1531
+#: classes/GemsEscort.php:1532
msgid "System is in maintenance mode"
msgstr "System is in maintenance mode"
-#: classes/GemsEscort.php:1560
+#: classes/GemsEscort.php:1546
msgid "No access to site."
msgstr "No access to site."
-#: classes/GemsEscort.php:1562
-#: classes/GemsEscort.php:1598
+#: classes/GemsEscort.php:1548
+#: classes/GemsEscort.php:1584
msgid "You have no access to this site."
msgstr "You have no access to this site."
-#: classes/GemsEscort.php:1578
+#: classes/GemsEscort.php:1564
msgid "No access to page"
msgstr "No access to page"
-#: classes/GemsEscort.php:1580
+#: classes/GemsEscort.php:1566
#, php-format
msgid "Access to this page is not allowed for current role: %s."
msgstr "Access to this page is not allowed for current role: %s."
-#: classes/GemsEscort.php:1585
-#: classes/GemsEscort.php:1596
+#: classes/GemsEscort.php:1571
+#: classes/GemsEscort.php:1582
msgid "You are no longer logged in."
msgstr "You are no longer logged in."
-#: classes/GemsEscort.php:1586
+#: classes/GemsEscort.php:1572
msgid "You must login to access this page."
msgstr "You must login to access this page."
@@ -477,7 +477,7 @@
msgid "Cancel"
msgstr "Cancel"
-#: classes/Gems/Controller/ModelSnippetActionAbstract.php:175
+#: classes/Gems/Controller/ModelSnippetActionAbstract.php:181
msgid "No data found."
msgstr "No data found."
@@ -577,35 +577,35 @@
msgid "The number zero and the letter O are treated as the same; the same goes for the number one and the letter L."
msgstr "The number zero and the letter O are treated as the same; the same goes for the number one and the letter L."
-#: classes/Gems/Default/ConsentAction.php:66
+#: classes/Gems/Default/ConsentAction.php:68
#: classes/Gems/Default/GroupAction.php:87
msgid "Description"
msgstr "Description"
-#: classes/Gems/Default/ConsentAction.php:68
+#: classes/Gems/Default/ConsentAction.php:70
#: classes/Gems/Default/DatabaseAction.php:167
msgid "Order"
msgstr "Order"
-#: classes/Gems/Default/ConsentAction.php:69
+#: classes/Gems/Default/ConsentAction.php:71
msgid "Determines order of presentation in interface."
msgstr "Determines order of presentation in interface."
-#: classes/Gems/Default/ConsentAction.php:71
+#: classes/Gems/Default/ConsentAction.php:73
msgid "Consent code"
msgstr "Consent code"
-#: classes/Gems/Default/ConsentAction.php:73
+#: classes/Gems/Default/ConsentAction.php:75
msgid "Internal code, not visible to users, copied with the token information to the source."
msgstr "Internal code, not visible to users, copied with the token information to the source."
-#: classes/Gems/Default/ConsentAction.php:90
+#: classes/Gems/Default/ConsentAction.php:92
msgid "respondent consent"
msgid_plural "respondent consents"
msgstr[0] "patient consent"
msgstr[1] "patient consents"
-#: classes/Gems/Default/ConsentAction.php:95
+#: classes/Gems/Default/ConsentAction.php:97
msgid "Respondent consents"
msgstr "Patient consents"
@@ -637,6 +637,14 @@
msgid "Links concerning this web application:"
msgstr "Links concerning this web application:"
+#: classes/Gems/Default/CronAction.php:136
+msgid "Cron jobs turned off."
+msgstr "Cron jobs turned off."
+
+#: classes/Gems/Default/CronAction.php:200
+msgid "No mails sent"
+msgstr "No mails sent"
+
#: classes/Gems/Default/DatabaseAction.php:64
#, php-format
msgid "Executed %2$s creation script %1$s:"
@@ -950,7 +958,7 @@
msgstr "Export data"
#: classes/Gems/Default/ExportAction.php:155
-#: classes/Gems/Default/MailJobAction.php:122
+#: classes/Gems/Default/MailJobAction.php:121
msgid "Survey"
msgstr "Survey"
@@ -960,7 +968,8 @@
msgstr "%s records found."
#: classes/Gems/Default/ExportAction.php:174
-#: classes/Gems/Default/MailJobAction.php:120
+#: classes/Gems/Default/IndexAction.php:105
+#: classes/Gems/Default/MailJobAction.php:119
msgid "Organization"
msgstr "Organization"
@@ -973,7 +982,7 @@
msgstr "Role"
#: classes/Gems/Default/GroupAction.php:91
-#: classes/Gems/Default/MailJobAction.php:105
+#: classes/Gems/Default/MailJobAction.php:104
msgid "Active"
msgstr "Active"
@@ -992,65 +1001,65 @@
msgid "Login to %s application"
msgstr "Login to %s application"
-#: classes/Gems/Default/IndexAction.php:102
-#: classes/Gems/Default/IndexAction.php:270
+#: classes/Gems/Default/IndexAction.php:117
+#: classes/Gems/Default/IndexAction.php:304
msgid "Username"
msgstr "Username"
-#: classes/Gems/Default/IndexAction.php:110
+#: classes/Gems/Default/IndexAction.php:125
#: classes/Gems/Default/MailServerAction.php:88
msgid "Password"
msgstr "Password"
-#: classes/Gems/Default/IndexAction.php:119
+#: classes/Gems/Default/IndexAction.php:134
msgid "Login"
msgstr "Login"
-#: classes/Gems/Default/IndexAction.php:126
+#: classes/Gems/Default/IndexAction.php:141
msgid "Enter your token..."
msgstr "Enter your token..."
-#: classes/Gems/Default/IndexAction.php:175
-#: classes/Gems/Default/IndexAction.php:210
+#: classes/Gems/Default/IndexAction.php:196
+#: classes/Gems/Default/IndexAction.php:244
#, php-format
msgid "Login successful, welcome %s."
msgstr "Login successful, welcome %s."
-#: classes/Gems/Default/IndexAction.php:236
+#: classes/Gems/Default/IndexAction.php:270
msgid "Good bye: "
msgstr "Good bye: "
-#: classes/Gems/Default/IndexAction.php:266
+#: classes/Gems/Default/IndexAction.php:300
#, php-format
msgid "Reset password for %s application"
msgstr "Reset password for %s application"
-#: classes/Gems/Default/IndexAction.php:278
+#: classes/Gems/Default/IndexAction.php:312
msgid "Reset password"
msgstr "Reset password"
-#: classes/Gems/Default/IndexAction.php:302
+#: classes/Gems/Default/IndexAction.php:336
msgid "No such user found or no e-mail address known"
msgstr "No such user found or no e-mail address known"
-#: classes/Gems/Default/IndexAction.php:304
+#: classes/Gems/Default/IndexAction.php:338
msgid "Reset e-mail already sent, please try again after 24 hours"
msgstr "Reset e-mail already sent, please try again after 24 hours"
-#: classes/Gems/Default/IndexAction.php:319
+#: classes/Gems/Default/IndexAction.php:353
msgid "Follow the instructions in the e-mail"
msgstr "Follow the instructions in the e-mail"
-#: classes/Gems/Default/IndexAction.php:321
-#: classes/Gems/Default/IndexAction.php:345
+#: classes/Gems/Default/IndexAction.php:355
+#: classes/Gems/Default/IndexAction.php:379
msgid "Unable to send e-mail"
msgstr "Unable to send e-mail"
-#: classes/Gems/Default/IndexAction.php:341
+#: classes/Gems/Default/IndexAction.php:375
msgid "An e-mail was sent containing your new password"
msgstr "An e-mail was sent containing your new password"
-#: classes/Gems/Default/IndexAction.php:349
+#: classes/Gems/Default/IndexAction.php:383
msgid "Unknown request"
msgstr "Unknown request"
@@ -1153,98 +1162,107 @@
msgid "Log maintenance"
msgstr "Log maintenance"
-#: classes/Gems/Default/MailJobAction.php:63
+#: classes/Gems/Default/MailJobAction.php:62
msgid "No automatic mail jobs found..."
msgstr "No automatic mail jobs found..."
-#: classes/Gems/Default/MailJobAction.php:73
+#: classes/Gems/Default/MailJobAction.php:72
msgid "New automatic mail job..."
msgstr "New automatic mail job..."
-#: classes/Gems/Default/MailJobAction.php:101
+#: classes/Gems/Default/MailJobAction.php:100
#: classes/Gems/Default/MailLogAction.php:116
msgid "Template"
msgstr "Template"
-#: classes/Gems/Default/MailJobAction.php:102
+#: classes/Gems/Default/MailJobAction.php:101
msgid "By staff member"
msgstr "By staff member"
-#: classes/Gems/Default/MailJobAction.php:104
+#: classes/Gems/Default/MailJobAction.php:103
msgid "Used for logging and possibly from address."
msgstr "Used for logging and possibly from address."
-#: classes/Gems/Default/MailJobAction.php:107
+#: classes/Gems/Default/MailJobAction.php:106
msgid "Job is only run when active."
msgstr "Job is only run when active."
-#: classes/Gems/Default/MailJobAction.php:110
+#: classes/Gems/Default/MailJobAction.php:109
msgid "From address used"
msgstr "From address used"
-#: classes/Gems/Default/MailJobAction.php:112
+#: classes/Gems/Default/MailJobAction.php:111
msgid "From other"
msgstr "From other"
-#: classes/Gems/Default/MailJobAction.php:113
+#: classes/Gems/Default/MailJobAction.php:112
#, php-format
msgid "Only when '%s' is '%s'."
msgstr "Only when '%s' is '%s'."
-#: classes/Gems/Default/MailJobAction.php:115
+#: classes/Gems/Default/MailJobAction.php:114
msgid "Processing Method"
msgstr "Processing Method"
-#: classes/Gems/Default/MailJobAction.php:116
+#: classes/Gems/Default/MailJobAction.php:115
msgid "Filter for"
msgstr "Filter for"
-#: classes/Gems/Default/MailJobAction.php:117
+#: classes/Gems/Default/MailJobAction.php:116
msgid "Days between reminders"
msgstr "Days between reminders"
-#: classes/Gems/Default/MailJobAction.php:133
+#: classes/Gems/Default/MailJobAction.php:132
msgid "Do you want to delete this mail job?"
msgstr "Do you want to delete this mail job?"
-#: classes/Gems/Default/MailJobAction.php:144
+#: classes/Gems/Default/MailJobAction.php:143
msgid "Edit automatic mail job"
msgstr "Edit automatic mail job"
-#: classes/Gems/Default/MailJobAction.php:157
+#: classes/Gems/Default/MailJobAction.php:156
msgid "First mail"
msgstr "First mail"
-#: classes/Gems/Default/MailJobAction.php:158
+#: classes/Gems/Default/MailJobAction.php:157
msgid "Reminder"
msgstr "Reminder"
-#: classes/Gems/Default/MailJobAction.php:169
+#: classes/Gems/Default/MailJobAction.php:168
msgid "Use organizational from address"
msgstr "Use organizational from address"
-#: classes/Gems/Default/MailJobAction.php:172
+#: classes/Gems/Default/MailJobAction.php:171
#, php-format
msgid "Use site %s address"
msgstr "Use site %s address"
-#: classes/Gems/Default/MailJobAction.php:175
+#: classes/Gems/Default/MailJobAction.php:174
msgid "Use the 'By staff member' address"
msgstr "Use the 'By staff member' address"
-#: classes/Gems/Default/MailJobAction.php:176
+#: classes/Gems/Default/MailJobAction.php:175
msgid "Other"
msgstr "Other"
-#: classes/Gems/Default/MailJobAction.php:186
+#: classes/Gems/Default/MailJobAction.php:185
msgid "Automatic mail jobs"
msgstr "Automatic mail jobs"
-#: classes/Gems/Default/MailJobAction.php:190
+#: classes/Gems/Default/MailJobAction.php:189
+#, php-format
+msgid "Automatic mails have been turned off since %s."
+msgstr "Automatic mails have been turned off since %s."
+
+#: classes/Gems/Default/MailJobAction.php:193
+msgid "Turn Automatic Mail Jobs ON"
+msgstr "Turn Automatic Mail Jobs ON"
+
+#: classes/Gems/Default/MailJobAction.php:199
msgid "With automatic mail jobs and a cron job on the server, mails can be sent without manual user action."
msgstr "With automatic mail jobs and a cron job on the server, mails can be sent without manual user action."
-#: classes/Gems/Default/MailJobAction.php:198
+#: classes/Gems/Default/MailJobAction.php:207
msgid "Automatic mail job details"
msgstr "Automatic mail job details"
@@ -1353,67 +1371,58 @@
msgid "Email templates"
msgstr "Email templates"
-#: classes/Gems/Default/OptionAction.php:73
+#: classes/Gems/Default/OptionAction.php:75
#: classes/Gems/Default/OrganizationAction.php:128
#: classes/Gems/Default/RespondentAction.php:173
-#: classes/Gems/Default/StaffAction.php:188
+#: classes/Gems/Default/StaffAction.php:196
msgid "Language"
msgstr "Language"
-#: classes/Gems/Default/OptionAction.php:74
-#: classes/Gems/Default/StaffAction.php:189
-msgid "Logout on survey"
-msgstr "Logout on survey"
-
-#: classes/Gems/Default/OptionAction.php:74
-msgid "If checked you will logoff after answering a survey."
-msgstr "If checked you will logoff after answering a survey."
-
-#: classes/Gems/Default/OptionAction.php:91
+#: classes/Gems/Default/OptionAction.php:94
msgid "Current password"
msgstr "Current password"
-#: classes/Gems/Default/OptionAction.php:101
-#: classes/Gems/Default/OptionAction.php:117
+#: classes/Gems/Default/OptionAction.php:105
+#: classes/Gems/Default/OptionAction.php:121
msgid "New password"
msgstr "New password"
-#: classes/Gems/Default/OptionAction.php:141
+#: classes/Gems/Default/OptionAction.php:146
msgid "New password is active."
msgstr "New password is active."
-#: classes/Gems/Default/OptionAction.php:147
+#: classes/Gems/Default/OptionAction.php:152
msgid "Caps Lock seems to be on!"
msgstr "Caps Lock seems to be on!"
-#: classes/Gems/Default/OptionAction.php:186
+#: classes/Gems/Default/OptionAction.php:191
msgid "Login Name"
msgstr "Login Name"
-#: classes/Gems/Default/OptionAction.php:204
+#: classes/Gems/Default/OptionAction.php:207
#, php-format
msgid "Options"
msgstr "Options"
-#: classes/Gems/Default/OptionAction.php:213
+#: classes/Gems/Default/OptionAction.php:216
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:233
+#: classes/Gems/Default/OptionAction.php:236
msgid "IP address"
msgstr "IP address"
-#: classes/Gems/Default/OptionAction.php:233
+#: classes/Gems/Default/OptionAction.php:236
msgid "Date / time"
msgstr "Date / time"
-#: classes/Gems/Default/OptionAction.php:239
+#: classes/Gems/Default/OptionAction.php:242
msgid "item"
msgid_plural "items"
msgstr[0] "item"
msgstr[1] "items"
-#: classes/Gems/Default/OptionAction.php:244
+#: classes/Gems/Default/OptionAction.php:247
msgid "Item"
msgstr "Item"
@@ -1565,31 +1574,35 @@
msgid "Time on server"
msgstr "Time on server"
-#: classes/Gems/Default/ProjectInformationAction.php:148
+#: classes/Gems/Default/ProjectInformationAction.php:149
msgid "Turn Maintenance Mode OFF"
msgstr "Turn Maintenance Mode OFF"
-#: classes/Gems/Default/ProjectInformationAction.php:150
+#: classes/Gems/Default/ProjectInformationAction.php:151
msgid "Turn Maintenance Mode ON"
msgstr "Turn Maintenance Mode ON"
-#: classes/Gems/Default/ProjectInformationAction.php:159
+#: classes/Gems/Default/ProjectInformationAction.php:161
msgid "Version information"
msgstr "Version information"
-#: classes/Gems/Default/ProjectInformationAction.php:185
+#: classes/Gems/Default/ProjectInformationAction.php:187
+msgid "Cache cleaned"
+msgstr "Cache cleaned"
+
+#: classes/Gems/Default/ProjectInformationAction.php:195
msgid "Server PHP Info"
msgstr "Server PHP Info"
-#: classes/Gems/Default/ProjectInformationAction.php:198
+#: classes/Gems/Default/ProjectInformationAction.php:208
msgid "Project settings"
msgstr "Project settings"
-#: classes/Gems/Default/ProjectInformationAction.php:205
+#: classes/Gems/Default/ProjectInformationAction.php:215
msgid "Session content"
msgstr "Session content"
-#: classes/Gems/Default/ProjectInformationAction.php:206
+#: classes/Gems/Default/ProjectInformationAction.php:216
msgid "Session"
msgstr "Session"
@@ -1652,78 +1665,83 @@
msgid "Track %s does not exist."
msgstr "Track %s does not exist."
-#: classes/Gems/Default/ReceptionAction.php:53
+#: classes/Gems/Default/ReceptionAction.php:55
msgid "Can be assigned to"
msgstr "Can be assigned to"
-#: classes/Gems/Default/ReceptionAction.php:54
+#: classes/Gems/Default/ReceptionAction.php:56
msgid "Additional action"
msgstr "Additional action"
-#: classes/Gems/Default/ReceptionAction.php:77
+#: classes/Gems/Default/ReceptionAction.php:79
msgid "Code"
msgstr "Code"
-#: classes/Gems/Default/ReceptionAction.php:80
+#: classes/Gems/Default/ReceptionAction.php:82
msgid "Is success code"
msgstr "Is success code"
-#: classes/Gems/Default/ReceptionAction.php:84
+#: classes/Gems/Default/ReceptionAction.php:86
msgid "This reception code is a success code."
msgstr "This reception code is a success code."
-#: classes/Gems/Default/ReceptionAction.php:88
+#: classes/Gems/Default/ReceptionAction.php:90
msgid "Only active codes can be selected."
msgstr "Only active codes can be selected."
-#: classes/Gems/Default/ReceptionAction.php:89
+#: classes/Gems/Default/ReceptionAction.php:91
msgid "For respondents"
msgstr "For patients"
-#: classes/Gems/Default/ReceptionAction.php:92
+#: classes/Gems/Default/ReceptionAction.php:94
msgid "This reception code can be assigned to a respondent."
msgstr "This reception code can be assigned to a respondent."
-#: classes/Gems/Default/ReceptionAction.php:93
+#: classes/Gems/Default/ReceptionAction.php:95
msgid "For tracks"
msgstr "For tracks"
-#: classes/Gems/Default/ReceptionAction.php:96
+#: classes/Gems/Default/ReceptionAction.php:98
msgid "This reception code can be assigned to a track."
msgstr "This reception code can be assigned to a track."
-#: classes/Gems/Default/ReceptionAction.php:97
+#: classes/Gems/Default/ReceptionAction.php:99
msgid "For surveys"
msgstr "For surveys"
-#: classes/Gems/Default/ReceptionAction.php:100
+#: classes/Gems/Default/ReceptionAction.php:102
msgid "This reception code can be assigned to a survey."
msgstr "This reception code can be assigned to a survey."
-#: classes/Gems/Default/ReceptionAction.php:101
+#: classes/Gems/Default/ReceptionAction.php:103
msgid "Redo survey"
msgstr "Redo survey"
-#: classes/Gems/Default/ReceptionAction.php:104
+#: classes/Gems/Default/ReceptionAction.php:106
msgid "Redo a survey on this reception code."
msgstr "Redo a survey on this reception code."
-#: classes/Gems/Default/ReceptionAction.php:105
+#: classes/Gems/Default/ReceptionAction.php:107
msgid "Overwrite ansers"
msgstr "Overwrite ansers"
-#: classes/Gems/Default/ReceptionAction.php:108
+#: classes/Gems/Default/ReceptionAction.php:110
msgid "Remove the consent from already answered surveys."
msgstr "Remove the consent from already answered surveys."
-#: classes/Gems/Default/ReceptionAction.php:126
+#: classes/Gems/Default/ReceptionAction.php:128
msgid "reception code"
msgid_plural "reception codes"
msgstr[0] "reception code"
msgstr[1] "reception codes"
+#: classes/Gems/Default/RespondentAction.php:119
+#, php-format
+msgid "Random Example BSN: %s"
+msgstr "Random Example BSN: %s"
+
#: classes/Gems/Default/RespondentAction.php:122
-msgid "Enter a 9-digit BSN number."
+msgid "Enter a 9-digit SSN number."
msgstr "Enter a 9-digit BSN number."
#: classes/Gems/Default/RespondentAction.php:131
@@ -1731,7 +1749,7 @@
msgstr "Identification"
#: classes/Gems/Default/RespondentAction.php:132
-msgid "BSN"
+msgid "SSN"
msgstr "BSN"
#: classes/Gems/Default/RespondentAction.php:136
@@ -1837,44 +1855,48 @@
msgid "Respondent planning"
msgstr "Respondent planning"
-#: classes/Gems/Default/RoleAction.php:174
-#: classes/Gems/Default/RoleAction.php:233
+#: classes/Gems/Default/RoleAction.php:175
+msgid "Illegal name"
+msgstr "Illegal n...
[truncated message content] |
|
From: <gem...@li...> - 2011-11-08 09:42:21
|
Revision: 189
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=189&view=rev
Author: mennodekker
Date: 2011-11-08 09:42:10 +0000 (Tue, 08 Nov 2011)
Log Message:
-----------
Added controller for #34, privileges not set by default at this time
Modified Paths:
--------------
trunk/library/classes/Gems/Menu.php
trunk/library/classes/Gems/UpgradesAbstract.php
Added Paths:
-----------
trunk/library/classes/Gems/Default/UpgradeAction.php
trunk/library/controllers/UpgradeController.php
Added: trunk/library/classes/Gems/Default/UpgradeAction.php
===================================================================
--- trunk/library/classes/Gems/Default/UpgradeAction.php (rev 0)
+++ trunk/library/classes/Gems/Default/UpgradeAction.php 2011-11-08 09:42:10 UTC (rev 189)
@@ -0,0 +1,193 @@
+<?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 Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $
+ */
+
+/**
+ * This controller handles applying upgrades to the project
+ *
+ * @package Gems
+ * @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class Gems_Default_UpgradeAction extends Gems_Controller_Action
+{
+ public $useHtmlView = true;
+
+ /**
+ * @var Gems_Menu
+ */
+ public $menu;
+
+ /**
+ * @var Gems_Upgrades
+ */
+ protected $_upgrades;
+
+ public function init()
+ {
+ parent::init();
+
+ $this->_upgrades = $this->loader->getUpgrades();
+
+ }
+
+ /**
+ *
+ * @var Gems_Loader
+ */
+ public $loader;
+
+ /**
+ * Executes the upgrades for a certain context
+ *
+ * optional: give from and to levels
+ *
+ * usage: execute/context/<context>{/from/int/to/int}
+ */
+ protected function executeAction()
+ {
+ $context = $this->getRequest()->getParam('id', 'gems');
+ $from = $this->getRequest()->getParam('from');
+ $to = $this->getRequest()->getParam('to');
+
+ $this->html->h3(sprintf($this->_('Upgrading %s'), $context));
+
+ $this->_upgrades->execute($context, $to, $from);
+ $messages = $this->_upgrades->getMessages();
+ foreach($messages as $message) {
+ $this->html->p($message);
+ }
+
+ if ($menuItem = $this->menu->find(array('controller' => $this->_getParam('controller'), 'action' => 'show', 'allowed' => true))) {
+ $this->html->br();
+ $this->html[] = $menuItem->toActionLinkLower($this->getRequest(), array('id'=>$context));
+ }
+ }
+
+ /**
+ * Proxy for the menu
+ */
+ public function executeAllAction() {
+ $this->executeAction();
+ }
+
+ public function executeFromAction() {
+ $this->executeAction();
+ }
+
+ public function executeOneAction() {
+ $this->executeAction();
+ }
+
+ public function executeToAction() {
+ $this->executeAction();
+ }
+
+ /**
+ * Overview of available contexts, max upgrade level and achieved upgrade level
+ */
+ public function indexAction()
+ {
+ $this->html->h3($this->getTopicTitle());
+
+ $displayColumns = array('link' => '',
+ 'context' => $this->_('Context'),
+ 'maxLevel' => $this->_('Max level'),
+ 'level' => $this->_('Level'));
+
+ foreach($this->_upgrades->getUpgradesInfo() as $row) {
+ if ($menuItem = $this->menu->find(array('controller' => $this->_getParam('controller'), 'action' => 'show', 'allowed' => true))) {
+ $row['link'] = $menuItem->toActionLinkLower($this->getRequest(), $row);
+ }
+ $data[] = $row;
+
+ }
+ $this->addSnippet('SelectiveTableSnippet', 'data', $data, 'class', 'browser', 'columns', $displayColumns);
+ }
+
+ /**
+ * Show the upgrades and level for a certain context
+ *
+ * Usage: show/context/<context>
+ */
+ public function showAction()
+ {
+ $this->html->h3($this->getTopicTitle());
+
+ $context = $this->_getParam('id', 'gems');
+ $this->_upgrades->setContext($context);
+ if ($info = $this->_upgrades->getUpgradesInfo($context)) {
+ $this->html->table(array('class'=>'browser'))->tr()
+ ->th($this->_('Context'))->td($info['context'])
+ ->tr()
+ ->th($this->_('Level'))->td($info['level']);
+ $data = $this->_upgrades->getUpgrades();
+ foreach($data as $level => $row) {
+ foreach($this->menu->getCurrent()->getChildren() as $menuItem) {
+ if ($menuItem->is('allowed', true)) {
+ $show = true;
+ if ($level <= $info['level'] && $menuItem->is('action','execute-to')) {
+ //When this level is < current level don't allow to execute from current level to this one
+ $show = false;
+ }
+ if ($level <= $info['level'] && $menuItem->is('action','execute-from')) {
+ //When this level is < current level don't allow to execute from current level to this one
+ $show = false;
+ }
+ if ($show) {
+ $row['action'][] = $menuItem->toActionLinkLower($this->getRequest(), $row, array('from'=>$level, 'to'=>$level));
+ }
+ }
+ }
+ $row['level'] = $level;
+ $data[$level] = $row;
+ }
+ $displayColumns = array('level' => $this->_('Level'),
+ 'info' => $this->_('Description'),
+ 'action' => $this->_('Action'));
+ $this->addSnippet('SelectiveTableSnippet', 'data', $data, 'class', 'browser', 'columns', $displayColumns);
+ } else {
+ $this->html[] = sprintf($this->_('Context %s not found!'), $context);
+ }
+ }
+
+ public function getTopicTitle() {
+ return $this->_('Upgrades');
+ }
+
+ public function getTopic($n = 1) {
+ return $this->_('Upgrades');
+ }
+}
\ No newline at end of file
Modified: trunk/library/classes/Gems/Menu.php
===================================================================
--- trunk/library/classes/Gems/Menu.php 2011-11-07 15:30:23 UTC (rev 188)
+++ trunk/library/classes/Gems/Menu.php 2011-11-08 09:42:10 UTC (rev 189)
@@ -213,6 +213,14 @@
$logMaint = $page->addPage($this->_('Maintenance'), 'pr.log.maintenance', 'log-maintenance');
$logMaint->addAutofilterAction();
$logMaint->addEditAction('pr.log.maintenance');
+
+ //UPGRADES CONTROLLER
+ $page = $setup->addPage($this->_('Upgrade'), 'pr.upgrade', 'upgrade', 'index');
+ $show = $page->addAction($this->_('Show'), null, 'show')->setNamedParameters('id','context');
+ $page->addAction($this->_('Execute all'), 'pr.upgrade.all', 'execute-all')->setModelParameters(1);
+ $show->addActionButton($this->_('Execute this'), 'pr.upgrade.one', 'execute-one')->setModelParameters(1)->addNamedParameters('from','from','to','to');
+ $show->addActionButton($this->_('Execute from here'), 'pr.upgrade.from', 'execute-from')->setModelParameters(1)->addNamedParameters('from','from');
+ $show->addActionButton($this->_('Execute to here'), 'pr.upgrade.to', 'execute-to')->setModelParameters(1)->addNamedParameters('to','to');
return $setup;
}
Modified: trunk/library/classes/Gems/UpgradesAbstract.php
===================================================================
--- trunk/library/classes/Gems/UpgradesAbstract.php 2011-11-07 15:30:23 UTC (rev 188)
+++ trunk/library/classes/Gems/UpgradesAbstract.php 2011-11-08 09:42:10 UTC (rev 189)
@@ -148,7 +148,7 @@
$to = $this->getMaxLevel($context);
}
if(is_null($from)) {
- $from = $this->getNextLevel();
+ $from = $this->getNextLevel($context);
if ($from > $to) {
$this->addMessage($this->_('Already at max. level.'));
@@ -165,7 +165,7 @@
ksort($upgrades);
$this->_upgradeStack[$context] = $upgrades;
foreach($this->_upgradeStack[$context] as $level => $upgrade) {
- if (($level > $from && $level <= $to)) {
+ if (($level >= $from && $level <= $to)) {
$this->addMessage(sprintf($this->_('Trying upgrade for %s to level %s: %s'), $context, $level, $this->_upgradeStack[$context][$level]['info']));
if (call_user_func($upgrade['upgrade'])) {
$success = $level;
@@ -244,10 +244,11 @@
$current = array_search($level, $levels);
//And if it is present, return the next level
- if (isset($levels[$current++])) return $levels[$current++];
+ $current++;
+ if (isset($levels[$current])) return $levels[$current];
//Else return current level +1 (doesn't exist anyway)
- return $level++;
+ return ++$level;
}
public function getMessages()
Added: trunk/library/controllers/UpgradeController.php
===================================================================
--- trunk/library/controllers/UpgradeController.php (rev 0)
+++ trunk/library/controllers/UpgradeController.php 2011-11-08 09:42:10 UTC (rev 189)
@@ -0,0 +1,30 @@
+<?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.
+ */
+class UpgradeController extends Gems_Default_UpgradeAction
+{
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-11-14 12:53:59
|
Revision: 208
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=208&view=rev
Author: matijsdejong
Date: 2011-11-14 12:53:50 +0000 (Mon, 14 Nov 2011)
Log Message:
-----------
Reintegration of newUser2 branch for #31 - note: gems__users is no longer used.
Modified Paths:
--------------
trunk/library/changelog.txt
trunk/library/classes/Gems/Auth.php
trunk/library/classes/Gems/Cookies.php
trunk/library/classes/Gems/Default/AskAction.php
trunk/library/classes/Gems/Default/CronAction.php
trunk/library/classes/Gems/Default/ExportAction.php
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/Default/OptionAction.php
trunk/library/classes/Gems/Default/OrganizationAction.php
trunk/library/classes/Gems/Default/RespondentAction.php
trunk/library/classes/Gems/Default/StaffAction.php
trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php
trunk/library/classes/Gems/Default/TokenPlanAction.php
trunk/library/classes/Gems/Email/TemplateMailer.php
trunk/library/classes/Gems/Loader/LoaderAbstract.php
trunk/library/classes/Gems/Loader.php
trunk/library/classes/Gems/Menu/MenuAbstract.php
trunk/library/classes/Gems/Model/DbaModel.php
trunk/library/classes/Gems/Model.php
trunk/library/classes/Gems/Project/Organization/MultiOrganizationInterface.php
trunk/library/classes/Gems/Project/ProjectSettings.php
trunk/library/classes/Gems/Tracker/Token.php
trunk/library/classes/Gems/User/UserLoader.php
trunk/library/classes/Gems/Util/DbLookup.php
trunk/library/classes/GemsEscort.php
trunk/library/classes/MUtil/Date.php
trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php
trunk/library/classes/MUtil/Model/FormBridge.php
trunk/library/classes/MUtil/Model/JoinModel.php
trunk/library/classes/MUtil/Registry/Source.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__organizations.20.sql
trunk/library/configs/db/tables/gems__staff.20.sql
trunk/library/configs/db/tables/gems__user_ids.10.sql
trunk/library/configs/db/tables/gems__user_logins.10.sql
trunk/library/configs/db/tables/gems__user_passwords.50.sql
Added Paths:
-----------
trunk/library/classes/Gems/User/LoginPasswordValidator.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/StaffUserDefinition.php
trunk/library/classes/Gems/User/User.php
trunk/library/classes/Gems/User/UserDefinitionAbstract.php
trunk/library/classes/Gems/User/UserDefinitionInterface.php
trunk/library/classes/Gems/User/UserPasswordValidator.php
trunk/library/configs/db/tables/gems__user_login_attempts.10.sql
Removed Paths:
-------------
trunk/library/classes/Gems/Model/UserModel.php
trunk/library/classes/Gems/User/DatabaseUserAbstract.php
trunk/library/classes/Gems/User/NoLoginUser.php
trunk/library/classes/Gems/User/ProjectSuperUser.php
trunk/library/classes/Gems/User/RespondentUser.php
trunk/library/classes/Gems/User/StaffUser.php
trunk/library/classes/Gems/User/UserAbstract.php
trunk/library/classes/Gems/User/UserInterface.php
trunk/library/classes/Gems/Validate/GemsPasswordUsername.php
trunk/library/configs/db/tables/gems__users.10.sql
trunk/library/configs/db_multi_layout/
Property Changed:
----------------
trunk/library/
Property changes on: trunk/library
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/newUser:113-150
+ /branches/newUser:113-150
/branches/newUser2:175-207
Modified: trunk/library/changelog.txt
===================================================================
--- trunk/library/changelog.txt 2011-11-14 12:43:05 UTC (rev 207)
+++ trunk/library/changelog.txt 2011-11-14 12:53:50 UTC (rev 208)
@@ -1,7 +1,8 @@
Important changes from 1.4.3 => 1.5
============================================================
Passwords should be set with a project.ini->salt. Salt is now a required project setting!
-The table gems__staff is split into gems__staff and gems__user with all login data in gems__users.
+The table gems__staff is split into gems__staff, gems__user_logins with generic login data and gems__users_passwords containing db stored password information.
+The table gems__user_ids provides unique and non-sequential user ids accross gems__staff and gems__respondents.
The gems__respondent.grs_bsn has been renamed to grs_ssn, to make the code more international.
MailController is now called MailTemplateController.
EmailController is now called CronController (with stub for compatibility).
Modified: trunk/library/classes/Gems/Auth.php
===================================================================
--- trunk/library/classes/Gems/Auth.php 2011-11-14 12:43:05 UTC (rev 207)
+++ trunk/library/classes/Gems/Auth.php 2011-11-14 12:53:50 UTC (rev 208)
@@ -98,8 +98,8 @@
* Lookup last failed login and number of failed logins
*/
try {
- $sql = "SELECT gsu_failed_logins, UNIX_TIMESTAMP(gsu_last_failed)
- AS gsu_last_failed FROM gems__users WHERE gsu_login = ?";
+ $sql = "SELECT gul_failed_logins, UNIX_TIMESTAMP(gul_last_failed) AS gul_last_failed
+ FROM gems__user_logins WHERE gul_login = ?";
$results = $this->db->fetchRow($sql, array($username));
} catch (Zend_Db_Exception $zde) {
//If we need to apply a db patch, just use a default value
@@ -107,10 +107,10 @@
MUtil_Echo::r(GemsEscort::getInstance()->translate->_('Please update the database'));
}
- $delay = pow($results['gsu_failed_logins'], $this->_delayFactor);
- $remaining = ($results['gsu_last_failed'] + $delay) - time();
+ $delay = pow($results['gul_failed_logins'], $this->_delayFactor);
+ $remaining = ($results['gul_last_failed'] + $delay) - time();
- if ($results['gsu_failed_logins'] > 0 && $remaining > 0) {
+ if ($results['gul_failed_logins'] > 0 && $remaining > 0) {
//$this->_obscureValue = false;
$result = $this->_error(self::ERROR_PASSWORD_DELAY, ceil($remaining / 60));
}
Modified: trunk/library/classes/Gems/Cookies.php
===================================================================
--- trunk/library/classes/Gems/Cookies.php 2011-11-14 12:43:05 UTC (rev 207)
+++ trunk/library/classes/Gems/Cookies.php 2011-11-14 12:53:50 UTC (rev 208)
@@ -26,6 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
+ *
* @package Gems
* @subpackage Cookies
* @author Matijs de Jong <mj...@ma...>
@@ -73,14 +74,14 @@
}
/**
- * Get the organization from the cookie.
+ * Get the current organization from the cookie.
*
* @param Zend_Controller_Request_Abstract $request
- * @return int The organization
+ * @return int The current organization
*/
public static function getOrganization(Zend_Controller_Request_Abstract $request)
{
- return self::get($request, self::ORGANIZATION_COOKIE);
+ return intval(self::get($request, self::ORGANIZATION_COOKIE));
}
/**
@@ -120,13 +121,15 @@
/**
* Store the organization in a cookie.
*
- * @param int $locale Organization to store
+ * @param int $organization Organization to store
* @param string $basepath The folder of the domain, if any.
* @return boolean True if the cookie was stored.
*/
- public static function setOrganization($locale, $basepath = '/')
+ public static function setOrganization($organization, $basepath = '/')
{
- // Set the cookie for 30 days
- return self::set(self::ORGANIZATION_COOKIE, $locale, 30, $basepath);
+ if ($organization) {
+ // Set the cookie for 30 days
+ return self::set(self::ORGANIZATION_COOKIE, $organization, 30, $basepath);
+ }
}
}
Modified: trunk/library/classes/Gems/Default/AskAction.php
===================================================================
--- trunk/library/classes/Gems/Default/AskAction.php 2011-11-14 12:43:05 UTC (rev 207)
+++ trunk/library/classes/Gems/Default/AskAction.php 2011-11-14 12:53:50 UTC (rev 208)
@@ -82,13 +82,14 @@
/***************
* Get the url *
***************/
- $url = $token->getUrl($language, $this->session->user_id ? $this->session->user_id : $respId);
+ $user = $this->loader->getCurrentUser();
+ $url = $token->getUrl($language, $user->getUserId() ? $user->getUserId() : $respId);
/************************
* Optional user logout *
************************/
- if (isset($this->session->user_logout) && $this->session->user_logout) {
- $this->escort->afterLogout();
+ if ($user->isLogoutOnSurvey()) {
+ $user->unsetAsCurrentUser();
}
/***********************************
Modified: trunk/library/classes/Gems/Default/CronAction.php
===================================================================
--- trunk/library/classes/Gems/Default/CronAction.php 2011-11-14 12:43:05 UTC (rev 207)
+++ trunk/library/classes/Gems/Default/CronAction.php 2011-11-14 12:53:50 UTC (rev 208)
@@ -26,17 +26,23 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * @author Michiel Rook <mi...@to...>
- * @package Gems
+ *
+ * @author Michiel Rook <mi...@to...>
+ * @package Gems
* @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
*/
/**
* Performs bulk-mail action, can be called from a cronjob
*
- * @author Michiel Rook <mi...@to...>
- * @package Gems
+ * @package Gems
* @subpackage Default
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4
*/
class Gems_Default_CronAction extends MUtil_Controller_Action
{
@@ -69,6 +75,12 @@
/**
*
+ * @var Gems_Loader
+ */
+ public $loader;
+
+ /**
+ *
* @var Gems_Menu
*/
public $menu;
@@ -125,7 +137,7 @@
*/
protected function getUserLogin($userId)
{
- return $this->db->fetchOne("SELECT gsu_login FROM gems__users WHERE gsu_id_user = ?", $userId);
+ return $this->db->fetchOne("SELECT gsf_login FROM gems__staff WHERE gsf_id_user = ?", $userId);
}
public function indexAction()
@@ -141,112 +153,78 @@
public function mailJob()
{
- // Test: update `gems__tokens` set `gto_mail_sent_date` = null where `gto_mail_sent_date` > '2011-10-23'
+ $userLoader = $this->loader->getUserLoader();
+ $startUser = $userLoader->getCurrentUser();
+ $user = $startUser;
- $currentUser = isset($this->session->user_login) ? $this->session->user_login : null;
-
$model = $this->loader->getTracker()->getTokenModel();
$mailer = new Gems_Email_TemplateMailer($this->escort);
+
// $mailer->setDefaultTransport(new MUtil_Mail_Transport_EchoLog());
$jobs = $this->db->fetchAll("SELECT * FROM gems__mail_jobs WHERE gmj_active = 1");
if ($jobs) {
foreach ($jobs as $job) {
- $this->escort->loadLoginInfo($this->getUserLogin($job['gmj_id_user_as']));
-
- // Set up filter
- $filter = $this->defaultFilter;
- if ($job['gmj_filter_mode'] == 'R') {
- $filter[] = 'gto_mail_sent_date <= DATE_SUB(CURRENT_DATE, INTERVAL ' . $job['gmj_filter_days_between'] . ' DAY)';
- } else {
- $filter['gto_mail_sent_date'] = NULL;
+ if ($user->getUserId() != $job['gmj_id_user_as']) {
+ $user = $userLoader->getUserByStaffId($job['gmj_id_user_as']);
}
- if ($job['gmj_id_organization']) {
- $filter['gto_id_organization'] = $job['gmj_id_organization'];
- }
- if ($job['gmj_id_track']) {
- $filter['gto_id_track'] = $job['gmj_id_track'];
- }
- if ($job['gmj_id_survey']) {
- $filter['gto_id_survey'] = $job['gmj_id_survey'];
- }
- $tokensData = $model->load($filter);
+ if ($user->isActive()) {
+ if (! $user->isCurrentUser()) {
+ $user->setAsCurrentUser();
+ }
- if (count($tokensData)) {
- $mailer->setMethod($job['gmj_process_method']);
- if ($job['gmj_from_method'] == 'F') {
- $mailer->setFrom($job['gmj_from_fixed']);
+ // Set up filter
+ $filter = $this->defaultFilter;
+ if ($job['gmj_filter_mode'] == 'R') {
+ $filter[] = 'gto_mail_sent_date <= DATE_SUB(CURRENT_DATE, INTERVAL ' . $job['gmj_filter_days_between'] . ' DAY)';
} else {
- $mailer->setFrom($job['gmj_from_method']);
+ $filter['gto_mail_sent_date'] = NULL;
}
+ if ($job['gmj_id_organization']) {
+ $filter['gto_id_organization'] = $job['gmj_id_organization'];
+ }
+ if ($job['gmj_id_track']) {
+ $filter['gto_id_track'] = $job['gmj_id_track'];
+ }
+ if ($job['gmj_id_survey']) {
+ $filter['gto_id_survey'] = $job['gmj_id_survey'];
+ }
- $templateData = $this->getTemplate($job['gmj_id_message']);
- $mailer->setSubject($templateData['gmt_subject']);
- $mailer->setBody($templateData['gmt_body']);
+ $tokensData = $model->load($filter);
- $mailer->setTokens(MUtil_Ra::column('gto_id_token', $tokensData));
- $mailer->process($tokensData);
- }
+ if (count($tokensData)) {
+ $mailer->setMethod($job['gmj_process_method']);
+ if ($job['gmj_from_method'] == 'F') {
+ $mailer->setFrom($job['gmj_from_fixed']);
+ } else {
+ $mailer->setFrom($job['gmj_from_method']);
+ }
- Gems_Auth::getInstance()->clearIdentity();
- $this->escort->session->unsetAll();
+ $templateData = $this->getTemplate($job['gmj_id_message']);
+ $mailer->setSubject($templateData['gmt_subject']);
+ $mailer->setBody($templateData['gmt_body']);
+
+ $mailer->setTokens(MUtil_Ra::column('gto_id_token', $tokensData));
+ $mailer->process($tokensData);
+ }
+ }
}
}
$msg = $mailer->getMessages();
if (! $msg) {
- $msg[] = $this->_('No mails sent');
+ $msg[] = $this->_('No mails sent.');
}
-
- $this->html->append($msg);
-
- if ($currentUser) {
- $this->escort->loadLoginInfo($currentUser);
- } else {
- $this->escort->afterLogout();
+ if ($mailer->bounceCheck()) {
+ array_unshift($msg, $this->_('On this test system all mail will be delivered to the from address.'));
}
- /*
- if (isset($this->project->email['automatic'])) {
- $batches = $this->project->email['automatic'];
- $numBatches = count($batches['mode']);
+ $this->addMessage($msg);
- for ($i = 0; $i < $numBatches; $i++) {
- $this->_organizationId = $batches['organization'][$i];
-
- if (isset($batches['days'][$i])) {
- $this->_intervalDays = $batches['days'][$i];
- }
-
- $this->escort->loadLoginInfo($batches['user'][$i]);
-
- $model->setFilter($this->getFilter($batches['mode'][$i]));
-
- $tokensData = $model->load();
-
- if (count($tokensData)) {
- $tokens = array();
-
- foreach ($tokensData as $tokenData) {
- $tokens[] = $tokenData['gto_id_token'];
- }
-
- $templateData = $this->getTemplate($batches['template'][$i]);
- $mailer->setSubject($templateData['gmt_subject']);
- $mailer->setBody($templateData['gmt_body']);
- $mailer->setMethod($batches['method'][$i]);
- $mailer->setFrom($batches['from'][$i]);
- $mailer->setTokens($tokens);
-
- $mailer->process($tokensData);
- }
-
- Gems_Auth::getInstance()->clearIdentity();
- $this->escort->session->unsetAll();
- }
+ if (! $startUser->isCurrentUser()) {
+ $startUser->setAsCurrentUser();
}
- // */
}
}
\ No newline at end of file
Modified: trunk/library/classes/Gems/Default/ExportAction.php
===================================================================
--- trunk/library/classes/Gems/Default/ExportAction.php 2011-11-14 12:43:05 UTC (rev 207)
+++ trunk/library/classes/Gems/Default/ExportAction.php 2011-11-14 12:53:50 UTC (rev 208)
@@ -144,7 +144,7 @@
{
//Read some data from tables, initialize defaults...
$surveys = $this->db->fetchPairs('SELECT gsu_id_survey, gsu_survey_name FROM gems__surveys WHERE gsu_active = 1 ORDER BY gsu_survey_name');
- $organizations = $this->escort->getAllowedOrganizations();
+ $organizations = $this->loader->getCurrentUser()->getAllowedOrganizations();
$types = $this->export->getExportClasses();
//Create the basic form
@@ -230,7 +230,7 @@
$answerModel = $survey->getAnswerModel($language);
//Now add the organization id => name mapping
- $answerModel->set('organizationid', 'multiOptions', $this->escort->getAllowedOrganizations());
+ $answerModel->set('organizationid', 'multiOptions', $this->loader->getCurrentUser()->getAllowedOrganizations());
if (count($answers) === 0) {
$answers[0] = array('' => sprintf($this->_('No %s found.'), $this->getTopic(0)));
Modified: trunk/library/classes/Gems/Default/IndexAction.php
===================================================================
--- trunk/library/classes/Gems/Default/IndexAction.php 2011-11-14 12:43:05 UTC (rev 207)
+++ trunk/library/classes/Gems/Default/IndexAction.php 2011-11-14 12:53:50 UTC (rev 208)
@@ -66,37 +66,94 @@
public $menu;
/**
- * Extension point, use different auth adapter if needed depending on the provided formValues
+ * @var Gems_Project_ProjectSettings
+ */
+ public $project;
+
+ /**
+ * Returns a link for the token input page.
*
- * This could be an organization passed in the login-form or something else.
+ * @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 array $formValues
- * @return Zend_Auth_Adapter_Interface
+ * @param $description Optional description, %s is filled with project name.
+ * @return Gems_Form
*/
- protected function _getAuthAdapter($formValues) {
- $adapter = new Zend_Auth_Adapter_DbTable($this->db, 'gems__users', 'gsu_login', 'gsu_password');
- $adapter->setIdentity($formValues['userlogin']);
- $adapter->setCredential($this->escort->passwordHash(null, $formValues['password'], false));
- return $adapter;
+ protected function _getBasicForm($description = null)
+ {
+ Gems_Html::init();
+
+ $form = new Gems_Form(array('labelWidthFactor' => $this->labelWidthFactor));
+ $form->setMethod('post');
+ if ($description) {
+ $form->setDescription(sprintf($description, $this->project->getName()));
+ }
+
+ return $form;
}
/**
- * New version of login form
+ * Returns an element for keeping a reset key.
*
+ * @return Zend_Form_Element_Hidden
+ */
+ protected function _getKeyElement()
+ {
+ return new Zend_Form_Element_Hidden('key');
+ }
+
+ /**
+ * Returns a login form
+ *
* @return Gems_Form
*/
protected function _getLoginForm()
{
- Gems_Html::init();
+ $form = $this->_getBasicForm($this->_('Login to %s application'));
+ $form->addElement($this->_getOrganizationElement());
+ $form->addElement($this->_getUserLoginElement());
+ $form->addElement($this->_getPasswordElement());
+ $form->addElement($this->_getSubmitButton($this->_('Login')));
+ $form->addElement($this->_getAskTokenLinkElement());
+ $form->addElement($this->_getResetLinkElement());
- $this->track[] = 'Get login form.';
+ return $form;
+ }
- $delayFactor = (isset($this->project->account) && isset($this->project->account['delayFactor']) ? $this->project->account['delayFactor'] : null);
+ /**
+ * Returns a link to the login page
+ *
+ * @return MUtil_Form_Element_Html
+ */
+ protected function _getLoginLinkElement()
+ {
+ // Reset password
+ $element = new MUtil_Form_Element_Html('resetPassword');
+ $element->br();
+ $element->actionLink(array('controller' => 'index', 'action' => 'login'), $this->_('Back to login'));
- $form = new Gems_Form(array('labelWidthFactor' => $this->labelWidthFactor));
- $form->setMethod('post');
- $form->setDescription(sprintf($this->_('Login to %s application'), $this->project->name));
+ return $element;
+ }
+ /**
+ * Returns an element for determining / selecting the organization.
+ *
+ * @return Zend_Form_Element_Xhtml
+ */
+ protected function _getOrganizationElement()
+ {
if ($this->escort instanceof Gems_Project_Organization_SingleOrganizationInterface) {
$element = new Zend_Form_Element_Hidden('organization');
$element->setValue($this->escort->getRespondentOrganization());
@@ -110,56 +167,106 @@
$element->setValue($this->escort->getCurrentOrganization());
}
}
- $form->addElement($element);
- // Veld inlognaam
- $element = new Zend_Form_Element_Text('userlogin');
- $element->setLabel($this->_('Username'));
- $element->setAttrib('size', 10);
- $element->setAttrib('maxlength', 20);
- $element->setRequired(true);
- $form->addElement($element);
+ return $element;
+ }
+ /**
+ * 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);
- //$element->addValidator(new Gems_Validate_GemsPasswordUsername('userlogin', 'password', $this->db, $delayFactor));
- $form->addElement($element);
+ $element->addValidator(new Gems_User_LoginPasswordValidator($this->loader->getUserLoader(), 'userlogin', 'organization', $this->translate));
- // Submit knop
- $element = new Zend_Form_Element_Submit('button');
- $element->setLabel($this->_('Login'));
- $element->setAttrib('class', 'button');
- $form->addElement($element);
+ return $element;
+ }
- // Veld token
- $element = new MUtil_Form_Element_Html('askToken');
- $element->br();
- $element->actionLink(array('controller' => 'ask', 'action' => 'token'), $this->_('Enter your token...'));
- $form->addElement($element);
+ /**
+ * Gets a reset password form.
+ *
+ * @return Gems_Form
+ */
+ protected function _getResetForm()
+ {
+ $form = $this->_getBasicForm($this->_('Reset password for %s application'));
+ $form->addElement($this->_getKeyElement());
+ $form->addElement($this->_getOrganizationElement());
+ $form->addElement($this->_getUserLoginElement());
+ $form->addElement($this->_getSubmitButton($this->_('Reset password')));
+ $form->addElement($this->_getLoginLinkElement());
+ return $form;
+ }
+
+ /**
+ * Returns a link to the reset password page
+ *
+ * @return MUtil_Form_Element_Html
+ */
+ protected function _getResetLinkElement()
+ {
// Reset password
$element = new MUtil_Form_Element_Html('resetPassword');
$element->br();
$element->actionLink(array('controller' => 'index', 'action' => 'resetpassword'), $this->_('Lost password'));
- $form->addElement($element);
- return $form;
+ return $element;
}
- // Dummy: always rerouted by GemsEscort
+ /**
+ * Returns a submit button.
+ *
+ * @param string $label
+ * @return Zend_Form_Element_Submit
+ */
+ protected function _getSubmitButton($label)
+ {
+ // Submit knop
+ $element = new Zend_Form_Element_Submit('button');
+ $element->setLabel($label);
+ $element->setAttrib('class', 'button');
+
+ return $element;
+ }
+
+ /**
+ * Returns a login name element.
+ *
+ * @return Zend_Form_Element_Text
+ */
+ protected function _getUserLoginElement()
+ {
+ // Veld inlognaam
+ $element = new Zend_Form_Element_Text('userlogin');
+ $element->setLabel($this->_('Username'));
+ $element->setAttrib('size', 10);
+ $element->setAttrib('maxlength', 20);
+ $element->setRequired(true);
+
+ return $element;
+ }
+
+ /**
+ * Dummy: always rerouted by GemsEscort
+ */
public function indexAction() { }
+ /**
+ * Default login page
+ */
public function loginAction()
{
- /**
- * If already logged in, try to redirect to the first allowed and visible menu item
- * if that fails, try to reroute to respondent/index
- */
- if (isset($this->session->user_id)) {
+ // If already logged in, try to redirect to the first allowed and visible menu item
+ // if that fails, try to reroute to respondent/index
+ if ($this->loader->getCurrentUser()->isActive()) {
if ($menuItem = $this->menu->findFirst(array('allowed' => true, 'visible' => true))) {
$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->gotoRoute($menuItem->toRouteUrl($this->getRequest()));
@@ -167,87 +274,33 @@
$this->_reroute(array('controller' => 'respondent', 'action'=>'index'));
}
}
- // MUtil_Echo::track(get_class($this->loader->getUser('super', null)));
$form = $this->_getLoginForm();
- if ($this->_request->isPost()) {
- if ($form->isValid($_POST, false)) {
- /*
- if ($user = $this->loader->getUser($_POST['userlogin'], $_POST['organization'])) {
+ $request = $this->getRequest();
+ if ($request->isPost()) {
+ if ($form->isValid($request->getPost(), false)) {
- } // */
+ $user = $this->loader->getUser($request->getParam('userlogin'), $request->getParam('organization'));
- if (isset($this->project->admin) && $this->project->admin['user'] == $_POST['userlogin'] && $this->project->admin['pwd'] == $_POST['password']) {
- $this->session->user_id = 2000;
- $this->session->user_name = $_POST['userlogin'];
- $this->session->user_group = 800;
- $this->session->user_role = 'master';
- $this->session->user_organization_id = 70;
- $this->session->user_organization_name = 'SUPER ADMIN';
- $this->session->user_style = 'gems';
- //Als er nog geen tabellen zijn, moet dit ingesteld worden
- //@@TODO Nog kijken hoe beter op te lossen (met try op tabel ofzo)
- $this->session->allowedOrgs = array($this->session->user_organization_id=>$this->session->user_organization_name);
+ if ($user->isActive()) {
+ $user->setAsCurrentUser();
/**
- * Ready
+ * Fix current locale / organization in cookies
*/
- $this->addMessage(sprintf($this->_('Login successful, welcome %s.'), $this->session->user_name));
- $this->_reroute(array('controller' => 'database', 'acti...
[truncated message content] |
|
From: <gem...@li...> - 2011-11-14 17:51:14
|
Revision: 213
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=213&view=rev
Author: matijsdejong
Date: 2011-11-14 17:51:04 +0000 (Mon, 14 Nov 2011)
Log Message:
-----------
Started on independent Organization object for #31 respondent login.
User switch is performed on organization cookie instead of style cookie.
Added a lot of documentation.
Modified Paths:
--------------
trunk/library/changelog.txt
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/Loader.php
trunk/library/classes/Gems/Project/Layout/MultiLayoutInterface.php
trunk/library/classes/Gems/Project/Layout/SingleLayoutInterface.php
trunk/library/classes/Gems/Project/Log/LogRespondentAccessInterface.php
trunk/library/classes/Gems/Project/Organization/MultiOrganizationInterface.php
trunk/library/classes/Gems/Project/Organization/SingleOrganizationInterface.php
trunk/library/classes/Gems/Project/Tracks/FixedTracksInterface.php
trunk/library/classes/Gems/Project/Tracks/MultiTracksInterface.php
trunk/library/classes/Gems/Project/Tracks/SingleTrackInterface.php
trunk/library/classes/Gems/Project/Tracks/StandAloneSurveysInterface.php
trunk/library/classes/Gems/Project/Tracks/TracksOnlyInterface.php
trunk/library/classes/Gems/User/User.php
trunk/library/classes/Gems/User/UserLoader.php
trunk/library/classes/GemsEscort.php
Added Paths:
-----------
trunk/library/classes/Gems/User/Organization.php
Modified: trunk/library/changelog.txt
===================================================================
--- trunk/library/changelog.txt 2011-11-14 15:42:16 UTC (rev 212)
+++ trunk/library/changelog.txt 2011-11-14 17:51:04 UTC (rev 213)
@@ -2,6 +2,7 @@
============================================================
Passwords should be set with a project.ini->salt. Salt is now a required project setting!
The table gems__staff is split into gems__staff, gems__user_logins with generic login data and gems__users_passwords containing db stored password information.
+GemsEscort->afterLogin(), ->afterLogout() and ->loadLoginInfo(0 are now all handled by Gems_User_UserDefinitionInterface objects.
The table gems__user_ids provides unique and non-sequential user ids accross gems__staff and gems__respondents.
The gems__respondent.grs_bsn has been renamed to grs_ssn, to make the code more international.
MailController is now called MailTemplateController.
Modified: trunk/library/classes/Gems/Default/IndexAction.php
===================================================================
--- trunk/library/classes/Gems/Default/IndexAction.php 2011-11-14 15:42:16 UTC (rev 212)
+++ trunk/library/classes/Gems/Default/IndexAction.php 2011-11-14 17:51:04 UTC (rev 213)
@@ -164,7 +164,7 @@
$element->setRequired(true);
if (! $this->_request->isPost()) {
- $element->setValue($this->escort->getCurrentOrganization());
+ $element->setValue($this->loader->getCurrentUser()->getOrganizationId());
}
}
Modified: trunk/library/classes/Gems/Loader.php
===================================================================
--- trunk/library/classes/Gems/Loader.php 2011-11-14 15:42:16 UTC (rev 212)
+++ trunk/library/classes/Gems/Loader.php 2011-11-14 17:51:04 UTC (rev 213)
@@ -160,7 +160,20 @@
}
/**
+ * Returns an organization object, initiated from the database.
*
+ * @param int $organizationId Optional, uses current user when empty
+ * @return Gems_User_Organization
+ */
+ public function getOrganization($organizationId = null)
+ {
+ $loader = $this->getUserLoader();
+
+ return $loader->getOrganization($organizationId);
+ }
+
+ /**
+ *
* @return Gems_Pdf
*/
public function getPdf()
Modified: trunk/library/classes/Gems/Project/Layout/MultiLayoutInterface.php
===================================================================
--- trunk/library/classes/Gems/Project/Layout/MultiLayoutInterface.php 2011-11-14 15:42:16 UTC (rev 212)
+++ trunk/library/classes/Gems/Project/Layout/MultiLayoutInterface.php 2011-11-14 17:51:04 UTC (rev 213)
@@ -1,34 +1,41 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Project
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
* Marker interface for Pulse Projects using only multi layout
*
* But Gems_Project_Layout_MultiLayoutAbstract implements the functionality to use these functions.
@@ -37,14 +44,25 @@
*
* @see Gems_Project_Layout_SingleLayoutInterface
*
- * @author Matijs de Jong <mj...@ma...>
- * @since 1.1
- * @version 1.1
- * @package Gems
+ * @package Gems
* @subpackage Project
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.1
*/
interface Gems_Project_Layout_MultiLayoutInterface
{
+ /**
+ * Returns an array with descriptions of the styles that can be used in this project.
+ *
+ * @return array styleKey => styleDescription
+ */
public function getStyles();
- public function layoutSwitch(Zend_Controller_Request_Abstract $request, $settings);
+
+ /**
+ * Performs the actual switch of the layout
+ *
+ * @param Zend_Controller_Request_Abstract $request
+ */
+ public function layoutSwitch(Zend_Controller_Request_Abstract $request);
}
\ No newline at end of file
Modified: trunk/library/classes/Gems/Project/Layout/SingleLayoutInterface.php
===================================================================
--- trunk/library/classes/Gems/Project/Layout/SingleLayoutInterface.php 2011-11-14 15:42:16 UTC (rev 212)
+++ trunk/library/classes/Gems/Project/Layout/SingleLayoutInterface.php 2011-11-14 17:51:04 UTC (rev 213)
@@ -1,43 +1,50 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
/**
+ * 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 Project
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
* Marker interface for Pulse Projects using only a single layout
*
* @see Gems_Project_Layout_MultiLayoutInterface
*
- * @author Matijs de Jong <mj...@ma...>
- * @since 1.1
- * @version 1.1
- * @package Gems
+ * @package Gems
* @subpackage Project
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.1
*/
interface Gems_Project_Layout_SingleLayoutInterface
{
Modified: trunk/library/classes/Gems/Project/Log/LogRespondentAccessInterface.php
===================================================================
--- trunk/library/classes/Gems/Project/Log/LogRespondentAccessInterface.php 2011-11-14 15:42:16 UTC (rev 212)
+++ trunk/library/classes/Gems/Project/Log/LogRespondentAccessInterface.php 2011-11-14 17:51:04 UTC (rev 213)
@@ -1,41 +1,48 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Project
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
* Marker interface for Pulse Projects logging access to respondent data and their tokens
*
- * @author Matijs de Jong <mj...@ma...>
- * @since 1.1
- * @version 1.1
- * @package Gems
+ * @package Gems
* @subpackage Project
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.1
*/
interface Gems_Project_Log_LogRespondentAccessInterface
{}
\ No newline at end of file
Modified: trunk/library/classes/Gems/Project/Organization/MultiOrganizationInterface.php
===================================================================
--- trunk/library/classes/Gems/Project/Organization/MultiOrganizationInterface.php 2011-11-14 15:42:16 UTC (rev 212)
+++ trunk/library/classes/Gems/Project/Organization/MultiOrganizationInterface.php 2011-11-14 17:51:04 UTC (rev 213)
@@ -1,6 +1,5 @@
<?php
-
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
@@ -26,6 +25,14 @@
* 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 Project
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
*/
/**
@@ -40,13 +47,12 @@
*
* @see Gems_Project_Organization_SingleOrganizationInterface
*
- * @author Matijs de Jong <mj...@ma...>
- * @since 1.1
- * @version 1.1
- * @package Gems
+ * @package Gems
* @subpackage Project
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.1
*/
interface Gems_Project_Organization_MultiOrganizationInterface
{
- public function getUserOrganization();
}
Modified: trunk/library/classes/Gems/Project/Organization/SingleOrganizationInterface.php
===================================================================
--- trunk/library/classes/Gems/Project/Organization/SingleOrganizationInterface.php 2011-11-14 15:42:16 UTC (rev 212)
+++ trunk/library/classes/Gems/Project/Organization/SingleOrganizationInterface.php 2011-11-14 17:51:04 UTC (rev 213)
@@ -1,34 +1,41 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Project
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
* Marker interface for Pulse Projects having respondents
* in only one organization.
*
@@ -37,11 +44,11 @@
*
* @see Gems_Project_Organization_MultiOrganizationInterface
*
- * @author Matijs de Jong <mj...@ma...>
- * @since 1.1
- * @version 1.1
- * @package Gems
+ * @package Gems
* @subpackage Project
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.1
*/
interface Gems_Project_Organization_SingleOrganizationInterface
{
Modified: trunk/library/classes/Gems/Project/Tracks/FixedTracksInterface.php
===================================================================
--- trunk/library/classes/Gems/Project/Tracks/FixedTracksInterface.php 2011-11-14 15:42:16 UTC (rev 212)
+++ trunk/library/classes/Gems/Project/Tracks/FixedTracksInterface.php 2011-11-14 17:51:04 UTC (rev 213)
@@ -1,45 +1,52 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
/**
+ * 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 Project
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
* Marker interface for Pulse Projects that use tracks that cannot be assigned by the user
* (but are assigned by the system instead).
*
* @see Gems_Project_Tracks_MultiTracksInterface
* @see Gems_Project_Tracks_SingleTrackInterface
*
- * @author Matijs de Jong <mj...@ma...>
- * @since 1.1
- * @version 1.1
- * @package Gems
+ * @package Gems
* @subpackage Project
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.1
*/
interface Gems_Project_Tracks_FixedTracksInterface
{
Modified: trunk/library/classes/Gems/Project/Tracks/MultiTracksInterface.php
===================================================================
--- trunk/library/classes/Gems/Project/Tracks/MultiTracksInterface.php 2011-11-14 15:42:16 UTC (rev 212)
+++ trunk/library/classes/Gems/Project/Tracks/MultiTracksInterface.php 2011-11-14 17:51:04 UTC (rev 213)
@@ -1,45 +1,52 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
/**
+ * 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 H...
[truncated message content] |
|
From: <gem...@li...> - 2011-11-18 09:11:19
|
Revision: 232
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=232&view=rev
Author: mennodekker
Date: 2011-11-18 09:11:12 +0000 (Fri, 18 Nov 2011)
Log Message:
-----------
Fixed #42 - Failed logins should be logged
Added extra info to the LogViewer in the detailed (show) action
Modified Paths:
--------------
trunk/library/classes/Gems/AccessLog.php
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/Default/LogAction.php
trunk/library/configs/db/patches.sql
Modified: trunk/library/classes/Gems/AccessLog.php
===================================================================
--- trunk/library/classes/Gems/AccessLog.php 2011-11-17 17:19:37 UTC (rev 231)
+++ trunk/library/classes/Gems/AccessLog.php 2011-11-18 09:11:12 UTC (rev 232)
@@ -1,39 +1,39 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
* @version $Id$
* @package Gems
* @subpackage AccessLog
* @copyright Copyright (c) 2011 Erasmus MC
* @license New BSD License
*/
-
+
/**
* Logging class to log access to certaint controller/actions
*
@@ -177,7 +177,7 @@
try {
//When project escort doesn't implement the log interface, we disable logging
if (!(GemsEscort::getInstance() instanceof Gems_Project_Log_LogRespondentAccessInterface)
- || ! isset($this->_userInfo->user_id)) {
+ || (!isset($this->_userInfo->user_id) && $force === false ) ) {
return $this;
}
@@ -191,12 +191,12 @@
$values['glua_to'] = $respondentId;
$values['glua_message'] = $message;
- $values['glua_by'] = $this->_userInfo->user_id;
- $values['glua_organization'] = $this->_userInfo->user_organization_id;
+ $values['glua_by'] = $this->_userInfo->user_id ? $this->_userInfo->user_id : 0;
+ $values['glua_organization'] = $this->_userInfo->user_organization_id ? $this->_userInfo->user_organization_id : 0;
$values['glua_action'] = $this->getActionId($action);
$values['glua_role'] = $this->_userInfo->user_role;
$values['glua_created'] = new Zend_Db_Expr('CURRENT_TIMESTAMP');
-
+
if ($request instanceof Zend_Controller_Request_Http) {
$values['glua_remote_ip'] = $request->getClientIp();
} else {
Modified: trunk/library/classes/Gems/Default/IndexAction.php
===================================================================
--- trunk/library/classes/Gems/Default/IndexAction.php 2011-11-17 17:19:37 UTC (rev 231)
+++ trunk/library/classes/Gems/Default/IndexAction.php 2011-11-18 09:11:12 UTC (rev 232)
@@ -317,8 +317,15 @@
}
return;
} else {
+ //Now present the user with an error message
$errors = $authResult->getMessages();
- $this->addMessage($errors);
+ $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);
}
}
}
Modified: trunk/library/classes/Gems/Default/LogAction.php
===================================================================
--- trunk/library/classes/Gems/Default/LogAction.php 2011-11-17 17:19:37 UTC (rev 231)
+++ trunk/library/classes/Gems/Default/LogAction.php 2011-11-18 09:11:12 UTC (rev 232)
@@ -166,6 +166,11 @@
$model->set('staff_name', 'label', $this->_('Staff'));
$model->set('respondent_name', 'label', $this->_('Respondent'));
+ if ($detailed) {
+ $model->set('glua_role', 'label', $this->_('Role'));
+ $model->set('glua_remote_ip', 'label', $this->_('IP address'));
+ }
+
return $model;
}
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-11-17 17:19:37 UTC (rev 231)
+++ trunk/library/configs/db/patches.sql 2011-11-18 09:11:12 UTC (rev 232)
@@ -319,3 +319,7 @@
ALTER TABLE `gems__organizations` ADD gor_accessible_by text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER gor_task,
ADD gor_has_patients boolean not null default 1 AFTER gor_iso_lang,
ADD gor_add_patients boolean not null default 1 AFTER gor_has_patients;
+
+-- PATCH: Log failed logins
+INSERT INTO `zsd`.`gems__log_actions` (`glac_id_action`, `glac_name`, `glac_change`, `glac_log`, `glac_created`)
+ VALUES (NULL , 'loginFail', '0', '1', CURRENT_TIMESTAMP);
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-11-21 16:33:22
|
Revision: 256
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=256&view=rev
Author: matijsdejong
Date: 2011-11-21 16:33:16 +0000 (Mon, 21 Nov 2011)
Log Message:
-----------
Small changes useful for project specific User extensions
Modified Paths:
--------------
trunk/library/classes/Gems/User/OldStaffUserDefinition.php
trunk/library/classes/Gems/User/StaffUserDefinition.php
trunk/library/classes/Gems/User/User.php
trunk/library/configs/db/patches.sql
Modified: trunk/library/classes/Gems/User/OldStaffUserDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/OldStaffUserDefinition.php 2011-11-21 15:51:49 UTC (rev 255)
+++ trunk/library/classes/Gems/User/OldStaffUserDefinition.php 2011-11-21 16:33:16 UTC (rev 256)
@@ -58,14 +58,14 @@
* @var Gems_Project_ProjectSettings
*/
protected $project;
-
+
/**
* Perform UserDefinition specific post-login logic
*
* @param Zend_Auth_Result $authResult
* @return void
*/
- public function afterLogin($authResult, $formValues)
+ public function afterLogin(Zend_Auth_Result $authResult, $formValues)
{
if ($authResult->isValid()) {
$login_name = $formValues['userlogin'];
@@ -142,6 +142,32 @@
*/
public function getUserData($login_name, $organization)
{
+ $select = $this->getUserSelect($login_name, $organization);
+
+ // For a multi-layout project we need to select the appropriate style too,
+ // but as PATCHES may not be in effect we have to try two selects
+ $select2 = clone $select;
+ $select2->columns(array('user_style' => 'gor_style'), 'gems__organizations');
+
+ try {
+ // Fails before patch has run...
+ return $this->db->fetchRow($select2, array($login_name), Zend_Db::FETCH_ASSOC);
+
+ } catch (Zend_Db_Exception $e) {
+ // So then we try the old method
+ return $this->db->fetchRow($select, array($login_name), Zend_Db::FETCH_ASSOC);
+ }
+ }
+
+ /**
+ * Stub to allow subclasses to add fields to the select.
+ *
+ * @param string $login_name
+ * @param int $organization
+ * @return Zend_Db_Select
+ */
+ protected function getUserSelect($login_name, $organization)
+ {
/**
* Read the needed parameters from the different tables, lots of renames for backward
* compatibility
@@ -165,19 +191,7 @@
->where('gsf_login = ?')
->limit(1);
- // For a multi-layout project we need to select the appropriate style too,
- // but as PATCHES may not be in effect we have to try two selects
- $select2 = clone $select;
- $select2->columns(array('user_style' => 'gor_style'), 'gems__organizations');
-
- try {
- // Fails before patch has run...
- return $this->db->fetchRow($select2, array($login_name), Zend_Db::FETCH_ASSOC);
-
- } catch (Zend_Db_Exception $e) {
- // So then we try the old method
- return $this->db->fetchRow($select, array($login_name), Zend_Db::FETCH_ASSOC);
- }
+ return $select;
}
/**
Modified: trunk/library/classes/Gems/User/StaffUserDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/StaffUserDefinition.php 2011-11-21 15:51:49 UTC (rev 255)
+++ trunk/library/classes/Gems/User/StaffUserDefinition.php 2011-11-21 16:33:16 UTC (rev 256)
@@ -166,6 +166,20 @@
*/
public function getUserData($login_name, $organization)
{
+ $select = $this->getUserSelect($login_name, $organization);
+
+ return $this->db->fetchRow($select, array($login_name, $organization), Zend_Db::FETCH_ASSOC);
+ }
+
+ /**
+ * Stub to allow subclasses to add fields to the select.
+ *
+ * @param string $login_name
+ * @param int $organization
+ * @return Zend_Db_Select
+ */
+ protected function getUserSelect($login_name, $organization)
+ {
$select = new Zend_Db_Select($this->db);
$select->from('gems__user_logins', array('user_login_id' => 'gul_id_user'))
->join('gems__staff', 'gul_login = gsf_login AND gul_id_organization = gsf_id_organization', array(
@@ -192,7 +206,7 @@
->where('gul_id_organization = ?')
->limit(1);
- return $this->db->fetchRow($select, array($login_name, $organization), Zend_Db::FETCH_ASSOC);
+ return $select;
}
/**
Modified: trunk/library/classes/Gems/User/User.php
===================================================================
--- trunk/library/classes/Gems/User/User.php 2011-11-21 15:51:49 UTC (rev 255)
+++ trunk/library/classes/Gems/User/User.php 2011-11-21 16:33:16 UTC (rev 256)
@@ -50,7 +50,7 @@
*
* @var Zend_Auth_Result
*/
- private $_authResult;
+ protected $_authResult;
/**
*
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-11-21 15:51:49 UTC (rev 255)
+++ trunk/library/configs/db/patches.sql 2011-11-21 16:33:16 UTC (rev 256)
@@ -320,6 +320,8 @@
ADD gor_has_patients boolean not null default 1 AFTER gor_iso_lang,
ADD gor_add_patients boolean not null default 1 AFTER gor_has_patients;
+UPDATE `gems__organizations` SET gor_has_patients = COALESCE((SELECT 1 FROM gems__respondent2org WHERE gr2o_id_organization = gor_id_organization GROUP BY gr2o_id_organization), 0);
+
-- PATCH: Log failed logins
INSERT INTO `zsd`.`gems__log_actions` (`glac_id_action`, `glac_name`, `glac_change`, `glac_log`, `glac_created`)
VALUES (NULL , 'loginFail', '0', '1', CURRENT_TIMESTAMP);
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-11-22 15:18:36
|
Revision: 270
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=270&view=rev
Author: matijsdejong
Date: 2011-11-22 15:18:23 +0000 (Tue, 22 Nov 2011)
Log Message:
-----------
Ticket #43: Flexible user password constraints:
- IndexAction checks if the user password is according to the password constraints
- StaffAction checks the password, but only for new users
- OptionAction uses validators (with Gems_Auth) as otherwise the checks became to complex for me
Updated translations
Modified Paths:
--------------
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/Default/OptionAction.php
trunk/library/classes/Gems/Default/ProjectTracksAction.php
trunk/library/classes/Gems/Default/StaffAction.php
trunk/library/classes/Gems/Project/ProjectSettings.php
trunk/library/classes/Gems/User/OldStaffUserDefinition.php
trunk/library/classes/Gems/User/PasswordChecker.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/User/UserNewPasswordValidator.php
trunk/library/classes/Gems/User/UserPasswordValidator.php
Modified: trunk/library/classes/Gems/Default/IndexAction.php
===================================================================
--- trunk/library/classes/Gems/Default/IndexAction.php 2011-11-22 15:09:32 UTC (rev 269)
+++ trunk/library/classes/Gems/Default/IndexAction.php 2011-11-22 15:18:23 UTC (rev 270)
@@ -282,6 +282,13 @@
$user->afterLogin($form->getValues());
+ //*
+ if ($messages = $user->reportPasswordWeakness($request->getParam('password'))) {
+ $user->setPasswordResetRequired(true);
+ $this->addMessage($this->_('Your password must be changed.'));
+ $this->addMessage($messages);
+ } // */
+
/**
* Fix current locale / organization in cookies
*/
@@ -301,7 +308,10 @@
if ($previousRequestParameters = $this->session->previousRequestParameters) {
$this->_reroute(array('controller' => $previousRequestParameters['controller'], 'action' => $previousRequestParameters['action']), false);
} else {
- // This reroutes to the first available menu page after login
+ // 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;
Modified: trunk/library/classes/Gems/Default/OptionAction.php
===================================================================
--- trunk/library/classes/Gems/Default/OptionAction.php 2011-11-22 15:09:32 UTC (rev 269)
+++ trunk/library/classes/Gems/Default/OptionAction.php 2011-11-22 15:18:23 UTC (rev 270)
@@ -98,6 +98,7 @@
$element->setAttrib('maxlength', 20);
$element->setRenderPassword(true);
$element->setRequired(true);
+ $element->addValidator(new Gems_User_UserPasswordValidator($user, $this->translate));
$form->addElement($element);
}
@@ -108,7 +109,7 @@
$element->setAttrib('maxlength', 20);
$element->setRequired(true);
$element->setRenderPassword(true);
- $element->addValidator('StringLength', true, array('min' => $this->project->passwords['MinimumLength'], 'max' => 20));
+ $element->addValidator(new Gems_User_UserNewPasswordValidator($user));
$element->addValidator(new MUtil_Validate_IsConfirmed('repeat_password', $this->_('Repeat password')));
$form->addElement($element);
@@ -130,26 +131,16 @@
/****************
* Process form *
****************/
- if ($this->_request->isPost()) {
- if ($form->isValid($_POST)) {
- $authResult = $user->authenticate(array('userlogin' => $user->getLoginName(),
- 'password' => $_POST['old_password'],
- 'organization' =>$user->getOrganizationId()));
- if ($authResult->isValid()) {
- $user->setPassword($_POST['new_password']);
+ if ($this->_request->isPost() && $form->isValid($_POST)) {
+ $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!'));
- } else {
- $errors = $authResult->getMessages();
- $this->addMessage($errors);
+ $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);
Modified: trunk/library/classes/Gems/Default/ProjectTracksAction.php
===================================================================
--- trunk/library/classes/Gems/Default/ProjectTracksAction.php 2011-11-22 15:09:32 UTC (rev 269)
+++ trunk/library/classes/Gems/Default/ProjectTracksAction.php 2011-11-22 15:18:23 UTC (rev 270)
@@ -90,6 +90,18 @@
return $this->_('Active tracks');
}
+ /*
+ public function indexAction()
+ {
+ parent::indexAction();
+
+ $user = $this->loader->getCurrentUser();
+ foreach (array('X1X', 'adminijadIran', 'xx!2yy2z', 'admin2') as $password) {
+ $this->addMessage($password);
+ $this->addMessage($user->reportPasswordWeakness($password));
+ }
+ } // */
+
public function questionsAction()
{
if ($sid = $this->_getParam(Gems_Model::SURVEY_ID)) {
Modified: trunk/library/classes/Gems/Default/StaffAction.php
===================================================================
--- trunk/library/classes/Gems/Default/StaffAction.php 2011-11-22 15:09:32 UTC (rev 269)
+++ trunk/library/classes/Gems/Default/StaffAction.php 2011-11-22 15:18:23 UTC (rev 270)
@@ -92,6 +92,14 @@
*/
protected function addFormElements(MUtil_Model_FormBridge $bridge, MUtil_Model_ModelAbstract $model, array $data, $new = false)
{
+ // Sorry, for the time being no password complexity checking on new
+ // users. Can be done, but is to complex for the moment.
+ if ($new) {
+ $user = false;
+ } else {
+ $user = $this->loader->getUserLoader()->getUserByStaffId($data['gsf_id_user']);
+ // MUtil_Echo::track($data['gsf_id_user'], $user->getLoginName());
+ }
$dbLookup = $this->util->getDbLookup();
switch ($data['gul_user_class']) {
@@ -137,14 +145,17 @@
}
if ($passwordField) {
- $bridge->addPassword($passwordField,
+ $pwdElem = $bridge->addPassword($passwordField,
'label', $this->_('Password'),
- 'minlength', $this->project->passwords['MinimumLength'],
// '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'));
Modified: trunk/library/classes/Gems/Project/ProjectSettings.php
===================================================================
--- trunk/library/classes/Gems/Project/ProjectSettings.php 2011-11-22 15:09:32 UTC (rev 269)
+++ trunk/library/classes/Gems/Project/ProjectSettings.php 2011-11-22 15:18:23 UTC (rev 270)
@@ -213,7 +213,7 @@
{
$args = MUtil_Ra::flatten(func_get_args());
$args = array_change_key_case(array_flip(array_filter($args)));
- //MUtil_Echo::track($args);
+ // MUtil_Echo::track($args);
$rules = array();
if (isset($this->passwords) && is_array($this->passwords)) {
@@ -225,7 +225,7 @@
/**
* Timeout for sessions in seconds.
- *
+ *
* @return int
*/
public function getSessionTimeOut()
@@ -236,16 +236,16 @@
return $this->defaultSessionTimeout;
}
}
-
+
/**
* Returns an array with throttling settings for the ask
* controller
- *
+ *
* @return array
*/
public function getAskThrottleSettings()
{
- // Check for the 'askThrottle' config section
+ // Check for the 'askThrottle' config section
if (!empty($this->askThrottle)) {
return $this->askThrottle;
} else {
Modified: trunk/library/classes/Gems/User/OldStaffUserDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/OldStaffUserDefinition.php 2011-11-22 15:09:32 UTC (rev 269)
+++ trunk/library/classes/Gems/User/OldStaffUserDefinition.php 2011-11-22 15:18:23 UTC (rev 270)
@@ -67,6 +67,7 @@
*/
public function afterLogin(Zend_Auth_Result $authResult, $formValues)
{
+ // MUtil_Echo::track($authResult->isValid(), $formValues);
if ($authResult->isValid()) {
$login_name = $formValues['userlogin'];
$organization = $formValues['organization'];
Modified: trunk/library/classes/Gems/User/PasswordChecker.php
===================================================================
--- trunk/library/classes/Gems/User/PasswordChecker.php 2011-11-22 15:09:32 UTC (rev 269)
+++ trunk/library/classes/Gems/User/PasswordChecker.php 2011-11-22 15:18:23 UTC (rev 270)
@@ -90,7 +90,7 @@
{
$len = intval($parameter);
$results = array();
- if (preg_match_all('/[A-Z]/', $password, $results) < $len) {
+ if ($len && (preg_match_all('/[A-Z]/', $password, $results) < $len)) {
$this->_addError(sprintf(
$this->translate->plural('A password should contain at least one uppercase character.', 'A password should contain at least %d uppercase characters.', $len),
$len));
@@ -107,7 +107,7 @@
{
$len = intval($parameter);
$results = array();
- if (preg_match_all('/[a-z]/', $password, $results) < $len) {
+ if ($len && (preg_match_all('/[a-z]/', $password, $results) < $len)) {
$this->_addError(sprintf(
$this->translate->plural('A password should contain at least one lowercase character.', 'A password should contain at least %d lowercase characters.', $len),
$len));
@@ -123,7 +123,7 @@
protected function minLength($parameter, $password)
{
$len = intval($parameter);
- if (strlen($password) < $len) {
+ if ($len && (strlen($password) < $len)) {
$this->_addError(sprintf($this->translate->_('A password should be at least %d characters long.'), $len));
}
}
@@ -137,12 +137,14 @@
protected function notAlphaCount($parameter, $password)
{
$len = intval($parameter);
- $results = array();
- $count = preg_match_all('/[A-Za-z]/', $password, $results);
- if (strlen($password) - $count < $len) {
- $this->_addError(sprintf(
- $this->translate->plural('A password should contain at least one not alphabetic character.', 'A password should contain at least %d not alphabetic characters.', $len),
- $len));
+ if ($len) {
+ $results = array();
+ $count = preg_match_all('/[A-Za-z]/', $password, $results);
+ if (strlen($password) - $count < $len) {
+ $this->_addError(sprintf(
+ $this->translate->plural('A password should contain at least one not alphabetic character.', 'A password should contain at least %d not alphabetic characters.', $len),
+ $len));
+ }
}
}
@@ -155,12 +157,14 @@
protected function notAlphaNumCount($parameter, $password)
{
$len = intval($parameter);
- $results = array();
- $count = preg_match_all('/[A-Za-z]/', $password, $results);
- if (strlen($password) - $count < $len) {
- $this->_addError(sprintf(
- $this->translate->plural('A password should contain at least one not alphanumeric character.', 'A password should contain at least %d not alphanumeric characters.', $len),
- $len));
+ if ($len) {
+ $results = array();
+ $count = preg_match_all('/[A-Za-z]/', $password, $results);
+ if (strlen($password) - $count < $len) {
+ $this->_addError(sprintf(
+ $this->translate->plural('A password should contain at least one not alphanumeric character.', 'A password should contain at least %d not alphanumeric characters.', $len),
+ $len));
+ }
}
}
@@ -192,7 +196,7 @@
{
$len = intval($parameter);
$results = array();
- if (preg_match_all('/[0-9]/', $password, $results) < $len) {
+ if ($len && (preg_match_all('/[0-9]/', $password, $results) < $len)) {
$this->_addError(sprintf(
$this->translate->plural('A password should contain at least one number.', 'A password should contain at least %d numbers.', $len),
$len));
@@ -211,7 +215,7 @@
$this->_errors = array();
$this->user = $user;
- $rules = $this->project->getPasswordRules($user->getOrganizationCode(), $user->getRoles());
+ $rules = $this->project->getPasswordRules($user->getOrganizationCode(), $user->getRoles(), $user->getDefinitionName());
// MUtil_Echo::track($rules);
foreach ($rules as $rule => $parameter) {
@@ -219,6 +223,7 @@
$this->$rule($parameter, $password);
}
}
+ // MUtil_Echo::track($this->_errors);
return $this->_errors;
}
Modified: trunk/library/classes/Gems/User/User.php
===================================================================
--- trunk/library/classes/Gems/User/User.php 2011-11-22 15:09:32 UTC (rev 269)
+++ trunk/library/classes/Gems/User/User.php 2011-11-22 15:18:23 UTC (rev 270)
@@ -294,6 +294,16 @@
}
/**
+ * Returns the name of the user definition.
+ *
+ * @return string
+ */
+ public function getDefinitionName()
+ {
+ return $this->_getVar('__user_definition');
+ }
+
+ /**
* Return true if this user has a password.
*
* @return boolean
@@ -304,6 +314,20 @@
}
/**
+ * 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->getOrganizationId());
+ }
+
+ /**
* Returns the full user name (first, prefix, last).
*
* @return string
@@ -534,6 +558,21 @@
}
/**
+ * Check for password weakness.
+ *
+ * @param string $password
+ * @return mixed String or array of strings containing warning messages or nothing
+ */
+ public function reportPasswordWeakness($password)
+ {
+ if ($this->canSetPassword()) {
+ $checker = $this->userLoader->getPasswordChecker();
+
+ return $checker->reportPasswordWeakness($this, $password);
+ }
+ }
+
+ /**
* Set this user as the current user.
*
* This means that the data about this user will be stored in a session.
Modified: trunk/library/classes/Gems/User/UserLoader.php
===================================================================
--- trunk/library/classes/Gems/User/UserLoader.php 2011-11-22 15:09:32 UTC (rev 269)
+++ trunk/library/classes/Gems/User/UserLoader.php 2011-11-22 15:18:23 UTC (rev 270)
@@ -114,9 +114,9 @@
// is removed from GemsEscort
if (! $this->session instanceof Zend_Session_Namespace) {
$this->session = new Zend_Session_Namespace('gems.' . GEMS_PROJECT_NAME . '.session');
-
+
$idleTimeout = $this->project->getSessionTimeout();
-
+
$this->session->setExpirationSeconds($idleTimeout);
$extras['session'] = $this->session;
@@ -178,6 +178,16 @@
}
/**
+ * Get password weakness checker.
+ *
+ * @return Gems_User_PasswordChecker
+ */
+ public function getPasswordChecker()
+ {
+ return $this->_getClass('passwordChecker');
+ }
+
+ /**
* Returns a user object, that may be empty if no user exist.
*
* @param string $login_name
@@ -191,6 +201,7 @@
$definition = $this->_getClass($defName);
$values = $definition->getUserData($login_name, $organization);
+ // MUtil_Echo::track($defName, $login_name, $organization, $values);
if (! isset($values['user_active'])) {
$values['user_active'] = true;
@@ -215,6 +226,7 @@
{
$data = $this->db->fetchRow("SELECT gsf_login, gsf_id_organization FROM gems__staff WHERE gsf_id_user = ?", $staff_id);
+ // MUtil_Echo::track($data);
if (false == $data) {
$data = array('gsf_login' => null, 'gsf_id_organization' => null);
}
Added: trunk/library/classes/Gems/User/UserNewPasswordValidator.php
===================================================================
--- trunk/library/classes/Gems/User/UserNewPasswordValidator.php (rev 0)
+++ trunk/library/classes/Gems/User/UserNewPasswordValidator.php 2011-11-22 15:18:23 UTC (rev 270)
@@ -0,0 +1,113 @@
+<?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: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ *
+ *
+ * @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);
+
+ // 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();
+ }
+
+
+ }
+}
Copied: trunk/library/classes/Gems/User/UserPasswordValidator.php (from rev 216, trunk/library/classes/Gems/User/UserPasswordValidator.php)
===================================================================
--- trunk/library/classes/Gems/User/UserPasswordValidator.php (rev 0)
+++ trunk/library/classes/Gems/User/UserPasswordValidator.php 2011-11-22 15:18:23 UTC (rev 270)
@@ -0,0 +1,120 @@
+<?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: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ *
+ *
+ * @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/UserPasswordValidator.php
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/newUser/classes/Gems/User/UserPasswordValidator.php:113-150
/branches/newUser2/classes/Gems/User/UserPasswordValidator.php:175-207
Modified: trunk/library/languages/default-en.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-en.po
===================================================================
--- trunk/library/languages/default-en.po 2011-11-22 15:09:32 UTC (rev 269)
+++ trunk/library/languages/default-en.po 2011-11-22 15:18:23 UTC (rev 270)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse EN\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-11-16 19:09+0100\n"
+"POT-Creation-Date: 2011-11-22 16:14+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -18,58 +18,58 @@
"X-Poedit-KeywordsList: plural:1,2\n"
"X-Poedit-SearchPath-0: .\n"
-#: classes/GemsEscort.php:201
+#: classes/GemsEscort.php:207
#, php-format
msgid "Path %s not writable"
msgstr "Path %s not writable"
-#: classes/GemsEscort.php:876
+#: classes/GemsEscort.php:887
#, php-format
msgid "User: %s"
msgstr "User: %s"
-#: classes/GemsEscort.php:900
+#: classes/GemsEscort.php:911
msgid "version"
msgstr "version"
-#: classes/GemsEscort.php:1330
-msgid "Take note: your session has expired, your inputs where not saved. Please check the input data and try again"
-msgstr "Take note: your session has expired, your inputs where not saved. Please check the input data and try again"
+#: classes/GemsEscort.php:1342
+msgid "Take note: your session has expired, your inputs were not saved. Please check the input data and try again"
+msgstr "Take note: your session has expired, your inputs were not saved. Please check the input data and try again"
-#: classes/GemsEscort.php:1454
+#: classes/GemsEscort.php:1466
msgid "Please check back later."
msgstr "Please check back later."
-#: classes/GemsEscort.php:1456
-#: classes/GemsEscort.php:1460
-#: classes/GemsEscort.php:1461
+#: classes/GemsEscort.php:1468
+#: classes/GemsEscort.php:1472
+#: classes/GemsEscort.php:1473
msgid "System is in maintenance mode"
msgstr "System is in maintenance mode"
-#: classes/GemsEscort.php:1470
+#: classes/GemsEscort.php:1483
msgid "No access to site."
msgstr "No access to site."
-#: classes/GemsEscort.php:1472
-#: classes/GemsEscort.php:1508
+#: classes/GemsEscort.php:1485
+#: classes/GemsEscort.php:1521
msgid "You have no access to this site."
msgstr "You have no access to this site."
-#: classes/GemsEscort.php:1488
+#: classes/GemsEscort.php...
[truncated message content] |
|
From: <gem...@li...> - 2011-11-22 15:59:31
|
Revision: 273
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=273&view=rev
Author: michieltcs
Date: 2011-11-22 15:59:21 +0000 (Tue, 22 Nov 2011)
Log Message:
-----------
Refs #307 - add Gems_Validate_IPRanges class, use in GroupAction
Modified Paths:
--------------
trunk/library/classes/Gems/Default/GroupAction.php
trunk/library/languages/FakeTranslations.php
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
Added Paths:
-----------
trunk/library/classes/Gems/Validate/IPRanges.php
Modified: trunk/library/classes/Gems/Default/GroupAction.php
===================================================================
--- trunk/library/classes/Gems/Default/GroupAction.php 2011-11-22 15:43:20 UTC (rev 272)
+++ trunk/library/classes/Gems/Default/GroupAction.php 2011-11-22 15:59:21 UTC (rev 273)
@@ -66,7 +66,7 @@
$bridge->addCheckbox('ggp_group_active');
$bridge->addCheckbox('ggp_staff_members');
$bridge->addCheckbox('ggp_respondent_members');
- $bridge->addText('ggp_allowed_ip_ranges');
+ $bridge->addText('ggp_allowed_ip_ranges', 'size', 50, 'validator', new Gems_Validate_IPRanges());
}
/**
Added: trunk/library/classes/Gems/Validate/IPRanges.php
===================================================================
--- trunk/library/classes/Gems/Validate/IPRanges.php (rev 0)
+++ trunk/library/classes/Gems/Validate/IPRanges.php 2011-11-22 15:59:21 UTC (rev 273)
@@ -0,0 +1,97 @@
+<?php
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @package Gems
+ * @subpackage Validate
+ * @author Michiel Rook <mi...@to...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Not used anymore, checked if we could use soap connection. As soap is no longer a reliable
+ * interface in LimeSurvey it is deprecated for now.
+ *
+ * @package Gems
+ * @subpackage Validate
+ * @author Michiel Rook <mi...@to...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ */
+class Gems_Validate_IPRanges extends Zend_Validate_Abstract
+{
+ /**
+ * Error constants
+ */
+ const ERROR_INVALID_IP = 'invalidIPInRange';
+
+ /**
+ * Error messages
+ * @var array
+ */
+ protected $_messageTemplates = array(
+ self::ERROR_INVALID_IP => 'One or more IPs are illegal.'
+ );
+
+ /**
+ * 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
+ * @return boolean
+ * @throws Zend_Valid_Exception If validation of $value is impossible
+ */
+ public function isValid($value, $context = array())
+ {
+ $result = true;
+
+ $ranges = explode('|', $value);
+
+ foreach ($ranges as $range) {
+ if (($sep = strpos($range, '-')) !== false) {
+ $min = ip2long(substr($range, 0, $sep));
+ $max = ip2long(substr($range, $sep + 1));
+
+ if ($min === false || $max === false) {
+ $result = false;
+ }
+ } else if (ip2long($range) === false) {
+ $result = false;
+ }
+ }
+
+ if (!$result) {
+ $this->_error(self::ERROR_INVALID_IP);
+ }
+
+ return $result;
+ }
+}
Property changes on: trunk/library/classes/Gems/Validate/IPRanges.php
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision Date Author
Added: svn:eol-style
+ native
Modified: trunk/library/languages/FakeTranslations.php
===================================================================
--- trunk/library/languages/FakeTranslations.php 2011-11-22 15:43:20 UTC (rev 272)
+++ trunk/library/languages/FakeTranslations.php 2011-11-22 15:59:21 UTC (rev 273)
@@ -93,6 +93,9 @@
_("'%value%' is an empty string");
_("Invalid type given. String, integer or float expected");
+// Gems_Validate_IPRanges
+_("One or more IPs are illegal.");
+
// Zend_Validate_EmailAddress replaced by MUtil_Validate_SimpleEmail
/*
_("Invalid type given, value should be a string");
Modified: trunk/library/languages/default-nl.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-nl.po
===================================================================
--- trunk/library/languages/default-nl.po 2011-11-22 15:43:20 UTC (rev 272)
+++ trunk/library/languages/default-nl.po 2011-11-22 15:59:21 UTC (rev 273)
@@ -1,4463 +1,4446 @@
-msgid ""
-msgstr ""
-"Project-Id-Version: Pulse NL\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-11-22 16:14+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:207
-#, php-format
-msgid "Path %s not writable"
-msgstr "Path %s niet schrijfbaar"
-
-#: classes/GemsEscort.php:887
-#, php-format
-msgid "User: %s"
-msgstr "Login: %s"
-
-#: classes/GemsEscort.php:911
-msgid "version"
-msgstr "versie"
-
-#: classes/GemsEscort.php:1342
-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:1466
-msgid "Please check back later."
-msgstr "Probeer het later opnieuw."
-
-#: classes/GemsEscort.php:1468
-#: classes/GemsEscort.php:1472
-#: classes/GemsEscort.php:1473
-msgid "System is in maintenance mode"
-msgstr "Systeem is in onderhoudsmodus"
-
-#: classes/GemsEscort.php:1483
-msgid "No access to site."
-msgstr "Geen toegang tot website."
-
-#: classes/GemsEscort.php:1485
-#: classes/GemsEscort.php:1521
-msgid "You have no access to this site."
-msgstr "U heeft geen toegang tot deze website."
-
-#: classes/GemsEscort.php:1501
-msgid "No access to page"
-msgstr "Geen toegang tot pagina"
-
-#: classes/GemsEscort.php:1503
-#, 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:1508
-#: classes/GemsEscort.php:1519
-msgid "You are no longer logged in."
-msgstr "U bent niet meer ingelogd."
-
-#: classes/GemsEscort.php:1509
-msgid "You must login to access this page."
-msgstr "U moet ingelogd zijn voor toegang tot deze pagina."
-
-#: classes/Gems/AccessLog.php:239
-msgid "Database needs to be updated!"
-msgstr "Database dient ververst te worden!"
-
-#: classes/Gems/Auth.php:241
-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 zoek"
-
-#: 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:248
-msgid "Logoff"
-msgstr "Uitloggen"
-
-#: 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:518
-msgid "Respondents"
-msgstr "Patiënten"
-
-#: classes/Gems/Menu.php:521
-msgid "Overview"
-msgstr "Overzicht"
-
-#: classes/Gems/Menu.php:528
-msgid "Project"
-msgstr "Project"
-
-#: classes/Gems/Menu.php:531
-msgid "Setup"
-msgstr "Beheer"
-
-#: classes/Gems/Menu.php:534
-msgid "Mail"
-msgstr "Email"
-
-#: classes/Gems/Menu.php:537
-msgid "Track Builder"
-msgstr "Traject bouwer"
-
-#: classes/Gems/Menu.php:546
-msgid "Contact"
-msgstr "Contact"
-
-#: classes/Gems/Menu.php:559
-msgid "Changelog"
-msgstr "Changelog"
-
-#: classes/Gems/Model.php:193
-msgid "Respondent nr"
-msgstr "Patiënt nr"
-
-#: classes/Gems/Model.php:194
-msgid "Opened"
-msgstr "Bekeken"
-
-#: classes/Gems/Model.php:195
-msgid "Consent"
-msgstr "Toestemming"
-
-#: classes/Gems/Model.php:197
-msgid "E-Mail"
-msgstr "Email"
-
-#: classes/Gems/Model.php:202
-msgid "Gender"
-msgstr "Geslacht"
-
-#: classes/Gems/Model.php:203
-msgid "First name"
-msgstr "Voornaam"
-
-#: classes/Gems/Model.php:204
-msgid "Surname prefix"
-msgstr "Tussenvoegsel"
-
-#: classes/Gems/Model.php:205
-msgid "Last name"
-msgstr "Achternaam"
-
-#: classes/Gems/Model.php:207
-msgid "Name"
-msgstr "Naam"
-
-#: classes/Gems/Model.php:210
-msgid "Street"
-msgstr "Straat"
-
-#: classes/Gems/Model.php:211
-msgid "Zipcode"
-msgstr "Postcode"
-
-#: classes/Gems/Model.php:212
-msgid "City"
-msgstr "Stad"
-
-#: classes/Gems/Model.php:214
-msgid "Phone"
-msgstr "Telefoon"
-
-#: classes/Gems/Model.php:216
-msgid "Birthday"
-msgstr "Geboren op"
-
-#: classes/Gems/Pdf.php:195
-#, php-format
-msgid "PDF Source File '%s' not found!"
-msgstr "PDF bron bestand %s niet gevonden!"
-
-#: classes/Gems/Pdf.php:237
-#, php-format
-msgid "Could not create '%s' directory."
-msgstr "Kon de directory '%s' niet aanmaken."
-
-#: classes/Gems/Pdf.php:280
-#, php-format
-msgid " The error message is: %s"
-msgstr "De foutmelding is: %s"
-
-#: classes/Gems/Tracker.php:732
-msgid "Checks performed"
-msgstr "Controle uitgevoerd"
-
-#: classes/Gems/UpgradesAbstract.php:164
-msgid "Already at max. level."
-msgstr "Al op het hoogste niveau."
-
-#: classes/Gems/UpgradesAbstract.php:171
-#, 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:179
-#, php-format
-msgid "Trying upgrade for %s to level %s: %s"
-msgstr "Probeert upgrade voor %s naar niveau %s: %s"
-
-#: classes/Gems/UpgradesAbstract.php:337
-msgid "Cache cleaned"
-msgstr "Cache opgeschoond"
-
-#: classes/Gems/Controller/BrowseEditAction.php:346
-#, php-format
-msgid "New %s..."
-msgstr "Nieuw %s..."
-
-#: classes/Gems/Controller/BrowseEditAction.php:378
-#, php-format
-msgid "Delete %s"
-msgstr "Verwijder %s"
-
-#: classes/Gems/Controller/BrowseEditAction.php:382
-#, php-format
-msgid "%2$u %1$s deleted"
-msgstr "%2$u %1$s verwijderd"
-
-#: classes/Gems/Controller/BrowseEditAction.php:396
-#, php-format
-msgid "Edit %s"
-msgstr "Bewerk %s"
-
-#: classes/Gems/Controller/BrowseEditAction.php:493
-msgid "Free search text"
-msgstr "Vrije zoek tekst"
-
-#: classes/Gems/Controller/BrowseEditAction.php:564
-msgid "Search"
-msgstr "Zoeken"
-
-#: classes/Gems/Controller/BrowseEditAction.php:580
-#, php-format
-msgid "No %s found"
-msgstr "Geen %s gevonden"
-
-#: classes/Gems/Controller/BrowseEditAction.php:653
-#, php-format
-msgid "No %s found."
-msgstr "Geen %s gevonden."
-
-#: classes/Gems/Controller/BrowseEditAction.php:768
-msgid "Are you sure?"
-msgstr "Weet u het zeker?"
-
-#: classes/Gems/Controller/BrowseEditAction.php:784
-msgid "Yes"
-msgstr "Ja"
-
-#: classes/Gems/Controller/BrowseEditAction.php:785
-msgid "No"
-msgstr "Nee"
-
-#: classes/Gems/Controller/BrowseEditAction.php:838
-#, php-format
-msgid "Unknown %s requested"
-msgstr "Onjuist %s verzoek"
-
-#: classes/Gems/Controller/BrowseEditAction.php:861
-#, php-format
-msgid "New %1$s..."
-msgstr "Nieuwe %1$s..."
-
-#: classes/Gems/Controller/BrowseEditAction.php:869
-msgid "Save"
-msgstr "Opslaan"
-
-#: classes/Gems/Controller/BrowseEditAction.php:905
-#, php-format
-msgid "%2$u %1$s saved"
-msgstr "%2$u %1$s opgeslagen"
-
-#: classes/Gems/Controller/BrowseEditAction.php:908
-msgid "No changes to save."
-msgstr "Geen verandering om op te slaan."
-
-#: classes/Gems/Controller/BrowseEditAction.php:917
-msgid "Input error! No changes saved!"
-msgstr "Invoer fout! Veranderingen niet opgeslagen!"
-
-#: classes/Gems/Controller/BrowseEditAction.php:945
-#, php-format
-msgid "Show %s"
-msgstr "Toon %s"
-
-#: classes/Gems/Controller/BrowseEditAction.php:952
-#, 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:532
-msgid "Cancel"
-msgstr "Annuleren"
-
-#: classes/Gems/Controller/ModelSnippetActionAbstract.php:181
-msgid "No data found."
-msgstr "Geen gegevens gevonden."
-
-#: 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:167
-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:218
-msgid "No mails sent."
-msgstr "Geen mail verzonden."
-
-#: classes/Gems/Default/CronAction.php:221
-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:64
-#, php-format
-msgid "Executed %2$s creation script %1$s:"
-msgstr "Uitvoerresultaat %2$s script %1$s:"
-
-#: classes/Gems/Default/DatabaseAction.php:74
-#, php-format
-msgid "%d record(s) returned as result set %d in step %d of %d."
-msgstr "%d rij(en) in resultaat %d in stap %d van %d."
-
-#: classes/Gems/Default/DatabaseAction.php:78
-#, php-format
-msgid "%d record(s) updated in step %d of %d."
-msgstr "In stap %2$d van %3$d zijn %1$d rij(en) aangepast."
-
-#: classes/Gems/Default/DatabaseAction.php:81
-#, php-format
-msgid "Script ran step %d of %d succesfully."
-msgstr "Stap %d van %d in het script met succes uitgevoerd."
-
-#: classes/Gems/Default/DatabaseAction.php:84
-msgid " in step "
-msgstr " in stap "
-
-#: classes/Gems/Default/DatabaseAction.php:89
-#, php-format
-msgid "No script for %1$s."
-msgstr "Geen script voor %1$s:"
-
-#: classes/Gems/Default/DatabaseAction.php:133
-#, php-format
-msgid "No rows in %s."
-msgstr "Geen gegevens in %s."
-
-#: classes/Gems/Default/DatabaseAction.php:162
-msgid "Type"
-msgstr "Type"
-
-#: classes/Gems/Default/DatabaseAction.php:166
-msgid "Group"
-msgstr "Groep"
-
-#: classes/Gems/Default/DatabaseAction.php:168
-msgid "Location"
-msgstr "Locatie"
-
-#: classes/Gems/Default/DatabaseAction.php:171
-msgid "Status"
-msgstr "Status"
-
-#: classes/Gems/Default/DatabaseAction.php:172
-msgid "created"
-msgstr "bestaat"
-
-#: classes/Gems/Default/DatabaseAction.php:173
-msgid "not created"
-msgstr "niet aanwezig"
-
-#: classes/Gems/Default/DatabaseAction.php:174
-msgid "unknown"
-msgstr "onbekend"
-
-#: classes/Gems/Default/DatabaseAction.php:177
-msgid "Script"
-msgstr "Script"
-
-#: classes/Gems/Default/DatabaseAction.php:179
-msgid "Changed on"
-msgstr "Veranderd op"
-
-#: classes/Gems/Default/DatabaseAction.php:198
-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:203
-#, php-format
-msgid "Drop %s"
-msgstr "Verwijder %s"
-
-#: classes/Gems/Default/DatabaseAction.php:211
-#, php-format
-msgid "There are %d rows in the table."
-msgstr "Er zijn %d rijen in deze tabel."
-
-#: classes/Gems/Default/DatabaseAction.php:213
-#, php-format
-msgid "Drop table with %d rows"
-msgstr "Tabel met %d rijen aan data verwijderen"
-
-#: classes/Gems/Default/DatabaseAction.php:214
-msgid "Are you really sure?"
-msgstr "Weet u het heel erg zeker?"
-
-#: classes/Gems/Default/DatabaseAction.php:230
-#, php-format
-msgid "%1$s %2$s dropped"
-msgstr "%1$s %2$s verwijderd"
-
-#: classes/Gems/Default/DatabaseAction.php:235
-msgid " during statement "
-msgstr " tijdens het commando "
-
-#: classes/Gems/Default/DatabaseAction.php:246
-#, php-format
-msgid "%s no longer exists in the database."
-msgstr "%s bestaat niet meer in de database."
-
-#: classes/Gems/Default/DatabaseAction.php:249
-#, php-format
-msgid "%s does not yet exist in the database."
-msgstr "%s bestaat nog niet in de database."
-
-#: classes/Gems/Default/DatabaseAction.php:252
-#, php-format
-msgid "%s object does exist."
-msgstr "%s object bestaat."
-
-#: classes/Gems/Default/DatabaseAction.php:270
-msgid "Object is not a table."
-msgstr "Niet een tabel object."
-
-#: classes/Gems/Default/DatabaseAction.php:293
-msgid "Structure"
-msgstr "Structuur"
-
-#: classes/Gems/Default/DatabaseAction.php:302
-msgid "database object"
-msgid_plural "database objects"
-msgstr[0] "database object"
-msgstr[1] "database objects"
-
-#: classes/Gems/Default/DatabaseAction.php:307
-msgid "Database object overview"
-msgstr "Database object overzicht"
-
-#: classes/Gems/Default/DatabaseAction.php:316
-#: classes/Gems/Default/DatabaseAction.php:368
-msgid "Level"
-msgstr "Niveau"
-
-#: classes/Gems/Default/DatabaseAction.php:317
-#: classes/Gems/Default/DatabaseAction.php:369
-msgid "Subtype"
-msgstr "Subtype"
-
-#: classes/Gems/Default/DatabaseAction.php:319
-msgid "To be executed"
-msgstr "Uit te voeren"
-
-#: classes/Gems/Default/DatabaseAction.php:320
-#: classes/Gems/Default/DatabaseAction.php:372
-msgid "Executed"
-msgstr "Uitgevoerd"
-
-#: classes/Gems/Default/DatabaseAction.php:321
-#: classes/Gems/Default/DatabaseAction.php:373
-msgid "Finished"
-msgstr "Afgerond"
-
-#: classes/Gems/Default/DatabaseAction.php:324
-msgid "Create the patch table!"
-msgstr "De patch tabel bestaat nog niet!"
-
-#: classes/Gems/Default/DatabaseAction.php:326
-#, php-format
-msgid "%d new or changed patch(es)."
-msgstr "%d nieuwe of veranderde patch(es)."
-
-#: classes/Gems/Default/DatabaseAction.php:331
-msgid "Gems build"
-msgstr "Gems bouwnummer"
-
-#: classes/Gems/Default/DatabaseAction.php:332
-msgid "Database build"
-msgstr "Database versie"
-
-#: classes/Gems/Default/DatabaseAction.php:334
-msgid "Execute level"
-msgstr "Uit te voeren versie"
-
-#: classes/Gems/Default/DatabaseAction.php:338
-msgid "Ignore finished"
-msgstr "Afgeronde patches overslaan"
-
-#: classes/Gems/Default/DatabaseAction.php:339
-msgid "Ignore executed"
-msgstr "Uitgevoerde patches overslaan"
-
-#: classes/Gems/Default/DatabaseAction.php:340
-msgid "Show patches"
-msgstr "Toon patches"
-
-#: classes/Gems/Default/DatabaseAction.php:354
-#, php-format
-msgid "%d patch(es) executed."
-msgstr "%d patch(es) uitgevoerd."
-
-#: classes/Gems/Default/DatabaseAction.php:367
-msgid "Patch"
-msgstr "Patch"
-
-#: classes/Gems/Default...
[truncated message content] |
|
From: <gem...@li...> - 2011-11-23 18:52:44
|
Revision: 278
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=278&view=rev
Author: matijsdejong
Date: 2011-11-23 18:52:36 +0000 (Wed, 23 Nov 2011)
Log Message:
-----------
MENU: Rebuilt menu to simpler parameter processing form using a single ParameterCollector instead of looping through sources (and treating each differently). You should not notice anything, but keep an eye out for missing or not working links. Specifying extra parameters should have become simpler.
HTML: $html->input() could not create a simple element, now it can.
ORGANIZATIONS: You can now specify the organizations that can have respondents. 90% ready, works except for adding new respondents. Logging in with an organization that cannot have a respondent will show either a message or a selection of allowed organization that do have patients.
Modified Paths:
--------------
trunk/library/classes/Gems/Default/OrganizationAction.php
trunk/library/classes/Gems/Default/RespondentAction.php
trunk/library/classes/Gems/Menu/MenuAbstract.php
trunk/library/classes/Gems/Menu/ParameterSourceInterface.php
trunk/library/classes/Gems/Menu/SubMenuItem.php
trunk/library/classes/Gems/Menu.php
trunk/library/classes/Gems/Pdf.php
trunk/library/classes/Gems/User/Organization.php
trunk/library/classes/GemsEscort.php
trunk/library/classes/MUtil/Html/InputRenderer.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__organizations.20.sql
trunk/library/languages/default-en.mo
trunk/library/languages/default-en.po
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
trunk/library/snippets/Organization/OrganizationTableSnippet.php
Added Paths:
-----------
trunk/library/classes/Gems/Menu/ParameterCollector.php
trunk/library/snippets/Organization/ChooseOrganizationSnippet.php
Modified: trunk/library/classes/Gems/Default/OrganizationAction.php
===================================================================
--- trunk/library/classes/Gems/Default/OrganizationAction.php 2011-11-23 14:20:20 UTC (rev 277)
+++ trunk/library/classes/Gems/Default/OrganizationAction.php 2011-11-23 18:52:36 UTC (rev 278)
@@ -61,17 +61,24 @@
protected $createEditSnippets = 'Organization_OrganizationEditSnippet';
/**
+ *
+ * @var Gems_Loader
+ */
+ public $loader;
+
+ /**
* Switch the active organization
*/
public function changeUiAction()
{
- $request = $this->getRequest();
- $org = urldecode($request->getParam('org'));
- $url = base64_decode($request->getParam('current_uri'));
- $oldOrgId = $this->session->user_organization_id;
+ $user = $this->loader->getCurrentUser();
+ $request = $this->getRequest();
+ $orgId = urldecode($request->getParam('org'));
+ $url = base64_decode($request->getParam('current_uri'));
+ $oldOrgId = $user->getOrganizationId();
- $allowedOrganizations = $this->loader->getCurrentUser()->getAllowedOrganizations();
- if ($orgId = array_search($org, $allowedOrganizations)) {
+ $allowedOrganizations = $user->getAllowedOrganizations();
+ if (isset($allowedOrganizations[$orgId])) {
$this->session->user_organization_id = $orgId;
$this->session->user_organization_name = $allowedOrganizations[$orgId];
@@ -83,8 +90,8 @@
);
}
- //Now update the requestcache to change the oldOrgId to the new orgId
- //Don't do it when the oldOrgId doesn't match
+ // Now update the requestcache to change the oldOrgId to the new orgId
+ // Don't do it when the oldOrgId doesn't match
$requestCache = $this->session->requestCache;
//Create the list of request cache keys that match an organization ID (to be extended)
@@ -106,7 +113,11 @@
$this->session->requestCache = $requestCache;
if (Gems_Cookies::setOrganization($orgId, $this->basepath->getBasePath())) {
- $this->getResponse()->setRedirect($url);
+ if ($url) {
+ $this->getResponse()->setRedirect($url);
+ } else {
+ $user->gotoStartPage($this->menu, $request);
+ }
return;
}
@@ -126,6 +137,27 @@
parent::createAction();
}
+
+ public function chooseAction()
+ {
+ $this->addSnippet('Organization_ChooseOrganizationSnippet');
+ $this->html->h3($this->_('Choose an organization'));
+
+ $user = $this->loader->getCurrentUser();
+ $request = $this->getRequest();
+
+ foreach ($user->getAllowedOrganizations() as $orgId => $name) {
+ $org = $this->loader->getOrganization($orgId);
+
+ if ($org->canHaveRespondents()) {
+ $url = array($request->getActionKey() => 'change-ui');
+ $url['org'] = $orgId;
+
+ $this->html->pInfo()->actionLink($url, $name, array('style' => 'font-size: 120%;'));
+ }
+ }
+ }
+
/**
* Creates a model for getModel(). Called only for each new $action.
*
@@ -141,7 +173,7 @@
{
$model = new MUtil_Model_TableModel('gems__organizations');
- $model->setDeleteValues('gor_active', 0, 'gor_add_patients', 0);
+ $model->setDeleteValues('gor_active', 0, 'gor_add_respondents', 0);
$model->set('gor_name', 'label', $this->_('Name'), 'size', 25);
$model->set('gor_location', 'label', $this->_('Location'), 'size', 25);
@@ -161,8 +193,8 @@
);
$yesNo = $this->util->getTranslated()->getYesNo();
$model->set('gor_active', 'label', $this->_('Active'), 'description', $this->_('Can the organization be used?'), 'elementClass', 'Checkbox', 'multiOptions', $yesNo);
- $model->set('gor_add_patients', 'label', $this->_('Accepting'), 'description', $this->_('Can new respondents be added to the organization?'), 'elementClass', 'CheckBox', 'multiOptions', $yesNo);
- $model->set('gor_has_patients', 'label', $this->_('Respondents'), 'description', $this->_('Does the organization have respondents?'), 'elementClass', 'Exhibitor', 'multiOptions', $yesNo);
+ $model->set('gor_add_respondents', 'label', $this->_('Accepting'), 'description', $this->_('Can new respondents be added to the organization?'), 'elementClass', 'CheckBox', 'multiOptions', $yesNo);
+ $model->set('gor_has_respondents', 'label', $this->_('Respondents'), 'description', $this->_('Does the organization have respondents?'), 'elementClass', 'Exhibitor', 'multiOptions', $yesNo);
if ($detailed) {
$model->set('gor_name', 'validator', $model->createUniqueValidator('gor_name'));
Modified: trunk/library/classes/Gems/Default/RespondentAction.php
===================================================================
--- trunk/library/classes/Gems/Default/RespondentAction.php 2011-11-23 14:20:20 UTC (rev 277)
+++ trunk/library/classes/Gems/Default/RespondentAction.php 2011-11-23 18:52:36 UTC (rev 278)
@@ -341,6 +341,19 @@
}
/**
+ * Overrule default index for the case that the current
+ * organization cannot have users.
+ */
+ public function indexAction()
+ {
+ if ($this->loader->getOrganization()->canHaveRespondents()) {
+ parent::indexAction();
+ } else {
+ $this->addSnippet('Organization_ChooseOrganizationSnippet');
+ }
+ }
+
+ /**
* Initialize translate and html objects
*
* Called from {@link __construct()} as final step of object instantiation.
Modified: trunk/library/classes/Gems/Menu/MenuAbstract.php
===================================================================
--- trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-11-23 14:20:20 UTC (rev 277)
+++ trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-11-23 18:52:36 UTC (rev 278)
@@ -85,7 +85,7 @@
}
}
- protected function _toNavigationArray(array $parameterSources)
+ protected function _toNavigationArray(Gems_Menu_ParameterCollector $source)
{
if ($this->_subItems) {
$lastParams = null;
@@ -93,7 +93,7 @@
$pages = array();
foreach ($this->_subItems as $item) {
if (! $item->get('button_only')) {
- $page = $item->_toNavigationArray($parameterSources);
+ $page = $item->_toNavigationArray($source);
if (($this instanceof Gems_Menu_SubMenuItem) &&
(! $this->notSet('controller', 'action')) &&
Added: trunk/library/classes/Gems/Menu/ParameterCollector.php
===================================================================
--- trunk/library/classes/Gems/Menu/ParameterCollector.php (rev 0)
+++ trunk/library/classes/Gems/Menu/ParameterCollector.php 2011-11-23 18:52:36 UTC (rev 278)
@@ -0,0 +1,105 @@
+<?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 Menu
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ *
+ *
+ * @package Gems
+ * @subpackage Menu
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class Gems_Menu_ParameterCollector
+{
+ protected $sources = array();
+ protected $values = array();
+
+ public function __construct()
+ {
+ $sources = MUtil_Ra::flatten(func_get_args());
+ foreach ($sources as $source) {
+ $this->addSource($source);
+ }
+ }
+
+ public function addSource($source)
+ {
+ array_unshift($this->sources, $source);
+ }
+
+ /**
+ * Returns a value to use as parameter for $name or
+ * $default if this object does not contain the value.
+ *
+ * @param string $name
+ * @param mixed $default
+ * @return mixed
+ */
+ public function getMenuParameter($name, $altname = null)
+ {
+ if (array_key_exists($name, $this->values)) {
+ return $this->values[$name];
+ }
+
+ $this->values[$name] = null;
+ foreach ($this->sources as $source) {
+ if ($source instanceof Zend_Controller_Request_Abstract) {
+ $value = $source->getParam($name, null);
+ if (null === $value) {
+ $value = $source->getParam($altname, $this->values[$name]);
+ }
+ $this->values[$name] = $value;
+
+ } elseif ($source instanceof Gems_Menu_ParameterSourceInterface) {
+ $this->values[$name] = $source->getMenuParameter($name, $this->values[$name]);
+
+ } elseif ($source instanceof MUtil_Lazy_RepeatableInterface) {
+ $this->values[$name] = $source->__get($name);
+
+ } elseif (is_array($source)) {
+ if (isset($source[$name])) {
+ $this->values[$name] = $source[$name];
+ }
+ }
+ if (null !== $this->values[$name]) {
+ break;
+ }
+ }
+ return $this->values[$name];
+ }
+}
Modified: trunk/library/classes/Gems/Menu/ParameterSourceInterface.php
===================================================================
--- trunk/library/classes/Gems/Menu/ParameterSourceInterface.php 2011-11-23 14:20:20 UTC (rev 277)
+++ trunk/library/classes/Gems/Menu/ParameterSourceInterface.php 2011-11-23 18:52:36 UTC (rev 278)
@@ -1,6 +1,5 @@
<?php
-
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
@@ -51,7 +50,7 @@
*/
interface Gems_Menu_ParameterSourceInterface
{
- /**
+ /**
* Returns a value to use as parameter for $name or
* $default if this object does not contain the value.
*
Modified: trunk/library/classes/Gems/Menu/SubMenuItem.php
===================================================================
--- trunk/library/classes/Gems/Menu/SubMenuItem.php 2011-11-23 14:20:20 UTC (rev 277)
+++ trunk/library/classes/Gems/Menu/SubMenuItem.php 2011-11-23 18:52:36 UTC (rev 278)
@@ -92,11 +92,11 @@
return print_r($this->_itemOptions, true);
}
- private function _applyParameterFilter($source, $paramFunction, $raiseConditions, &$condition)
+ private function _applyParameterFilter(Gems_Menu_ParameterCollector $source, $raiseConditions, &$condition)
{
if ($this->_parameterFilter) {
foreach ($this->_parameterFilter as $name => $testValue) {
- $paramValue = call_user_func($paramFunction, $source, $name, null);
+ $paramValue = $source->getMenuParameter($name);
if ($paramValue instanceof MUtil_Lazy_LazyInterface) {
if ($raiseConditions) {
@@ -124,20 +124,12 @@
}
}
- private function _applyParameterSource($source, $paramFunction, array &$parameters)
+ private function _applyParameterSource(Gems_Menu_ParameterCollector $source, array &$parameters)
{
// Fill in required parameters
if ($this->_parameters && is_array($this->_parameters)) {
foreach ($this->_parameters as $param => $name) {
-
- $default = isset($parameters[$param]) ? $parameters[$param] : null;
-
- $check = $name;
- if ($source instanceof Zend_Controller_Request_Abstract) $check = $param;
-
- if ($value = call_user_func($paramFunction, $source, $check, $default)) {
- $parameters[$param] = $value;
- }
+ $parameters[$param] = $source->getMenuParameter($name, $param);
// MUtil_Echo::r($param . '/' . $name . ' => ' . $value, $this->get('label'));
}
}
@@ -145,31 +137,16 @@
return false;
}
- private function _applyParameterSources(array $parameterSources, array &$parameters, $raiseConditions)
+ private function _applyParameterSources(Gems_Menu_ParameterCollector $source, array &$parameters, $raiseConditions)
{
+ // Gems_Menu::$verbose = true;
// MUtil_Echo::r($this->get('label'));
$condition = true;
- foreach ($parameterSources as $source) {
- if ($source instanceof Zend_Controller_Request_Abstract) {
- $this->_applyParameterSource($source, array(__CLASS__, '_getRequestValue'), $parameters);
-
- } elseif ($source instanceof Gems_Menu_ParameterSourceInterface) {
- if ($this->_applyParameterFilter($source, array(__CLASS__, '_getSourceValue'), $raiseConditions, $condition)) {
- return false;
- }
- $this->_applyParameterSource($source, array(__CLASS__, '_getSourceValue'), $parameters);
-
- } elseif ($source instanceof MUtil_Lazy_RepeatableInterface) {
- if ($this->_applyParameterFilter($source, array(__CLASS__, '_getRepeatableValue'), $raiseConditions, $condition)) {
- return false;
- }
- $this->_applyParameterSource($source, array(__CLASS__, '_getRepeatableValue'), $parameters);
-
- } elseif (is_array($source)) {
- $this->_applyParameterSource($source, array(__CLASS__, '_getArrayValue'), $parameters);
- }
+ if ($this->_applyParameterFilter($source, $raiseConditions, $condition)) {
+ return false;
}
+ $this->_applyParameterSource($source, $parameters);
// Test required parameters
if ($this->_requiredParameters) {
@@ -186,39 +163,14 @@
return $condition;
}
- private static function _getArrayValue($source, $name, $default)
+ private function _toHRef(Gems_Menu_ParameterCollector $source, &$condition)
{
- if (isset($source[$name])) {
- return $source[$name];
- } else {
- return $default;
- }
- }
-
- private static function _getRepeatableValue($source, $name, $default)
- {
- return $source->$name;
- }
-
- private static function _getRequestValue($source, $name, $default)
- {
- return $source->getParam($name, $default);
- }
-
- private static function _getSourceValue($source, $name, $default)
- {
- return $source->getMenuParameter($name, $default);
- }
-
- private function _toHRef(array $parameterSources, &$condition)
- {
if ($this->get('allowed')) {
$parameters = array();
- if ($condition = $this->_applyParameterSources($parameterSources, $parameters, ! $condition)) {
+ if ($condition = $this->_applyParameterSources($source, $parameters, ! $condition)) {
$url = new MUtil_Html_HrefArrayAttribute($parameters);
- // $url->setRequest($request); // TODO: Filter from $parameterSources?
$url->setRouteReset($this->get('reset_param', true));
foreach (array('module', 'controller', 'action', 'route') as $name) {
@@ -234,10 +186,10 @@
}
}
- private function _toLi(array $parameterSources)
+ private function _toLi(Gems_Menu_ParameterCollector $source)
{
$condition = false;
- if ($href = $this->_toHRef($parameterSources, $condition)) {
+ if ($href = $this->_toHRef($source, $condition)) {
$li = MUtil_Html::create()->li();
$li->a($href, $this->get('label'));
@@ -246,13 +198,13 @@
}
}
- protected function _toNavigationArray(array $parameterSources)
+ protected function _toNavigationArray(Gems_Menu_ParameterCollector $source)
{
$result = $this->_itemOptions;
if ($result['visible']) {
$parameters = array();
- if ($this->_applyParameterSources($parameterSources, $parameters, true)) {
+ if ($this->_applyParameterSources($source, $parameters, true)) {
$result['params'] = $parameters;
} else {
$result['visible'] = false;
@@ -260,7 +212,7 @@
}
if ($this->hasChildren()) {
- $result['pages'] = parent::_toNavigationArray($parameterSources);
+ $result['pages'] = parent::_toNavigationArray($source);
}
// Get any missing MVC keys from children, even when invisible
@@ -301,11 +253,11 @@
return $result;
}
- protected function _toRouteArray(array $parameterSources)
+ protected function _toRouteArray(Gems_Menu_ParameterCollector $source)
{
if ($this->get('allowed')) {
$result = array();
- if ($this->_applyParameterSources($parameterSources, $result, true)) {
+ if ($this->_applyParameterSources($source, $result, true)) {
if (isset($this->_itemOptions['controller'])) {
$result['controller'] = $this->_itemOptions['controller'];
}
@@ -323,7 +275,7 @@
if ($this->hasChildren()) {
foreach ($this->getChildren() as $child) {
if ($child->check(array('allowed', true))) {
- $firstChild = $firstChild->toRouteArray($parameterSources);
+ $firstChild = $firstChild->toRouteArray($source);
break;
}
}
@@ -387,6 +339,13 @@
return $this->addAction(null, $this->get('privilege'), 'autofilter');
}
+ /**
+ * Add an "Create new" action to the current subMenuItem
+ *
+ * @param string $privilege The privilege for the item
+ * @param array $other Array of extra options for this item, e.g. 'visible', 'allowed', 'class', 'icon', 'target', 'type', 'button_only'
+ * @return Gems_Menu_SubMenuItem
+ */
public function addCreateAction($privilege = null, array $other = array())
{
if (isset($other['label'])) {
@@ -725,6 +684,7 @@
public function is($key, $value)
{
+ // MUtil_Echo::track($key, $value);
$target = $this->get($key);
if (is_array($value)) {
@@ -856,7 +816,7 @@
}
$condition = true;
- if ($href = $this->_toHRef($parameterSources, $condition)) {
+ if ($href = $this->_toHRef(new Gems_Menu_ParameterCollector($parameterSources), $condition)) {
if ($condition instanceof MUtil_Lazy_LazyInterface) {
if ($showDisabled) {
@@ -937,14 +897,14 @@
$parameterSources = func_get_args();
$condition = true;
- return $this->_toHRef($parameterSources, $condition);
+ return $this->_toHRef(new Gems_Menu_ParameterCollector($parameterSources), $condition);
}
public function toRouteUrl($parameterSources_args = null)
{
$parameterSources = func_get_args();
- return $this->_toRouteArray($parameterSources);
+ return $this->_toRouteArray(new Gems_Menu_ParameterCollector($parameterSources));
}
public function toUl($actionController = null)
@@ -955,7 +915,7 @@
$ul = MUtil_Html_ListElement::ul();
foreach ($this->getChildren() as $menuItem) {
- if ($li = $menuItem->_toLi($parameterSources)) {
+ if ($li = $menuItem->_toLi(new Gems_Menu_ParameterCollector($parameterSources))) {
$ul->append($li);
}
}
Modified: trunk/library/classes/Gems/Menu.php
===================================================================
--- trunk/library/classes/Gems/Menu.php 2011-11-23 14:20:20 UTC (rev 277)
+++ trunk/library/classes/Gems/Menu.php 2011-11-23 18:52:36 UTC (rev 278)
@@ -264,7 +264,7 @@
// MAIN RESPONDENTS ITEM
$page = $this->addPage($label, 'pr.respondent', 'respondent');
$page->addAutofilterAction();
- $page->addCreateAction('pr.respondent.create');
+ $page->addCreateAction('pr.respondent.create')->setParameterFilter('can_add_respondents', true);;
$page->addShowAction()->addNamedParameters(MUtil_Model::REQUEST_ID, 'gr2o_patient_nr');
/*
@@ -517,6 +517,11 @@
// MAIN RESPONDENTS ITEM
$this->addRespondentPage($this->_('Respondents'));
+ /*
+ if ($this->escort instanceof Gems_Project_Organization_MultiOrganizationInterface) {
+ $this->addPage($this->_('Switch'), 'pr.respondent', 'organization', 'choose');
+ } // */
+
// MAIN PLANNING ITEM
$this->addPlanPage($this->_('Overview'));
@@ -625,14 +630,13 @@
$parameterSources = func_get_args();
if ($this->_menuParameters) {
- // array_unshift($parameterSources, $this->_menuParameters);
- // MUtil_echo::track($this->_menuParameters);
$parameterSources[] = $this->_menuParameters;
}
+ $source = new Gems_Menu_ParameterCollector($parameterSources);
// self::$verbose = true;
- $nav = new Zend_Navigation($this->_toNavigationArray($parameterSources));
+ $nav = new Zend_Navigation($this->_toNavigationArray($source));
// MUtil_Echo::r($this->_toNavigationArray($parameterSources));
Modified: trunk/library/classes/Gems/Pdf.php
===================================================================
--- trunk/library/classes/Gems/Pdf.php 2011-11-23 14:20:20 UTC (rev 277)
+++ trunk/library/classes/Gems/Pdf.php 2011-11-23 18:52:36 UTC (rev 278)
@@ -126,7 +126,7 @@
$content = $pdf->render();
- MUtil_Echo::track($filename);
+ // MUtil_Echo::track($filename);
if ($download) {
// Download & save
header('Content-Type: application/x-download');
Modified: trunk/library/classes/Gems/User/Organization.php
===================================================================
--- trunk/library/classes/Gems/User/Organization.php 2011-11-23 14:20:20 UTC (rev 277)
+++ trunk/library/classes/Gems/User/Organization.php 2011-11-23 18:52:36 UTC (rev 278)
@@ -125,6 +125,37 @@
}
/**
+ * Set menu parameters from the organization
+ *
+ * @param Gems_Menu_ParameterSource $source
+ * @return Gems_Tracker_Token (continuation pattern)
+ */
+ public function applyToMenuSource(Gems_Menu_ParameterSource $source)
+ {
+ $source->offsetSet('can_add_respondents', $this->canCreateRespondents());
+ }
+
+ /**
+ * Returns true when this organization has or can have respondents
+ *
+ * @return boolean
+ */
+ public function canCreateRespondents()
+ {
+ return (boolean) $this->_organizationData['gor_add_respondents'];
+ }
+
+ /**
+ * Returns true when this organization has or can have respondents
+ *
+ * @return boolean
+ */
+ public function canHaveRespondents()
+ {
+ return (boolean) $this->_organizationData['gor_has_respondents'] || $this->_organizationData['gor_add_respondents'];
+ }
+
+ /**
* Should be called after answering the request to allow the Target
* to check if all required registry values have been set correctly.
*
Modified: trunk/library/classes/GemsEscort.php
===================================================================
--- trunk/library/classes/GemsEscort.php 2011-11-23 14:20:20 UTC (rev 277)
+++ trunk/library/classes/GemsEscort.php 2011-11-23 18:52:36 UTC (rev 278)
@@ -801,21 +801,20 @@
$orgSwitch = MUtil_Html::create('div', array('id' => 'organizations'));
$currentUri = base64_encode($this->view->url());
+ $url = $this->view->getHelper('url')->url(array('controller' => 'organization', 'action' => 'change-ui'), null, true);
- $url = $this->view->getHelper('url')->url(array(
- 'controller' => 'organization',
- 'action' => 'change-ui'), null, true);
- $orgSwitch->raw('<form method="get" action="' . $url . '"><div><input type="hidden" name="current_uri" value="' . $currentUri . '" /><select name="org" onchange="javascript:this.form.submit();">');
+ $formDiv = $orgSwitch->form(array('method' => 'get', 'action' => $url))->div();
+ $formDiv->input(array('type' => "hidden", 'name' => "current_uri", 'value' => $currentUri));
+
+ $select = $formDiv->select(array('name' => "org", 'onchange' => "javascript:this.form.submit();"));
foreach ($orgs as $id => $org) {
$selected = '';
if ($id == $user->getOrganizationId()) {
- $selected = ' selected="selected"';
-
- } else {
+ $selected = array('selected' => "selected");
}
- $orgSwitch->raw('<option value="' . urlencode($org) . '"' . $selected . '>' . $org . '</option>');
+ $select->option(array('value' => $id), $org, $selected);
}
- $orgSwitch->raw('</select></div></form>');
+
return $orgSwitch;
} else {
return;
@@ -1455,6 +1454,9 @@
$this->menu = $loader->createMenu($this);
$this->_updateVariable('menu');
+ $source = $this->menu->getParameterSource();
+ $this->getLoader()->getOrganization()->applyToMenuSource($source);
+
/**
* Check if we are in maintenance mode or not. This is triggeren by a file in the var/settings
* directory with the name lock.txt
@@ -1531,7 +1533,7 @@
}
if (isset($menuItem)) {
- $menuItem->applyHiddenParameters($request, $this->menu->getParameterSource());
+ $menuItem->applyHiddenParameters($request, $source);
$this->menu->setCurrent($menuItem);
}
}
Modified: trunk/library/classes/MUtil/Html/InputRenderer.php
===================================================================
--- trunk/library/classes/MUtil/Html/InputRenderer.php 2011-11-23 14:20:20 UTC (rev 277)
+++ trunk/library/classes/MUtil/Html/InputRenderer.php 2011-11-23 18:52:36 UTC (rev 278)
@@ -1,45 +1,52 @@
<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of condit...
[truncated message content] |
|
From: <gem...@li...> - 2011-11-24 11:11:20
|
Revision: 279
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=279&view=rev
Author: matijsdejong
Date: 2011-11-24 11:11:14 +0000 (Thu, 24 Nov 2011)
Log Message:
-----------
Moved functionality from OrganizationAction.php to User->setCurrentOrganization()
Moved determination of password rule codes from PasswordChecker.php to User.php (seemed more logical and better extensible)
Modified Paths:
--------------
trunk/library/changelog.txt
trunk/library/classes/Gems/Default/OrganizationAction.php
trunk/library/classes/Gems/Project/ProjectSettings.php
trunk/library/classes/Gems/User/Organization.php
trunk/library/classes/Gems/User/PasswordChecker.php
trunk/library/classes/Gems/User/User.php
trunk/library/classes/Gems/User/UserLoader.php
Modified: trunk/library/changelog.txt
===================================================================
--- trunk/library/changelog.txt 2011-11-23 18:52:36 UTC (rev 278)
+++ trunk/library/changelog.txt 2011-11-24 11:11:14 UTC (rev 279)
@@ -4,6 +4,7 @@
Setting rules for user passwords has changed and has become more powerfull, unless you do not set them.
The table gems__staff is split into gems__staff, gems__user_logins with generic login data and gems__users_passwords containing db stored password information.
GemsEscort->afterLogin(), ->afterLogout() and ->loadLoginInfo(0 are now all handled by Gems_User_UserDefinitionInterface objects.
+GemsEscort->session kept for compatibility reasons, but use should be stopped.
The table gems__user_ids provides unique and non-sequential user ids accross gems__staff and gems__respondents.
The gems__respondent.grs_bsn has been renamed to grs_ssn, to make the code more international.
MailController is now called MailTemplateController.
Modified: trunk/library/classes/Gems/Default/OrganizationAction.php
===================================================================
--- trunk/library/classes/Gems/Default/OrganizationAction.php 2011-11-23 18:52:36 UTC (rev 278)
+++ trunk/library/classes/Gems/Default/OrganizationAction.php 2011-11-24 11:11:14 UTC (rev 279)
@@ -79,49 +79,14 @@
$allowedOrganizations = $user->getAllowedOrganizations();
if (isset($allowedOrganizations[$orgId])) {
- $this->session->user_organization_id = $orgId;
- $this->session->user_organization_name = $allowedOrganizations[$orgId];
+ $user->setCurrentOrganization($orgId);
- if ($this->escort instanceof Gems_Project_Layout_MultiLayoutInterface) {
- $this->session->user_style = $this->db->fetchOne(
- "SELECT gor_style
- FROM gems__organizations
- WHERE gor_id_organization = ?", $orgId
- );
+ if ($url) {
+ $this->getResponse()->setRedirect($url);
+ } else {
+ $user->gotoStartPage($this->menu, $request);
}
-
- // Now update the requestcache to change the oldOrgId to the new orgId
- // Don't do it when the oldOrgId doesn't match
- $requestCache = $this->session->requestCache;
-
- //Create the list of request cache keys that match an organization ID (to be extended)
- $possibleOrgIds = array(
- 'gr2o_id_organization',
- 'gto_id_organization');
-
- foreach ($requestCache as $key => $value) {
- if (is_array($value)) {
- foreach ($value as $paramKey => $paramValue) {
- if (in_array($paramKey, $possibleOrgIds)) {
- if ($paramValue == $oldOrgId) {
- $requestCache[$key][$paramKey] = $orgId;
- }
- }
- }
- }
- }
- $this->session->requestCache = $requestCache;
-
- if (Gems_Cookies::setOrganization($orgId, $this->basepath->getBasePath())) {
- if ($url) {
- $this->getResponse()->setRedirect($url);
- } else {
- $user->gotoStartPage($this->menu, $request);
- }
- return;
- }
-
- throw new Exception($this->_('Cookies must be enabled.'));
+ return;
}
throw new Exception($this->_('Invalid organization.'));
@@ -137,27 +102,6 @@
parent::createAction();
}
-
- public function chooseAction()
- {
- $this->addSnippet('Organization_ChooseOrganizationSnippet');
- $this->html->h3($this->_('Choose an organization'));
-
- $user = $this->loader->getCurrentUser();
- $request = $this->getRequest();
-
- foreach ($user->getAllowedOrganizations() as $orgId => $name) {
- $org = $this->loader->getOrganization($orgId);
-
- if ($org->canHaveRespondents()) {
- $url = array($request->getActionKey() => 'change-ui');
- $url['org'] = $orgId;
-
- $this->html->pInfo()->actionLink($url, $name, array('style' => 'font-size: 120%;'));
- }
- }
- }
-
/**
* Creates a model for getModel(). Called only for each new $action.
*
Modified: trunk/library/classes/Gems/Project/ProjectSettings.php
===================================================================
--- trunk/library/classes/Gems/Project/ProjectSettings.php 2011-11-23 18:52:36 UTC (rev 278)
+++ trunk/library/classes/Gems/Project/ProjectSettings.php 2011-11-24 11:11:14 UTC (rev 279)
@@ -100,13 +100,21 @@
$this->checkRequiredValues();
}
- protected function _getPasswordRules(array $current, array $keys, array &$rules)
+ /**
+ * Add recursively the rules active for this specific set of codes.
+ *
+ * @param array $current The current (part)sub) array of $this->passwords to check
+ * @param array $codes An array of code names that identify rules that should be used only for those codes.
+ * @param array $rules The array that stores the activated rules.
+ * @return void
+ */
+ protected function _getPasswordRules(array $current, array $codes, array &$rules)
{
foreach ($current as $key => $value) {
if (is_array($value)) {
// Only act when this is in the set of key values
- if (isset($keys[strtolower($key)])) {
- $this->_getPasswordRules($value, $keys, $rules);
+ if (isset($codes[strtolower($key)])) {
+ $this->_getPasswordRules($value, $codes, $rules);
}
} else {
$rules[$key] = $value;
@@ -195,6 +203,30 @@
}
/**
+ * Returns an array with throttling settings for the ask
+ * controller
+ *
+ * @return array
+ */
+ public function getAskThrottleSettings()
+ {
+ // Check for the 'askThrottle' config section
+ if (!empty($this->askThrottle)) {
+ return $this->askThrottle;
+ } else {
+ // Set some sensible defaults
+ // Detection window: 15 minutes
+ // Threshold: 20 requests per minute
+ // Delay: 10 seconds
+ $throttleSettings = array(
+ 'period' => 15 * 60,
+ 'threshold' => 15 * 20,
+ 'delay' => 10
+ );
+ }
+ }
+
+ /**
* Returns the public name of this project.
* @return string
*/
@@ -204,20 +236,20 @@
}
/**
+ * Get the rules active for this specific set of codes.
*
- * @param string $userDefinition
- * @param string $role
+ * @param array $codes An array of code names that identify rules that should be used only for those codes.
* @return array
*/
- public function getPasswordRules($userDefinition, $role)
+ public function getPasswordRules(array $codes)
{
- $args = MUtil_Ra::flatten(func_get_args());
- $args = array_change_key_case(array_flip(array_filter($args)));
- // MUtil_Echo::track($args);
+ // Process the codes array to a format better used for filtering
+ $codes = array_change_key_case(array_flip(array_filter($codes)));
+ // MUtil_Echo::track($codes);
$rules = array();
if (isset($this->passwords) && is_array($this->passwords)) {
- $this->_getPasswordRules($this->passwords, $args, $rules);
+ $this->_getPasswordRules($this->passwords, $codes, $rules);
}
return $rules;
@@ -238,30 +270,6 @@
}
/**
- * Returns an array with throttling settings for the ask
- * controller
- *
- * @return array
- */
- public function getAskThrottleSettings()
- {
- // Check for the 'askThrottle' config section
- if (!empty($this->askThrottle)) {
- return $this->askThrottle;
- } else {
- // Set some sensible defaults
- // Detection window: 15 minutes
- // Threshold: 20 requests per minute
- // Delay: 10 seconds
- $throttleSettings = array(
- 'period' => 15 * 60,
- 'threshold' => 15 * 20,
- 'delay' => 10
- );
- }
- }
-
- /**
* Returns the super admin name, if any
*
* @return string
@@ -296,7 +304,7 @@
return $this->admin['ipRanges'];
}
}
-
+
/**
* Returns a salted hash on the
*
Modified: trunk/library/classes/Gems/User/Organization.php
===================================================================
--- trunk/library/classes/Gems/User/Organization.php 2011-11-23 18:52:36 UTC (rev 278)
+++ trunk/library/classes/Gems/User/Organization.php 2011-11-24 11:11:14 UTC (rev 279)
@@ -186,7 +186,7 @@
}
/**
- * Get the style attribute.
+ * Get the code attribute.
*
* @return string
*/
@@ -196,6 +196,26 @@
}
/**
+ * Get the organization id.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->_organizationData['gor_id_organization'];
+ }
+
+ /**
+ * Get the name of the organization.
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->_organizationData['gor_name'];
+ }
+
+ /**
* Get the style attribute.
*
* @return string
Modified: trunk/library/classes/Gems/User/PasswordChecker.php
===================================================================
--- trunk/library/classes/Gems/User/PasswordChecker.php 2011-11-23 18:52:36 UTC (rev 278)
+++ trunk/library/classes/Gems/User/PasswordChecker.php 2011-11-24 11:11:14 UTC (rev 279)
@@ -206,16 +206,16 @@
/**
* Check for password weakness.
*
- * @param Gems_User_User $user The user for e.g. name checks
* @param string $password
+ * @param array $codes An array of code names that identify rules that should be used only for those codes.
* @return mixed String or array of strings containing warning messages
*/
- public function reportPasswordWeakness(Gems_User_User $user, $password)
+ public function reportPasswordWeakness(Gems_User_User $user, $password, array $codes)
{
+ $this->user = $user;
$this->_errors = array();
- $this->user = $user;
- $rules = $this->project->getPasswordRules($user->getOrganizationCode(), $user->getRoles(), $user->getDefinitionName());
+ $rules = $this->project->getPasswordRules($codes);
// MUtil_Echo::track($rules);
foreach ($rules as $rule => $parameter) {
Modified: trunk/library/classes/Gems/User/User.php
===================================================================
--- trunk/library/classes/Gems/User/User.php 2011-11-23 18:52:36 UTC (rev 278)
+++ trunk/library/classes/Gems/User/User.php 2011-11-24 11:11:14 UTC (rev 279)
@@ -59,30 +59,42 @@
private $_vars;
/**
+ * Required
*
* @var MUtil_Acl
*/
protected $acl;
/**
+ * Required
*
+ * @var Gems_Util_BasePath
+ */
+ protected $basepath;
+
+ /**
+ * Required
+ *
* @var Zend_Db_Adapter_Abstract
*/
protected $db;
/**
+ * Required, set in constructor
*
* @var Gems_User_UserDefinitionInterface
*/
protected $definition;
/**
+ * Required
*
* @var Zend_Session_Namespace
*/
protected $session;
/**
+ * Required
*
* @var Gems_User_UserLoader
*/
@@ -260,7 +272,7 @@
*/
public function checkRegistryRequestsAnswers()
{
- if (! $this->session instanceof Zend_Session_Namespace) {
+ if (! (($this->db instanceof Zend_Db_Adapter_Abstract) && ($this->session instanceof Zend_Session_Namespace))) {
return false;
}
@@ -292,7 +304,7 @@
$this->refreshAllowedOrganizations();
}
- return true;
+ return (boolean) $this->acl && $this->basepath && $this->userLoader;
}
/**
@@ -319,11 +331,11 @@
* Returns the name of the user definition.
*
* @return string
- */
+ * NOT NEEDED FOR THE MOMENT /
public function getDefinitionName()
{
return $this->_getVar('__user_definition');
- }
+ } // */
/**
* Return true if this user has a password.
@@ -390,6 +402,15 @@
/**
*
+ * @return Gems_User_Organization
+ */
+ public function getOrganization()
+ {
+ return $this->userLoader->getOrganization($this->getOrganizationId());
+ }
+
+ /**
+ *
* @return int
*/
public function getOrganizationId()
@@ -407,13 +428,13 @@
* Gets the (optional) organization code.
*
* @return string
- */
+ * NOT NEEDED FOR THE MOMENT /
public function getOrganizationCode()
{
$organizationId = $this->getOrganizationId();
return $this->userLoader->getOrganization($organizationId)->getCode();
- }
+ } // */
/**
* Return a password reset key
@@ -632,7 +653,11 @@
if ($this->canSetPassword()) {
$checker = $this->userLoader->getPasswordChecker();
- return $checker->reportPasswordWeakness($this, $password);
+ $codes[] = $this->getOrganization()->getCode();
+ $codes[] = $this->getRoles();
+ $codes[] = $this->_getVar('__user_definition');
+
+ return $checker->reportPasswordWeakness($this, $password, MUtil_Ra::flatten($codes));
}
}
@@ -667,7 +692,64 @@
return $this;
}
+ /**
+ * Set the currently selected organization for this user
+ *
+ * @param mixed $organization Gems_User_Organization or an organization id.
+ * @return Gems_User_User (continuation pattern)
+ */
+ public function setCurrentOrganization($organization)
+ {
+ if ($organization instanceof Gems_User_Organization) {
+ $organizationId = $organization->getId();
+ } else {
+ $organizationId = $organization;
+ $organization = $this->userLoader->getOrganization($organizationId);
+ }
+ $oldOrganizationId = $this->getOrganizationId();
+
+ if ($organizationId != $oldOrganizationId) {
+ $this->_setVar('user_organization_id', $organizationId);
+
+ // Depreciation warning: the settings will be removed in
+ // version 1.6 at the latest.
+ $this->_setVar('user_organization_name', $organization->getName());
+ $this->_setVar('user_style', $organization->getStyle());
+ // End depreciation warning
+
+ if ($this->isCurrentUser()) {
+ // Now update the requestcache to change the oldOrgId to the new orgId
+ // Don't do it when the oldOrgId doesn't match
+ $requestCache = $this->session->requestCache;
+
+ //Create the list of request cache keys that match an organization ID (to be extended)
+ $possibleOrgIds = array(
+ 'gr2o_id_organization',
+ 'gto_id_organization');
+
+ foreach ($requestCache as $key => $value) {
+ if (is_array($value)) {
+ foreach ($value as $paramKey => $paramValue) {
+ if (in_array($paramKey, $possibleOrgIds)) {
+ if ($paramValue == $oldOrganizationId) {
+ $requestCache[$key][$paramKey] = $organizationId;
+ }
+ }
+ }
+ }
+ }
+ $this->session->requestCache = $requestCache;
+ }
+ }
+
+ if (! Gems_Cookies::setOrganization($organizationId, $this->basepath->getBasePath())) {
+ throw new Exception($this->_('Cookies must be enabled for this site.'));
+ }
+
+ return $this;
+ }
+
/**
* Set the password, if allowed for this user type.
*
Modified: trunk/library/classes/Gems/User/UserLoader.php
===================================================================
--- trunk/library/classes/Gems/User/UserLoader.php 2011-11-23 18:52:36 UTC (rev 278)
+++ trunk/library/classes/Gems/User/UserLoader.php 2011-11-24 11:11:14 UTC (rev 279)
@@ -299,7 +299,7 @@
{
$checker = $this->_getClass('passwordChecker');
- return $checker->reportPasswordWeakness($user, $password);
+ return $user->reportPasswordWeakness($password);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-11-24 17:17:45
|
Revision: 284
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=284&view=rev
Author: matijsdejong
Date: 2011-11-24 17:17:39 +0000 (Thu, 24 Nov 2011)
Log Message:
-----------
Users can now login as any organization they are allowed to access.
Oodles of small bugs, e.g. gor_accessible_by implemented in wrong way
Modified Paths:
--------------
trunk/library/classes/Gems/User/OldStaffUserDefinition.php
trunk/library/classes/Gems/User/Organization.php
trunk/library/classes/Gems/User/StaffUserDefinition.php
trunk/library/classes/Gems/User/User.php
trunk/library/classes/Gems/User/UserLoader.php
trunk/library/snippets/Organization/OrganizationTableSnippet.php
Modified: trunk/library/classes/Gems/User/OldStaffUserDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/OldStaffUserDefinition.php 2011-11-24 15:35:11 UTC (rev 283)
+++ trunk/library/classes/Gems/User/OldStaffUserDefinition.php 2011-11-24 17:17:39 UTC (rev 284)
@@ -148,7 +148,7 @@
// For a multi-layout project we need to select the appropriate style too,
// but as PATCHES may not be in effect we have to try two selects
$select2 = clone $select;
- $select2->columns(array('user_style' => 'gor_style', 'user_allowed_ip_ranges' => 'ggp_allowed_ip_ranges', 'accessible_by' => 'gor_accessible_by'), 'gems__organizations');
+ $select2->columns(array('user_allowed_ip_ranges' => 'ggp_allowed_ip_ranges'), 'gems__groups');
try {
// Fails before patch has run...
@@ -184,7 +184,6 @@
->columns(array('user_name'=>"(concat(coalesce(concat(`gems__staff`.`gsf_first_name`,_utf8' '),_utf8''),coalesce(concat(`gems__staff`.`gsf_surname_prefix`,_utf8' '),_utf8''),coalesce(`gems__staff`.`gsf_last_name`,_utf8'')))"))
->join('gems__groups', 'gsf_id_primary_group = ggp_id_group', array('user_role'=>'ggp_role'))
->where('ggp_group_active = 1')
- ->where('gor_active = 1')
->where('gsf_active = 1')
->where('gsf_login = ?')
->limit(1);
Modified: trunk/library/classes/Gems/User/Organization.php
===================================================================
--- trunk/library/classes/Gems/User/Organization.php 2011-11-24 15:35:11 UTC (rev 283)
+++ trunk/library/classes/Gems/User/Organization.php 2011-11-24 17:17:39 UTC (rev 284)
@@ -32,7 +32,7 @@
* @author Matijs de Jong <mj...@ma...>
* @copyright Copyright (c) 2011 Erasmus MC
* @license New BSD License
- * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ * @version $id: Organization.php 203 2011-07-07 12:51:32Z matijs $
*/
/**
@@ -57,12 +57,21 @@
'gor_id_organization' => 1,
'gor_name' => 'NO ORGANIZATION',
'gor_code' => null,
+ 'gor_location' => null,
+ 'gor_url' => null,
+ 'gor_task' => null,
+ 'gor_accessible_by' => null,
+ 'gor_contact_name' => null,
+ 'gor_contact_email' => null,
+ 'gor_welcome' => null,
+ 'gor_signature' => null,
'gor_style' => null,
'gor_iso_lang' => 'en',
+ 'gor_has_respondents' => 0,
+ 'gor_add_respondents' => 0,
'gor_active' => 0,
- 'gor_has_respondents' => false,
- 'gor_add_respondents' => false
- );
+ 'can_access' => array(),
+ );
/**
*
@@ -173,21 +182,46 @@
}
if (! $this->_organizationData) {
- $this->_organizationData = $this->db->fetchRow('SELECT * FROM gems__organizations WHERE gor_id_organization = ? LIMIT 1', $this->_organizationId);
+ $sql = "SELECT * FROM gems__organizations WHERE gor_id_organization = ? LIMIT 1";
+ $this->_organizationData = $this->db->fetchRow($sql, $this->_organizationId);
if (! $this->_organizationData) {
$this->_organizationData = $this->_noOrganization;
+ } else {
+ $dbOrgId = $this->db->quote($this->_organizationId, Zend_Db::INT_TYPE);
+ $sql = "SELECT gor_id_organization, gor_name
+ FROM gems__organizations
+ WHERE gor_active = 1 AND
+ (
+ gor_id_organization = $dbOrgId OR
+ gor_accessible_by LIKE '%:$dbOrgId:%'
+ )
+ ORDER BY gor_name";
+ $this->_organizationData['can_access'] = $this->db->fetchPairs($sql);
+
+ // MUtil_Echo::track($sql, $this->_organizationData['can_access']);
}
if ($cacheId) {
$this->cache->save($this->_organizationData, $cacheId);
}
}
+ // MUtil_Echo::track($this->_organizationData);
return is_array($this->_organizationData) && parent::checkRegistryRequestsAnswers();
}
/**
+ * Get the organizations this organizations can access.
+ *
+ * @return array Of type orgId => orgName
+ */
+ public function getAllowedOrganizations()
+ {
+ return $this->_organizationData['can_access'];
+ }
+
+ /**
* Get the code attribute.
*
* @return string
Modified: trunk/library/classes/Gems/User/StaffUserDefinition.php
===================================================================
--- trunk/library/classes/Gems/User/StaffUserDefinition.php 2011-11-24 15:35:11 UTC (rev 283)
+++ trunk/library/classes/Gems/User/StaffUserDefinition.php 2011-11-24 17:17:39 UTC (rev 284)
@@ -192,16 +192,9 @@
'user_base_org_id' => 'gsf_id_organization'))
->columns(array('user_name'=>"(concat(coalesce(concat(`gems__staff`.`gsf_first_name`,_utf8' '),_utf8''),coalesce(concat(`gems__staff`.`gsf_surname_prefix`,_utf8' '),_utf8''),coalesce(`gems__staff`.`gsf_last_name`,_utf8'')))"))
->join('gems__groups', 'gsf_id_primary_group = ggp_id_group', array('user_role'=>'ggp_role', 'user_allowed_ip_ranges' => 'ggp_allowed_ip_ranges'))
- ->join('gems__organizations', 'gul_id_organization = gor_id_organization',
- array(
- 'user_organization_id' => 'gor_id_organization',
- 'user_organization_name' => 'gor_name',
- 'user_style' => 'gor_style',
- 'accessible_by' => 'gor_accessible_by'))
->joinLeft('gems__user_passwords', 'gul_id_user = gup_id_user',
array('user_password_reset' => 'gup_reset_required'))
->where('ggp_group_active = 1')
- ->where('gor_active = 1')
->where('gsf_active = 1')
->where('gul_can_login = 1')
->where('gul_login = ?')
Modified: trunk/library/classes/Gems/User/User.php
===================================================================
--- trunk/library/classes/Gems/User/User.php 2011-11-24 15:35:11 UTC (rev 283)
+++ trunk/library/classes/Gems/User/User.php 2011-11-24 17:17:39 UTC (rev 284)
@@ -230,6 +230,7 @@
$auth = Gems_Auth::getInstance();
$formValues['allowed_ip_ranges'] = $this->getAllowedIPRanges();
+ $formValues['organization'] = $this->getBaseOrganizationId();
$adapter = $this->definition->getAuthAdapter($formValues);
$authResult = $auth->authenticate($adapter, $formValues);
@@ -305,11 +306,6 @@
}
}
- if (! $this->_hasVar('__allowedOrgs')) {
- // Is always requested so no win in waiting.
- $this->refreshAllowedOrganizations();
- }
-
return (boolean) $this->acl && $this->basepath && $this->userLoader;
}
@@ -330,10 +326,25 @@
*/
public function getAllowedOrganizations()
{
+
+ if (! $this->_hasVar('__allowedOrgs')) {
+ $this->refreshAllowedOrganizations();
+ }
+
return $this->_getVar('__allowedOrgs');
}
/**
+ * Returns the original (not the current) organization used by this user.
+ *
+ * @return Gems_User_Organization
+ */
+ public function getBaseOrganization()
+ {
+ return $this->userLoader->getOrganization($this->getBaseOrganizationId());
+ }
+
+ /**
* Returns the original (not the current) organization id of this user.
*
* @return int
@@ -605,33 +616,14 @@
*/
public function refreshAllowedOrganizations()
{
- $sql = "SELECT gor_id_organization, gor_name FROM gems__organizations WHERE ";
-
// Privilege overrules organizational settings
- if (! $this->hasPrivilege('pr.organization-switch')) {
- if ($by = $this->_getVar('accessible_by')) {
- $orgs = explode(':', trim($by, ':'));
-
- if ($orgs) {
- // Not to forget: the users own organization
- $orgs[] = $this->getBaseOrganizationId();
-
- $sql .= "gor_id_organization IN (";
- $sql .= implode(', ', $orgs);
- $sql .= ") AND ";
- } else {
- $sql = false;
- }
- } else {
- $sql = false;
- }
- }
- if ($sql) {
- $sql .= " gor_active = 1 ORDER BY gor_name";
- $orgs = $this->db->fetchPairs($sql);
+ if ($this->hasPrivilege('pr.organization-switch')) {
+ $orgs = $this->db->fetchPairs("SELECT gor_id_organization, gor_name FROM gems__organizations WHERE gor_active = 1 ORDER BY gor_name");
} else {
- $orgs = array();
+ $orgs = $this->getBaseOrganization()->getAllowedOrganizations();
}
+ natsort($orgs);
+ // MUtil_Echo::track($orgs);
$this->_setVar('__allowedOrgs', $orgs);
Modified: trunk/library/classes/Gems/User/UserLoader.php
===================================================================
--- trunk/library/classes/Gems/User/UserLoader.php 2011-11-24 15:35:11 UTC (rev 283)
+++ trunk/library/classes/Gems/User/UserLoader.php 2011-11-24 17:17:39 UTC (rev 284)
@@ -126,16 +126,6 @@
}
/**
- * Get an array of OrgId => Org Name for all allowed organizations for the current loggedin user
- *
- * @return array
- */
- public function getAllowedOrganizations()
- {
- return $this->db->fetchPairs("SELECT gor_id_organization, gor_name FROM gems__organizations WHERE gor_active = 1 ORDER BY gor_name");
- }
-
- /**
* Get the currently loggin in user
*
* @return Gems_User_User
@@ -194,14 +184,15 @@
* @param int $organization
* @return Gems_User_User But ! ->isActive when the user does not exist
*/
- public function getUser($login_name, $organization)
+ public function getUser($login_name, $currentOrganization)
{
- $defName = $this->getUserClassName($login_name, $organization);
+ list($defName, $userOrganization) = $this->getUserClassInfo($login_name, $currentOrganization);
+ // MUtil_Echo::track($defName, $userOrganization);
$definition = $this->_getClass($defName);
- $values = $definition->getUserData($login_name, $organization);
- // MUtil_Echo::track($defName, $login_name, $organization, $values);
+ $values = $definition->getUserData($login_name, $userOrganization);
+ // MUtil_Echo::track($defName, $login_name, $userOrganization, $values);
if (! isset($values['user_active'])) {
$values['user_active'] = true;
@@ -211,7 +202,7 @@
$user = $this->_loadClass('User', true, array($values, $definition));
- $user->setCurrentOrganization($organization);
+ $user->setCurrentOrganization($currentOrganization);
return $user;
}
@@ -239,29 +230,64 @@
*
* @param string $login_name
* @param int $organization
- * @return string
+ * @return array Containing definitionName, organizationId
*/
- protected function getUserClassName($login_name, $organization)
+ protected function getUserClassInfo($login_name, $organization)
{
if ((null == $login_name) || (null == $organization)) {
- return 'NoLoginDefinition';
+ return array('NoLoginDefinition', $organization);
}
if ($this->isProjectUser($login_name)) {
- return 'ProjectUserDefinition';
+ return array('ProjectUserDefinition', $organization);
}
try {
- $sql = "SELECT gul_user_class FROM gems__user_logins WHERE gul_can_login = 1 AND gul_login = ? AND gul_id_organization = ?";
- if ($class = $this->db->fetchOne($sql, array($login_name, $organization))) {
- return $class . 'Definition';
+ $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
+ 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) {
+ // MUtil_Echo::track($row);
+ return $row;
+ }
+
} catch (Zend_Db_Exception $e) {
// Intentional fall through
}
// Fail over for pre 1.5 projects
- $sql = "SELECT gsf_id_user FROM gems__staff WHERE gsf_active = 1 AND gsf_login = ? AND gsf_id_organization = ?";
+ //
+ // No login as other organization 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 = ?";
if ($user_id = $this->db->fetchOne($sql, array($login_name, $organization))) {
// Move user to new staff.
@@ -281,10 +307,10 @@
// MUtil_Echo::r($e);
}
- return self::USER_OLD_STAFF . 'Definition';
+ return array(self::USER_OLD_STAFF . 'Definition', $organization);
}
- return 'NoLoginDefinition';
+ return array('NoLoginDefinition', $organization);
}
protected function isProjectUser($login_name)
Modified: trunk/library/snippets/Organization/OrganizationTableSnippet.php
===================================================================
--- trunk/library/snippets/Organization/OrganizationTableSnippet.php 2011-11-24 15:35:11 UTC (rev 283)
+++ trunk/library/snippets/Organization/OrganizationTableSnippet.php 2011-11-24 17:17:39 UTC (rev 284)
@@ -92,7 +92,7 @@
$bridge->addMultiSort($orgName, $BR, 'gor_task', $BR, 'gor_location');
$bridge->addMultiSort($mailName, $BR, 'gor_style', $BR, 'gor_iso_lang');
$bridge->addMultiSort('gor_active', $BR, 'gor_add_respondents', $BR, 'gor_has_respondents');
- // $bridge->add('gor_accessible_by');
+ $bridge->add('gor_accessible_by');
if ($editMenuItem = $this->getEditMenuItem()) {
$bridge->addItemLink($editMenuItem->toActionLinkLower($this->request, $bridge));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-11-28 11:37:32
|
Revision: 295
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=295&view=rev
Author: matijsdejong
Date: 2011-11-28 11:37:20 +0000 (Mon, 28 Nov 2011)
Log Message:
-----------
Separate organization login option added
Use of 'Ask token' and 'Lost password' buttons in IndexAction.php now optional.
Modified Paths:
--------------
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/Default/OrganizationAction.php
trunk/library/classes/Gems/Default/TokenPlanAction.php
trunk/library/classes/Gems/Util/DbLookup.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__organizations.20.sql
trunk/library/languages/default-en.mo
trunk/library/languages/default-en.po
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
trunk/library/snippets/Organization/OrganizationTableSnippet.php
Modified: trunk/library/classes/Gems/Default/IndexAction.php
===================================================================
--- trunk/library/classes/Gems/Default/IndexAction.php 2011-11-28 10:49:52 UTC (rev 294)
+++ trunk/library/classes/Gems/Default/IndexAction.php 2011-11-28 11:37:20 UTC (rev 295)
@@ -71,6 +71,20 @@
public $project;
/**
+ * The default behaviour for showing a lost password button
+ *
+ * @var boolean
+ */
+ protected $showPasswordLostButton = true;
+
+ /**
+ * The default behaviour for showing an 'ask token' button
+ *
+ * @var boolean
+ */
+ protected $showTokenButton = true;
+
+ /**
* Returns a link for the token input page.
*
* @return MUtil_Form_Element_Html
@@ -117,18 +131,25 @@
/**
* Returns a login form
*
+ * @param boolean $showTokenButton Optional, show 'Ask token' button, $this->showTokenButton is used when not specified
+ * @param boolean $showPasswordLostButton Optional, show 'Lost password' button, $this->showPasswordLostButton is used when not specified
* @return Gems_Form
*/
- protected function _getLoginForm()
+ protected function _getLoginForm($showTokenButton = null, $showPasswordLostButton = null)
{
$form = $this->_getBasicForm($this->_('Login to %s application'));
$form->addElement($this->_getOrganizationElement());
$form->addElement($this->_getUserLoginElement());
$form->addElement($this->_getPasswordElement());
$form->addElement($this->_getSubmitButton($this->_('Login')));
- $form->addElement($this->_getAskTokenLinkElement());
- $form->addElement($this->_getResetLinkElement());
+ if (null === $showTokenButton ? $this->showTokenButton : $showTokenButton) {
+ $form->addElement($this->_getAskTokenLinkElement());
+ }
+ if (null === $showPasswordLostButton ? $this->showPasswordLostButton : $showPasswordLostButton) {
+ $form->addElement($this->_getResetLinkElement());
+ }
+
return $form;
}
@@ -154,17 +175,27 @@
*/
protected function _getOrganizationElement()
{
- if ($this->escort instanceof Gems_Project_Organization_SingleOrganizationInterface) {
+ $hidden = $this->escort instanceof Gems_Project_Organization_SingleOrganizationInterface;
+ if ($hidden) {
+ $org = $this->escort->getRespondentOrganization();
+ } else {
+ $org = $this->loader->getCurrentUser()->getCurrentOrganizationId();
+ $orgs = $this->util->getDbLookup()->getOrganizationsForLogin();
+ $hidden = count($orgs) < 2;
+ }
+
+ if ($hidden) {
$element = new Zend_Form_Element_Hidden('organization');
- $element->setValue($this->escort->getRespondentOrganization());
+ $element->setValue($org);
} else {
$element = new Zend_Form_Element_Select('organization');
$element->setLabel($this->_('Organization'));
- $element->setMultiOptions($this->util->getDbLookup()->getOrganizations());
+ $element->setMultiOptions($orgs);
$element->setRequired(true);
+ $element->setAttrib('size', max(count($orgs) + 1, 6));
if (! $this->_request->isPost()) {
- $element->setValue($this->loader->getCurrentUser()->getCurrentOrganizationId());
+ $element->setValue($org);
}
}
Modified: trunk/library/classes/Gems/Default/OrganizationAction.php
===================================================================
--- trunk/library/classes/Gems/Default/OrganizationAction.php 2011-11-28 10:49:52 UTC (rev 294)
+++ trunk/library/classes/Gems/Default/OrganizationAction.php 2011-11-28 11:37:20 UTC (rev 295)
@@ -136,6 +136,7 @@
);
$yesNo = $this->util->getTranslated()->getYesNo();
$model->set('gor_active', 'label', $this->_('Active'), 'description', $this->_('Can the organization be used?'), 'elementClass', 'Checkbox', 'multiOptions', $yesNo);
+ $model->set('gor_has_login', 'label', $this->_('Login'), 'description', $this->_('Can people login for this organization?'), 'elementClass', 'CheckBox', 'multiOptions', $yesNo);
$model->set('gor_add_respondents', 'label', $this->_('Accepting'), 'description', $this->_('Can new respondents be added to the organization?'), 'elementClass', 'CheckBox', 'multiOptions', $yesNo);
$model->set('gor_has_respondents', 'label', $this->_('Respondents'), 'description', $this->_('Does the organization have respondents?'), 'elementClass', 'Exhibitor', 'multiOptions', $yesNo);
$model->set('gor_respondent_group', 'label', $this->_('Respondent group'), 'description', $this->_('Allows respondents to login.'), 'multiOptions', $this->util->getDbLookup()->getAllowedRespondentGroups());
Modified: trunk/library/classes/Gems/Default/TokenPlanAction.php
===================================================================
--- trunk/library/classes/Gems/Default/TokenPlanAction.php 2011-11-28 10:49:52 UTC (rev 294)
+++ trunk/library/classes/Gems/Default/TokenPlanAction.php 2011-11-28 11:37:20 UTC (rev 295)
@@ -341,7 +341,7 @@
if (($this->escort instanceof Gems_Project_Organization_MultiOrganizationInterface) &&
$this->escort->hasPrivilege('pr.plan.choose-org')){
// Select organisation
- $options = $this->util->getDbLookup()->getActiveOrganizations();
+ $options = $this->util->getDbLookup()->getOrganizationsWithRespondents();
$elements[] = $this->_createSelectElement('gto_id_organization', $options);
}
Modified: trunk/library/classes/Gems/Util/DbLookup.php
===================================================================
--- trunk/library/classes/Gems/Util/DbLookup.php 2011-11-28 10:49:52 UTC (rev 294)
+++ trunk/library/classes/Gems/Util/DbLookup.php 2011-11-28 11:37:20 UTC (rev 295)
@@ -75,24 +75,7 @@
*/
protected $session;
- public function getActiveOrganizations()
- {
- static $organizations;
- if (! $organizations) {
- $orgId = GemsEscort::getInstance()->getCurrentOrganization();
- $organizations = $this->db->fetchPairs('
- SELECT gor_id_organization, gor_name
- FROM gems__organizations
- WHERE (gor_active=1 AND
- gor_id_organization IN (SELECT gr2o_id_organization FROM gems__respondent2org)) OR
- gor_id_organization = ?
- ORDER BY gor_name', $orgId);
- }
-
- return $organizations;
- }
-
/**
* Return key/value pairs of all active staff members
*
@@ -230,6 +213,42 @@
return $organizations;
}
+ /**
+ * Returns a list of the organizations where users can login.
+ *
+ * @staticvar array $organizations
+ * @return array List of the active organizations
+ */
+ public function getOrganizationsForLogin()
+ {
+ static $organizations;
+
+ if (! $organizations) {
+ $organizations = $this->db->fetchPairs('SELECT gor_id_organization, gor_name FROM gems__organizations WHERE gor_active=1 AND gor_has_login=1 ORDER BY gor_name');
+ natsort($organizations);
+ }
+
+ return $organizations;
+ }
+
+ /**
+ * Returns a list of the organizations that have respondents.
+ *
+ * @staticvar array $organizations
+ * @return array List of the active organizations
+ */
+ public function getOrganizationsWithRespondents()
+ {
+ static $organizations;
+
+ if (! $organizations) {
+ $organizations = $this->db->fetchPairs('SELECT gor_id_organization, gor_name FROM gems__organizations WHERE gor_active=1 AND gor_has_respondents=1 ORDER BY gor_name');
+ natsort($organizations);
+ }
+
+ return $organizations;
+ }
+
public function getRoles()
{
$roles = array();
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-11-28 10:49:52 UTC (rev 294)
+++ trunk/library/configs/db/patches.sql 2011-11-28 11:37:20 UTC (rev 295)
@@ -327,6 +327,10 @@
ALTER TABLE `gems__organizations` ADD gor_respondent_group bigint unsigned null AFTER gor_add_respondents;
+ALTER TABLE `gems__organizations` ADD gor_has_login boolean not null default 1 AFTER gor_iso_lang;
+
+UPDATE `gems__organizations` SET gor_has_login = COALESCE((SELECT 1 FROM gems__staff WHERE gsf_id_organization = gor_id_organization GROUP BY gsf_id_organization), 0);
+
-- PATCH: Log failed logins
INSERT INTO `gems__log_actions` (`glac_id_action`, `glac_name`, `glac_change`, `glac_log`, `glac_created`)
VALUES (NULL , 'loginFail', '0', '1', CURRENT_TIMESTAMP);
Modified: trunk/library/configs/db/tables/gems__organizations.20.sql
===================================================================
--- trunk/library/configs/db/tables/gems__organizations.20.sql 2011-11-28 10:49:52 UTC (rev 294)
+++ trunk/library/configs/db/tables/gems__organizations.20.sql 2011-11-28 11:37:20 UTC (rev 295)
@@ -20,6 +20,7 @@
gor_iso_lang char(2) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'
not null default 'en' references gems__languages (gml_iso_lang),
+ gor_has_login boolean not null default 1,
gor_has_respondents boolean not null default 1,
gor_add_respondents boolean not null default 1,
gor_respondent_group bigint unsigned references gems__groups (ggp_id_group) null,
Modified: trunk/library/languages/default-en.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-en.po
===================================================================
--- trunk/library/languages/default-en.po 2011-11-28 10:49:52 UTC (rev 294)
+++ trunk/library/languages/default-en.po 2011-11-28 11:37:20 UTC (rev 295)
@@ -2,7 +2,7 @@
msgstr ""
"Project-Id-Version: Pulse EN\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-11-25 17:05+0100\n"
+"POT-Creation-Date: 2011-11-28 12:25+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Matijs de Jong <mj...@ma...>\n"
"Language-Team: Erasmus MGZ <mat...@ma...>\n"
@@ -1023,7 +1023,7 @@
msgstr "%s records found."
#: classes/Gems/Default/ExportAction.php:172
-#: classes/Gems/Default/IndexAction.php:162
+#: classes/Gems/Default/IndexAction.php:179
#: classes/Gems/Default/MailJobAction.php:119
msgid "Organization"
msgstr "Organization"
@@ -1056,88 +1056,88 @@
msgid "Administrative groups"
msgstr "Administrative groups"
-#: classes/Gems/Default/IndexAction.php:83
+#: classes/Gems/Default/IndexAction.php:91
msgid "Enter your token..."
msgstr "Enter your token..."
-#: classes/Gems/Default/IndexAction.php:124
+#: classes/Gems/Default/IndexAction.php:132
#, php-format
msgid "Login to %s application"
msgstr "Login to %s application"
-#: classes/Gems/Default/IndexAction.php:128
+#: classes/Gems/Default/IndexAction.php:136
msgid "Login"
msgstr "Login"
-#: classes/Gems/Default/IndexAction.php:145
+#: classes/Gems/Default/IndexAction.php:153
msgid "Back to login"
msgstr "Back to login"
-#: classes/Gems/Default/IndexAction.php:183
+#: classes/Gems/Default/IndexAction.php:201
msgid "Password"
msgstr "Password"
-#: classes/Gems/Default/IndexAction.php:198
+#: classes/Gems/Default/IndexAction.php:216
#, php-format
msgid "Reset password for %s application"
msgstr "Reset password for %s application"
-#: classes/Gems/Default/IndexAction.php:202
+#: classes/Gems/Default/IndexAction.php:220
msgid "Reset password"
msgstr "Reset password"
-#: classes/Gems/Default/IndexAction.php:248
+#: classes/Gems/Default/IndexAction.php:266
msgid "Username"
msgstr "Username"
-#: classes/Gems/Default/IndexAction.php:288
+#: classes/Gems/Default/IndexAction.php:306
msgid "Your password must be changed."
msgstr "Your password must be changed."
-#: classes/Gems/Default/IndexAction.php:300
+#: classes/Gems/Default/IndexAction.php:318
#, php-format
msgid "Login successful, welcome %s."
msgstr "Login successful, welcome %s."
-#: classes/Gems/Default/IndexAction.php:340
+#: classes/Gems/Default/IndexAction.php:358
#, php-format
msgid "Good bye: %s."
msgstr "Good bye: %s."
-#: classes/Gems/Default/IndexAction.php:365
+#: classes/Gems/Default/IndexAction.php:383
msgid "Reset accepted, enter your new password."
msgstr "Reset accepted, enter your new password."
-#: classes/Gems/Default/IndexAction.php:369
+#: classes/Gems/Default/IndexAction.php:387
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:386
+#: classes/Gems/Default/IndexAction.php:404
msgid "Password reset requested"
msgstr "Password reset requested"
-#: classes/Gems/Default/IndexAction.php:387
+#: classes/Gems/Default/IndexAction.php:405
#, 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:392
+#: classes/Gems/Default/IndexAction.php:410
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:394
+#: classes/Gems/Default/IndexAction.php:412
msgid "Unable to send e-mail."
msgstr "Unable to send e-mail."
-#: classes/Gems/Default/IndexAction.php:399
+#: classes/Gems/Default/IndexAction.php:417
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:403
+#: classes/Gems/Default/IndexAction.php:421
msgid "We received your password reset key."
msgstr "We received your password reset key."
-#: classes/Gems/Default/IndexAction.php:404
+#: classes/Gems/Default/IndexAction.php:422
msgid "Please enter the organization and username belonging to this key."
msgstr "Please enter the organization and username belonging to this key."
@@ -1546,67 +1546,71 @@
msgstr "Can the organization be used?"
#: classes/Gems/Default/OrganizationAction.php:139
+msgid "Can people login for this organization?"
+msgstr "Can people login for this organization?"
+
+#: classes/Gems/Default/OrganizationAction.php:140
msgid "Accepting"
msgstr "Accepting"
-#: classes/Gems/Default/OrganizationAction.php:139
+#: classes/Gems/Default/OrganizationAction.php:140
msgid "Can new respondents be added to the organization?"
msgstr "Can new patients be added to the organization?"
-#: classes/Gems/Default/OrganizationAction.php:140
+#: classes/Gems/Default/OrganizationAction.php:141
msgid "Does the organization have respondents?"
msgstr "Does the organization have patients?"
-#: classes/Gems/Default/OrganizationAction.php:141
+#: classes/Gems/Default/OrganizationAction.php:142
msgid "Respondent group"
msgstr "Patient group"
-#: classes/Gems/Default/OrganizationAction.php:141
+#: classes/Gems/Default/OrganizationAction.php:142
msgid "Allows respondents to login."
msgstr "Allow patients to login."
-#: classes/Gems/Default/OrganizationAction.php:145
+#: classes/Gems/Default/OrganizationAction.php:146
msgid "Greeting"
msgstr "Greeting"
-#: classes/Gems/Default/OrganizationAction.php:145
#: classes/Gems/Default/OrganizationAction.php:146
+#: classes/Gems/Default/OrganizationAction.php:147
msgid "For emails and token forward screen."
msgstr "For emails and token forward screen."
-#: classes/Gems/Default/OrganizationAction.php:146
+#: classes/Gems/Default/OrganizationAction.php:147
msgid "Signature"
msgstr "Signature"
-#: classes/Gems/Default/OrganizationAction.php:148
+#: classes/Gems/Default/OrganizationAction.php:149
msgid "Accessible by"
msgstr "Accessible by"
-#: classes/Gems/Default/OrganizationAction.php:148
+#: classes/Gems/Default/OrganizationAction.php:149
msgid "Checked organizations see this organizations respondents."
msgstr "Checked organizations see this organizations patients."
-#: classes/Gems/Default/OrganizationAction.php:158
+#: classes/Gems/Default/OrganizationAction.php:159
msgid "Code name"
msgstr "Code name"
-#: classes/Gems/Default/OrganizationAction.php:158
+#: classes/Gems/Default/OrganizationAction.php:159
msgid "Only for programmers."
msgstr "Only for programmers."
-#: classes/Gems/Default/OrganizationAction.php:172
+#: classes/Gems/Default/OrganizationAction.php:173
msgid "Delete organization"
msgstr "Delete organization"
-#: classes/Gems/Default/OrganizationAction.php:182
+#: classes/Gems/Default/OrganizationAction.php:183
msgid "Edit organization"
msgstr "Edit organization"
-#: classes/Gems/Default/OrganizationAction.php:192
+#: classes/Gems/Default/OrganizationAction.php:193
msgid "Participating organizations"
msgstr "Participating organizations"
-#: classes/Gems/Default/OrganizationAction.php:202
+#: classes/Gems/Default/OrganizationAction.php:203
msgid "Show organization"
msgstr "Show organization"
@@ -1912,41 +1916,41 @@
msgid "Has the respondent signed the informed consent letter?"
msgstr "Has the patient signed the informed consent letter?"
-#: classes/Gems/Default/RespondentAction.php:199
+#: classes/Gems/Default/RespondentAction.php:204
msgid "Comments"
msgstr "Comments"
-#: classes/Gems/Default/RespondentAction.php:200
+#: classes/Gems/Default/RespondentAction.php:205
msgid "Physician"
msgstr "Physician"
-#: classes/Gems/Default/RespondentAction.php:201
+#: classes/Gems/Default/RespondentAction.php:206
msgid "Treatment"
msgstr "Treatment"
-#: classes/Gems/Default/RespondentAction.php:230
+#: classes/Gems/Default/RespondentAction.php:235
msgid "Rejection code"
msgstr "Rejection code"
-#: classes/Gems/Default/RespondentAction.php:237
+#: classes/Gems/Default/RespondentAction.php:242
msgid "Delete respondent"
msgstr "Delete patient"
-#: classes/Gems/Default/RespondentAction.php:288
+#: classes/Gems/Default/RespondentAction.php:293
msgid "Respondent deleted."
msgstr "Patient deleted"
-#: classes/Gems/Default/RespondentAction.php:291
+#: classes/Gems/Default/RespondentAction.php:296
msgid "Choose a reception code to delete."
msgstr "Choose a reception code to delete."
-#: classes/Gems/Default/RespondentAction.php:335
+#: classes/Gems/Default/RespondentAction.php:340
msgid "respondent"
msgid_plural "respondents"
msgstr[0] "patient"
msgstr[1] "patients"
-#: classes/Gems/Default/RespondentAction.php:405
+#: classes/Gems/Default/RespondentAction.php:410
msgid "Please settle the informed consent form for this respondent."
msgstr "Please settle the informed consent form for this patient."
Modified: trunk/library/languages/default-nl.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-nl.po
===================================================================
--- trunk/library/languages/default-nl.po 2011-11-28 10:49:52 UTC (rev 294)
+++ trunk/library/languages/default-nl.po 2011-11-28 11:37:20 UTC (rev 295)
@@ -1,4489 +1,4519 @@
-msgid ""
-msgstr ""
-"Project-Id-Version: Pulse NL\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-11-25 17:23+0100\n"
-"PO-Revision-Date: \n"
-"Last-Translator: Michiel Rook <in...@to...>\n"
-"Language-Team: Erasmus MGZ <mat...@ma...>\n"
-"Language: \n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Poedit-Language: Dutch\n"
-"X-Poedit-Country: NETHERLANDS\n"
-"X-Poedit-SourceCharset: iso-8859-1\n"
-"X-Poedit-Basepath: ../\n"
-"X-Poedit-KeywordsList: plural:1,2\n"
-"X-Poedit-SearchPath-0: .\n"
-
-#: classes/GemsEscort.php:207
-#, php-format
-msgid "Path %s not writable"
-msgstr "Path %s niet schrijfbaar"
-
-#: classes/GemsEscort.php:891
-#, php-format
-msgid "User: %s"
-msgstr "Login: %s"
-
-#: classes/GemsEscort.php:916
-msgid "version"
-msgstr "versie"
-
-#: classes/GemsEscort.php:1347
-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:1474
-msgid "Please check back later."
-msgstr "Probeer het later opnieuw."
-
-#: classes/GemsEscort.php:1476
-#: classes/GemsEscort.php:1481
-msgid "System is in maintenance mode"
-msgstr "Systeem is in onderhoudsmodus"
-
-#: classes/GemsEscort.php:1491
-msgid "No access to site."
-msgstr "Geen toegang tot website."
-
-#: classes/GemsEscort.php:1493
-msgid "You have no access to this site."
-msgstr "U heeft geen toegang tot deze website."
-
-#: classes/GemsEscort.php:1509
-msgid "No access to page"
-msgstr "Geen toegang tot pagina"
-
-#: classes/GemsEscort.php:1511
-#, 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:1516
-msgid "You are no longer logged in."
-msgstr "U bent niet meer ingelogd."
-
-#: classes/GemsEscort.php:1517
-msgid "You must login to access this page."
-msgstr "U moet ingelogd zijn voor toegang tot deze pagina."
-
-#: classes/Gems/Pdf.php:195
-#, php-format
-msgid "PDF Source File '%s' not found!"
-msgstr "PDF bron bestand %s niet gevonden!"
-
-#: classes/Gems/Pdf.php:237
-#, php-format
-msgid "Could not create '%s' directory."
-msgstr "Kon de directory '%s' niet aanmaken."
-
-#: classes/Gems/Pdf.php:280
-#, php-format
-msgid " The error message is: %s"
-msgstr "De foutmelding is: %s"
-
-#: classes/Gems/Tracker.php:732
-msgid "Checks performed"
-msgstr "Controle uitgevoerd"
-
-#: classes/Gems/AccessLog.php:239
-msgid "Database needs to be updated!"
-msgstr "Database dient ververst te worden!"
-
-#: classes/Gems/Html.php:154
-msgid "<< First"
-msgstr "<< Eerste"
-
-#: classes/Gems/Html.php:155
-msgid "< Previous"
-msgstr "< Terug"
-
-#: classes/Gems/Html.php:156
-msgid "Next >"
-msgstr "Verder >"
-
-#: classes/Gems/Html.php:157
-msgid "Last >>"
-msgstr "Laatste >>"
-
-#: classes/Gems/Html.php:158
-msgid " | "
-msgstr " | "
-
-#: classes/Gems/Html.php:162
-msgid "to"
-msgstr "tot"
-
-#: classes/Gems/Html.php:163
-msgid "of"
-msgstr "van"
-
-#: classes/Gems/Menu.php:139
-#, php-format
-msgid "About %s"
-msgstr "Over %s"
-
-#: classes/Gems/Menu.php:143
-msgid "Reporting bugs"
-msgstr "Meld een bug"
-
-#: classes/Gems/Menu.php:146
-msgid "Support"
-msgstr "Ondersteuning"
-
-#: classes/Gems/Menu.php:166
-msgid "Project setup"
-msgstr "Projectinfo"
-
-#: classes/Gems/Menu.php:169
-msgid "Database"
-msgstr "Database"
-
-#: classes/Gems/Menu.php:173
-msgid "Content"
-msgstr "Inhoud"
-
-#: classes/Gems/Menu.php:176
-msgid "Execute"
-msgstr "Uitvoeren"
-
-#: classes/Gems/Menu.php:181
-msgid "Patches"
-msgstr "Patches"
-
-#: classes/Gems/Menu.php:182
-msgid "Execute new"
-msgstr "Nieuwe aanmaken"
-
-#: classes/Gems/Menu.php:184
-msgid "Refresh translateables"
-msgstr "Ververs vertaalbaren"
-
-#: classes/Gems/Menu.php:186
-msgid "Run SQL"
-msgstr "SQL uitvoeren"
-
-#: classes/Gems/Menu.php:189
-msgid "Reception codes"
-msgstr "Ontvangst codes"
-
-#: classes/Gems/Menu.php:192
-msgid "Consents"
-msgstr "Toestemmingen"
-
-#: classes/Gems/Menu.php:195
-msgid "Roles"
-msgstr "Rollen"
-
-#: classes/Gems/Menu.php:196
-msgid "Assigned"
-msgstr "Toegewezen"
-
-#: classes/Gems/Menu.php:197
-msgid "Privileges"
-msgstr "Priviléges"
-
-#: classes/Gems/Menu.php:200
-msgid "Groups"
-msgstr "Groepen"
-
-#: classes/Gems/Menu.php:203
-msgid "Organizations"
-msgstr "Organisaties"
-
-#: classes/Gems/Menu.php:206
-msgid "Staff"
-msgstr "Medewerkers"
-
-#: classes/Gems/Menu.php:209
-msgid "Logging"
-msgstr "Logboek"
-
-#: classes/Gems/Menu.php:213
-msgid "Maintenance"
-msgstr "Onderhoud"
-
-#: classes/Gems/Menu.php:218
-msgid "Upgrade"
-msgstr "Upgrade"
-
-#: classes/Gems/Menu.php:219
-msgid "Show"
-msgstr "Toon"
-
-#: classes/Gems/Menu.php:220
-msgid "Execute all"
-msgstr "Alles uitvoeren"
-
-#: classes/Gems/Menu.php:221
-msgid "Execute this"
-msgstr "Dit uitvoeren"
-
-#: classes/Gems/Menu.php:222
-msgid "Execute from here"
-msgstr "Uitvoeren vanaf hier"
-
-#: classes/Gems/Menu.php:223
-msgid "Execute to here"
-msgstr "Uitvoeren tot hier"
-
-#: classes/Gems/Menu.php:235
-#, php-format
-msgid "Stand-alone privilige: %s"
-msgstr "Zelfstandig privilege: %s"
-
-#: classes/Gems/Menu.php:242
-msgid "Logon"
-msgstr "Login"
-
-#: classes/Gems/Menu.php:243
-msgid "Lost password"
-msgstr "Wachtwoord vergeten"
-
-#: classes/Gems/Menu.php:244
-msgid "Your account"
-msgstr "Uw account"
-
-#: classes/Gems/Menu.php:245
-msgid "Activity overview"
-msgstr "Activiteiten overzicht"
-
-#: classes/Gems/Menu.php:246
-msgid "Change password"
-msgstr "Uw wachtwoord"
-
-#: classes/Gems/Menu.php:247
-#: classes/Gems/Menu.php:322
-msgid "Token"
-msgstr "Kenmerk"
-
-#: classes/Gems/Menu.php:248
-msgid "Logoff"
-msgstr "Uitloggen"
-
-#: classes/Gems/Menu.php:283
-msgid "Track"
-msgstr "Traject"
-
-#: classes/Gems/Menu.php:290
-#: classes/Gems/Menu.php:341
-msgid "Add"
-msgstr "Voeg toe"
-
-#: classes/Gems/Menu.php:294
-msgid "Preview"
-msgstr "Preview"
-
-#: classes/Gems/Menu.php:301
-msgid "Tracks"
-msgstr "Trajecten"
-
-#: classes/Gems/Menu.php:314
-msgid "Assignments"
-msgstr "Toewijzingen"
-
-#: classes/Gems/Menu.php:326
-msgid "Edit"
-msgstr "Wijzig"
-
-#: classes/Gems/Menu.php:330
-msgid "Delete"
-msgstr "Verwijder"
-
-#: classes/Gems/Menu.php:335
-msgid "Surveys"
-msgstr "Vragenlijsten"
-
-#: classes/Gems/Menu.php:367
-msgid "Fill in"
-msgstr "Vul in"
-
-#: classes/Gems/Menu.php:371
-msgid "Print PDF"
-msgstr "Print PDF"
-
-#: classes/Gems/Menu.php:374
-msgid "E-Mail now!"
-msgstr "Email nu!"
-
-#: classes/Gems/Menu.php:380
-msgid "Answers"
-msgstr "Antwoorden"
-
-#: classes/Gems/Menu.php:518
-msgid "Respondents"
-msgstr "Patiënten"
-
-#: classes/Gems/Menu.php:526
-msgid "Overview"
-msgstr "Overzicht"
-
-#: classes/Gems/Menu.php:533
-msgid "Project"
-msgstr "Project"
-
-#: classes/Gems/Menu.php:536
-msgid "Setup"
-msgstr "Beheer"
-
-#: classes/Gems/Menu.php:539
-msgid "Mail"
-msgstr "Email"
-
-#: classes/Gems/Menu.php:542
-msgid "Track Builder"
-msgstr "Traject bouwer"
-
-#: classes/Gems/Menu.php:551
-msgid "Contact"
-msgstr "Contact"
-
-#: classes/Gems/Menu.php:564
-msgid "Changelog"
-msgstr "Changelog"
-
-#: classes/Gems/Model.php:193
-msgid "Respondent nr"
-msgstr "Patiënt nr"
-
-#: classes/Gems/Model.php:194
-msgid "Opened"
-msgstr "Bekeken"
-
-#: classes/Gems/Model.php:195
-msgid "Consent"
-msgstr "Toestemming"
-
-#: classes/Gems/Model.php:197
-msgid "E-Mail"
-msgstr "Email"
-
-#: classes/Gems/Model.php:202
-msgid "Gender"
-msgstr "Geslacht"
-
-#: classes/Gems/Model.php:203
-msgid "First name"
-msgstr "Voornaam"
-
-#: classes/Gems/Model.php:204
-msgid "Surname prefix"
-msgstr "Tussenvoegsel"
-
-#: classes/Gems/Model.php:205
-msgid "Last name"
-msgstr "Achternaam"
-
-#: classes/Gems/Model.php:207
-msgid "Name"
-msgstr "Naam"
-
-#: classes/Gems/Model.php:210
-msgid "Street"
-msgstr "Straat"
-
-#: classes/Gems/Model.php:211
-msgid "Zipcode"
-msgstr "Postcode"
-
-#: classes/Gems/Model.php:212
-msgid "City"
-msgstr "Stad"
-
-#: classes/Gems/Model.php:214
-msgid "Phone"
-msgstr "Telefoon"
-
-#: classes/Gems/Model.php:216
-msgid "Birthday"
-msgstr "Geboren op"
-
-#: classes/Gems/UpgradesAbstract.php:164
-msgid "Already at max. level."
-msgstr "Al op het hoogste niveau."
-
-#: classes/Gems/UpgradesAbstract.php:171
-#, 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:179
-#, php-format
-msgid "Trying upgrade for %s to level %s: %s"
-msgstr "Probeert upgrade voor %s naar niveau %s: %s"
-
-#: classes/Gems/UpgradesAbstract.php:337
-msgid "Cache cleaned"
-msgstr "Cache opgeschoond"
-
-#: classes/Gems/Auth.php:241
-msgid "Combination of organization, username and password not found."
-msgstr "Combinatie van organisatie, gebruikersnaam en wachtwoord niet gevonden."
-
-#: classes/Gems/Export/Spss.php:59
-msgid "Which file"
-msgstr "Kies bestand"
-
-#: classes/Gems/Export/Spss.php:60
-msgid "syntax"
-msgstr "syntax"
-
-#: classes/Gems/Export/Spss.php:61
-msgid "data"
-msgstr "data"
-
-#: classes/Gems/Export/Spss.php:66
-msgid "Some help for this export"
-msgstr "Uitleg over deze export mogelijkheid"
-
-#: classes/Gems/Export/Excel.php:60
-msgid "Excel options"
-msgstr "Excel opties"
-
-#: classes/Gems/Export/Excel.php:62
-msgid "Export questions instead of variable names"
-msgstr "Exporteer vragen in plaats van variabele namen"
-
-#: classes/Gems/Export/Excel.php:63
-msgid "Format answers"
-msgstr "Antwoorden opmaken"
-
-#: classes/Gems/Util/Translated.php:84
-msgid "-"
-msgstr "n.v.t."
-
-#: classes/Gems/Util/Translated.php:99
-msgid "forever"
-msgstr "altijd"
-
-#: classes/Gems/Ut...
[truncated message content] |
|
From: <gem...@li...> - 2011-11-28 15:16:51
|
Revision: 299
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=299&view=rev
Author: michieltcs
Date: 2011-11-28 15:16:40 +0000 (Mon, 28 Nov 2011)
Log Message:
-----------
Allow switching to a specific organization that matches with the base URL (in multi-layout situations)
Modified Paths:
--------------
trunk/library/classes/Gems/Default/IndexAction.php
trunk/library/classes/Gems/Default/OrganizationAction.php
trunk/library/classes/Gems/Util/DbLookup.php
trunk/library/configs/db/patches.sql
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
Modified: trunk/library/classes/Gems/Default/IndexAction.php
===================================================================
--- trunk/library/classes/Gems/Default/IndexAction.php 2011-11-28 13:12:29 UTC (rev 298)
+++ trunk/library/classes/Gems/Default/IndexAction.php 2011-11-28 15:16:40 UTC (rev 299)
@@ -295,8 +295,22 @@
public function loginAction()
{
$form = $this->_getLoginForm();
+
+ $request = $this->getRequest();
+
+ // Allow layout switching based on request base url
+ if ($this->escort instanceof Gems_Project_Layout_MultiLayoutInterface) {
+ $hostUrl = $request->getScheme() . '://' . $request->getHttpHost() . $request->getBasePath();
+
+ $organizationId = $this->util->getDbLookup()->getOrganizationForUrl($hostUrl);
+
+ if ($organizationId) {
+ $user = $this->escort->getLoader()->getUserLoader()->getCurrentUser();
+ $user->setCurrentOrganization($organizationId);
+ $this->escort->layoutSwitch($request);
+ }
+ }
- $request = $this->getRequest();
if ($request->isPost()) {
if ($form->isValid($request->getPost(), false)) {
Modified: trunk/library/classes/Gems/Default/OrganizationAction.php
===================================================================
--- trunk/library/classes/Gems/Default/OrganizationAction.php 2011-11-28 13:12:29 UTC (rev 298)
+++ trunk/library/classes/Gems/Default/OrganizationAction.php 2011-11-28 15:16:40 UTC (rev 299)
@@ -129,6 +129,11 @@
'gor_style', 'label', $this->_('Style'),
'multiOptions', MUtil_Lazy::call(array($this->escort, 'getStyles'))
);
+ $model->setIfExists(
+ 'gor_url_base', 'label', $this->_('Default url'),
+ 'size', 50,
+ 'description', sprintf($this->_('Always switch to this organization when %s is accessed from this url'), $this->project->getName())
+ );
}
$model->set(
'gor_iso_lang', 'label', $this->_('Language'),
Modified: trunk/library/classes/Gems/Util/DbLookup.php
===================================================================
--- trunk/library/classes/Gems/Util/DbLookup.php 2011-11-28 13:12:29 UTC (rev 298)
+++ trunk/library/classes/Gems/Util/DbLookup.php 2011-11-28 15:16:40 UTC (rev 299)
@@ -274,6 +274,20 @@
return $organizations;
}
+
+ /**
+ * Returns the organization
+ * @param string $url
+ * @return int|null the organization
+ */
+ public function getOrganizationForUrl($url)
+ {
+ try {
+ return $this->db->fetchOne("SELECT gor_id_organization FROM gems__organizations WHERE gor_active=1 AND gor_url_base = ?", $url);
+ } catch (Exception $e) {
+ return null;
+ }
+ }
public function getRoles()
{
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-11-28 13:12:29 UTC (rev 298)
+++ trunk/library/configs/db/patches.sql 2011-11-28 15:16:40 UTC (rev 299)
@@ -341,3 +341,6 @@
-- PATCH: Roles fields sometimes empty
ALTER TABLE gems__roles CHANGE grl_parents grl_parents text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null;
ALTER TABLE gems__roles CHANGE grl_privileges grl_privileges text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null;
+
+-- PATCH: Base URL / installation URL to facilitate org switching
+ALTER TABLE gems__organizations ADD `gor_url_base` VARCHAR(1270) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER `gor_url`;
Modified: trunk/library/languages/default-nl.mo
===================================================================
(Binary files differ)
Modified: trunk/library/languages/default-nl.po
===================================================================
--- trunk/library/languages/default-nl.po 2011-11-28 13:12:29 UTC (rev 298)
+++ trunk/library/languages/default-nl.po 2011-11-28 15:16:40 UTC (rev 299)
@@ -1,4519 +1,4502 @@
-msgid ""
-msgstr ""
-"Project-Id-Version: Pulse NL\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-11-28 12:25+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:207
-#, php-format
-msgid "Path %s not writable"
-msgstr "Path %s niet schrijfbaar"
-
-#: classes/GemsEscort.php:891
-#, php-format
-msgid "User: %s"
-msgstr "Login: %s"
-
-#: classes/GemsEscort.php:916
-msgid "version"
-msgstr "versie"
-
-#: classes/GemsEscort.php:1347
-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:1474
-msgid "Please check back later."
-msgstr "Probeer het later opnieuw."
-
-#: classes/GemsEscort.php:1476
-#: classes/GemsEscort.php:1480
-#: classes/GemsEscort.php:1481
-msgid "System is in maintenance mode"
-msgstr "Systeem is in onderhoudsmodus"
-
-#: classes/GemsEscort.php:1491
-msgid "No access to site."
-msgstr "Geen toegang tot website."
-
-#: classes/GemsEscort.php:1493
-#: classes/GemsEscort.php:1529
-msgid "You have no access to this site."
-msgstr "U heeft geen toegang tot deze website."
-
-#: classes/GemsEscort.php:1509
-msgid "No access to page"
-msgstr "Geen toegang tot pagina"
-
-#: classes/GemsEscort.php:1511
-#, 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:1516
-#: classes/GemsEscort.php:1527
-msgid "You are no longer logged in."
-msgstr "U bent niet meer ingelogd."
-
-#: classes/GemsEscort.php:1517
-msgid "You must login to access this page."
-msgstr "U moet ingelogd zijn voor toegang tot deze pagina."
-
-#: classes/Gems/AccessLog.php:239
-msgid "Database needs to be updated!"
-msgstr "Database dient ververst te worden!"
-
-#: classes/Gems/Auth.php:241
-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:248
-msgid "Logoff"
-msgstr "Uitloggen"
-
-#: 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:518
-msgid "Respondents"
-msgstr "Patiënten"
-
-#: classes/Gems/Menu.php:526
-msgid "Overview"
-msgstr "Overzicht"
-
-#: classes/Gems/Menu.php:533
-msgid "Project"
-msgstr "Project"
-
-#: classes/Gems/Menu.php:536
-msgid "Setup"
-msgstr "Beheer"
-
-#: classes/Gems/Menu.php:539
-msgid "Mail"
-msgstr "Email"
-
-#: classes/Gems/Menu.php:542
-msgid "Track Builder"
-msgstr "Traject bouwer"
-
-#: classes/Gems/Menu.php:551
-msgid "Contact"
-msgstr "Contact"
-
-#: classes/Gems/Menu.php:564
-msgid "Changelog"
-msgstr "Changelog"
-
-#: classes/Gems/Model.php:193
-msgid "Respondent nr"
-msgstr "Patiënt nr"
-
-#: classes/Gems/Model.php:194
-msgid "Opened"
-msgstr "Bekeken"
-
-#: classes/Gems/Model.php:195
-msgid "Consent"
-msgstr "Toestemming"
-
-#: classes/Gems/Model.php:197
-msgid "E-Mail"
-msgstr "Email"
-
-#: classes/Gems/Model.php:202
-msgid "Gender"
-msgstr "Geslacht"
-
-#: classes/Gems/Model.php:203
-msgid "First name"
-msgstr "Voornaam"
-
-#: classes/Gems/Model.php:204
-msgid "Surname prefix"
-msgstr "Tussenvoegsel"
-
-#: classes/Gems/Model.php:205
-msgid "Last name"
-msgstr "Achternaam"
-
-#: classes/Gems/Model.php:207
-msgid "Name"
-msgstr "Naam"
-
-#: classes/Gems/Model.php:210
-msgid "Street"
-msgstr "Straat"
-
-#: classes/Gems/Model.php:211
-msgid "Zipcode"
-msgstr "Postcode"
-
-#: classes/Gems/Model.php:212
-msgid "City"
-msgstr "Stad"
-
-#: classes/Gems/Model.php:214
-msgid "Phone"
-msgstr "Telefoon"
-
-#: classes/Gems/Model.php:216
-msgid "Birthday"
-msgstr "Geboren op"
-
-#: classes/Gems/Pdf.php:195
-#, php-format
-msgid "PDF Source File '%s' not found!"
-msgstr "PDF bron bestand %s niet gevonden!"
-
-#: classes/Gems/Pdf.php:237
-#, php-format
-msgid "Could not create '%s' directory."
-msgstr "Kon de directory '%s' niet aanmaken."
-
-#: classes/Gems/Pdf.php:280
-#, php-format
-msgid " The error message is: %s"
-msgstr "De foutmelding is: %s"
-
-#: classes/Gems/Tracker.php:732
-msgid "Checks performed"
-msgstr "Controle uitgevoerd"
-
-#: classes/Gems/UpgradesAbstract.php:164
-msgid "Already at max. level."
-msgstr "Al op het hoogste niveau."
-
-#: classes/Gems/UpgradesAbstract.php:171
-#, 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:179
-#, php-format
-msgid "Trying upgrade for %s to level %s: %s"
-msgstr "Probeert upgrade voor %s naar niveau %s: %s"
-
-#: classes/Gems/UpgradesAbstract.php:337
-msgid "Cache cleaned"
-msgstr "Cache opgeschoond"
-
-#: classes/Gems/Controller/BrowseEditAction.php:346
-#, php-format
-msgid "New %s..."
-msgstr "Nieuw %s..."
-
-#: classes/Gems/Controller/BrowseEditAction.php:378
-#, php-format
-msgid "Delete %s"
-msgstr "Verwijder %s"
-
-#: classes/Gems/Controller/BrowseEditAction.php:382
-#, php-format
-msgid "%2$u %1$s deleted"
-msgstr "%2$u %1$s verwijderd"
-
-#: classes/Gems/Controller/BrowseEditAction.php:396
-#, php-format
-msgid "Edit %s"
-msgstr "Bewerk %s"
-
-#: classes/Gems/Controller/BrowseEditAction.php:493
-msgid "Free search text"
-msgstr "Vrije zoek tekst"
-
-#: classes/Gems/Controller/BrowseEditAction.php:564
-msgid "Search"
-msgstr "Zoeken"
-
-#: classes/Gems/Controller/BrowseEditAction.php:580
-#, php-format
-msgid "No %s found"
-msgstr "Geen %s gevonden"
-
-#: classes/Gems/Controller/BrowseEditAction.php:653
-#, php-format
-msgid "No %s found."
-msgstr "Geen %s gevonden."
-
-#: classes/Gems/Controller/BrowseEditAction.php:768
-msgid "Are you sure?"
-msgstr "Weet u het zeker?"
-
-#: classes/Gems/Controller/BrowseEditAction.php:784
-msgid "Yes"
-msgstr "Ja"
-
-#: classes/Gems/Controller/BrowseEditAction.php:785
-msgid "No"
-msgstr "Nee"
-
-#: classes/Gems/Controller/BrowseEditAction.php:838
-#, php-format
-msgid "Unknown %s requested"
-msgstr "Onjuist %s verzoek"
-
-#: classes/Gems/Controller/BrowseEditAction.php:861
-#, php-format
-msgid "New %1$s..."
-msgstr "Nieuwe %1$s..."
-
-#: classes/Gems/Controller/BrowseEditAction.php:869
-msgid "Save"
-msgstr "Opslaan"
-
-#: classes/Gems/Controller/BrowseEditAction.php:905
-#, php-format
-msgid "%2$u %1$s saved"
-msgstr "%2$u %1$s opgeslagen"
-
-#: classes/Gems/Controller/BrowseEditAction.php:908
-msgid "No changes to save."
-msgstr "Geen verandering om op te slaan."
-
-#: classes/Gems/Controller/BrowseEditAction.php:917
-msgid "Input error! No changes saved!"
-msgstr "Invoer fout! Veranderingen niet opgeslagen!"
-
-#: classes/Gems/Controller/BrowseEditAction.php:945
-#, php-format
-msgid "Show %s"
-msgstr "Toon %s"
-
-#: classes/Gems/Controller/BrowseEditAction.php:952
-#, 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:532
-msgid "Cancel"
-msgstr "Annuleren"
-
-#: classes/Gems/Controller/ModelSnippetActionAbstract.php:181
-msgid "No data found."
-msgstr "Geen gegevens gevonden."
-
-#: 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:167
-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:218
-msgid "No mails sent."
-msgstr "Geen mail verzonden."
-
-#: classes/Gems/Default/CronAction.php:221
-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:64
-#, php-format
-msgid "Executed %2$s creation script %1$s:"
-msgstr "Uitvoerresultaat %2$s script %1$s:"
-
-#: classes/Gems/Default/DatabaseAction.php:74
-#, php-format
-msgid "%d record(s) returned as result set %d in step %d of %d."
-msgstr "%d rij(en) in resultaat %d in stap %d van %d."
-
-#: classes/Gems/Default/DatabaseAction.php:78
-#, php-format
-msgid "%d record(s) updated in step %d of %d."
-msgstr "In stap %2$d van %3$d zijn %1$d rij(en) aangepast."
-
-#: classes/Gems/Default/DatabaseAction.php:81
-#, php-format
-msgid "Script ran step %d of %d succesfully."
-msgstr "Stap %d van %d in het script met succes uitgevoerd."
-
-#: classes/Gems/Default/DatabaseAction.php:84
-msgid " in step "
-msgstr " in stap "
-
-#: classes/Gems/Default/DatabaseAction.php:89
-#, php-format
-msgid "No script for %1$s."
-msgstr "Geen script voor %1$s:"
-
-#: classes/Gems/Default/DatabaseAction.php:133
-#, php-format
-msgid "No rows in %s."
-msgstr "Geen gegevens in %s."
-
-#: classes/Gems/Default/DatabaseAction.php:162
-msgid "Type"
-msgstr "Type"
-
-#: classes/Gems/Default/DatabaseAction.php:166
-msgid "Group"
-msgstr "Groep"
-
-#: classes/Gems/Default/DatabaseAction.php:168
-msgid "Location"
-msgstr "Locatie"
-
-#: classes/Gems/Default/DatabaseAction.php:171
-msgid "Status"
-msgstr "Status"
-
-#: classes/Gems/Default/DatabaseAction.php:172
-msgid "created"
-msgstr "bestaat"
-
-#: classes/Gems/Default/DatabaseAction.php:173
-msgid "not created"
-msgstr "niet aanwezig"
-
-#: classes/Gems/Default/DatabaseAction.php:174
-msgid "unknown"
-msgstr "onbekend"
-
-#: classes/Gems/Default/DatabaseAction.php:177
-msgid "Script"
-msgstr "Script"
-
-#: classes/Gems/Default/DatabaseAction.php:179
-msgid "Changed on"
-msgstr "Veranderd op"
-
-#: classes/Gems/Default/DatabaseAction.php:198
-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:203
-#, php-format
-msgid "Drop %s"
-msgstr "Verwijder %s"
-
-#: classes/Gems/Default/DatabaseAction.php:211
-#, php-format
-msgid "There are %d rows in the table."
-msgstr "Er zijn %d rijen in deze tabel."
-
-#: classes/Gems/Default/DatabaseAction.php:213
-#, php-format
-msgid "Drop table with %d rows"
-msgstr "Tabel met %d rijen aan data verwijderen"
-
-#: classes/Gems/Default/DatabaseAction.php:214
-msgid "Are you really sure?"
-msgstr "Weet u het heel erg zeker?"
-
-#: classes/Gems/Default/DatabaseAction.php:230
-#, php-format
-msgid "%1$s %2$s dropped"
-msgstr "%1$s %2$s verwijderd"
-
-#: classes/Gems/Default/DatabaseAction.php:235
-msgid " during statement "
-msgstr " tijdens het commando "
-
-#: classes/Gems/Default/DatabaseAction.php:246
-#, php-format
-msgid "%s no longer exists in the database."
-msgstr "%s bestaat niet meer in de database."
-
-#: classes/Gems/Default/DatabaseAction.php:249
-#, php-format
-msgid "%s does not yet exist in the database."
-msgstr "%s bestaat nog niet in de database."
-
-#: classes/Gems/Default/DatabaseAction.php:252
-#, php-format
-msgid "%s object does exist."
-msgstr "%s object bestaat."
-
-#: classes/Gems/Default/DatabaseAction.php:270
-msgid "Object is not a table."
-msgstr "Niet een tabel object."
-
-#: classes/Gems/Default/DatabaseAction.php:293
-msgid "Structure"
-msgstr "Structuur"
-
-#: classes/Gems/Default/DatabaseAction.php:302
-msgid "database object"
-msgid_plural "database objects"
-msgstr[0] "database object"
-msgstr[1] "database objects"
-
-#: classes/Gems/Default/DatabaseAction.php:307
-msgid "Database object overview"
-msgstr "Database object overzicht"
-
-#: classes/Gems/Default/DatabaseAction.php:316
-#: classes/Gems/Default/DatabaseAction.php:368
-msgid "Level"
-msgstr "Niveau"
-
-#: classes/Gems/Default/DatabaseAction.php:317
-#: classes/Gems/Default/DatabaseAction.php:369
-msgid "Subtype"
-msgstr "Subtype"
-
-#: classes/Gems/Default/DatabaseAction.php:319
-msgid "To be executed"
-msgstr "Uit te voeren"
-
-#: classes/Gems/Default/DatabaseAction.php:320
-#: classes/Gems/Default/DatabaseAction.php:372
-msgid "Executed"
-msgstr "Uitgevoerd"
-
-#: classes/Gems/Default/DatabaseAction.php:321
-#: classes/Gems/Default/DatabaseAction.php:373
-msgid "Finished"
-msgstr "Afgerond"
-
-#: classes/Gems/Default/DatabaseAction.php:324
-msgid "Create the patch table!"
-msgstr "De patch tabel bestaat nog niet!"
-
-#: classes/Gems/Default/DatabaseAction.php:326
-#, php-format
-msgid "%d new or changed patch(es)."
-msgstr "%d nieuwe of veranderde patch(es)."
-
-#: classes/Gems/Default/DatabaseAction.php:331
-msgid "Gems build"
-msgstr "Gems bouwnummer"
-
-#: classes/Gems/Default/DatabaseAction.php:332
-msgid "Database build"
-msgstr "Database versie"
-
-#: classes/Gems/Default/DatabaseAction.php:334
-msgid "Execute level"
-msgstr "Uit te voeren versie"
-
-#: classes/Gems/Default/DatabaseAction.php:338
-msgid "Ignore finished"
-msgstr "Afgeronde patches overslaan"
-
-#: classes/Gems/Default/DatabaseAction.php:339
-msgid "Ignore executed"
-msgstr "Uitgevoerde patches overslaan"
-
-#: classes/Gems/Default/DatabaseAction.php:340
-msgid "Show patches"
-msgstr "Toon patches"
-
-#: classes/Gems/Default/DatabaseAction.php:354
-#, php-format
-msgid "%d patch(es) executed."
-msgstr "%d patch(es) uitgevoerd."
-
-#: classes/Gems/Default/DatabaseAction.php:367
-msgid "Patch"
-msgstr "Patch"
-
-#: classes/Gems/Default/DatabaseAction.php:371
-msgid "Query"
-msgstr "Query"
-
-#: classes/Gems/Default/DatabaseAction.php:374
-msgid "Result"
-msgstr "Resultaat"
-
-#: classes/Gems/Default/DatabaseAction.php:398
-msgid "Patch maintenance"
-msgstr "Patch onderhoud"
-
-#: classes/Gems/Default/DatabaseAction.php:402
-msgid "Patch overview"
-msgstr "Patch overzicht"
-
-#: classes/Gems/Default/DatabaseAction.php:464
-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:470
-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:481
-#, php-format
-msgid "Run %s"
-msgstr "Voer %s script uit"
-
-#: classes/Gems/Default/DatabaseAction.php:500
-#, php-format
-msgid "Starting %d object creation scripts."
-msgstr "Aanvang %d object aanmaak scripts."
-
-#: classes/Gems/Default/DatabaseAction.php:505
-#, 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:509
-msgid "All objects exist. Nothing was executed."
-msgstr "Alle objects bestaan. Niets was uitgevoerd."
-
-#: classes/Gems/Default/DatabaseAction.php:515
-msgid "Create not-existing database objects"
-msgstr "Aanmaak van database objecten die nog niet bestaan"
-
-#: classes/Gems/Default/DatabaseAction.php:517
-#, php-format
-msgid "One database object does not exist."
-msgid_plural "These %d database objects do not exist."
-msgstr[0] "...
[truncated message content] |
|
From: <gem...@li...> - 2011-11-28 18:24:41
|
Revision: 301
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=301&view=rev
Author: matijsdejong
Date: 2011-11-28 18:24:32 +0000 (Mon, 28 Nov 2011)
Log Message:
-----------
#44 Reception codes can be stopped.
Reception codes got their own objects in the margin. Processing changes has become more simple: just cascade to respondentTrack and token and let them decide to change anything.
Modified Paths:
--------------
trunk/library/classes/Gems/Default/ReceptionAction.php
trunk/library/classes/Gems/Default/RespondentAction.php
trunk/library/classes/Gems/Tracker/RespondentTrack.php
trunk/library/classes/Gems/Tracker/Token.php
trunk/library/classes/Gems/Tracker.php
trunk/library/classes/Gems/User/Organization.php
trunk/library/classes/Gems/User/User.php
trunk/library/classes/Gems/Util/Translated.php
trunk/library/classes/Gems/Util.php
trunk/library/configs/db/patches.sql
trunk/library/configs/db/tables/gems__reception_codes.10.sql
trunk/library/languages/default-en.mo
trunk/library/languages/default-en.po
trunk/library/languages/default-nl.mo
trunk/library/languages/default-nl.po
trunk/library/snippets/DeleteInSourceTrackSnippet.php
trunk/library/snippets/DeleteSingleSurveyInSourceTokenSnippet.php
trunk/library/snippets/DeleteTrackTokenSnippet.php
Added Paths:
-----------
trunk/library/classes/Gems/Registry/CachedArrayTargetAbstract.php
trunk/library/classes/Gems/Util/ReceptionCode.php
trunk/library/classes/Gems/Util/ReceptionCodeLibrary.php
Modified: trunk/library/classes/Gems/Default/ReceptionAction.php
===================================================================
--- trunk/library/classes/Gems/Default/ReceptionAction.php 2011-11-28 15:20:01 UTC (rev 300)
+++ trunk/library/classes/Gems/Default/ReceptionAction.php 2011-11-28 18:24:32 UTC (rev 301)
@@ -71,9 +71,10 @@
*/
public function createModel($detailed, $action)
{
- $yesNo = $this->util->getTranslated()->getYesNo();
+ $rcLib = $this->util->getReceptionCodeLibrary();
+ $yesNo = $this->util->getTranslated()->getYesNo();
- $model = new MUtil_Model_TableModel('gems__reception_codes');
+ $model = new MUtil_Model_TableModel('gems__reception_codes');
$model->copyKeys(); // The user can edit the keys.
$model->set('grc_id_reception_code', 'label', $this->_('Code'), 'size', '10');
@@ -85,11 +86,11 @@
'elementClass', 'CheckBox',
'description', $this->_('This reception code is a success code.'));
$model->set('grc_active', 'label', $this->_('Active'),
- 'multiOptions', $yesNo ,
+ 'multiOptions', $yesNo,
'elementClass', 'CheckBox',
'description', $this->_('Only active codes can be selected.'));
$model->set('grc_for_respondents', 'label', $this->_('For respondents'),
- 'multiOptions', $yesNo ,
+ 'multiOptions', $yesNo,
'elementClass', 'CheckBox',
'description', $this->_('This reception code can be assigned to a respondent.'));
$model->set('grc_for_tracks', 'label', $this->_('For tracks'),
@@ -97,15 +98,13 @@
'elementClass', 'CheckBox',
'description', $this->_('This reception code can be assigned to a track.'));
$model->set('grc_for_surveys', 'label', $this->_('For surveys'),
- 'multiOptions', $yesNo ,
- 'elementClass', 'CheckBox',
+ 'multiOptions', $rcLib->getSurveyApplicationValues(),
'description', $this->_('This reception code can be assigned to a survey.'));
$model->set('grc_redo_survey', 'label', $this->_('Redo survey'),
- 'multiOptions', $this->util->getTranslated()->getRedoCodes(),
- 'elementClass', 'Select',
+ 'multiOptions', $rcLib->getRedoValues(),
'description', $this->_('Redo a survey on this reception code.'));
$model->set('grc_overwrite_answers', 'label', $this->_('Overwrite ansers'),
- 'multiOptions', $yesNo ,
+ 'multiOptions', $yesNo,
'elementClass', 'CheckBox',
'description', $this->_('Remove the consent from already answered surveys.'));
Modified: trunk/library/classes/Gems/Default/RespondentAction.php
===================================================================
--- trunk/library/classes/Gems/Default/RespondentAction.php 2011-11-28 15:20:01 UTC (rev 300)
+++ trunk/library/classes/Gems/Default/RespondentAction.php 2011-11-28 18:24:32 UTC (rev 301)
@@ -227,8 +227,7 @@
// Log
$this->openedRespondent($data['gr2o_patient_nr'], $data['gr2o_id_organization'], $data['grs_id_user']);
- $sql = 'SELECT grc_id_reception_code, grc_description FROM gems__reception_codes WHERE grc_active = 1 AND grc_for_respondents = 1 ORDER BY grc_description';
- $options = $this->db->fetchPairs($sql);
+ $options = $this->util->getReceptionCodeLibrary()->getRespondentDeletionCodes();
$bridge = new MUtil_Model_FormBridge($model, $this->createForm());
$bridge->addSelect('gr2o_reception_code',
@@ -245,53 +244,39 @@
if ($request->isPost()) {
$data = $_POST + $data;
if ($form->isValid($data )) {
- // Is really removed
- if ($data['gr2o_reception_code'] != GemsEscort::RECEPTION_OK) {
- // Perform actual save
- $where = 'gr2o_id_user = ? AND gr2o_id_organization = ?';
- $where = $this->db->quoteInto($where, $data['gr2o_id_user'], null, 1);
- $where = $this->db->quoteInto($where, $data['gr2o_id_organization'], null, 1);
- $this->db->update('gems__respondent2org', array(
- 'gr2o_reception_code' => $data['gr2o_reception_code'],
- 'gr2o_changed' => new Zend_Db_Expr('CURRENT_TIMESTAMP'),
- 'gr2o_changed_by' => $this->session->user_id),
- $where);
+ $code = $this->util->getReceptionCode($data['gr2o_reception_code']);
- // Check for redo or overwrite answer in reception code.
- $sql = 'SELECT grc_overwrite_answers
- FROM gems__reception_codes
- WHERE grc_overwrite_answers = 1 AND grc_id_reception_code = ? LIMIT 1';
- if ($this->db->fetchOne($sql, $data['gr2o_reception_code'])) {
- // Update consent for tokens
- $consentCode = $this->util->getConsentRejected();
+ // Is the respondent really removed
+ if (! $code->isSuccess()) {
+ $userId = $this->loader->getCurrentUser()->getUserId();
- $tracker = $this->loader->getTracker();
- $tokenSelect = $tracker->getTokenSelect(true);
- $tokenSelect
- ->andReceptionCodes()
- ->andRespondentOrganizations()
- ->andConsents()
- ->forRespondent($data['gr2o_id_user'], $data['gr2o_id_organization']);
+ // Cascade to tracks
+ // the responsiblilty to handle it correctly is on the sub objects now.
+ $tracks = $this->loader->getTracker()->getRespondentTracks($data['gr2o_id_user'], $data['gr2o_id_organization']);
+ foreach ($tracks as $track) {
+ $track->setReceptionCode($code, null, $userId);
+ }
- // Update reception code for tokens
- $tokens = $tokenSelect->fetchAll();
+ // Perform actual save, but not simple stop codes.
+ if ($code->isForRespondents()) {
+ $values['gr2o_reception_code'] = $data['gr2o_reception_code'];
+ $values['gr2o_changed'] = new Zend_Db_Expr('CURRENT_TIMESTAMP');
+ $values['gr2o_changed_by'] = $userId;
- // When a TRACK is removed, all tokens are automatically revoked
- foreach ($tokens as $tokenData) {
- $token = $tracker->getToken($tokenData);
- if ($token->hasSuccesCode() && $token->inSource()) {
+ $where = 'gr2o_id_user = ? AND gr2o_id_organization = ?';
+ $where = $this->db->quoteInto($where, $data['gr2o_id_user'], null, 1);
+ $where = $this->db->quoteInto($where, $data['gr2o_id_organization'], null, 1);
- $token->getSurvey()->updateConsent($token, $consentCode);
+ $this->db->update('gems__respondent2org', $values, $where);
- // TODO: Decide what to do: now we only update the consent codes, not
- // the token and respondentTrack consent codes
- // $token->setReceptionCode($data['gr2t_reception_code'], null, $this->session->user_id);
- }
- }
+ $this->addMessage($this->_('Respondent deleted.'));
+ $this->_reroute(array('action' => 'index'), true);
+ } else {
+ // Just a stop code
+ $this->addMessage($this->_('Respondent tracks stopped.'));
+ $this->_reroute(array('action' => 'show'));
}
- $this->addMessage($this->_('Respondent deleted.'));
- $this->_reroute(array('action' => 'index'), true);
} else {
$this->addMessage($this->_('Choose a reception code to delete.'));
}
Added: trunk/library/classes/Gems/Registry/CachedArrayTargetAbstract.php
===================================================================
--- trunk/library/classes/Gems/Registry/CachedArrayTargetAbstract.php (rev 0)
+++ trunk/library/classes/Gems/Registry/CachedArrayTargetAbstract.php 2011-11-28 18:24:32 UTC (rev 301)
@@ -0,0 +1,175 @@
+<?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 Registry
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ * Add's automatic caching to an registry target object.
+ *
+ * @package Gems
+ * @subpackage Registry
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+abstract class Gems_Registry_CachedArrayTargetAbstract extends Gems_Registry_TargetAbstract
+{
+ /**
+ * Variable to add tags to the cache for cleanup.
+ *
+ * @var array
+ */
+ protected $_cacheTags = array();
+
+ /**
+ * The current data.
+ *
+ * @var array
+ */
+ protected $_data;
+
+ /**
+ * The id for this data
+ *
+ * @var mixed
+ */
+ protected $_id;
+
+ /**
+ *
+ * @var Zend_Cache_Core
+ */
+ protected $cache;
+
+ /**
+ * Creates the object.
+ *
+ * @param mixed $id Whatever identifies this object.
+ */
+ public function __construct($id)
+ {
+ $this->_id = $id;
+ }
+
+ /**
+ * isset() safe array access helper function.
+ *
+ * @param string $name
+ * @return mixed
+ */
+ protected function _get($name)
+ {
+ if (isset($this->_data[$name])) {
+ return $this->_data[$name];
+ }
+ }
+
+ /**
+ * Get the cacheId for the organization
+ *
+ * @return string
+ */
+ private function _getCacheId() {
+ return GEMS_PROJECT_NAME . '__' . get_class($this) . '__' . $this->_id;
+ }
+
+ /**
+ * Changes a value and signals the cache.
+ *
+ * @param string $name
+ * @param mixed $value
+ * @return Gems_Registry_CachedArrayTargetAbstract (continuation pattern)
+ */
+ protected function _set($name, $value)
+ {
+ $this->_data[$name] = $value;
+
+ // Do not reload / save here:
+ // 1: other changes might follow,
+ // 2: it might not be used,
+ // 3: e.g. database saves may change other data.
+ $this->invalidateCache();
+
+ return $this;
+ }
+
+ /**
+ * Should be called after answering the request to allow the Target
+ * to check if all required registry values have been set correctly.
+ *
+ * @return boolean False if required are missing.
+ */
+ public function checkRegistryRequestsAnswers()
+ {
+ if ($this->cache) {
+ $cacheId = $this->_getCacheId();
+ $this->_data = $this->cache->load($cacheId);
+ } else {
+ $cacheId = false;
+ }
+
+ if (! $this->_data) {
+ $this->_data = $this->loadData($this->_id);
+
+ if ($cacheId) {
+ $this->cache->save($this->_data, $cacheId, $this->_cacheTags);
+ }
+ }
+ // MUtil_Echo::track($this->_data);
+
+ return is_array($this->_data) && parent::checkRegistryRequestsAnswers();
+ }
+
+ /**
+ * Empty the cache of the organization
+ *
+ * @return Gems_User_Organization (continutation pattern)
+ */
+ public function invalidateCache() {
+ if ($this->cache) {
+ $cacheId = $this->_getCacheId();
+ $this->cache->remove($cacheId);
+ }
+ return $this;
+ }
+
+ /**
+ * Load the data when the cache is empty.
+ *
+ * @param mixed $id
+ * @return array The array of data values
+ */
+ abstract protected function loadData($id);
+}
Modified: trunk/library/classes/Gems/Tracker/RespondentTrack.php
===================================================================
--- trunk/library/classes/Gems/Tracker/RespondentTrack.php 2011-11-28 15:20:01 UTC (rev 300)
+++ trunk/library/classes/Gems/Tracker/RespondentTrack.php 2011-11-28 18:24:32 UTC (rev 301)
@@ -100,6 +100,12 @@
/**
*
+ * @var Gems_Util
+ */
+ protected $util;
+
+ /**
+ *
* @param mixed $respTracksData Track Id or array containing reps2track record
*/
public function __construct($respTracksData)
@@ -113,6 +119,40 @@
}
/**
+ * Check this respondent track for the number of tokens completed / to do
+ *
+ * @param int $userId Id of the user who takes the action (for logging)
+ * @return int 1 if the track was changed by this code
+ */
+ public function _checkTrackCount($userId)
+ {
+ $sqlCount = 'SELECT COUNT(*) AS count, COALESCE(SUM(CASE WHEN gto_completion_time IS NULL THEN 0 ELSE 1 END), 0) AS completed
+ FROM gems__tokens
+ JOIN gems__reception_codes ON gto_reception_code = grc_id_reception_code AND grc_success = 1
+ WHERE gto_id_respondent_track = ?';
+
+ if ($counts = $this->db->fetchRow($sqlCount, $this->_respTrackId)) {
+ $values['gr2t_count'] = intval($counts['count']);
+ $values['gr2t_completed'] = intval($counts['completed']);
+
+ if ($values['gr2t_count'] == $values['gr2t_completed']) {
+ $tokenSelect = $this->tracker->getTokenSelect(array('MAX(gto_completion_time)'));
+ $tokenSelect->andReceptionCodes(array())
+ ->forRespondentTrack($this->_respTrackId)
+ ->onlySucces();
+
+ $values['gr2t_end_date'] = $tokenSelect->fetchOne();
+ } else {
+ $values['gr2t_end_date'] = null;
+ }
+
+ return $this->_updateTrack($values, $userId);
+ }
+
+ return 0;
+ }
+
+ /**
* Makes sure the fieldData is in $this->_fieldData
*
* @param boolean $reload Optional parameter to force reload.
@@ -129,7 +169,7 @@
$fieldData[$fieldMap[$key]] = $value;
}
}
-
+
$this->_fieldData = $fieldData;
}
}
@@ -137,19 +177,23 @@
/**
* Makes sure the receptioncode data is part of the $this->_respTrackData
*
- * @param boolean $reload Optional parameter to force reload.
+ * @param boolean $reload Optional parameter to force reload or array with new values.
*/
private function _ensureReceptionCode($reload = false)
{
if ($reload || (! isset($this->_respTrackData['grc_success']))) {
- $sql = "SELECT * FROM gems__reception_codes WHERE grc_id_reception_code = ?";
- $code = $this->_respTrackData['gr2t_reception_code'];
+ if (is_array($reload)) {
+ $this->_respTrackData = $reload + $this->_respTrackData;
+ } else {
+ $sql = "SELECT * FROM gems__reception_codes WHERE grc_id_reception_code = ?";
+ $code = $this->_respTrackData['gr2t_reception_code'];
- if ($row = $this->db->fetchRow($sql, $code)) {
- $this->_respTrackData = $row + $this->_respTrackData;
- } else {
- $trackId = $this->_respTrackId;
- throw new Gems_Exception("Reception code $code is missing for track $trackId.");
+ if ($row = $this->db->fetchRow($sql, $code)) {
+ $this->_respTrackData = $row + $this->_respTrackData;
+ } else {
+ $trackId = $this->_respTrackId;
+ throw new Gems_Exception("Reception code $code is missing for track $trackId.");
+ }
}
}
}
@@ -292,31 +336,12 @@
*/
public function checkTrackTokens($userId, Gems_Tracker_Token $fromToken = null)
{
- $sqlCount = 'SELECT COUNT(*) AS count, COALESCE(SUM(CASE WHEN gto_completion_time IS NULL THEN 0 ELSE 1 END), 0) AS completed
- FROM gems__tokens
- JOIN gems__reception_codes ON gto_reception_code = grc_id_reception_code AND grc_success = 1
- WHERE gto_id_respondent_track = ?';
+ // Update token completion count.
+ $this->_checkTrackCount($userId);
- if ($counts = $this->db->fetchRow($sqlCount, $this->_respTrackId)) {
- $values['gr2t_count'] = intval($counts['count']);
- $values['gr2t_completed'] = intval($counts['completed']);
-
- if ($values['gr2t_count'] == $values['gr2t_completed']) {
- $tokenSelect = $this->tracker->getTokenSelect(array('MAX(gto_completion_time)'));
- $tokenSelect->andReceptionCodes(array())
- ->forRespondentTrack($this->_respTrackId)
- ->onlySucces();
-
- $values['gr2t_end_date'] = $tokenSelect->fetchOne();
- } else {
- $values['gr2t_end_date'] = null;
- }
-
- $this->_updateTrack($values, $userId);
- }
-
$engine = $this->getTrackEngine();
+ // Check for validFrom and validUntil dates that have changed.
if ($fromToken) {
return $engine->checkTokensFrom($this, $fromToken, $userId);
} elseif ($this->_checkStart) {
@@ -619,7 +644,7 @@
$this->_respTrackData = $this->db->fetchRow($sql, $this->_respTrackId);
}
-
+
$this->_ensureFieldData(true);
return $this;
@@ -629,30 +654,57 @@
* Set the reception code for this respondent track and make sure the
* necessary cascade to the tokens and thus the source takes place.
*
- * @param string $code The new reception code
+ * @param string $code The new (non-success) reception code or a Gems_Util_ReceptionCode object
* @param string $comment Comment for tokens. False values leave value unchanged
* @param int $userId The current user
* @return int 1 if the token has changed, 0 otherwise
*/
public function setReceptionCode($code, $comment, $userId)
{
- $values['gr2t_reception_code'] = $code;
+ // Make sure it is a Gems_Util_ReceptionCode object
+ if (! $code instanceof Gems_Util_ReceptionCode) {
+ $code = $this->util->getReceptionCode($code);
+ }
+ $changed = 0;
- $changed = $this->_updateTrack($values, $userId);
+ // Apply this code both only when it is a track code.
+ // Patient level codes are just cascaded to the tokens.
+ //
+ // The exception is of course when the exiting values must
+ // be overwritten, e.g. when cooperation is retracted.
+ if ($code->isForTracks() || $code->isOverwriter()) {
+ $values['gr2t_reception_code'] = $code->getCode();
- if ($changed) {
- // Reload reception code values
- $this->_ensureReceptionCode(true);
+ $changed = $this->_updateTrack($values, $userId);
- // Cascade to tokens
- if (! $this->hasSuccesCode()) {
- foreach ($this->getTokens() as $token) {
- if ($token->hasSuccesCode()) {
- $token->setReceptionCode($code, $comment, $userId);
- }
+ if ($changed) {
+ // Reload reception code values
+ $this->_ensureReceptionCode($code->getAllData());
+ }
+ }
+
+ // Stopcodes have a different logic.
+ if ($code->isStopCode()) {
+ // Cascade stop to tokens
+ foreach ($this->getTokens() as $token) {
+ if ($token->hasSuccesCode() && (! $token->isCompleted())) {
+ $changed += $token->setReceptionCode($code, $comment, $userId);
}
}
+ $changed = max($changed, 1);
+
+ // Update token count / completion
+ $this->_checkTrackCount($userId);
+
+ } elseif (! $code->isSuccess()) {
+ // Cascade code to tokens
+ foreach ($this->getTokens() as $token) {
+ if ($token->hasSuccesCode()) {
+ $token->setReceptionCode($code, $comment, $userId);
+ }
+ }
}
+
return $changed;
}
}
Modified: trunk/library/classes/Gems/Tracker/Token.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Token.php 2011-11-28 15:20:01 UTC (rev 300)
+++ trunk/library/classes/Gems/Tracker/Token.php 2011-11-28 18:24:32 UTC (rev 301)
@@ -147,19 +147,23 @@
/**
* Makes sure the receptioncode data is part of the $this->_gemsData
*
- * @param boolean $reload Optional parameter to force reload.
+ * @param boolean $reload Optional parameter to force reload or an array with the new values.
*/
private function _ensureReceptionCode($reload = false)
{
if ($reload || (! isset($this->_gemsData['grc_success']))) {
- $sql = "SELECT * FROM gems__reception_codes WHERE grc_id_reception_code = ?";
- $code = $this->_gemsData['gto_reception_code'];
+ if (is_array($reload)) {
+ $this->_gemsData = $reload + $this->_gemsData;
+ } else {
+ $sql = "SELECT * FROM gems__reception_codes WHERE grc_id_reception_code = ?";
+ $code = $this->_gemsData['gto_reception_code'];
- if ($row = $this->db->fetchRow($sql, $code)) {
- $this->_gemsData = $row + $this->_gemsData;
- } else {
- $token = $this->_tokenId;
- throw new Gems_Exception("Reception code $code is missing for token $token.");
+ if ($row = $this->db->fetchRow($sql, $code)) {
+ $this->_gemsData = $row + $this->_gemsData;
+ } else {
+ $token = $this->_tokenId;
+ throw new Gems_Exception("Reception code $code is missing for token $token.");
+ }
}
}
}
@@ -973,6 +977,7 @@
/**
*
+ * @deprecated Use the ReceptionCode->hadRedoCode
* @return boolean
*/
public function hasRedoCode()
@@ -987,6 +992,7 @@
/**
* True if the reception code is a redo survey copy.
*
+ * @deprecated Use the ReceptionCode->hasRedoCopyCode
* @return boolean
*/
public function hasRedoCopyCode()
@@ -995,7 +1001,7 @@
$this->_ensureReceptionCode();
}
- return Gems_Util_Translated::REDO_COPY == $this->_gemsData['grc_redo_survey'];
+ return Gems_Util_ReceptionCodeLibrary::REDO_COPY == $this->_gemsData['grc_redo_survey'];
}
/**
@@ -1101,25 +1107,31 @@
* Set the reception code for this token and make sure the necessary
* cascade to the source takes place.
*
- * @param string $code The new reception code
+ * @param string $code The new (non-success) reception code or a Gems_Util_ReceptionCode object
* @param string $comment Comment False values leave value unchanged
* @param int $userId The current user
* @return int 1 if the token has changed, 0 otherwise
*/
public function setReceptionCode($code, $comment, $userId)
{
- $values['gto_reception_code'] = $code;
+ // Make sure it is a Gems_Util_ReceptionCode object
+ if (! $code instanceof Gems_Util_ReceptionCode) {
+ $code = $this->util->getReceptionCode($code);
+ }
+
+ $values['gto_reception_code'] = $code->getCode();
if ($comment) {
$values['gto_comment'] = $comment;
}
+ MUtil_Echo::track($values);
$changed = $this->_updateToken($values, $userId);
if ($changed) {
// Reload reception code values
- $this->_ensureReceptionCode(true);
+ $this->_ensureReceptionCode($code->getAllData());
- if (! $this->hasSuccesCode()) {
+ if ($code->isOverwriter() || (! $code->isSuccess())) {
$survey = $this->getSurvey();
// Update the consent code in the source
Modified: trunk/library/classes/Gems/Tracker.php
===================================================================
--- trunk/library/classes/Gems/Tracker.php 2011-11-28 15:20:01 UTC (rev 300)
+++ trunk/library/classes/Gems/Tracker.php 2011-11-28 18:24:32 UTC (rev 301)
@@ -331,6 +331,27 @@
/**
*
+ * @param int $userId
+ * @param int $organizationId
+ * @return array of Gems_Tracker_RespondentTrack
+ */
+ public function getRespondentTracks($userId, $organizationId)
+ {
+ $sql = "SELECT *
+ FROM gems__respondent2track INNER JOIN gems__reception_codes ON gr2t_reception_code = grc_id_reception_code
+ WHERE gr2t_id_user = ? AND gr2t_id_organization = ?";
+ $rows = $this->db->fetchAll($sql, array($userId, $organizationId));
+ $tracks = array();
+
+ foreach ($rows as $row) {
+ $tracks[$row['gr2t_id_respondent_track']] = $this->getRespondentTrack($row);
+ }
+
+ return $tracks;
+ }
+
+ /**
+ *
* @param mixed $respTrackData Track id or array containing trackdata
* @return Gems_Tracker_RespondentTrack
*/
Modified: trunk/library/classes/Gems/User/Organization.php
===================================================================
--- trunk/library/classes/Gems/User/Organization.php 2011-11-28 15:20:01 UTC (rev 300)
+++ trunk/library/classes/Gems/User/Organization.php 2011-11-28 18:24:32 UTC (rev 301)
@@ -46,9 +46,16 @@
* @license New BSD License
* @since Class available since version 1.5
*/
-class Gems_User_Organization extends Gems_Registry_TargetAbstract
+class Gems_User_Organization extends Gems_Registry_CachedArrayTargetAbstract
{
/**
+ * Variable to add tags to the cache for cleanup.
+ *
+ * @var array
+ */
+ protected $_cacheTags = array('organization');
+
+ /**
* The default organization data for 'no organization'.
*
* @var array
@@ -56,16 +63,6 @@
protected $_noOrganization = array(
'gor_id_organization' => 1,
'gor_name' => 'NO ORGANIZATION',
- 'gor_code' => null,
- 'gor_location' => null,
- 'gor...
[truncated message content] |
|
From: <gem...@li...> - 2011-12-07 11:27:57
|
Revision: 345
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=345&view=rev
Author: michieltcs
Date: 2011-12-07 11:27:48 +0000 (Wed, 07 Dec 2011)
Log Message:
-----------
Merge
Modified Paths:
--------------
trunk/library/classes/Gems/Tracker/Token.php
Property Changed:
----------------
trunk/library/
Property changes on: trunk/library
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.5.0-pulse/library:306-342
/branches/newUser:113-150
/branches/newUser2:175-207
/branches/userloader:259-324
/tags/1.5.0beta1/library:305
+ /branches/1.5.0-pulse/library:306-344
/branches/newUser:113-150
/branches/newUser2:175-207
/branches/userloader:259-324
/tags/1.5.0beta1/library:305
Modified: trunk/library/classes/Gems/Tracker/Token.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Token.php 2011-12-07 10:51:24 UTC (rev 344)
+++ trunk/library/classes/Gems/Tracker/Token.php 2011-12-07 11:27:48 UTC (rev 345)
@@ -60,7 +60,7 @@
*
* @var array The gems token data
*/
- private $_gemsData;
+ private $_gemsData = array();
/**
*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-12-15 15:54:29
|
Revision: 360
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=360&view=rev
Author: matijsdejong
Date: 2011-12-15 15:54:19 +0000 (Thu, 15 Dec 2011)
Log Message:
-----------
Added initRawOutput() and disableLayout() to MUtil_Controller_Action
Renamed MUtil/Html/Link to MUtil/Html/Code
Modified Paths:
--------------
trunk/library/classes/Gems/Controller/BrowseEditAction.php
trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php
trunk/library/classes/Gems/Default/TrackActionAbstract.php
trunk/library/classes/Gems/Pdf.php
trunk/library/classes/MUtil/Controller/Action.php
trunk/library/classes/MUtil/Controller/html-view.phtml
trunk/library/classes/MUtil/Html/ProgressPanel.php
trunk/library/layouts/scripts/gems.phtml
Added Paths:
-----------
trunk/library/classes/MUtil/Html/Code/
trunk/library/classes/MUtil/Html/Code/DynamicAbstract.php
trunk/library/classes/MUtil/Html/Code/JavaScript.php
Removed Paths:
-------------
trunk/library/classes/MUtil/Html/Link/
Modified: trunk/library/classes/Gems/Controller/BrowseEditAction.php
===================================================================
--- trunk/library/classes/Gems/Controller/BrowseEditAction.php 2011-12-15 15:40:20 UTC (rev 359)
+++ trunk/library/classes/Gems/Controller/BrowseEditAction.php 2011-12-15 15:54:19 UTC (rev 360)
@@ -275,7 +275,7 @@
// MUtil_Model::$verbose = true;
// We do not need to return the layout, just the above table
- Zend_Layout::resetMvcInstance();
+ $this->disableLayout();
$this->html[] = $this->_createTable();
$this->html->raw(MUtil_Echo::out());
Modified: trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php
===================================================================
--- trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2011-12-15 15:40:20 UTC (rev 359)
+++ trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2011-12-15 15:54:19 UTC (rev 360)
@@ -415,6 +415,10 @@
public function pdfAction()
{
+ // Make sure nothing else is output
+ $this->initRawOutput();
+
+ // Output the PDF
$this->loader->getPdf()->echoPdfBySurveyId($this->_getParam(MUtil_Model::REQUEST_ID));
}
Modified: trunk/library/classes/Gems/Default/TrackActionAbstract.php
===================================================================
--- trunk/library/classes/Gems/Default/TrackActionAbstract.php 2011-12-15 15:40:20 UTC (rev 359)
+++ trunk/library/classes/Gems/Default/TrackActionAbstract.php 2011-12-15 15:54:19 UTC (rev 360)
@@ -400,6 +400,10 @@
*/
public function pdfAction()
{
+ // Make sure nothing else is output
+ $this->initRawOutput();
+
+ // Output the PDF
$this->loader->getPdf()->echoPdfByTokenId($this->_getIdParam());
}
Modified: trunk/library/classes/Gems/Pdf.php
===================================================================
--- trunk/library/classes/Gems/Pdf.php 2011-12-15 15:40:20 UTC (rev 359)
+++ trunk/library/classes/Gems/Pdf.php 2011-12-15 15:54:19 UTC (rev 360)
@@ -118,12 +118,10 @@
* @param Zend_Pdf $pdf
* @param string $filename
* @param boolean $download
+ * @param boolean $exit Should the application stop running after output
*/
- protected function echoPdf(Zend_Pdf $pdf, $filename, $download = false)
+ protected function echoPdf(Zend_Pdf $pdf, $filename, $download = false, $exit = true)
{
- // We do not need to return the layout, just the above table
- Zend_Layout::resetMvcInstance();
-
$content = $pdf->render();
// MUtil_Echo::track($filename);
@@ -140,6 +138,11 @@
header('Pragma: public');
echo $content;
+
+ if ($exit) {
+ // No further output
+ exit;
+ }
}
/**
Modified: trunk/library/classes/MUtil/Controller/Action.php
===================================================================
--- trunk/library/classes/MUtil/Controller/Action.php 2011-12-15 15:40:20 UTC (rev 359)
+++ trunk/library/classes/MUtil/Controller/Action.php 2011-12-15 15:54:19 UTC (rev 360)
@@ -1,6 +1,5 @@
<?php
-
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
@@ -26,15 +25,14 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @author Matijs de Jong
- * @since 1.0
- * @version 1.1
+ *
+ *
* @package MUtil
* @subpackage Controller
- * @copyright Copyright (c) 2010 Erasmus MC (www.erasmusmc.nl) & MagnaFacta (www.magnafacta.nl)
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
*/
/**
@@ -44,15 +42,18 @@
* - title attribute for use in htm/head/title element
* - flashMessenger use standardised and simplified
* - use of Zend_Translate simplified and shortened in code
+ * - disable Zend_Layout and Zend_View with initRawOutput() and $useRawOutput.
*
* MUtil_Html functionality provided:
* - semi automatic MUtil_Html_Sequence initiation
* - view script set to html-view.phtml when using html
* - snippet usage for repeatably used snippets of html on a page
*
- * @author Matijs de Jong
* @package MUtil
* @subpackage Controller
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
*/
abstract class MUtil_Controller_Action extends Zend_Controller_Action
{
@@ -94,13 +95,28 @@
/**
* Set to true in child class for automatic creation of $this->html.
*
- * Otherwise call $this->initHtml()
+ * To initiate the use of $this->html from the code call $this->initHtml()
*
+ * Overrules $useRawOutput.
+ *
+ * @see $useRawOutput
* @var boolean $useHtmlView
*/
public $useHtmlView = false;
/**
+ * Set to true in child class for automatic use of raw (e.g. echo) output only.
+ *
+ * Otherwise call $this->initRawOutput() to switch to raw echo output.
+ *
+ * Overruled in initialization if $useHtmlView is true.
+ *
+ * @see $useHtmlView
+ * @var boolean $useRawOutput
+ */
+ public $useRawOutput = false;
+
+ /**
* A ssession based message store.
*
* Standard the flash messenger for storing messages
@@ -232,6 +248,24 @@
}
/**
+ * Disable the use of Zend_Layout
+ *
+ * @return Zend_Controller_Action (continuation pattern)
+ */
+ public function disableLayout()
+ {
+ // Actually I would like a check if there is a
+ // layout instance in the first place.
+ $layout = Zend_Layout::getMvcInstance();
+ if ($layout instanceof Zend_Layout) {
+ $layout->disableLayout();
+ }
+ // Zend_Layout::resetMvcInstance();
+
+ return $this;
+ }
+
+ /**
* Returns a session based message store for adding messages to.
*
* @return Zend_Controller_Action_Helper_FlashMessenger
@@ -318,6 +352,7 @@
if (null === $translate) {
// Make sure there always is a translator
$translate = new MUtil_Translate_Adapter_Potemkin();
+ Zend_Registry::set('Zend_Translate', $translate);
}
$this->setTranslate($translate);
@@ -348,6 +383,8 @@
if ($this->useHtmlView) {
$this->initHtml();
+ } elseif ($this->useRawOutput) {
+ $this->initRawOutput();
}
}
@@ -369,10 +406,30 @@
$this->view->setScriptPath(dirname(__FILE__));
$this->_helper->viewRenderer->setNoController();
$this->_helper->viewRenderer->setScriptAction('html-view');
+
+ $this->useHtmlView = true;
+ $this->useRawOutput = false;
}
}
/**
+ * Intializes the raw (echo) output component.
+ *
+ * @return void
+ */
+ public function initRawOutput()
+ {
+ // Disable layout ((if any)
+ $this->disableLayout();
+
+ // Set view rendering off
+ $this->_helper->viewRenderer->setNoRender(true);
+
+ $this->useHtmlView = false;
+ $this->useRawOutput = true;
+ }
+
+ /**
* Stub for overruling default snippet loader initiation.
*/
protected function loadSnippetLoader()
Modified: trunk/library/classes/MUtil/Controller/html-view.phtml
===================================================================
--- trunk/library/classes/MUtil/Controller/html-view.phtml 2011-12-15 15:40:20 UTC (rev 359)
+++ trunk/library/classes/MUtil/Controller/html-view.phtml 2011-12-15 15:54:19 UTC (rev 360)
@@ -1 +1 @@
-<?php echo $this->html->render($this); ?>
+<?php echo $this->html->render($this); ?>
\ No newline at end of file
Property changes on: trunk/library/classes/MUtil/Html/Code
___________________________________________________________________
Added: bugtraq:url
+ http://survey.erasmusmc.nl/support/mantis/view.php?id=%BUGID%
Added: bugtraq:logregex
+ #(\d+)
Added: trunk/library/classes/MUtil/Html/Code/DynamicAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Html/Code/DynamicAbstract.php (rev 0)
+++ trunk/library/classes/MUtil/Html/Code/DynamicAbstract.php 2011-12-15 15:54:19 UTC (rev 360)
@@ -0,0 +1,162 @@
+<?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 MUtil
+ * @subpackage Html
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ *
+ *
+ * @package MUtil
+ * @subpackage Html
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+abstract class MUtil_Html_Code_DynamicAbstract implements MUtil_Html_HtmlInterface
+{
+ /**
+ * Contains the content to output. Can be a mix of filenames and string content.
+ *
+ * @var array Numeric array of strings or MUtil_Html_HtmlInterface elements
+ */
+ protected $_content = array();
+
+ /**
+ * The fields that must be replaced in the content before output.
+ *
+ * @var array Key => string array
+ */
+ protected $_fields = array();
+
+ /**
+ *
+ * @var string The seperator used to join multiple content items together
+ */
+ protected $_seperator = "\n";
+
+ /**
+ * Creates the object storing any values with a name as a field, unless
+ * there exists a set{Name} function. Other values are treated as content.
+ *
+ * @param mixed $args_array MUtil_Ra::args() parameters
+ */
+ public function __construct($args_array = null)
+ {
+ $args = MUtil_Ra::args(func_get_args());
+
+ foreach ($args as $name => $value) {
+ if (is_integer($name)) {
+ $this->addContent($value);
+ } else {
+ $function = 'set' . ucfirst($name);
+ if (method_exists($this, $function)) {
+ $this->$function($value);
+ } else {
+ $this->setField($name, $value);
+ }
+ }
+ }
+ }
+
+ /**
+ * Add a filename or some other content that can be rendered.
+ *
+ * @param mixed $content
+ */
+ public function addContent($content)
+ {
+ $this->_content[] = $content;
+ }
+
+ /**
+ * Renders the content
+ *
+ * @param Zend_View_Abstract $view
+ * @return string
+ */
+ protected function getContentOutput(Zend_View_Abstract $view)
+ {
+ if (! $this->_content) {
+ return null;
+ }
+
+ $output = array();
+
+ foreach ($this->_content as $content) {
+ if (! is_string($content)) {
+ $content = MUtil_Html::renderAny($view, $content);
+ }
+
+ if ((false === strpos($content, "\n")) && file_exists($content)) {
+ $content = file_get_contents($content);
+ }
+
+ $output[] = $content;
+ }
+
+ if ($this->_fields) {
+ $output = str_replace(array_keys($this->_fields), $this->_fields, $output);
+ }
+
+ return implode($this->_seperator, $output);
+ }
+
+ /**
+ * Set a field to search and replace in the content.
+ *
+ * No markers are used. If you want to replace '{path}' with 'x', you
+ * must specificy the name '{path}', not 'path'.
+ *
+ * @param string $name Full name to replace.
+ * @param string $value The value placed.
+ * @return MUtil_Html_Link_LinkAbstract (continuation pattern)
+ */
+ public function setField($name, $value)
+ {
+ $this->_fields[$name] = $value;
+ return $this;
+ }
+
+ /**
+ *
+ * @param string $seperator
+ * @return MUtil_Html_Link_LinkAbstract (continuation pattern)
+ */
+ public function setSeperator($seperator)
+ {
+ $this->_seperator = $seperator;
+ return $this;
+ }
+}
Added: trunk/library/classes/MUtil/Html/Code/JavaScript.php
===================================================================
--- trunk/library/classes/MUtil/Html/Code/JavaScript.php (rev 0)
+++ trunk/library/classes/MUtil/Html/Code/JavaScript.php 2011-12-15 15:54:19 UTC (rev 360)
@@ -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 MUtil
+ * @subpackage Html
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ *
+ *
+ * @package MUtil
+ * @subpackage Html
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class MUtil_Html_Code_JavaScript extends MUtil_Html_Code_DynamicAbstract
+{
+ protected $_inHeader = true;
+
+ /**
+ * When true the output should be displayed in the result HEAD,
+ * otherwise in the BODY.
+ *
+ * @return boolean
+ */
+ public function getInHeader()
+ {
+ if ($this->_inHeader instanceof MUtil_Lazy_LazyInterface) {
+ return (boolean) MUtil_Lazy::raise($this->_inHeader);
+ } else {
+ return (boolean) $this->_inHeader;
+ }
+ }
+ /**
+ * Renders the element into a html string
+ *
+ * The $view is used to correctly encode and escape the output
+ *
+ * @param Zend_View_Abstract $view
+ * @return string Correctly encoded and escaped html output
+ */
+ public function render(Zend_View_Abstract $view)
+ {
+ $content = $this->getContentOutput($view);
+
+ // Of course this setting makes little difference if you have optimized
+ // your JavaScript loading by putting all script tags at the end of
+ // your body. (Except that inlineScript is always loaded last.)
+ if ($this->getInHeader()) {
+ $scriptTag = $view->headScript();
+ } else {
+ $scriptTag = $view->inlineScript();
+ }
+ $scriptTag->appendScript($content);
+
+ return '';
+ }
+
+ /**
+ * When true the result is displayed in the result HEAD,
+ * otherwise in the BODY.
+ *
+ * @param boolean $value
+ * @return MUtil_Html_Code_JavaScript (continuation pattern)
+ */
+ public function setInHeader($value = true)
+ {
+ $this->_inHeader = $value;
+ return $this;
+ }
+}
Modified: trunk/library/classes/MUtil/Html/ProgressPanel.php
===================================================================
--- trunk/library/classes/MUtil/Html/ProgressPanel.php 2011-12-15 15:40:20 UTC (rev 359)
+++ trunk/library/classes/MUtil/Html/ProgressPanel.php 2011-12-15 15:54:19 UTC (rev 360)
@@ -46,6 +46,8 @@
*/
class MUtil_Html_ProgressPanel extends MUtil_Html_HtmlElement
{
+ const CODE = "MUtil_Html_ProgressPanel_Code";
+
/**
* Usually no text is appended after an element, but for certain elements we choose
* to add a "\n" newline character instead, to keep the output readable in source
@@ -87,6 +89,28 @@
}
/**
+ * Returns the JavaScript object associated with this object.
+ *
+ * WARNING: calling this object sets it's position in the order the
+ * objects are rendered. If you use MUtil_Lazy objects, make sure they
+ * have the correct value when rendering.
+ *
+ * @return MUtil_Html_Code_JavaScript
+ */
+ public function getCode()
+ {
+ if (! $this->offsetExists(self::CODE)) {
+ $js = new MUtil_Html_Code_JavaScript(dirname(__FILE__) . '/ProgressPanel.js');
+ // $js->setInHeader(false);
+ $js->setField('FUNCTION_PREFIX', __CLASS__);
+
+ $this->offsetSet(self::CODE, $js);
+ }
+
+ return $this->offsetGet(self::CODE);
+ }
+
+ /**
* Creates a 'div' progress panel
*
* @param mixed $arg_array A MUtil_Ra::args data collection.
@@ -110,11 +134,9 @@
*/
protected function renderElement(Zend_View_Abstract $view)
{
- $js = new MUtil_Html_Link_JavaScript(dirname(__FILE__) . '/ProgressPanel.js');
- $js->setField('FUNCTION_PREFIX', __CLASS__);
+ // Make sure the JS code is added
+ $this->getCode();
- $this->append($js);
-
return parent::renderElement($view);
}
}
Modified: trunk/library/layouts/scripts/gems.phtml
===================================================================
--- trunk/library/layouts/scripts/gems.phtml 2011-12-15 15:40:20 UTC (rev 359)
+++ trunk/library/layouts/scripts/gems.phtml 2011-12-15 15:54:19 UTC (rev 360)
@@ -50,6 +50,8 @@
?></div>
</div><?php
echo MUtil_Echo::out();
+
+ // Scripts here for load optimization
echo $this->headScript();
echo $this->inlineScript();
?></body>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-12-15 15:56:59
|
Revision: 361
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=361&view=rev
Author: mennodekker
Date: 2011-12-15 15:56:53 +0000 (Thu, 15 Dec 2011)
Log Message:
-----------
Organization can now have a default userclass, can not be changed (yet) as it needs logic to update the users
Next step is to use this class in the staffAction
Modified Paths:
--------------
trunk/library/classes/Gems/Default/OrganizationAction.php
trunk/library/configs/db/patches.sql
Modified: trunk/library/classes/Gems/Default/OrganizationAction.php
===================================================================
--- trunk/library/classes/Gems/Default/OrganizationAction.php 2011-12-15 15:54:19 UTC (rev 360)
+++ trunk/library/classes/Gems/Default/OrganizationAction.php 2011-12-15 15:56:53 UTC (rev 361)
@@ -163,6 +163,21 @@
}
$model->setIfExists('gor_code', 'label', $this->_('Code name'), 'size', 10, 'description', $this->_('Only for programmers.'));
+ if($model->has('gor_user_class')) {
+ $definitions = $this->loader->getUserLoader()->getAvailableStaffDefinitions();
+ //Use first element as default
+ $default = array_shift(array_keys($definitions));
+ $model->set('gor_user_class', 'default', $default);
+ if (count($definitions)>1) {
+ if ($action !== 'create') {
+ $model->set('gor_user_class', 'elementClass', 'Exhibitor', 'description', $this->_('This can not be changed yet'));
+ }
+ $model->set('gor_user_class', 'label', $this->_('User Definition'), 'multiOptions', $definitions);
+ } else {
+ $model->set('elementClass', 'hidden');
+ }
+ }
+
$model->addColumn("CASE WHEN gor_active = 1 THEN '' ELSE 'deleted' END", 'row_class');
Gems_Model::setChangeFieldsByPrefix($model, 'gor');
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2011-12-15 15:54:19 UTC (rev 360)
+++ trunk/library/configs/db/patches.sql 2011-12-15 15:56:53 UTC (rev 361)
@@ -361,3 +361,6 @@
-- GEMS VERSION: 43
-- PATCH: Add comment field to respondent tracks
ALTER TABLE `gems__respondent2track` ADD gr2t_comment varchar(250) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null default null AFTER `gr2t_reception_code`;
+
+-- PATCH: Default userdefinition per organization
+ALTER TABLE gems__organizations ADD `gor_user_class` VARCHAR( 30 ) NOT NULL DEFAULT 'StaffUser' AFTER `gor_code`;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-12-16 11:07:30
|
Revision: 364
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=364&view=rev
Author: mennodekker
Date: 2011-12-16 11:07:19 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
Introducing the ModelTabFormSnippet(Generic) first working draft
Modified Paths:
--------------
trunk/library/classes/MUtil/Model/FormBridge.php
trunk/library/snippets/Organization/OrganizationEditSnippet.php
Added Paths:
-----------
trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php
Added: trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php (rev 0)
+++ trunk/library/classes/Gems/Snippets/ModelTabFormSnippetGeneric.php 2011-12-16 11:07:19 UTC (rev 364)
@@ -0,0 +1,169 @@
+<?php
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Short description of file
+ *
+ * @package Gems
+ * @subpackage Snippets
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $
+ */
+
+/**
+ * Short description for ModelTabFormSnippetGeneric
+ *
+ * Long description for class ModelTabFormSnippetGeneric (if any)...
+ *
+ * @package Gems
+ * @subpackage Snippets
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.0
+ * @deprecated Class deprecated since version 2.0
+ */
+class Gems_Snippets_ModelTabFormSnippetGeneric extends Gems_Snippets_ModelFormSnippetGeneric
+{
+ /**
+ *
+ * @var Gems_TabForm
+ */
+ protected $_form;
+
+ /**
+ * Array of item names still to be added to the form
+ *
+ * @var array
+ */
+ protected $_items;
+
+ /**
+ * Add items to the bridge, and remove them from the items array
+ *
+ * @param MUtil_Model_FormBridge $bridge
+ * @param string $element1
+ *
+ * @return void
+ */
+ protected function addItems($bridge, $element1)
+ {
+ $args = func_get_args();
+ if (count($args)<2) {
+ throw new Gems_Exception_Coding('Use at least 2 arguments, first the bridge and then one or more idividual items');
+ }
+
+ $bridge = array_shift($args);
+ $elements = $args;
+
+ //Remove the elements from the _items variable
+ $this->_items = array_diff($this->_items, $elements);
+
+ //And add them to the bridge
+ foreach($elements as $name) {
+ if ($label = $this->model->get($name, 'label')) {
+ $bridge->add($name);
+ } else {
+ $bridge->addHidden($name);
+ }
+ }
+ }
+
+ /**
+ * Adds elements from the model to the bridge that creates the form.
+ *
+ * Overrule this function to add different elements to the browse table, without
+ * having to recode the core table building code.
+ *
+ * @param MUtil_Model_FormBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ * @param array $items
+ */
+ protected function addFormElements(MUtil_Model_FormBridge $bridge, MUtil_Model_ModelAbstract $model, $items = null)
+ {
+ //Get all elements in the model if not already done
+ $this->initItems();
+
+ //Now add all remaining items to the last last tab (if any)
+ foreach($this->_items as $name) {
+ if ($label = $model->get($name, 'label')) {
+ $bridge->add($name);
+ } else {
+ $bridge->addHidden($name);
+ }
+ }
+ }
+
+ /**
+ * Perform some actions on the form, right before it is displayed but already populated
+ *
+ * Here we add the table display to the form.
+ *
+ * @return Zend_Form
+ */
+ public function beforeDisplay()
+ {
+ //If needed, add a row of link buttons to the bottom of the form
+ $form = $this->_form;
+ if ($links = $this->getMenuList()) {
+ $element = new MUtil_Form_Element_Html('formLinks');
+ $element->setValue($links);
+ $element->setOrder(999);
+ if ($form instanceof Gems_TabForm) {
+ $form->resetContext();
+ }
+ $form->addElement($element);
+ $form->addDisplayGroup(array('formLinks'), 'form_buttons');
+ }
+ }
+
+ /**
+ * Creates an empty form. Allows overruling in sub-classes.
+ *
+ * @param mixed $options
+ * @return Gems_TabForm
+ */
+ protected function createForm($options = null)
+ {
+ $form = new Gems_TabForm($options);
+ $this->_form = $form;
+
+ //Now first add the saveButton as it needs to be outside the tabs
+ $this->addSaveButton();
+
+ return $form;
+ }
+
+ /**
+ * Initialize the _items variable to hold all items from the model
+ */
+ protected function initItems()
+ {
+ if (is_null($this->_items)) {
+ $this->_items = $this->model->getItemsOrdered();
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/library/classes/MUtil/Model/FormBridge.php
===================================================================
--- trunk/library/classes/MUtil/Model/FormBridge.php 2011-12-16 10:11:39 UTC (rev 363)
+++ trunk/library/classes/MUtil/Model/FormBridge.php 2011-12-16 11:07:19 UTC (rev 364)
@@ -701,4 +701,17 @@
{
return $this->model;
}
+
+ /**
+ * Retrieve a tab from a Gems_TabForm to add extra content to it
+ *
+ * @param string $name
+ * @return Gems_Form_TabSubForm
+ */
+ public function getTab($name)
+ {
+ if (method_exists($this->form, 'getTab')) {
+ return $this->form->getTab($name);
+ }
+ }
}
Modified: trunk/library/snippets/Organization/OrganizationEditSnippet.php
===================================================================
--- trunk/library/snippets/Organization/OrganizationEditSnippet.php 2011-12-16 10:11:39 UTC (rev 363)
+++ trunk/library/snippets/Organization/OrganizationEditSnippet.php 2011-12-16 11:07:19 UTC (rev 364)
@@ -44,7 +44,7 @@
* @license New BSD License
* @since Class available since version 1.5
*/
-class Organization_OrganizationEditSnippet extends Gems_Snippets_ModelFormSnippetGeneric
+class Organization_OrganizationEditSnippet extends Gems_Snippets_ModelTabFormSnippetGeneric
{
/**
*
@@ -52,6 +52,51 @@
*/
protected $loader;
+ /**
+ * Adds elements from the model to the bridge that creates the form.
+ *
+ * Overrule this function to add different elements to the browse table, without
+ * having to recode the core table building code.
+ *
+ * @param MUtil_Model_FormBridge $bridge
+ * @param MUtil_Model_ModelAbstract $model
+ */
+ protected function addFormElements(MUtil_Model_FormBridge $bridge, MUtil_Model_ModelAbstract $model)
+ {
+ //Get all elements in the model if not already done
+ $this->initItems();
+
+ //Create our tab structure first check if tab already exists to allow extension
+ if (!($bridge->getTab('general'))) {
+ $bridge->addTab('general', 'value', $this->_('General'));
+ }
+ //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');
+ $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');
+ $bridge->addHtml('general_other')->b($this->_('Other'));
+ $this->addItems($bridge, 'gor_iso_lang', 'gor_code', 'gor_has_respondents');
+
+ if (!($bridge->getTab('email'))) {
+ $bridge->addTab('email', 'value', $this->_('Email') . ' & ' . $this->_('Token'));
+ }
+ $this->addItems($bridge, 'gor_welcome', 'gor_signature');
+
+ if (!($bridge->getTab('access'))) {
+ $bridge->addTab('access', 'value', $this->_('Access'));
+ }
+ $this->addItems($bridge, 'gor_has_login', 'gor_add_respondents', 'gor_respondent_group', 'gor_accessible_by', 'gor_user_class');
+
+ //now add remaining items if any
+
+ if (count($this->_items)>0 && !($bridge->getTab('other'))) {
+ $bridge->addTab('other', 'value', $this->_('Other'));
+ }
+ parent::addFormElements($bridge, $model);
+ }
+
public function afterSave($changed)
{
$org = $this->loader->getOrganization($data['gor_id_organization']);
@@ -62,4 +107,4 @@
return parent::afterSave($changed);
}
-}
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-12-16 15:06:52
|
Revision: 367
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=367&view=rev
Author: mennodekker
Date: 2011-12-16 15:06:43 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
Bugfix in OrganizationEditSnipper.php afterSave
OrganizationModel can now have a a userDefinition with it's own config options that can be saved anywhere
Modified Paths:
--------------
trunk/library/classes/Gems/Default/OrganizationAction.php
trunk/library/classes/Gems/Model.php
trunk/library/snippets/Organization/OrganizationEditSnippet.php
Added Paths:
-----------
trunk/library/classes/Gems/Model/OrganizationModel.php
trunk/library/classes/Gems/User/UserDefinitionConfigurableInterface.php
Modified: trunk/library/classes/Gems/Default/OrganizationAction.php
===================================================================
--- trunk/library/classes/Gems/Default/OrganizationAction.php 2011-12-16 15:03:03 UTC (rev 366)
+++ trunk/library/classes/Gems/Default/OrganizationAction.php 2011-12-16 15:06:43 UTC (rev 367)
@@ -114,7 +114,7 @@
*/
public function createModel($detailed, $action)
{
- $model = new MUtil_Model_TableModel('gems__organizations');
+ $model = $this->loader->getModels()->getOrganizationModel();
$model->setDeleteValues('gor_active', 0, 'gor_add_respondents', 0);
Added: trunk/library/classes/Gems/Model/OrganizationModel.php
===================================================================
--- trunk/library/classes/Gems/Model/OrganizationModel.php (rev 0)
+++ trunk/library/classes/Gems/Model/OrganizationModel.php 2011-12-16 15:06:43 UTC (rev 367)
@@ -0,0 +1,160 @@
+<?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.
+ *
+ * The organization model
+ *
+ * @package Gems
+ * @subpackage Model
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 215 2011-07-12 08:52:54Z michiel $
+ */
+
+/**
+ * Contains the organization
+ *
+ * Handles saving of the user definition config
+ *
+ * @package Gems
+ * @subpackage Model
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class Gems_Model_OrganizationModel extends Gems_Model_JoinModel implements MUtil_Registry_TargetInterface
+{
+ /**
+ * @var Gems_Loader
+ */
+ public $loader;
+
+ public function __construct()
+ {
+ parent::__construct('organization', 'gems__organizations', 'gor');
+ }
+
+ /**
+ * Allows the loader to set resources.
+ *
+ * @param string $name Name of resource to set
+ * @param mixed $resource The resource.
+ * @return boolean True if $resource was OK
+ */
+ public function answerRegistryRequest($name, $resource)
+ {
+ $this->$name = $resource;
+
+ return true;
+ }
+
+ /**
+ * Should be called after answering the request to allow the Target
+ * to check if all required registry values have been set correctly.
+ *
+ * @return boolean False if required are missing.
+ */
+ public function checkRegistryRequestsAnswers()
+ {
+ return true;
+ }
+
+ /**
+ * Filters the names that should not be requested.
+ *
+ * Can be overriden.
+ *
+ * @param string $name
+ * @return boolean
+ */
+ protected function filterRequestNames($name)
+ {
+ return '_' !== $name[0];
+ }
+
+ /**
+ * Allows the loader to know the resources to set.
+ *
+ * Returns those object variables defined by the subclass but not at the level of this definition.
+ *
+ * Can be overruled.
+ *
+ * @return array of string names
+ */
+ public function getRegistryRequests()
+ {
+ return array_filter(array_keys(get_object_vars($this)), array($this, 'filterRequestNames'));
+ }
+
+ /**
+ * Save a single model item.
+ *
+ * Makes sure the password is saved too using the userclass
+ *
+ * @param array $newValues The values to store for a single model item.
+ * @param array $filter If the filter contains old key values these are used
+ * to decide on update versus insert.
+ * @param array $saveTables Optional array containing the table names to save,
+ * otherwise the tables set to save at model level will be saved.
+ * @return array The values as they are after saving (they may change).
+ */
+ public function save(array $newValues, array $filter = null, array $saveTables = null)
+ {
+ //First perform a save
+ $savedValues = parent::save($newValues, $filter, $saveTables);
+
+ //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);
+
+ if ($definition->hasConfig()) {
+ $savedValues['config'] = $definition->saveConfig($savedValues,$newValues['config']);
+ if ($definition->getConfigChanged()>0 && $this->getChanged()<1) {
+ $this->setChanged(1);
+ }
+ }
+ }
+
+ return $savedValues;
+ }
+
+ public function loadFirst($filter = true, $sort = true)
+ {
+ $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);
+
+ if ($definition->hasConfig()) {
+ $data['config'] = $definition->loadConfig($data);
+ }
+ }
+
+ return $data;
+ }
+}
\ No newline at end of file
Modified: trunk/library/classes/Gems/Model.php
===================================================================
--- trunk/library/classes/Gems/Model.php 2011-12-16 15:03:03 UTC (rev 366)
+++ trunk/library/classes/Gems/Model.php 2011-12-16 15:06:43 UTC (rev 367)
@@ -171,6 +171,13 @@
return $model;
}
+ public function getOrganizationModel()
+ {
+ $model = $this->_loadClass('OrganizationModel', true);
+
+ return $model;
+ }
+
/**
* Load project specific model or general Gems model otherwise
*
Added: trunk/library/classes/Gems/User/UserDefinitionConfigurableInterface.php
===================================================================
--- trunk/library/classes/Gems/User/UserDefinitionConfigurableInterface.php (rev 0)
+++ trunk/library/classes/Gems/User/UserDefinitionConfigurableInterface.php 2011-12-16 15:06:43 UTC (rev 367)
@@ -0,0 +1,83 @@
+<?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: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ *
+ *
+ * @package Gems
+ * @subpackage User
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+interface Gems_User_UserDefinitionConfigurableInterface
+{
+ /**
+ * Appends the needed fields for this config to the $bridge
+ *
+ * @param MUtil_Model_FormBridge $bridge
+ */
+ public function appendConfigFields(MUtil_Model_FormBridge $bridge);
+
+ /**
+ * Should return the number of changed records for the save performed
+ */
+ public function getConfigChanged();
+
+ /**
+ * Do we need to add custom config parameters to use this definition?
+ *
+ * @return boolean
+ */
+ public function hasConfig();
+
+ /**
+ * Handles loading the config for the given data
+ *
+ * @param array $data
+ * @return array
+ */
+ public function loadConfig($data);
+
+ /**
+ * Handles saving the configvalues in $values using the $data
+ *
+ * @param array $data
+ * @param array $values
+ * @return array
+ */
+ public function saveConfig($data, $values);
+}
\ No newline at end of file
Modified: trunk/library/snippets/Organization/OrganizationEditSnippet.php
===================================================================
--- trunk/library/snippets/Organization/OrganizationEditSnippet.php 2011-12-16 15:03:03 UTC (rev 366)
+++ trunk/library/snippets/Organization/OrganizationEditSnippet.php 2011-12-16 15:06:43 UTC (rev 367)
@@ -89,8 +89,17 @@
}
$this->addItems($bridge, 'gor_has_login', 'gor_add_respondents', 'gor_respondent_group', 'gor_accessible_by', '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);
+
+ if ($definition->hasConfig()) {
+ $definition->appendConfigFields($bridge);
+ }
+
+ }
+
//now add remaining items if any
-
if (count($this->_items)>0 && !($bridge->getTab('other'))) {
$bridge->addTab('other', 'value', $this->_('Other'));
}
@@ -99,7 +108,7 @@
public function afterSave($changed)
{
- $org = $this->loader->getOrganization($data['gor_id_organization']);
+ $org = $this->loader->getOrganization($changed['gor_id_organization']);
$org->invalidateCache();
// Make sure any changes in the allowed list are reflected.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2011-12-16 15:23:35
|
Revision: 368
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=368&view=rev
Author: mennodekker
Date: 2011-12-16 15:23:24 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
Forgot check for compatibility with definitions that are not configurable :)
Modified Paths:
--------------
trunk/library/classes/Gems/Model/OrganizationModel.php
trunk/library/snippets/Organization/OrganizationEditSnippet.php
Modified: trunk/library/classes/Gems/Model/OrganizationModel.php
===================================================================
--- trunk/library/classes/Gems/Model/OrganizationModel.php 2011-12-16 15:06:43 UTC (rev 367)
+++ trunk/library/classes/Gems/Model/OrganizationModel.php 2011-12-16 15:23:24 UTC (rev 368)
@@ -131,7 +131,7 @@
$class = $newValues['gor_user_class'] . 'Definition';
$definition = $this->loader->getUserLoader()->getUserDefinition($class);
- if ($definition->hasConfig()) {
+ if ($definition instanceof Gems_User_UserDefinitionConfigurableInterface && $definition->hasConfig()) {
$savedValues['config'] = $definition->saveConfig($savedValues,$newValues['config']);
if ($definition->getConfigChanged()>0 && $this->getChanged()<1) {
$this->setChanged(1);
@@ -150,7 +150,7 @@
$class = $data['gor_user_class'] . 'Definition';
$definition = $this->loader->getUserLoader()->getUserDefinition($class);
- if ($definition->hasConfig()) {
+ if ($definition instanceof Gems_User_UserDefinitionConfigurableInterface && $definition->hasConfig()) {
$data['config'] = $definition->loadConfig($data);
}
}
Modified: trunk/library/snippets/Organization/OrganizationEditSnippet.php
===================================================================
--- trunk/library/snippets/Organization/OrganizationEditSnippet.php 2011-12-16 15:06:43 UTC (rev 367)
+++ trunk/library/snippets/Organization/OrganizationEditSnippet.php 2011-12-16 15:23:24 UTC (rev 368)
@@ -93,7 +93,7 @@
$class = $this->formData['gor_user_class'] . 'Definition';
$definition = $this->loader->getUserLoader()->getUserDefinition($class);
- if ($definition->hasConfig()) {
+ 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...> - 2011-12-21 09:43:35
|
Revision: 380
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=380&view=rev
Author: mennodekker
Date: 2011-12-21 09:43:26 +0000 (Wed, 21 Dec 2011)
Log Message:
-----------
Introducing the RadiusUserDefinition
Modified Paths:
--------------
trunk/library/classes/Gems/User/UserLoader.php
Added Paths:
-----------
trunk/library/classes/Gems/User/Adapter/
trunk/library/classes/Gems/User/Adapter/Radius/
trunk/library/classes/Gems/User/Adapter/Radius/COPYING
trunk/library/classes/Gems/User/Adapter/Radius/COPYING.LESSER
trunk/library/classes/Gems/User/Adapter/Radius/README.TXT
trunk/library/classes/Gems/User/Adapter/Radius/radius.class.php
trunk/library/classes/Gems/User/Adapter/Radius.php
trunk/library/classes/Gems/User/RadiusUserDefinition.php
trunk/library/configs/db/tables/gems__radius_config.999.sql
Added: trunk/library/classes/Gems/User/Adapter/Radius/COPYING
===================================================================
--- trunk/library/classes/Gems/User/Adapter/Radius/COPYING (rev 0)
+++ trunk/library/classes/Gems/User/Adapter/Radius/COPYING 2011-12-21 09:43:26 UTC (rev 380)
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and a...
[truncated message content] |
|
From: <gem...@li...> - 2012-01-06 14:09:26
|
Revision: 403
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=403&view=rev
Author: mennodekker
Date: 2012-01-06 14:09:20 +0000 (Fri, 06 Jan 2012)
Log Message:
-----------
reverting #400 and committing other fix for the same problem
Modified Paths:
--------------
trunk/library/classes/MUtil/Snippets/ModelFormSnippetAbstract.php
trunk/library/snippets/Organization/OrganizationEditSnippet.php
Modified: trunk/library/classes/MUtil/Snippets/ModelFormSnippetAbstract.php
===================================================================
--- trunk/library/classes/MUtil/Snippets/ModelFormSnippetAbstract.php 2012-01-06 14:02:50 UTC (rev 402)
+++ trunk/library/classes/MUtil/Snippets/ModelFormSnippetAbstract.php 2012-01-06 14:09:20 UTC (rev 403)
@@ -157,10 +157,10 @@
protected function addFormElements(MUtil_Model_FormBridge $bridge, MUtil_Model_ModelAbstract $model)
{
//Get all elements in the model if not already done
- $this->initItems($model);
+ $this->initItems();
//And any remaining item
- $this->addItems($bridge, $model, $this->_items);
+ $this->addItems($bridge, $this->_items);
}
/**
@@ -171,22 +171,22 @@
*
* @return void
*/
- protected function addItems(MUtil_Model_FormBridge $bridge, MUtil_Model_ModelAbstract $model, $element1)
+ protected function addItems(MUtil_Model_FormBridge $bridge, $element1)
{
$args = func_get_args();
- if (count($args) < 3) {
- throw new Gems_Exception_Coding('Use at least 3 arguments; bridge, model and then one or more individual items');
+ if (count($args)<2) {
+ throw new Gems_Exception_Coding('Use at least 2 arguments, first the bridge and then one or more idividual items');
}
$bridge = array_shift($args);
- $model = array_shift($args);
$elements = MUtil_Ra::flatten($args);
//Remove the elements from the _items variable
$this->_items = array_diff($this->_items, $elements);
-
+
//And add them to the bridge
foreach($elements as $name) {
+ $model = $this->getModel();
if ($label = $model->get($name, 'label')) {
$bridge->add($name);
} else {
@@ -362,9 +362,10 @@
/**
* Initialize the _items variable to hold all items from the model
*/
- protected function initItems(MUtil_Model_ModelAbstract $model)
+ protected function initItems()
{
if (is_null($this->_items)) {
+ $model = $this->getModel();
$this->_items = $model->getItemsOrdered();
}
}
@@ -549,4 +550,4 @@
// Note we use an MUtil_Form
return $this->_form->isValid($this->formData, $this->disableValidatorTranslation);
}
-}
+}
\ No newline at end of file
Modified: trunk/library/snippets/Organization/OrganizationEditSnippet.php
===================================================================
--- trunk/library/snippets/Organization/OrganizationEditSnippet.php 2012-01-06 14:02:50 UTC (rev 402)
+++ trunk/library/snippets/Organization/OrganizationEditSnippet.php 2012-01-06 14:09:20 UTC (rev 403)
@@ -64,7 +64,7 @@
protected function addFormElements(MUtil_Model_FormBridge $bridge, MUtil_Model_ModelAbstract $model)
{
//Get all elements in the model if not already done
- $this->initItems($model);
+ $this->initItems();
//Create our tab structure first check if tab already exists to allow extension
if (!($bridge->getTab('general'))) {
@@ -72,17 +72,17 @@
}
//Need the first two together for validation
$bridge->addHtml('org')->b($this->_('Organization'));
- $this->addItems($bridge, $model, 'gor_name', 'gor_id_organization', 'gor_location', 'gor_url', 'gor_active');
+ $this->addItems($bridge, 'gor_name', 'gor_id_organization', 'gor_location', 'gor_url', '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, $model, 'gor_contact_name', 'gor_contact_email');
+ $this->addItems($bridge, 'gor_contact_name', 'gor_contact_email');
$bridge->addHtml('general_other')->b($this->_('Other'));
- $this->addItems($bridge, $model, 'gor_iso_lang', 'gor_code', 'gor_has_respondents');
+ $this->addItems($bridge, 'gor_iso_lang', 'gor_code', 'gor_has_respondents');
if (!($bridge->getTab('email'))) {
$bridge->addTab('email', 'value', $this->_('Email') . ' & ' . $this->_('Token'));
}
- $this->addItems($bridge, $model, 'gor_welcome', 'gor_signature');
+ $this->addItems($bridge, 'gor_welcome', 'gor_signature');
if (!($bridge->getTab('access'))) {
$bridge->addTab('access', 'value', $this->_('Access'));
@@ -94,7 +94,7 @@
unset($multiOptions[$this->formData['gor_id_organization']]);
$model->set('gor_accessible_by', 'multiOptions', $multiOptions);
}
- $this->addItems($bridge, $model, 'gor_has_login', 'gor_add_respondents', 'gor_respondent_group', 'gor_accessible_by');
+ $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'])) {
@@ -106,7 +106,7 @@
$bridge->addExhibitor('allowed', 'value', $display, 'label', $this->_('Can access'));
}
- $this->addItems($bridge, $model, 'gor_user_class');
+ $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';
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-02-16 17:15:42
|
Revision: 498
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=498&view=rev
Author: matijsdejong
Date: 2012-02-16 17:15:30 +0000 (Thu, 16 Feb 2012)
Log Message:
-----------
refreshTokenAttributesBatch works, but could yet be implemented at other levels than source level
LimeSurvey token tables now have token length corrected when needed
LimeSurvey 1.91 token tables now get usesleft field when it does not exists
Modified Paths:
--------------
trunk/library/classes/Gems/Default/SourceAction.php
trunk/library/classes/Gems/Menu/MenuAbstract.php
trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m91Database.php
trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php
trunk/library/classes/Gems/Tracker/TrackerInterface.php
trunk/library/classes/Gems/Tracker.php
trunk/library/configs/db/patches.sql
Added Paths:
-----------
trunk/library/classes/Gems/Tracker/Batch/RefreshTokenAttributesBatch.php
Modified: trunk/library/classes/Gems/Default/SourceAction.php
===================================================================
--- trunk/library/classes/Gems/Default/SourceAction.php 2012-02-16 15:22:35 UTC (rev 497)
+++ trunk/library/classes/Gems/Default/SourceAction.php 2012-02-16 17:15:30 UTC (rev 498)
@@ -103,6 +103,22 @@
}
/**
+ * Check all token attributes for a single source
+ */
+ public function attributesAction()
+ {
+ $sourceId = $this->getSourceId();
+ $where = $this->db->quoteInto('gsu_id_source = ?', $sourceId);
+
+ $batch = $this->loader->getTracker()->refreshTokenAttributesBatch('sourceCheck' . $sourceId, $where);
+
+ $title = sprintf($this->_('Refreshing token attributes for for %s source.'),
+ $this->db->fetchOne("SELECT gso_source_name FROM gems__sources WHERE gso_id_source = ?", $sourceId));
+
+ $this->_helper->BatchRunner($batch, $title);
+ }
+
+ /**
* Check all the tokens for a single source
*/
public function checkAction()
Modified: trunk/library/classes/Gems/Menu/MenuAbstract.php
===================================================================
--- trunk/library/classes/Gems/Menu/MenuAbstract.php 2012-02-16 15:22:35 UTC (rev 497)
+++ trunk/library/classes/Gems/Menu/MenuAbstract.php 2012-02-16 17:15:30 UTC (rev 498)
@@ -412,6 +412,7 @@
$page->addAction($this->_('Check status'), null, 'ping')->addParameters(MUtil_Model::REQUEST_ID);
$page->addAction($this->_('Synchronize surveys'), 'pr.source.synchronize', 'synchronize')->addParameters(MUtil_Model::REQUEST_ID);
$page->addAction($this->_('Check answers'), 'pr.source.check-answers', 'check')->addParameters(MUtil_Model::REQUEST_ID);
+ $page->addAction($this->_('Check attributes'), 'pr.source.check-attributes', 'attributes')->addParameters(MUtil_Model::REQUEST_ID);
$page->addAction($this->_('Synchronize all surveys'), 'pr.source.synchronize-all', 'synchronize-all');
$page->addAction($this->_('Check all answers'), 'pr.source.check-answers-all', 'check-all');
Added: trunk/library/classes/Gems/Tracker/Batch/RefreshTokenAttributesBatch.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Batch/RefreshTokenAttributesBatch.php (rev 0)
+++ trunk/library/classes/Gems/Tracker/Batch/RefreshTokenAttributesBatch.php 2012-02-16 17:15:30 UTC (rev 498)
@@ -0,0 +1,133 @@
+<?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 Tracker
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id$
+ */
+
+/**
+ * Refresh the attributes of all tokens
+ *
+ * @package Gems
+ * @subpackage Tracker
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.5
+ */
+class Gems_Tracker_Batch_RefreshTokenAttributesBatch extends MUtil_Batch_BatchAbstract
+{
+ /**
+ *
+ * @var Gems_Tracker
+ */
+ protected $tracker;
+
+ /**
+ *
+ * @var Zend_Translate
+ */
+ protected $translate;
+
+ /**
+ * Add a token check step to the batch
+ *
+ * @param string $tokenId A token id
+ * @return Gems_Tracker_Batch_UpdateAttributesBatch (Continuation pattern)
+ */
+ public function addToken($tokenId)
+ {
+ $this->addStep('updateAttributes', $tokenId);
+
+ return $this;
+ }
+
+ /**
+ * Add token check steps to the batch
+ *
+ * @param array $tokenIds An array of token ids
+ * @return Gems_Tracker_Batch_UpdateAttributesBatch (Continuation pattern)
+ */
+ public function addTokens(array $tokenIds)
+ {
+ foreach ($tokenIds as $tokenId) {
+ $this->addStep('updateAttributes', $tokenId);
+ }
+
+ return $this;
+ }
+
+ /**
+ * String of messages from the batch
+ *
+ * Do not forget to reset() the batch if you're done with it after
+ * displaying the report.
+ *
+ * @param boolean $reset When true the batch is reset afterwards
+ * @return array
+ */
+ public function getMessages($reset = false)
+ {
+
+ $cAll = $this->count();
+ $cTokens = $this->getCounter('changedTokens');
+
+ $messages = parent::getMessages($reset);
+
+ array_unshift($messages, sprintf($this->translate->_('Checked %d token.'), $cAll));
+ if ($cTokens == 0) {
+ $messages[] = $this->translate->_('No attributes were updated.');
+ } else {
+ $messages[] = sprintf($this->translate->plural('%d token changed.', '%d tokens changed.', $cTokens), $cTokens);
+ }
+
+ return $messages;
+ }
+
+ /**
+ * Update the attributes of a token, if the token is
+ * already in the source.
+ *
+ * @param string $tokenId A token id
+ */
+ protected function updateAttributes($tokenId)
+ {
+ $token = $this->tracker->getToken($tokenId);
+
+ if ($token->inSource()) {
+ $survey = $token->getSurvey();
+ if ($survey->copyTokenToSource($token, '')) {
+ $this->addToCounter('changedTokens');
+ }
+ }
+ }
+}
Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m91Database.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m91Database.php 2012-02-16 15:22:35 UTC (rev 497)
+++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m91Database.php 2012-02-16 17:15:30 UTC (rev 498)
@@ -1,4 +1,5 @@
<?php
+
/**
* Copyright (c) 2011, Erasmus MC
* All rights reserved.
@@ -54,4 +55,38 @@
*/
protected $_anonymizedField = 'anonymized';
+ /**
+ * Returns a list of field names that should be set in a newly inserted token.
+ *
+ * Added the usesleft value.
+ *
+ * @param Gems_Tracker_Token $token
+ * @return array Of fieldname => value type
+ */
+ protected function _fillAttributeMap(Gems_Tracker_Token $token)
+ {
+ $values = parent::_fillAttributeMap($token);
+
+ // Not really an attribute, but it is the best place to set this
+ $values['usesleft'] = $token->isCompleted() ? 0 : 1;
+
+ return $values;
+ }
+
+ /**
+ * Check a token table for any changes needed by this version.
+ *
+ * @param array $tokenTable
+ * @return array Fieldname => change field commands
+ */
+ protected function _checkTokenTable(array $tokenTable)
+ {
+ $missingFields = parent::_checkTokenTable($tokenTable);
+
+ if (! isset($tokenTable['usesleft'])) {
+ $missingFields['usesleft'] = "ADD `usesleft` INT( 11 ) NULL DEFAULT '1' AFTER `completed`";
+ }
+
+ return $missingFields;
+ }
}
\ No newline at end of file
Modified: trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php
===================================================================
--- trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-02-16 15:22:35 UTC (rev 497)
+++ trunk/library/classes/Gems/Tracker/Source/LimeSurvey1m9Database.php 2012-02-16 17:15:30 UTC (rev 498)
@@ -48,8 +48,9 @@
{
const CACHE_TOKEN_INFO = 'tokenInfo';
- const LS_DB_DATE_FORMAT = 'yyyy-MM-dd';
- const LS_DB_DATETIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';
+ const LS_DB_COMPLETION_FORMAT = 'yyyy-MM-dd HH:mm';
+ const LS_DB_DATE_FORMAT = 'yyyy-MM-dd';
+ const LS_DB_DATETIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';
const QUESTIONS_TABLE = 'questions';
const SURVEY_TABLE = 'survey_';
@@ -119,9 +120,41 @@
protected $util;
/**
+ * Check a token table for any changes needed by this version.
+ *
+ * @param array $tokenTable
+ * @return array Fieldname => change field commands
+ */
+ protected function _checkTokenTable(array $tokenTable)
+ {
+ $missingFields = array();
+
+ $lengths = array();
+ if (preg_match('/\(([^\)]+)\)/', $tokenTable['token']['Type'], $lengths)) {
+ $tokenLength = $lengths[1];
+ } else {
+ $tokenLength = 0;
+ }
+ $token_library = $this->tracker->getTokenLibrary();
+ if ($tokenLength < $token_library->getLength()) {
+ $tokenLength = $token_library->getLength();
+ $missingFields['token'] = "CHANGE COLUMN `token` `token` varchar($tokenLength) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NULL";
+ }
+
+ foreach ($this->_attributeMap as $name => $field) {
+ if (! isset($tokenTable[$field])) {
+ $missingFields[$field] = "ADD $field varchar(255) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'";
+ }
+ }
+
+ return $missingFields;
+ }
+
+ /**
* Returns a list of field names that should be set in a newly inserted token.
*
* @param Gems_Tracker_Token $token
+ * @return array Of fieldname => value type
*/
protected function _fillAttributeMap(Gems_Tracker_Token $token)
{
@@ -377,7 +410,7 @@
$messages[] = sprintf($this->translate->_('The \'%s\' survey is no longer active. The survey was removed from LimeSurvey!'), $survey->getName());
}
} else {
- $lsDb = $this->getSourceDatabase();
+ $lsDb = $this->getSourceDatabase();
// SELECT sid, surveyls_title AS short_title, surveyls_description AS description, active, datestamp, ' . $this->_anonymizedField . '
$select = $lsDb->select();
@@ -401,7 +434,7 @@
break;
default:
// This is for the case that $this->_anonymizedField is empty, we show an update statement.
- // The answers already in the table can only be linked to the repsonse based on the completion time
+ // The answers already in the table can only be linked to the response based on the completion time
// this requires a manual action as token table only hold minuts while survey table holds seconds
// and we might have responses with the same timestamp.
$lsDb->query("UPDATE " . $this->_getSurveysTableName() . " SET `" . $this->_anonymizedField . "` = 'N' WHERE sid = ?;", $sourceSurveyId);
@@ -425,34 +458,21 @@
}
if ($tokenTable) {
- $lengths = array();
- if (preg_match('/\(([^\)]+)\)/', $tokenTable['token']['Type'], $lengths)) {
- $tokenLength = $lengths[1];
- } else {
- $tokenLength = 0;
- }
- $token_library = $this->tracker->getTokenLibrary();
- if ($tokenLength < $token_library->getLength()) {
- $surveyor_status .= 'Token field length is too short. ';
- }
+ $missingFields = $this->_checkTokenTable($tokenTable);
- $missingFields = array();
- foreach ($this->_attributeMap as $name => $field) {
- if (! isset($tokenTable[$field])) {
- $missingFields[$field] = "ADD $field varchar(255) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'";
- }
- }
if ($missingFields) {
- $sql = "ALTER TABLE " . $this->_getTokenTableName($sourceSurveyId) . " " . implode(', ', $missingFields);
+ $sql = "ALTER TABLE " . $this->_getTokenTableName($sourceSurveyId) . " " . implode(', ', $missingFields);
+ $fields = implode($this->translate->_(', '), array_keys($missingFields));
+ // MUtil_Echo::track($missingFields, $sql);
try {
$lsDb->query($sql);
- $messages[] = sprintf($this->translate->_("Added attribute fields to token table for '%s'"), $surveyor_title);
+ $messages[] = sprintf($this->translate->_("Added to token table '%s' the field(s): %s"), $surveyor_title, $fields);
} catch (Zend_Exception $e) {
$surveyor_status .= 'Token attributes could not be created. ';
$surveyor_status .= $e->getMessage() . ' ';
$messages[] = sprintf($this->translate->_("Attribute fields not created for token table for '%s'"), $surveyor_title);
- $messages[] = sprintf($this->translate->_('Required fields: %s', implode($this->translate->_(', '), array_keys($missingFields))));
+ $messages[] = sprintf($this->translate->_('Required fields: %s', $fields));
$messages[] = $e->getMessage();
// Maximum reporting for this case
@@ -587,7 +607,12 @@
// Get the mapped values
$values = $this->_fillAttributeMap($token);
- $values['completed'] = 'N'; // Apparently it is possible to have this value filled without a survey questionnaire.
+ // Apparently it is possible to have this value filled without a survey questionnaire.
+ if ($token->isCompleted()) {
+ $values['completed'] = $token->getCompletionTime()->toString(self::LS_DB_COMPLETION_FORMAT);
+ } else {
+ $values['completed'] = 'N';
+ }
$result = 0;
if ($oldValues = $lsDb->fetchRow("SELECT * FROM $lsTokens WHERE token = ? LIMIT 1", $tokenId)) {
@@ -974,7 +999,7 @@
$result = $token->cacheGet(self::CACHE_TOKEN_INFO);
}
- if ($fields !== null) $result = array_intersect_key((array) $result, array_flip ($fields));
+ if ($fields !== null) $result = array_intersect_key((array) $result, array_flip($fields));
return $result;
}
Modified: trunk/library/classes/Gems/Tracker/TrackerInterface.php
===================================================================
--- trunk/library/classes/Gems/Tracker/TrackerInterface.php 2012-02-16 15:22:35 UTC (rev 497)
+++ trunk/library/classes/Gems/Tracker/TrackerInterface.php 2012-02-16 17:15:30 UTC (rev 498)
@@ -301,4 +301,13 @@
* @return Gems_Tracker_Batch_ProcessTokensBatch A batch to process the changes
*/
public function recalculateTokensBatch($batch_id, $userId = null, $cond = null);
+
+ /**
+ * Refreshes the tokens in the source
+ *
+ * @param string $batch_id A unique identifier for the current batch
+ * @param string $cond An optional where statement
+ * @return Gems_Tracker_Batch_ProcessTokensBatch A batch to process the changes
+ */
+ public function refreshTokenAttributesBatch($batch_id, $cond = null);
}
Modified: trunk/library/classes/Gems/Tracker.php
===================================================================
--- trunk/library/classes/Gems/Tracker.php 2012-02-16 15:22:35 UTC (rev 497)
+++ trunk/library/classes/Gems/Tracker.php 2012-02-16 17:15:30 UTC (rev 498)
@@ -887,6 +887,7 @@
return $batch;
}
+
/**
* Recalculates all token dates, timing and results
* and outputs text messages.
@@ -916,4 +917,37 @@
self::$verbose = true;
return $this->processTokensBatch($batch_id, $tokenSelect, $userId);
}
+
+ /**
+ * Refreshes the tokens in the source
+ *
+ * @param string $batch_id A unique identifier for the current batch
+ * @param string $cond An optional where statement
+ * @return Gems_Tracker_Batch_ProcessTokensBatch A batch to process the changes
+ */
+ public function refreshTokenAttributesBatch($batch_id, $cond = null)
+ {
+ $batch = $this->_loadClass('Batch_RefreshTokenAttributesBatch', true, array($batch_id));
+
+ if (! $batch->isLoaded()) {
+ $tokenSelect = $this->getTokenSelect(array('gto_id_token'));
+ $tokenSelect->andSurveys(array())
+ ->forWhere('gsu_surveyor_active = 1')
+ ->forWhere('gto_in_source = 1');
+
+ if ($cond) {
+ // Add all connections for filtering, but select only surveys that are active in the source
+ $tokenSelect->andReceptionCodes(array())
+ ->andRespondents(array())
+ ->andRespondentOrganizations(array())
+ ->andConsents(array())
+ ->forWhere($cond);
+ }
+
+ $batch->addTokens($this->db->fetchCol($tokenSelect->getSelect()));
+ }
+ self::$verbose = true;
+
+ return $batch;
+ }
}
Modified: trunk/library/configs/db/patches.sql
===================================================================
--- trunk/library/configs/db/patches.sql 2012-02-16 15:22:35 UTC (rev 497)
+++ trunk/library/configs/db/patches.sql 2012-02-16 17:15:30 UTC (rev 498)
@@ -375,3 +375,7 @@
-- PATCH: Add track completion event
ALTER TABLE `gems__tracks` ADD gtr_completed_event varchar(64) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' AFTER gtr_track_class;
+
+-- GEMS VERSION: 45
+-- PATCH: Assign attribute sync to super role
+UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges,',pr.source.check-attributes') WHERE grl_name = 'super' AND grl_privileges NOT LIKE '%pr.source.check-attributes%';
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gem...@li...> - 2012-03-01 16:05:40
|
Revision: 531
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=531&view=rev
Author: matijsdejong
Date: 2012-03-01 16:05:31 +0000 (Thu, 01 Mar 2012)
Log Message:
-----------
Second round in simplifying ModelSnippetActionAbstract
Modified Paths:
--------------
trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php
Added Paths:
-----------
trunk/library/snippets/Generic/CurrentButtonRowSnippet.php
Removed Paths:
-------------
trunk/library/snippets/Generic/CurrentButtonRow.php
Modified: trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php
===================================================================
--- trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php 2012-03-01 15:35:00 UTC (rev 530)
+++ trunk/library/classes/Gems/Controller/ModelSnippetActionAbstract.php 2012-03-01 16:05:31 UTC (rev 531)
@@ -104,7 +104,7 @@
*
* @var mixed String or array of snippets name
*/
- protected $indexStopSnippets = 'Generic_CurrentButtonRow';
+ protected $indexStopSnippets = 'Generic_CurrentButtonRowSnippet';
/**
* The snippets used for the show action
Deleted: trunk/library/snippets/Generic/CurrentButtonRow.php
===================================================================
--- trunk/library/snippets/Generic/CurrentButtonRow.php 2012-03-01 15:35:00 UTC (rev 530)
+++ trunk/library/snippets/Generic/CurrentButtonRow.php 2012-03-01 16:05:31 UTC (rev 531)
@@ -1,85 +0,0 @@
-<?php
-
-/**
- * Copyright (c) 2011, Erasmus MC
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Erasmus MC nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Short description of file
- *
- * @package Gems
- * @subpackage Snippets\Generic
- * @author Matijs de Jong <mj...@ma...>
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
- */
-
-/**
- * Short description for class
- *
- * Long description for class (if any)...
- *
- * @package Gems
- * @subpackage Snippets\Generic
- * @copyright Copyright (c) 2011 Erasmus MC
- * @license New BSD License
- * @since Class available since version 1.4.2
- */
-class Generic_CurrentButtonRow extends MUtil_Snippets_SnippetAbstract
-{
- /**
- * Required
- *
- * @var Gems_Menu
- */
- protected $menu;
-
- /**
- * Required
- *
- * @var Zend_Controller_Request_Abstract
- */
- protected $request;
-
- /**
- * Create the snippets content
- *
- * This is a stub function either override getHtmlOutput() or override render()
- *
- * @param Zend_View_Abstract $view Just in case it is needed here
- * @return MUtil_Html_HtmlInterface Something that can be rendered
- */
- public function getHtmlOutput(Zend_View_Abstract $view)
- {
- $menuList = $this->menu->getMenuList();
-
- $menuList->addParameterSources($this->request)
- ->addCurrentParent($this->_('Cancel'))
- ->addCurrentChildren();
-
- return $menuList;
- }
-
-}
Added: trunk/library/snippets/Generic/CurrentButtonRowSnippet.php
===================================================================
--- trunk/library/snippets/Generic/CurrentButtonRowSnippet.php (rev 0)
+++ trunk/library/snippets/Generic/CurrentButtonRowSnippet.php 2012-03-01 16:05:31 UTC (rev 531)
@@ -0,0 +1,83 @@
+<?php
+
+/**
+ * Copyright (c) 2011, Erasmus MC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Erasmus MC nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @package Gems
+ * @subpackage Snippets\Generic
+ * @author Matijs de Jong <mj...@ma...>
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $
+ */
+
+/**
+ * Displays the parent menu item (if existing) plus any current
+ * level buttons that are visible
+ *
+ * @package Gems
+ * @subpackage Snippets\Generic
+ * @copyright Copyright (c) 2011 Erasmus MC
+ * @license New BSD License
+ * @since Class available since version 1.4.2
+ */
+class Generic_CurrentButtonRowSnippet extends MUtil_Snippets_SnippetAbstract
+{
+ /**
+ * Required
+ *
+ * @var Gems_Menu
+ */
+ protected $menu;
+
+ /**
+ * Required
+ *
+ * @var Zend_Controller_Request_Abstract
+ */
+ protected $request;
+
+ /**
+ * Create the snippets content
+ *
+ * This is a stub function either override getHtmlOutput() or override render()
+ *
+ * @param Zend_View_Abstract $view Just in case it is needed here
+ * @return MUtil_Html_HtmlInterface Something that can be rendered
+ */
+ public function getHtmlOutput(Zend_View_Abstract $view)
+ {
+ $menuList = $this->menu->getMenuList();
+
+ $menuList->addParameterSources($this->request)
+ ->addCurrentParent($this->_('Cancel'))
+ ->addCurrentChildren();
+
+ return $menuList;
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|