From ea175ca89d9774c20db865ae8f562d6ec241b28e Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Fri, 12 Apr 2013 10:35:40 +0000 Subject: [PATCH] Change mail preview to use new nextmatch onselect method --- mail/inc/class.mail_ui.inc.php | 4 ++-- mail/js/app.js | 16 +++++++++++----- mail/templates/default/index.xet | 4 ++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index e6897f9116..4f47e1f764 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -638,7 +638,7 @@ class mail_ui 'open' => array( 'caption' => lang('Open'), 'group' => ++$group, - 'onExecute' => 'javaScript:app.mail.mail_preview', //dummy by nathan + 'onExecute' => 'javaScript:app.mail.mail_open', 'allowOnMultiple' => false, 'default' => true, ), @@ -890,7 +890,7 @@ class mail_ui 'dragType' => array('mail','file'), 'type' => 'drag', 'onExecute' => 'javaScript:app.mail.mail_dragStart', - ), + ) ); // save as tracker, save as infolog, as this are actions that are either available for all, or not, we do that for all and not via css-class disabling if (!isset($GLOBALS['egw_info']['user']['apps']['infolog'])) diff --git a/mail/js/app.js b/mail/js/app.js index eff7fdfb1e..194465b68a 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -49,13 +49,19 @@ mail_open: function(_action, _senders) { /** * mail_preview - implementation of the copy action * - * @param _action - * @param _senders - the representation of the elements(s) the action is to be performed on + * @param nextmatch et2_nextmatch The widget whose row was selected + * @param selected Array Selected row IDs. May be empty if user unselected all rows. */ -mail_preview: function(_action, _senders) { +mail_preview: function(nextmatch, selected) { //console.log("mail_preview",_action, _senders); - var _id = _senders[0].id; - var dataElem = egw.dataGetUIDdata(_id); + + // Empty values, just in case selected is empty (user cleared selection) + var dataElem = {data:{subject:"",fromaddress:"",toaddress:"",date:"",subject:""}}; + if(selected.length > 0) + { + var _id = selected[0]; + dataElem = egw.dataGetUIDdata(_id); + } console.log("mail_preview",dataElem); var subject =dataElem.data.subject; etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('previewFromAddress').set_value(dataElem.data.fromaddress); diff --git a/mail/templates/default/index.xet b/mail/templates/default/index.xet index 3510f8ce90..6abd98288c 100644 --- a/mail/templates/default/index.xet +++ b/mail/templates/default/index.xet @@ -41,7 +41,7 @@ - + @@ -106,4 +106,4 @@ - \ No newline at end of file +