diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 889c15089e..9ed4e3118a 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -1327,6 +1327,9 @@ class mail_ui 'caption' => 'Set / Remove Labels', 'icon' => 'tag_message', 'group' => ++$group, + // note this one is NOT a real CAPABILITY reported by the server, but added by selectMailbox + 'enabled' => $this->mail_bo->icServer->hasCapability('SUPPORTS_KEYWORDS'), + 'hideOnDisabled' => true, 'children' => array( 'unlabel' => array( 'group' => ++$group, @@ -1422,12 +1425,6 @@ class mail_ui { unset($actions['tracker']); } - // note this one is NOT a real CAPABILITY reported by the server, but added by selectMailbox - if (!$this->mail_bo->icServer->hasCapability('SUPPORTS_KEYWORDS')) - { - unset($actions['mark']['children']['setLabel']); - unset($actions['mark']['children']['unsetLabel']); - } return $actions; } @@ -1438,9 +1435,9 @@ class mail_ui * @param array &$rows * @param array &$readonlys */ - function get_rows($query,&$rows,&$readonlys) + function get_rows(&$query,&$rows,&$readonlys) { - unset($query['actions']); +// unset($query['actions']); //error_log(__METHOD__.__LINE__.' SelectedFolder:'.$query['selectedFolder'].' Start:'.$query['start'].' NumRows:'.$query['num_rows'].array2string($query['order']).'->'.array2string($query['sort'])); if (mail_bo::$debugTimes) $starttime = microtime(true); //$query['search'] is the phrase in the searchbox @@ -1466,6 +1463,7 @@ class mail_ui try { $this->changeProfile($_profileID); + $query['actions'] = $this->get_actions(); } catch(Exception $e) { @@ -2037,7 +2035,6 @@ class mail_ui $actionsenabled = self::get_actions(); unset($actionsenabled['open']); unset($actionsenabled['mark']['children']['setLabel']); - unset($actionsenabled['mark']['children']['unsetLabel']); unset($actionsenabled['mark']['children']['read']); unset($actionsenabled['mark']['children']['unread']); unset($actionsenabled['mark']['children']['undelete']); @@ -3868,7 +3865,7 @@ class mail_ui * @param bool $getFolders The client needs the folders for the profile * @return nothing */ - function ajax_changeProfile($icServerID, $getFolders = true) + function ajax_changeProfile($icServerID, $getFolders = true, $exec_id=null) { $response = egw_json_response::get(); @@ -3876,7 +3873,18 @@ class mail_ui { try { + if ($exec_id) $old_actions = $this->get_actions(); $this->changeProfile($icServerID); + // if we have an eTemplate exec_id, also send changed actions + if ($exec_id && ($actions = $this->get_actions()) != $old_actions) + { + $response->generic('assign', array( + 'etemplate_exec_id' => $exec_id, + 'id' => 'nm', + 'key' => 'actions', + 'value' => $actions, + )); + } } catch (Exception $e) { self::callWizard($e->getMessage(),true, 'error'); diff --git a/mail/js/app.js b/mail/js/app.js index 931c50f579..224293e484 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -97,7 +97,7 @@ app.classes.mail = AppJS.extend( $j(nm).off('refresh'); } } - + // Unregister client side cache this.egw.dataCacheUnregister('mail'); @@ -1542,7 +1542,7 @@ app.classes.mail = AppJS.extend( var server = _senders[0].iface.id.split('::'); var activeFilters = this.mail_getActiveFilters(); var self = this; - + this.egw.message(this.egw.lang('empty trash')); egw.json('mail.mail_ui.ajax_emptyTrash',[server[0], activeFilters['selectedFolder']? activeFilters['selectedFolder']:null],function(){self.unlock_tree()}) .sendRequest(true); @@ -1598,7 +1598,7 @@ app.classes.mail = AppJS.extend( this.egw.message(this.egw.lang('Connect to Profile %1',_widget.getSelectedLabel().replace(this._unseen_regexp, ''))); this.lock_tree(); - egw.json('mail.mail_ui.ajax_changeProfile',[folder, getFolders], jQuery.proxy(function() { + egw.json('mail.mail_ui.ajax_changeProfile',[folder, getFolders, this.et2._inst.etemplate_exec_id], jQuery.proxy(function() { // Profile changed, select inbox var inbox = folder + '::INBOX'; _widget.reSelectItem(inbox); @@ -3075,12 +3075,12 @@ app.classes.mail = AppJS.extend( if (addr) { tmp = aliases.concat(addr.get_value()); - + // returns de-duplicate items of an array var deDuplicator = function (item,pos){ - return tmp.indexOf(item) == pos + return tmp.indexOf(item) == pos }; - + aliases = tmp.filter(deDuplicator); addr.set_value(aliases); }