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 conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Erasmus MC nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - /** - * @author Matijs de Jong - * @since 1.0 - * @version 1.1 - * @package MUtil + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package MUtil * @subpackage Html + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ */ /** - * @author Matijs de Jong - * @package MUtil + * This class handles the rendering of input elements. + * + * If a Zend_Form object is passed as first parameter, then it is rendered appropriately. + * Otherwise the constructor tries to handle it as an attempt to create a raw HtmlElement + * input element. + * + * @package MUtil * @subpackage Html + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 */ class MUtil_Html_InputRenderer implements MUtil_Html_HtmlInterface { @@ -48,6 +55,7 @@ const MODE_ELEMENT = 'except'; const MODE_EXCEPT = 'except'; const MODE_FORM = 'form'; + const MODE_HTML = 'html'; const MODE_ONLY = 'only'; const MODE_UNTIL = 'until'; const MODE_UPTO = 'upto'; @@ -97,8 +105,23 @@ $this->_mode = $mode; } else { - throw new MUtil_Html_HtmlException(sprintf(self::ARGUMENT_ERROR, get_class($element), __CLASS__ . ' constructor')); + if (self::MODE_ELEMENT === $mode) { + // Was the second argument not specified? + // Then the arguments should be passed in $element. + $args = $element; + } else { + // Use all args + $args = func_get_args(); + } + if (is_array($args)) { + // Treat this as a standard Html Element + $this->_element = new MUtil_Html_HtmlElement('input', $args); + $this->_mode = self::MODE_HTML; + // MUtil_Echo::track($args); + } else { + throw new MUtil_Html_HtmlException(sprintf(self::ARGUMENT_ERROR, (is_object($element) ? get_class($element) : gettype($element)), __CLASS__ . ' constructor')); + } } } @@ -272,6 +295,9 @@ case self::MODE_FORM: return self::renderForm($view, $this->_element); + case self::MODE_HTML: + return $this->_element->render($view); + case self::MODE_ONLY: return self::renderOnly($view, $this->_element, $this->_decorators); Modified: trunk/library/configs/db/patches.sql =================================================================== --- trunk/library/configs/db/patches.sql 2011-11-23 14:20:20 UTC (rev 277) +++ trunk/library/configs/db/patches.sql 2011-11-23 18:52:36 UTC (rev 278) @@ -316,12 +316,15 @@ ALTER TABLE `gems__organizations` ADD UNIQUE INDEX (`gor_code`); -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; +ALTER TABLE `gems__organizations` ADD gor_accessible_by text CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' null AFTER gor_task; -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); +ALTER TABLE `gems__organizations` + ADD gor_has_respondents boolean not null default 1 AFTER gor_iso_lang, + ADD gor_add_respondents boolean not null default 1 AFTER gor_has_respondents; +UPDATE `gems__organizations` SET gor_has_respondents = COALESCE((SELECT 1 FROM gems__respondent2org WHERE gr2o_id_organization = gor_id_organization GROUP BY gr2o_id_organization), 0); +UPDATE `gems__organizations` SET gor_add_respondents = CASE WHEN gor_has_respondents = 1 AND gor_active = 1 THEN 1 ELSE 0 END; + -- 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-23 14:20:20 UTC (rev 277) +++ trunk/library/configs/db/tables/gems__organizations.20.sql 2011-11-23 18:52:36 UTC (rev 278) @@ -20,8 +20,8 @@ gor_iso_lang char(2) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' not null default 'en' references gems__languages (gml_iso_lang), - gor_has_patients boolean not null default 1, - gor_add_patients boolean not null default 1, + gor_has_respondents boolean not null default 1, + gor_add_respondents boolean not null default 1, gor_active boolean not null default 1, gor_changed timestamp not null default current_timestamp on update current_timestamp, 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-23 14:20:20 UTC (rev 277) +++ trunk/library/languages/default-en.po 2011-11-23 18:52:36 UTC (rev 278) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-11-23 14:53+0100\n" +"POT-Creation-Date: 2011-11-23 19:43+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -23,53 +23,53 @@ msgid "Path %s not writable" msgstr "Path %s not writable" -#: classes/GemsEscort.php:888 +#: classes/GemsEscort.php:887 #, php-format msgid "User: %s" msgstr "User: %s" -#: classes/GemsEscort.php:912 +#: classes/GemsEscort.php:911 msgid "version" msgstr "version" -#: classes/GemsEscort.php:1343 +#: 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:1467 +#: classes/GemsEscort.php:1469 msgid "Please check back later." msgstr "Please check back later." -#: classes/GemsEscort.php:1469 -#: classes/GemsEscort.php:1473 -#: classes/GemsEscort.php:1474 +#: classes/GemsEscort.php:1471 +#: classes/GemsEscort.php:1475 +#: classes/GemsEscort.php:1476 msgid "System is in maintenance mode" msgstr "System is in maintenance mode" -#: classes/GemsEscort.php:1484 +#: classes/GemsEscort.php:1486 msgid "No access to site." msgstr "No access to site." -#: classes/GemsEscort.php:1486 -#: classes/GemsEscort.php:1522 +#: classes/GemsEscort.php:1488 +#: classes/GemsEscort.php:1524 msgid "You have no access to this site." msgstr "You have no access to this site." -#: classes/GemsEscort.php:1502 +#: classes/GemsEscort.php:1504 msgid "No access to page" msgstr "No access to page" -#: classes/GemsEscort.php:1504 +#: classes/GemsEscort.php:1506 #, 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:1509 -#: classes/GemsEscort.php:1520 +#: classes/GemsEscort.php:1511 +#: classes/GemsEscort.php:1522 msgid "You are no longer logged in." msgstr "You are no longer logged in." -#: classes/GemsEscort.php:1510 +#: classes/GemsEscort.php:1512 msgid "You must login to access this page." msgstr "You must login to access this page." @@ -310,31 +310,31 @@ msgid "Respondents" msgstr "Patients" -#: classes/Gems/Menu.php:521 +#: classes/Gems/Menu.php:526 msgid "Overview" msgstr "Overview" -#: classes/Gems/Menu.php:528 +#: classes/Gems/Menu.php:533 msgid "Project" msgstr "Project" -#: classes/Gems/Menu.php:531 +#: classes/Gems/Menu.php:536 msgid "Setup" msgstr "Setup" -#: classes/Gems/Menu.php:534 +#: classes/Gems/Menu.php:539 msgid "Mail" msgstr "Mail" -#: classes/Gems/Menu.php:537 +#: classes/Gems/Menu.php:542 msgid "Track Builder" msgstr "Track Builder" -#: classes/Gems/Menu.php:546 +#: classes/Gems/Menu.php:551 msgid "Contact" msgstr "Contact" -#: classes/Gems/Menu.php:559 +#: classes/Gems/Menu.php:564 msgid "Changelog" msgstr "Changelog" @@ -1484,7 +1484,7 @@ msgstr "Login Name" #: classes/Gems/Default/OptionAction.php:188 -#: classes/Gems/Default/OrganizationAction.php:158 +#: classes/Gems/Default/OrganizationAction.php:191 #: classes/Gems/Default/RespondentAction.php:173 #: classes/Gems/Default/StaffAction.php:224 msgid "Language" @@ -1513,96 +1513,100 @@ msgid "Item" msgstr "Item" -#: classes/Gems/Default/OrganizationAction.php:114 +#: classes/Gems/Default/OrganizationAction.php:124 msgid "Cookies must be enabled." msgstr "Cookies must be enabled." -#: classes/Gems/Default/OrganizationAction.php:117 +#: classes/Gems/Default/OrganizationAction.php:127 msgid "Invalid organization." msgstr "Invalid organization." -#: classes/Gems/Default/OrganizationAction.php:125 +#: classes/Gems/Default/OrganizationAction.php:135 msgid "New organization..." msgstr "New organization..." -#: classes/Gems/Default/OrganizationAction.php:147 +#: classes/Gems/Default/OrganizationAction.php:144 +msgid "Choose an organization" +msgstr "Choose an organization" + +#: classes/Gems/Default/OrganizationAction.php:180 msgid "Url" msgstr "Url" -#: classes/Gems/Default/OrganizationAction.php:148 +#: classes/Gems/Default/OrganizationAction.php:181 msgid "Task" msgstr "Task" -#: classes/Gems/Default/OrganizationAction.php:149 +#: classes/Gems/Default/OrganizationAction.php:182 msgid "Contact name" msgstr "Contact name" -#: classes/Gems/Default/OrganizationAction.php:150 +#: classes/Gems/Default/OrganizationAction.php:183 msgid "Contact email" msgstr "Contact email" -#: classes/Gems/Default/OrganizationAction.php:153 +#: classes/Gems/Default/OrganizationAction.php:186 msgid "Style" msgstr "Style" -#: classes/Gems/Default/OrganizationAction.php:162 +#: classes/Gems/Default/OrganizationAction.php:195 msgid "Can the organization be used?" msgstr "Can the organization be used?" -#: classes/Gems/Default/OrganizationAction.php:163 +#: classes/Gems/Default/OrganizationAction.php:196 msgid "Accepting" msgstr "Accepting" -#: classes/Gems/Default/OrganizationAction.php:163 +#: classes/Gems/Default/OrganizationAction.php:196 msgid "Can new respondents be added to the organization?" msgstr "Can new patients be added to the organization?" -#: classes/Gems/Default/OrganizationAction.php:164 +#: classes/Gems/Default/OrganizationAction.php:197 msgid "Does the organization have respondents?" msgstr "Does the organization have patients?" -#: classes/Gems/Default/OrganizationAction.php:168 +#: classes/Gems/Default/OrganizationAction.php:201 msgid "Greeting" msgstr "Greeting" -#: classes/Gems/Default/OrganizationAction.php:168 -#: classes/Gems/Default/OrganizationAction.php:169 +#: classes/Gems/Default/OrganizationAction.php:201 +#: classes/Gems/Default/OrganizationAction.php:202 msgid "For emails and token forward screen." msgstr "For emails and token forward screen." -#: classes/Gems/Default/OrganizationAction.php:169 +#: classes/Gems/Default/OrganizationAction.php:202 msgid "Signature" msgstr "Signature" -#: classes/Gems/Default/OrganizationAction.php:171 +#: classes/Gems/Default/OrganizationAction.php:204 msgid "Accessible by" msgstr "Accessible by" -#: classes/Gems/Default/OrganizationAction.php:171 +#: classes/Gems/Default/OrganizationAction.php:204 msgid "Checked organizations see this organizations respondents." msgstr "Checked organizations see this organizations patients." -#: classes/Gems/Default/OrganizationAction.php:180 +#: classes/Gems/Default/OrganizationAction.php:214 msgid "Code name" msgstr "Code name" -#: classes/Gems/Default/OrganizationAction.php:180 +#: classes/Gems/Default/OrganizationAction.php:214 msgid "Only for programmers." msgstr "Only for programmers." -#: classes/Gems/Default/OrganizationAction.php:193 +#: classes/Gems/Default/OrganizationAction.php:228 msgid "Delete organization" msgstr "Delete organization" -#: classes/Gems/Default/OrganizationAction.php:203 +#: classes/Gems/Default/OrganizationAction.php:238 msgid "Edit organization" msgstr "Edit organization" -#: classes/Gems/Default/OrganizationAction.php:213 +#: classes/Gems/Default/OrganizationAction.php:248 msgid "Participating organizations" msgstr "Participating organizations" -#: classes/Gems/Default/OrganizationAction.php:223 +#: classes/Gems/Default/OrganizationAction.php:258 msgid "Show organization" msgstr "Show organization" @@ -1942,7 +1946,7 @@ msgstr[0] "patient" msgstr[1] "patients" -#: classes/Gems/Default/RespondentAction.php:392 +#: classes/Gems/Default/RespondentAction.php:405 msgid "Please settle the informed consent form for this respondent." msgstr "Please settle the informed consent form for this patient." @@ -2853,15 +2857,15 @@ msgid "Check all assignments" msgstr "Check all assignments" -#: classes/Gems/Menu/SubMenuItem.php:396 +#: classes/Gems/Menu/SubMenuItem.php:355 msgid "New" msgstr "New" -#: classes/Gems/Menu/SubMenuItem.php:450 +#: classes/Gems/Menu/SubMenuItem.php:409 msgid "Export the current data set to Excel" msgstr "Export the current data set to Excel" -#: classes/Gems/Menu/SubMenuItem.php:454 +#: classes/Gems/Menu/SubMenuItem.php:413 msgid "Excel export" msgstr "Excel export" @@ -3231,11 +3235,15 @@ msgstr "Answers for token %s, patient number %s: %s." #: classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php:223 +#: classes/Gems/Tracker/Snippets/EditTokenSnippetAbstract.php:124 +#: classes/Gems/Tracker/Snippets/ShowTokenSnippetAbstract.php:164 #, php-format msgid "Token %s not found." msgstr "Token %s not found." #: classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php:227 +#: classes/Gems/Tracker/Snippets/EditTokenSnippetAbstract.php:128 +#: classes/Gems/Tracker/Snippets/ShowTokenSnippetAbstract.php:168 msgid "No token specified." msgstr "No token specified." @@ -3801,12 +3809,10 @@ msgstr "Recalculate track" #: snippets/RespondentDetailsSnippet.php:59 -#: snippets/RespondentDetailsWithAssignmentsSnippet.php:74 msgid "Respondent information" msgstr "Patient information" #: snippets/RespondentDetailsSnippet.php:71 -#: snippets/RespondentDetailsWithAssignmentsSnippet.php:97 msgid "Respondent nr: " msgstr "Patient nr:" @@ -3894,6 +3900,14 @@ msgid "This track can be assigned since %s." msgstr "This track can be assigned since %s." +#: snippets/Organization/ChooseOrganizationSnippet.php:93 +msgid "This organization cannot have any respondents, please choose one that does:" +msgstr "This organization cannot have any patients, please choose one that does:" + +#: snippets/Organization/ChooseOrganizationSnippet.php:105 +msgid "This organization cannot have any respondents." +msgstr "This organization cannot have any patients." + #~ msgid "Allow new respondents" #~ msgstr "Allow new patients" 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-23 14:20:20 UTC (rev 277) +++ trunk/library/languages/default-nl.po 2011-11-23 18:52:36 UTC (rev 278) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse NL\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-11-23 14:50+0100\n" +"POT-Creation-Date: 2011-11-23 19:43+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -23,53 +23,53 @@ msgid "Path %s not writable" msgstr "Path %s niet schrijfbaar" -#: classes/GemsEscort.php:888 +#: classes/GemsEscort.php:887 #, php-format msgid "User: %s" msgstr "Login: %s" -#: classes/GemsEscort.php:912 +#: classes/GemsEscort.php:911 msgid "version" msgstr "versie" -#: classes/GemsEscort.php:1343 +#: 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:1467 +#: classes/GemsEscort.php:1469 msgid "Please check back later." msgstr "Probeer het later opnieuw." -#: classes/GemsEscort.php:1469 -#: classes/GemsEscort.php:1473 -#: classes/GemsEscort.php:1474 +#: classes/GemsEscort.php:1471 +#: classes/GemsEscort.php:1475 +#: classes/GemsEscort.php:1476 msgid "System is in maintenance mode" msgstr "Systeem is in onderhoudsmodus" -#: classes/GemsEscort.php:1484 +#: classes/GemsEscort.php:1486 msgid "No access to site." msgstr "Geen toegang tot website." -#: classes/GemsEscort.php:1486 -#: classes/GemsEscort.php:1522 +#: classes/GemsEscort.php:1488 +#: classes/GemsEscort.php:1524 msgid "You have no access to this site." msgstr "U heeft geen toegang tot deze website." -#: classes/GemsEscort.php:1502 +#: classes/GemsEscort.php:1504 msgid "No access to page" msgstr "Geen toegang tot pagina" -#: classes/GemsEscort.php:1504 +#: classes/GemsEscort.php:1506 #, 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:1509 -#: classes/GemsEscort.php:1520 +#: classes/GemsEscort.php:1511 +#: classes/GemsEscort.php:1522 msgid "You are no longer logged in." msgstr "U bent niet meer ingelogd." -#: classes/GemsEscort.php:1510 +#: classes/GemsEscort.php:1512 msgid "You must login to access this page." msgstr "U moet ingelogd zijn voor toegang tot deze pagina." @@ -310,31 +310,31 @@ msgid "Respondents" msgstr "Patiënten" -#: classes/Gems/Menu.php:521 +#: classes/Gems/Menu.php:526 msgid "Overview" msgstr "Overzicht" -#: classes/Gems/Menu.php:528 +#: classes/Gems/Menu.php:533 msgid "Project" msgstr "Project" -#: classes/Gems/Menu.php:531 +#: classes/Gems/Menu.php:536 msgid "Setup" msgstr "Beheer" -#: classes/Gems/Menu.php:534 +#: classes/Gems/Menu.php:539 msgid "Mail" msgstr "Email" -#: classes/Gems/Menu.php:537 +#: classes/Gems/Menu.php:542 msgid "Track Builder" msgstr "Traject bouwer" -#: classes/Gems/Menu.php:546 +#: classes/Gems/Menu.php:551 msgid "Contact" msgstr "Contact" -#: classes/Gems/Menu.php:559 +#: classes/Gems/Menu.php:564 msgid "Changelog" msgstr "Changelog" @@ -1484,7 +1484,7 @@ msgstr "Login Naam" #: classes/Gems/Default/OptionAction.php:188 -#: classes/Gems/Default/OrganizationAction.php:158 +#: classes/Gems/Default/OrganizationAction.php:191 #: classes/Gems/Default/RespondentAction.php:173 #: classes/Gems/Default/StaffAction.php:224 msgid "Language" @@ -1513,96 +1513,100 @@ msgid "Item" msgstr "Item" -#: classes/Gems/Default/OrganizationAction.php:114 +#: classes/Gems/Default/OrganizationAction.php:124 msgid "Cookies must be enabled." msgstr "Zonder cookies kan de taal niet ingesteld worden." -#: classes/Gems/Default/OrganizationAction.php:117 +#: classes/Gems/Default/OrganizationAction.php:127 msgid "Invalid organization." msgstr "Ongeldige organisatie." -#: classes/Gems/Default/OrganizationAction.php:125 +#: classes/Gems/Default/OrganizationAction.php:135 msgid "New organization..." msgstr "Nieuwe organisatie..." -#: classes/Gems/Default/OrganizationAction.php:147 +#: classes/Gems/Default/OrganizationAction.php:144 +msgid "Choose an organization" +msgstr "Kies een organisatie" + +#: classes/Gems/Default/OrganizationAction.php:180 msgid "Url" msgstr "Url" -#: classes/Gems/Default/OrganizationAction.php:148 +#: classes/Gems/Default/OrganizationAction.php:181 msgid "Task" msgstr "Taak" -#: classes/Gems/Default/OrganizationAction.php:149 +#: classes/Gems/Default/OrganizationAction.php:182 msgid "Contact name" msgstr "Contact naam" -#: classes/Gems/Default/OrganizationAction.php:150 +#: classes/Gems/Default/OrganizationAction.php:183 msgid "Contact email" msgstr "Contact email" -#: classes/Gems/Default/OrganizationAction.php:153 +#: classes/Gems/Default/OrganizationAction.php:186 msgid "Style" msgstr "Stijl" -#: classes/Gems/Default/OrganizationAction.php:162 +#: classes/Gems/Default/OrganizationAction.php:195 msgid "Can the organization be used?" msgstr "Is de organisatie in gebruik?" -#: classes/Gems/Default/OrganizationAction.php:163 +#: classes/Gems/Default/OrganizationAction.php:196 msgid "Accepting" msgstr "Accepteerd" -#: classes/Gems/Default/OrganizationAction.php:163 +#: classes/Gems/Default/OrganizationAction.php:196 msgid "Can new respondents be added to the organization?" msgstr "Accepteert de organisatie nieuwe patiënten?" -#: classes/Gems/Default/OrganizationAction.php:164 +#: classes/Gems/Default/OrganizationAction.php:197 msgid "Does the organization have respondents?" msgstr "Heeft de organisatie patiënten?" -#: classes/Gems/Default/OrganizationAction.php:168 +#: classes/Gems/Default/OrganizationAction.php:201 msgid "Greeting" msgstr "Begroeting" -#: classes/Gems/Default/OrganizationAction.php:168 -#: classes/Gems/Default/OrganizationAction.php:169 +#: classes/Gems/Default/OrganizationAction.php:201 +#: classes/Gems/Default/OrganizationAction.php:202 msgid "For emails and token forward screen." msgstr "Voor emails en kenmerk scherm." -#: classes/Gems/Default/OrganizationAction.php:169 +#: classes/Gems/Default/OrganizationAction.php:202 msgid "Signature" msgstr "Handtekening" -#: classes/Gems/Default/OrganizationAction.php:171 +#: classes/Gems/Default/OrganizationAction.php:204 msgid "Accessible by" msgstr "Toegankelijk voor" -#: classes/Gems/Default/OrganizationAction.php:171 +#: classes/Gems/Default/OrganizationAction.php:204 msgid "Checked organizations see this organizations respondents." msgstr "Geselecteerde organizaties kunnen de patiënten van deze organisatie bekijken." -#: classes/Gems/Default/OrganizationAction.php:180 +#: classes/Gems/Default/OrganizationAction.php:214 msgid "Code name" msgstr "Code naam" -#: classes/Gems/Default/OrganizationAction.php:180 +#: classes/Gems/Default/OrganizationAction.php:214 msgid "Only for programmers." msgstr "Uitsluitend voor programmeurs." -#: classes/Gems/Default/OrganizationAction.php:193 +#: classes/Gems/Default/OrganizationAction.php:228 msgid "Delete organization" msgstr "Verwijder organisatie" -#: classes/Gems/Default/OrganizationAction.php:203 +#: classes/Gems/Default/OrganizationAction.php:238 msgid "Edit organization" msgstr "Bewerk organisatie" -#: classes/Gems/Default/OrganizationAction.php:213 +#: classes/Gems/Default/OrganizationAction.php:248 msgid "Participating organizations" msgstr "Deelnemende organisaties" -#: classes/Gems/Default/OrganizationAction.php:223 +#: classes/Gems/Default/OrganizationAction.php:258 msgid "Show organization" msgstr "Toon organisatie" @@ -1942,7 +1946,7 @@ msgstr[0] "patiënt" msgstr[1] "patiënten" -#: classes/Gems/Default/RespondentAction.php:392 +#: classes/Gems/Default/RespondentAction.php:405 msgid "Please settle the informed consent form for this respondent." msgstr "A.u.b. het informed consent formulier doornemen met deze patiënt" @@ -2853,15 +2857,15 @@ msgid "Check all assignments" msgstr "Controleer alle toewijzingen" -#: classes/Gems/Menu/SubMenuItem.php:396 +#: classes/Gems/Menu/SubMenuItem.php:355 msgid "New" msgstr "Nieuw" -#: classes/Gems/Menu/SubMenuItem.php:450 +#: classes/Gems/Menu/SubMenuItem.php:409 msgid "Export the current data set to Excel" msgstr "Exporteer de huidige gegevens naar Excel" -#: classes/Gems/Menu/SubMenuItem.php:454 +#: classes/Gems/Menu/SubMenuItem.php:413 msgid "Excel export" msgstr "Excel export" @@ -3231,11 +3235,15 @@ msgstr "Antwoorden voor kenmerk %s, patientnummer %s: %s." #: classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php:223 +#: classes/Gems/Tracker/Snippets/EditTokenSnippetAbstract.php:124 +#: classes/Gems/Tracker/Snippets/ShowTokenSnippetAbstract.php:164 #, php-format msgid "Token %s not found." msgstr "Kenmerk %s niet gevonden" #: classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php:227 +#: classes/Gems/Tracker/Snippets/EditTokenSnippetAbstract.php:128 +#: classes/Gems/Tracker/Snippets/ShowTokenSnippetAbstract.php:168 msgid "No token specified." msgstr "Geen kenmerk opgegeven." @@ -3801,12 +3809,10 @@ msgstr "Berekening traject opnieuw" #: snippets/RespondentDetailsSnippet.php:59 -#: snippets/RespondentDetailsWithAssignmentsSnippet.php:74 msgid "Respondent information" msgstr "Patiënt informatie" #: snippets/RespondentDetailsSnippet.php:71 -#: snippets/RespondentDetailsWithAssignmentsSnippet.php:97 msgid "Respondent nr: " msgstr "Patiënt nr:" @@ -3894,6 +3900,14 @@ msgid "This track can be assigned since %s." msgstr "Dit traject kan sinds %s aan een patiënt toegewezen worden." +#: snippets/Organization/ChooseOrganizationSnippet.php:93 +msgid "This organization cannot have any respondents, please choose one that does:" +msgstr "Deze organisatie heeft geen patiënten. Kies een organisatie met patiënten." + +#: snippets/Organization/ChooseOrganizationSnippet.php:105 +msgid "This organization cannot have any respondents." +msgstr "Deze organisatie heeft geen patiënten." + #~ msgid "Allow new respondents" #~ msgstr "Nieuwe patiënten toestaan" Added: trunk/library/snippets/Organization/ChooseOrganizationSnippet.php =================================================================== --- trunk/library/snippets/Organization/ChooseOrganizationSnippet.php (rev 0) +++ trunk/library/snippets/Organization/ChooseOrganizationSnippet.php 2011-11-23 18:52:36 UTC (rev 278) @@ -0,0 +1,110 @@ +<?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... [truncated message content] |