diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 1cac92b004..42ceb3275f 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -585,6 +585,9 @@ class mail_ui $etpl->setElementAttribute(self::$nm_index.'[foldertree]','actions', $tree_actions); + // sending preview toolbar actions + $etpl->setElementAttribute('mailPreview[toolbar]', 'actions', $this->get_toolbar_actions()); + if (empty($content[self::$nm_index]['filter2']) || empty($content[self::$nm_index]['search'])) $content[self::$nm_index]['filter2']='quick'; $readonlys = $preserv = $sel_options; if (mail_bo::$debugTimes) mail_bo::logRunTimes($starttime,null,'',__METHOD__.__LINE__); @@ -1584,25 +1587,13 @@ unset($query['actions']); } /** - * function header2gridelements - to populate the grid elements with the collected Data + * Get actions for preview toolbar * - * @param array $_headers, headerdata to process - * @param array $cols, cols to populate - * @param array $_folderName, used to ensure the uniqueness of the uid over all folders - * @param array $_folderType=0, foldertype, used to determine if we need to populate from/to - * @param array $previewMessage=0, the message previewed - * @return array populated result array + * @return array */ - public function header2gridelements($_headers, $cols, $_folderName, $_folderType=0, $previewMessage=0) + function get_toolbar_actions() { - if (mail_bo::$debugTimes) $starttime = microtime(true); - $timestamp7DaysAgo = - mktime(date("H"), date("i"), date("s"), date("m"), date("d")-7, date("Y")); - $timestampNow = - mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")); - $dateToday = date("Y-m-d"); - $rv = array(); - $actions = self::get_actions(); + $actions = $this->get_actions(); foreach(array('composeasnew','reply','reply_all','forward','flagged','delete','print','infolog','tracker','save','view') as $a => $act) { //error_log(__METHOD__.__LINE__.' '.$act.'->'.array2string($actions[$act])); @@ -1625,6 +1616,30 @@ unset($query['actions']); if (isset($actions[$act])) $actionsenabled[$act]=$actions[$act]; } } + unset($actionsenabled['drag_mail']); + + return $actionsenabled; + } + + /** + * function header2gridelements - to populate the grid elements with the collected Data + * + * @param array $_headers, headerdata to process + * @param array $cols, cols to populate + * @param array $_folderName, used to ensure the uniqueness of the uid over all folders + * @param array $_folderType=0, foldertype, used to determine if we need to populate from/to + * @param array $previewMessage=0, the message previewed + * @return array populated result array + */ + public function header2gridelements($_headers, $cols, $_folderName, $_folderType=0, $previewMessage=0) + { + if (mail_bo::$debugTimes) $starttime = microtime(true); + $timestamp7DaysAgo = + mktime(date("H"), date("i"), date("s"), date("m"), date("d")-7, date("Y")); + $timestampNow = + mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")); + $dateToday = date("Y-m-d"); + $rv = array(); $i=0; $firstuid = null; @@ -1854,15 +1869,17 @@ unset($query['actions']); else $data["flags"][$flag] = $flag; } } - unset($actionsenabled['drag_mail']); $data['attachmentsPresent'] = $imageTag; $data['attachmentsBlock'] = $imageHTMLBlock; - $data['toolbaractions'] = json_encode($actionsenabled); $data['address'] = ($_folderType?$data["toaddress"]:$data["fromaddress"]); $rv[] = $data; //error_log(__METHOD__.__LINE__.array2string($result)); } if (mail_bo::$debugTimes) mail_bo::logRunTimes($starttime,null,'Folder:'.$_folderName,__METHOD__.__LINE__); + + // ToDo: call this ONLY if labels change + etemplate_widget::setElementAttribute('toolbar', 'actions', $this->get_toolbar_actions()); + return $rv; } diff --git a/mail/js/app.js b/mail/js/app.js index 2dce859701..17a392ec4f 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -697,8 +697,6 @@ app.classes.mail = AppJS.extend( this.mail_selectedMails.push(_id); } this.mail_disablePreviewArea(false); - var toolbaractions = ((typeof dataElem != 'undefined' && typeof dataElem.data != 'undefined' && typeof dataElem.data.toolbaractions != 'undefined')?JSON.parse(dataElem.data.toolbaractions):undefined); - if (toolbaractions) this.et2.getWidgetById('toolbar').set_actions(toolbaractions); // Request email body from server IframeHandle.set_src(egw.link('/index.php',{menuaction:'mail.mail_ui.loadEmailBody',_messageID:_id})); @@ -2444,10 +2442,10 @@ app.classes.mail = AppJS.extend( /** * Focus handler for folder, address, reject textbox/taglist to automatic check associated radio button - * - * @param {event} _ev + * + * @param {event} _ev * @param {object} _widget taglist - * + * */ sieve_focus_radioBtn: function(_ev, _widget) { @@ -2456,7 +2454,7 @@ app.classes.mail = AppJS.extend( /** * Select all aliases - * + * */ sieve_vac_all_aliases: function() { @@ -2539,12 +2537,12 @@ app.classes.mail = AppJS.extend( /** * Send back action resault to server - * + * * @param {string} _typeId action name * @param {object} _data content * @param {string} _selectedID selected row id * @param {string} _msg message - * + * */ _do_action: function(_typeID, _data,_selectedID,_msg) { @@ -2556,10 +2554,10 @@ app.classes.mail = AppJS.extend( }, /** - * + * * @todo: Need to find a way how to refresh the grid - * - * + * + * */ sieve_refresh: function() { @@ -2624,7 +2622,7 @@ app.classes.mail = AppJS.extend( /** * Open seive filter list - * + * * @param {egwAction} action - Action user did to get here * @param {egwActionObject[]} selected - selected row(s) * diff --git a/mail/templates/default/index.xet b/mail/templates/default/index.xet index 9dcd54f341..e63c053f0b 100644 --- a/mail/templates/default/index.xet +++ b/mail/templates/default/index.xet @@ -103,9 +103,7 @@ - - - +