From: <gem...@li...> - 2011-10-20 16:03:41
|
Revision: 122 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=122&view=rev Author: matijsdejong Date: 2011-10-20 16:03:30 +0000 (Thu, 20 Oct 2011) Log Message: ----------- Continued on ModelSnippetAction (#10): removed functional extension, added the text marker interface and fixed the Echo output. Fixed several roles that I forgot to add for mail activities. Modified Paths: -------------- trunk/library/classes/Gems/Default/MailLogAction.php trunk/library/classes/Gems/Menu/MenuAbstract.php trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php trunk/library/configs/db/patches.sql trunk/library/configs/db/tables/gems__roles.20.sql trunk/library/controllers/MailLogController.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 trunk/library/snippets/Generic/ModelItemTableSnippet.php trunk/library/snippets/Generic/ModelTableSnippet.php Added Paths: ----------- trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php trunk/library/snippets/Mail/ trunk/library/snippets/Mail/Log/ trunk/library/snippets/Mail/Log/MailLogBrowseSnippet.php Removed Paths: ------------- trunk/library/classes/Gems/Default/MailLogActionOldStyle.php Modified: trunk/library/classes/Gems/Default/MailLogAction.php =================================================================== --- trunk/library/classes/Gems/Default/MailLogAction.php 2011-10-20 14:12:29 UTC (rev 121) +++ trunk/library/classes/Gems/Default/MailLogAction.php 2011-10-20 16:03:30 UTC (rev 122) @@ -37,10 +37,8 @@ */ /** - * Short description for class + * Controller for looking at mail activity * - * Long description for class (if any)... - * * @package Gems * @subpackage Default * @copyright Copyright (c) 2011 Erasmus MC @@ -50,28 +48,12 @@ class Gems_Default_MailLogAction extends Gems_Controller_ModelSnippetActionAbstract { /** - * Adds columns from the model to the bridge that creates the browse table. + * The snippets used for the autofilter action. * - * Adds a button column to the model, if such a button exists in the model. - * - * @param MUtil_Model_TableBridge $bridge - * @param MUtil_Model_ModelAbstract $model - * @rturn void + * @var mixed String or array of snippets name */ - public function addTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model) - { - if ($menuItem = $this->firstAllowedMenuItem('show')) { - $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge)); - } + protected $autofilterSnippets = 'Mail_Log_MailLogBrowseSnippet'; - // Newline placeholder - $br = MUtil_Html::create('br'); - - $bridge->addMultiSort('grco_created', $br, 'respondent_name', $br, 'grco_address'); - $bridge->addMultiSort('grco_id_token', $br, 'assigned_by', $br, 'grco_sender'); - $bridge->addMultiSort('grco_topic'); - } - /** * The automatically filtered result */ @@ -79,7 +61,6 @@ { $filter = array('grco_organization' => $this->escort->getCurrentOrganization()); - $this->autofilterParameters['addTableColumns'] = array($this, 'addTableColumns'); $this->autofilterParameters['extraFilter'] = $filter; $this->autofilterParameters['extraSort'] = array('grco_created' => SORT_DESC); @@ -147,7 +128,6 @@ { $this->html->h3($this->_('Mail Activity Log')); - // MUtil_Echo::track($this->indexParameters); parent::indexAction(); } Deleted: trunk/library/classes/Gems/Default/MailLogActionOldStyle.php =================================================================== --- trunk/library/classes/Gems/Default/MailLogActionOldStyle.php 2011-10-20 14:12:29 UTC (rev 121) +++ trunk/library/classes/Gems/Default/MailLogActionOldStyle.php 2011-10-20 16:03:30 UTC (rev 122) @@ -1,150 +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 Default - * @author Matijs de Jong <mj...@ma...> - * @copyright Copyright (c) 2011 Erasmus MC - * @license New BSD License - * @version $Id: Sample.php 203 2011-07-07 12:51:32Z matijs $ - */ - -/** - * Temprary class until Gems_Controller_ModelSnippetActionAbstract works - * - * @package Gems - * @subpackage Default - * @copyright Copyright (c) 2011 Erasmus MC - * @license New BSD License - * @since Class available since version 1.4.2 - */ -class Gems_Default_MailLogActionOldStyle extends Gems_Controller_BrowseEditAction -{ - public $sortKey = array('grco_created' => SORT_DESC); - - /** - * Adds columns from the model to the bridge that creates the browse table. - * - * Adds a button column to the model, if such a button exists in the model. - * - * @param MUtil_Model_TableBridge $bridge - * @param MUtil_Model_ModelAbstract $model - * @rturn void - */ - protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model) - { - if ($menuItem = $this->findAllowedMenuItem('show')) { - $bridge->addItemLink($menuItem->toActionLinkLower($this->getRequest(), $bridge)); - } - - // Newline placeholder - $br = MUtil_Html::create('br'); - - $bridge->addMultiSort('grco_created', $br, 'respondent_name', $br, 'grco_address'); - $bridge->addMultiSort('grco_id_token', $br, 'assigned_by', $br, 'grco_sender'); - $bridge->addMultiSort('grco_topic'); - } - - /** - * Creates a model for getModel(). Called only for each new $action. - * - * The parameters allow you to easily adapt the model to the current action. The $detailed - * parameter was added, because the most common use of action is a split between detailed - * and summarized actions. - * - * @param boolean $detailed True when the current action is not in $summarizedActions. - * @param string $action The current action. - * @return MUtil_Model_ModelAbstract - */ - public function createModel($detailed, $action) - { - $model = new Gems_Model_JoinModel('maillog', 'gems__log_respondent_communications'); - - $model->addLeftTable('gems__respondents', array('grco_id_to' => 'grs_id_user')); - $model->addLeftTable('gems__staff', array('grco_id_by' => 'gsf_id_user')); - $model->addLeftTable('gems__mail_templates', array('grco_id_message' => 'gmt_id_message')); - - $model->addColumn( - "TRIM(CONCAT(COALESCE(CONCAT(grs_last_name, ', '), '-, '), COALESCE(CONCAT(grs_first_name, ' '), ''), COALESCE(grs_surname_prefix, '')))", - 'respondent_name'); - $model->addColumn( - "CASE WHEN gems__staff.gsf_id_user IS NULL - THEN '-' - ELSE - CONCAT( - COALESCE(gems__staff.gsf_last_name, ''), - ', ', - COALESCE(gems__staff.gsf_first_name, ''), - COALESCE(CONCAT(' ', gems__staff.gsf_surname_prefix), '') - ) - END", - 'assigned_by'); - - $model->resetOrder(); - - $model->set('grco_created', 'label', $this->_('Date sent')); - $model->set('respondent_name', 'label', $this->_('Receiver')); - $model->set('grco_address', 'label', $this->_('To address'), 'itemDisplay', 'MUtil_Html_AElement::ifmail'); - $model->set('assigned_by', 'label', $this->_('Sender')); - $model->set('grco_sender', 'label', $this->_('From address'), 'itemDisplay', 'MUtil_Html_AElement::ifmail'); - $model->set('grco_id_token', 'label', $this->_('Token')); - $model->set('grco_topic', 'label', $this->_('Subject')); - - if ($detailed) { - $model->set('gmt_subject', 'label', $this->_('Template')); - } else { - $model->set('grco_created', 'formatFunction', $this->util->getTranslated()->formatDate); - } - - return $model; - } - - /** - * Helper function to allow generalized statements about the items in the model. - * - * @param int $count - * @return $string - */ - public function getTopic($count = 1) - { - return $this->plural('Activity Log', 'Activity Logs', $count); - } - - - /** - * Helper function to allow generalized treatment of the header. - * - * return $string - */ - public function getTopicTitle() - { - return $this->_('Mail Activity Log'); - } -} Modified: trunk/library/classes/Gems/Menu/MenuAbstract.php =================================================================== --- trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-10-20 14:12:29 UTC (rev 121) +++ trunk/library/classes/Gems/Menu/MenuAbstract.php 2011-10-20 16:03:30 UTC (rev 122) @@ -230,7 +230,7 @@ // MAIL ACTIVITY CONTROLLER //$setup->addBrowsePage(); - $page = $setup->addPage($this->_('Activity'), 'pr.mail.log', 'mail-log'); + $page = $setup->addPage($this->_('Activity log'), 'pr.mail.log', 'mail-log'); $page->addAutofilterAction(); $page->addExcelAction(); $page->addShowAction(); Modified: trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php =================================================================== --- trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php 2011-10-20 14:12:29 UTC (rev 121) +++ trunk/library/classes/Gems/Snippets/ModelTableSnippetAbstract.php 2011-10-20 16:03:30 UTC (rev 122) @@ -103,6 +103,24 @@ protected $sortParamDesc = 'dsrt'; /** + * Adds columns from the model to the bridge that creates the browse table. + * + * Overrule this function to add different columns to the browse table, without + * having to recode the core table building code. + * + * @param MUtil_Model_TableBridge $bridge + * @param MUtil_Model_ModelAbstract $model + * @return void + */ + protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model) + { + // make sure search results are highlighted + $this->applyTextMarker(); + + return parent::addBrowseTableColumns($bridge, $model); + } + + /** * Add the paginator panel to the table. * * Only called when $this->browse is true. Overrule this function @@ -116,6 +134,30 @@ } /** + * Make sure generic search text results are marked + * + * @return void + */ + protected function applyTextMarker() + { + $model = $this->getModel(); + + $textKey = $model->getTextFilter(); + $filter = $model->getFilter(); + + if (isset($filter[$textKey])) { + $searchText = $filter[$textKey]; + // MUtil_Echo::r('[' . $searchText . ']'); + $marker = new MUtil_Html_Marker($model->getTextSearches($searchText), 'strong', 'UTF-8'); + foreach ($model->getItemNames() as $name) { + if ($model->get($name, 'label')) { + $model->set($name, 'markCallback', array($marker, 'mark')); + } + } + } + } + + /** * Should be called after answering the request to allow the Target * to check if all required registry values have been set correctly. * @@ -204,7 +246,7 @@ $data = $this->requestCache->getProgramParams(); $model->applyParameters($data); - + } else { parent::processFilterAndSort($model); } Copied: trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php (from rev 114, trunk/library/snippets/Generic/ModelTableSnippet.php) =================================================================== --- trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php (rev 0) +++ trunk/library/classes/Gems/Snippets/ModelTableSnippetGeneric.php 2011-10-20 16:03:30 UTC (rev 122) @@ -0,0 +1,94 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package MUtil + * @subpackage Snippets + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ + */ + +/** + * Displays multiple items from a model in a tabel by row using + * the model set through the $model snippet parameter. + * + * If you want to use this class "as is" use the 'Generic_ModelTableSnippet' snippet. + * + * This class is not in the standard snippet loading directories and does not follow + * their naming conventions, but exists only to make it simple to extend this class + * for a specific implementation. + * + * @package MUtil + * @subpackage Snippets + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.4.4 + */ +class Gems_Snippets_ModelTableSnippetGeneric extends Gems_Snippets_ModelTableSnippetAbstract +{ + /** + * + * @var MUtil_Model_ModelAbstract + */ + protected $model; + + /** + * + * @var Gems_Util + */ + protected $util; + + /** + * Automatically add request cacge + * + * 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->util && (! $this->requestCache)) { + $this->requestCache = $this->util->getRequestCache(); + } + + return parent::checkRegistryRequestsAnswers(); + } + + /** + * Creates the model + * + * @return MUtil_Model_ModelAbstract + */ + protected function createModel() + { + return $this->model; + } +} Modified: trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php =================================================================== --- trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php 2011-10-20 14:12:29 UTC (rev 121) +++ trunk/library/classes/MUtil/Controller/ModelSnippetActionAbstract.php 2011-10-20 16:03:30 UTC (rev 122) @@ -98,6 +98,19 @@ protected $showSnippets = 'ModelVerticalTableSnippet'; /** + * Array of the actions that use a summarized version of the model. + * + * This determines the value of $detailed in createAction(). As it is usually + * less of a problem to use a $detailed model with an action that should use + * a summarized model and I guess there will usually be more detailed actions + * than summarized ones it seems less work to specify these. + * + * @var array $summarizedActions Array of the actions that use a + * summarized version of the model. + */ + public $summarizedActions = array('index', 'autofilter'); + + /** * Set the action key in request * * Use this when an action is a Ajax action for retrieving @@ -137,7 +150,9 @@ } if ($resetMvc && MUtil_Echo::hasOutput()) { - $this->html->raw(MUtil_Echo::out()); + // Lazy call here, because any echo calls in the snippets have not yet been + // performed. so they will appear only in the next call when not lazy. + $this->html->raw(MUtil_Lazy::call(array('MUtil_Echo', 'out'))); } } Modified: trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php =================================================================== --- trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php 2011-10-20 14:12:29 UTC (rev 121) +++ trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php 2011-10-20 16:03:30 UTC (rev 122) @@ -57,13 +57,6 @@ protected $_marker; /** - * Functional extension: optionally use this function to add the browse columns - * - * @var callable With signature: function(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model, MUtil_Snippets_ModelTableSnippetAbstract $snippet) - */ - public $addTableColumns; - - /** * Url parts added to each link in the resulting table * * @var array @@ -171,11 +164,7 @@ $bridge->setBaseUrl($this->baseUrl); } - if (is_callable($this->addTableColumns)) { - call_user_func($this->addTableColumns, $bridge, $model, $this); - } else { - $this->addBrowseTableColumns($bridge, $model); - } + $this->addBrowseTableColumns($bridge, $model); return $bridge->getTable(); } Modified: trunk/library/configs/db/patches.sql =================================================================== --- trunk/library/configs/db/patches.sql 2011-10-20 14:12:29 UTC (rev 121) +++ trunk/library/configs/db/patches.sql 2011-10-20 16:03:30 UTC (rev 122) @@ -208,3 +208,6 @@ UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges,',pr.maintenance') WHERE grl_name = 'super' AND grl_privileges NOT LIKE '%pr.maintenance%'; -- GEMS VERSION: 42 +-- PATCH: Add mail actions to admin role +UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges, ',pr.mail.log') WHERE grl_name = 'admin' AND grl_privileges NOT LIKE '%pr.mail.log%'; +UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges, ',pr.mail.server,pr.mail.server.create,pr.mail.server.delete,pr.mail.server.edit') WHERE grl_name = 'super' AND grl_privileges NOT LIKE '%pr.mail.server%'; Modified: trunk/library/configs/db/tables/gems__roles.20.sql =================================================================== --- trunk/library/configs/db/tables/gems__roles.20.sql 2011-10-20 14:12:29 UTC (rev 121) +++ trunk/library/configs/db/tables/gems__roles.20.sql 2011-10-20 16:03:30 UTC (rev 122) @@ -32,5 +32,5 @@ ('staff','staff','pr.option.edit,pr.option.password,pr.plan,pr.plan.overview,pr.plan.token,pr.project,pr.project.questions,pr.respondent.create,pr.respondent.edit,pr.respondent.who,pr.setup,pr.staff,pr.survey,pr.survey.create,pr.token,pr.token.answers,pr.token.delete,pr.token.edit,pr.token.mail,pr.token.print,pr.track,pr.track.create,pr.track.delete,pr.track.edit,pr.respondent.reportdeath','guest', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), ('physician','physician','','staff', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), ('researcher','researcher','pr.invitation,pr.result,pr.islogin','', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), - ('admin','admin','pr.consent,pr.consent.create,pr.consent.edit,pr.group,pr.role,pr.mail,pr.mail.create,pr.mail.delete,pr.mail.edit,pr.organization,pr.organization-switch,pr.plan.overview.excel,pr.plan.respondent,pr.plan.respondent.excel,pr.plan.token.excel,pr.project-information,pr.reception,pr.reception.create,pr.reception.edit,pr.respondent.choose-org,pr.respondent.delete,pr.respondent.result,pr.source,pr.staff.create,pr.staff.delete,pr.staff.edit,pr.staff.see.all,pr.survey-maintenance,pr.track-maintenance,pr.token.mail.freetext','staff,researcher,security', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), - ('super','super','pr.consent.delete,pr.country,pr.country.create,pr.country.delete,pr.country.edit,pr.database,pr.database.create,pr.database.delete,pr.database.edit,pr.database.execute,pr.database.patches,pr.group.create,pr.group.edit,pr.role.create,pr.role.edit,pr.language,pr.organization.create,pr.organization.edit,pr.plan.choose-org,pr.plan.mail-as-application,pr.reception.delete,pr.source.create,pr.source.edit,pr.source.synchronize,pr.source.synchronize-all,pr.staff.edit.all,pr.survey-maintenance.edit,pr.track-maintenance.create,pr.track-maintenance.edit,pr.maintenance','admin', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1); + ('admin','admin','pr.consent,pr.consent.create,pr.consent.edit,pr.group,pr.role,pr.mail,pr.mail.create,pr.mail.delete,pr.mail.edit,pr.mail.log,pr.organization,pr.organization-switch,pr.plan.overview.excel,pr.plan.respondent,pr.plan.respondent.excel,pr.plan.token.excel,pr.project-information,pr.reception,pr.reception.create,pr.reception.edit,pr.respondent.choose-org,pr.respondent.delete,pr.respondent.result,pr.source,pr.staff.create,pr.staff.delete,pr.staff.edit,pr.staff.see.all,pr.survey-maintenance,pr.track-maintenance,pr.token.mail.freetext','staff,researcher,security', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1), + ('super','super','pr.consent.delete,pr.country,pr.country.create,pr.country.delete,pr.country.edit,pr.database,pr.database.create,pr.database.delete,pr.database.edit,pr.database.execute,pr.database.patches,pr.group.create,pr.group.edit,pr.language,pr.mail.server,pr.mail.server.create,pr.mail.server.delete,pr.mail.server.edit,pr.organization.create,pr.organization.edit,pr.plan.choose-org,pr.plan.mail-as-application,pr.reception.delete,pr.role.create,pr.role.edit,pr.source.create,pr.source.edit,pr.source.synchronize,pr.source.synchronize-all,pr.staff.edit.all,pr.survey-maintenance.edit,pr.track-maintenance.create,pr.track-maintenance.edit,pr.maintenance','admin', CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 1); Modified: trunk/library/controllers/MailLogController.php =================================================================== --- trunk/library/controllers/MailLogController.php 2011-10-20 14:12:29 UTC (rev 121) +++ trunk/library/controllers/MailLogController.php 2011-10-20 16:03:30 UTC (rev 122) @@ -42,6 +42,5 @@ * @license New BSD License * @since Class available since version 1.4.2 */ -class MailLogController extends Gems_Default_MailLogActionOldStyle -{ -} +class MailLogController extends Gems_Default_MailLogAction +{ } Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2011-10-20 14:12:29 UTC (rev 121) +++ trunk/library/languages/default-en.po 2011-10-20 16:03:30 UTC (rev 122) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-10-20 15:30+0100\n" +"POT-Creation-Date: 2011-10-20 17:52+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -1151,8 +1151,7 @@ msgstr "Log maintenance" #: classes/Gems/Default/MailAction.php:61 -#: classes/Gems/Default/MailLogAction.php:132 -#: classes/Gems/Default/MailLogActionOldStyle.php:118 +#: classes/Gems/Default/MailLogAction.php:113 msgid "Subject" msgstr "Subject" @@ -1170,51 +1169,38 @@ msgid "Email templates" msgstr "Email templates" -#: classes/Gems/Default/MailLogAction.php:126 -#: classes/Gems/Default/MailLogActionOldStyle.php:112 +#: classes/Gems/Default/MailLogAction.php:107 msgid "Date sent" msgstr "Date sent" -#: classes/Gems/Default/MailLogAction.php:127 -#: classes/Gems/Default/MailLogActionOldStyle.php:113 +#: classes/Gems/Default/MailLogAction.php:108 msgid "Receiver" msgstr "Receiver" -#: classes/Gems/Default/MailLogAction.php:128 -#: classes/Gems/Default/MailLogActionOldStyle.php:114 +#: classes/Gems/Default/MailLogAction.php:109 msgid "To address" msgstr "To address" -#: classes/Gems/Default/MailLogAction.php:129 -#: classes/Gems/Default/MailLogActionOldStyle.php:115 +#: classes/Gems/Default/MailLogAction.php:110 msgid "Sender" msgstr "Sender" -#: classes/Gems/Default/MailLogAction.php:130 -#: classes/Gems/Default/MailLogActionOldStyle.php:116 +#: classes/Gems/Default/MailLogAction.php:111 msgid "From address" msgstr "From address" -#: classes/Gems/Default/MailLogAction.php:135 -#: classes/Gems/Default/MailLogActionOldStyle.php:121 +#: classes/Gems/Default/MailLogAction.php:116 msgid "Template" msgstr "Template" -#: classes/Gems/Default/MailLogAction.php:148 -#: classes/Gems/Default/MailLogActionOldStyle.php:148 +#: classes/Gems/Default/MailLogAction.php:129 msgid "Mail Activity Log" msgstr "Mail Activity Log" -#: classes/Gems/Default/MailLogAction.php:160 +#: classes/Gems/Default/MailLogAction.php:140 msgid "Show Mail Activity Log item" msgstr "Show Mail Activity Log item" -#: classes/Gems/Default/MailLogActionOldStyle.php:137 -msgid "Activity Log" -msgid_plural "Activity Logs" -msgstr[0] "Activity Log" -msgstr[1] "Activity Logs" - #: classes/Gems/Default/MailServerAction.php:68 msgid "From address [part]" msgstr "From address [part]" @@ -1256,6 +1242,8 @@ msgstr "User ID" #: classes/Gems/Default/MailServerAction.php:90 +#: classes/Gems/Default/OptionAction.php:107 +#: classes/Gems/Default/OptionAction.php:112 msgid "Repeat password" msgstr "Repeat password" @@ -1274,14 +1262,10 @@ msgstr "Email servers" #: classes/Gems/Default/OptionAction.php:73 -#: classes/Gems/Default/OrganizationAction.php:128 -#: classes/Gems/Default/RespondentAction.php:173 -#: classes/Gems/Default/StaffAction.php:188 msgid "Language" msgstr "Language" #: classes/Gems/Default/OptionAction.php:74 -#: classes/Gems/Default/StaffAction.php:189 msgid "Logout on survey" msgstr "Logout on survey" @@ -1568,6 +1552,7 @@ msgstr "Survey not specified." #: classes/Gems/Default/ProjectTracksAction.php:120 +#: classes/Gems/Default/TrackActionAbstract.php:479 #, php-format msgid "Track %s does not exist." msgstr "Track %s does not exist." @@ -2515,8 +2500,8 @@ msgstr "Some help for this export" #: classes/Gems/Menu/MenuAbstract.php:233 -msgid "Activity" -msgstr "Activity" +msgid "Activity log" +msgstr "Activity Log" #: classes/Gems/Menu/MenuAbstract.php:239 msgid "Servers" @@ -3564,6 +3549,9 @@ msgid "This track can be assigned since %s." msgstr "This track can be assigned since %s." +#~ msgid "Activity" +#~ msgstr "Activity" + #~ msgid "DB Adaptor" #~ msgstr "DB Adaptor" Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2011-10-20 14:12:29 UTC (rev 121) +++ trunk/library/languages/default-nl.po 2011-10-20 16:03:30 UTC (rev 122) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: Pulse NL\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-10-20 15:30+0100\n" +"POT-Creation-Date: 2011-10-20 17:53+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -1151,8 +1151,7 @@ msgstr "Logboek onderhoud" #: classes/Gems/Default/MailAction.php:61 -#: classes/Gems/Default/MailLogAction.php:132 -#: classes/Gems/Default/MailLogActionOldStyle.php:118 +#: classes/Gems/Default/MailLogAction.php:113 msgid "Subject" msgstr "Onderwerp" @@ -1170,51 +1169,38 @@ msgid "Email templates" msgstr "Email sjabloon" -#: classes/Gems/Default/MailLogAction.php:126 -#: classes/Gems/Default/MailLogActionOldStyle.php:112 +#: classes/Gems/Default/MailLogAction.php:107 msgid "Date sent" msgstr "Verzend datum" -#: classes/Gems/Default/MailLogAction.php:127 -#: classes/Gems/Default/MailLogActionOldStyle.php:113 +#: classes/Gems/Default/MailLogAction.php:108 msgid "Receiver" msgstr "Ontvanger" -#: classes/Gems/Default/MailLogAction.php:128 -#: classes/Gems/Default/MailLogActionOldStyle.php:114 +#: classes/Gems/Default/MailLogAction.php:109 msgid "To address" msgstr "Adres aan" -#: classes/Gems/Default/MailLogAction.php:129 -#: classes/Gems/Default/MailLogActionOldStyle.php:115 +#: classes/Gems/Default/MailLogAction.php:110 msgid "Sender" msgstr "Verzender" -#: classes/Gems/Default/MailLogAction.php:130 -#: classes/Gems/Default/MailLogActionOldStyle.php:116 +#: classes/Gems/Default/MailLogAction.php:111 msgid "From address" msgstr "Adres van" -#: classes/Gems/Default/MailLogAction.php:135 -#: classes/Gems/Default/MailLogActionOldStyle.php:121 +#: classes/Gems/Default/MailLogAction.php:116 msgid "Template" msgstr "Sjabloon" -#: classes/Gems/Default/MailLogAction.php:148 -#: classes/Gems/Default/MailLogActionOldStyle.php:148 +#: classes/Gems/Default/MailLogAction.php:129 msgid "Mail Activity Log" msgstr "Logboek Mail Activiteit" -#: classes/Gems/Default/MailLogAction.php:160 +#: classes/Gems/Default/MailLogAction.php:140 msgid "Show Mail Activity Log item" msgstr "Toon Logboek Mail item" -#: classes/Gems/Default/MailLogActionOldStyle.php:137 -msgid "Activity Log" -msgid_plural "Activity Logs" -msgstr[0] "Mail Activiteit Log" -msgstr[1] "Mail Activiteiten Logs" - #: classes/Gems/Default/MailServerAction.php:68 msgid "From address [part]" msgstr "Vanaf adres [gedeelte]" @@ -1256,6 +1242,8 @@ msgstr "Gebruikers ID" #: classes/Gems/Default/MailServerAction.php:90 +#: classes/Gems/Default/OptionAction.php:107 +#: classes/Gems/Default/OptionAction.php:112 msgid "Repeat password" msgstr "Herhaal wachtwoord" @@ -1274,14 +1262,10 @@ msgstr "Email servers" #: classes/Gems/Default/OptionAction.php:73 -#: classes/Gems/Default/OrganizationAction.php:128 -#: classes/Gems/Default/RespondentAction.php:173 -#: classes/Gems/Default/StaffAction.php:188 msgid "Language" msgstr "Taal" #: classes/Gems/Default/OptionAction.php:74 -#: classes/Gems/Default/StaffAction.php:189 msgid "Logout on survey" msgstr "Logout bij beantwoorden vragenlijst" @@ -1568,6 +1552,7 @@ msgstr "Vragenlijst niet opgegeven." #: classes/Gems/Default/ProjectTracksAction.php:120 +#: classes/Gems/Default/TrackActionAbstract.php:479 #, php-format msgid "Track %s does not exist." msgstr "Trajectnummer %s bestaat niet." @@ -2515,7 +2500,7 @@ msgstr "Uitleg over deze export mogelijkheid" #: classes/Gems/Menu/MenuAbstract.php:233 -msgid "Activity" +msgid "Activity log" msgstr "Activiteit" #: classes/Gems/Menu/MenuAbstract.php:239 @@ -3564,6 +3549,9 @@ msgid "This track can be assigned since %s." msgstr "Dit traject kan sinds %s aan een patiënt toegewezen worden." +#~ msgid "Activity" +#~ msgstr "Activiteit" + #~ msgid "DB Adaptor" #~ msgstr "DB Adaptor" Modified: trunk/library/snippets/Generic/ModelItemTableSnippet.php =================================================================== --- trunk/library/snippets/Generic/ModelItemTableSnippet.php 2011-10-20 14:12:29 UTC (rev 121) +++ trunk/library/snippets/Generic/ModelItemTableSnippet.php 2011-10-20 16:03:30 UTC (rev 122) @@ -108,7 +108,7 @@ $menuList = $this->menu->getMenuList(); $menuList->addParameterSources($bridge) - ->addByController($controller) + ->addByController($controller, 'index', $this->_('Cancel')) ->addByController($controller, 'edit') ->addByController($controller, 'delete'); Modified: trunk/library/snippets/Generic/ModelTableSnippet.php =================================================================== --- trunk/library/snippets/Generic/ModelTableSnippet.php 2011-10-20 14:12:29 UTC (rev 121) +++ trunk/library/snippets/Generic/ModelTableSnippet.php 2011-10-20 16:03:30 UTC (rev 122) @@ -39,50 +39,13 @@ * Displays multiple items from a model in a tabel by row using * the model set through the $model snippet parameter. * + * Usage snippet for Gems_Snippets_ModelTableSnippetGeneric + * * @package MUtil * @subpackage Snippets * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @since Class available since version 1.2 + * @since Class available since version 1.4 */ -class Generic_ModelTableSnippet extends Gems_Snippets_ModelTableSnippetAbstract -{ - /** - * - * @var MUtil_Model_ModelAbstract - */ - protected $model; - - /** - * - * @var Gems_Util - */ - protected $util; - - /** - * Automatically add request cacge - * - * 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->util && (! $this->requestCache)) { - $this->requestCache = $this->util->getRequestCache(); - } - - return parent::checkRegistryRequestsAnswers(); - } - - /** - * Creates the model - * - * @return MUtil_Model_ModelAbstract - */ - protected function createModel() - { - return $this->model; - } -} +class Generic_ModelTableSnippet extends Gems_Snippets_ModelTableSnippetGeneric +{ } Property changes on: trunk/library/snippets/Mail ___________________________________________________________________ Added: bugtraq:url + http://survey.erasmusmc.nl/support/mantis/view.php?id=%BUGID% Added: bugtraq:number + true Added: bugtraq:logregex + #(\d+) Property changes on: trunk/library/snippets/Mail/Log ___________________________________________________________________ Added: bugtraq:url + http://survey.erasmusmc.nl/support/mantis/view.php?id=%BUGID% Added: bugtraq:number + true Added: bugtraq:logregex + #(\d+) Added: trunk/library/snippets/Mail/Log/MailLogBrowseSnippet.php =================================================================== --- trunk/library/snippets/Mail/Log/MailLogBrowseSnippet.php (rev 0) +++ trunk/library/snippets/Mail/Log/MailLogBrowseSnippet.php 2011-10-20 16:03:30 UTC (rev 122) @@ -0,0 +1,76 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package Gems + * @subpackage Snippets + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ + */ + +/** + * Add complex column layout to display. + * + * + * @package Gems + * @subpackage Snippets + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.4.4 + */ +class Mail_Log_MailLogBrowseSnippet extends Gems_Snippets_ModelTableSnippetGeneric +{ + /** + * Adds columns from the model to the bridge that creates the browse table. + * + * Overrule this function to add different columns to the browse table, without + * having to recode the core table building code. + * + * @param MUtil_Model_TableBridge $bridge + * @param MUtil_Model_ModelAbstract $model + * @return void + */ + protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model) + { + if ($menuItem = $this->findMenuItem($this->request->getControllerName(), 'show')) { + $bridge->addItemLink($menuItem->toActionLinkLower($this->request, $bridge)); + } + + // Newline placeholder + $br = MUtil_Html::create('br'); + + // make sure search results are highlighted + $this->applyTextMarker(); + + $bridge->addMultiSort('grco_created', $br, 'respondent_name', $br, 'grco_address'); + $bridge->addMultiSort('grco_id_token', $br, 'assigned_by', $br, 'grco_sender'); + $bridge->addMultiSort('grco_topic'); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |