diff --git a/mail/inc/class.mail_sieve.inc.php b/mail/inc/class.mail_sieve.inc.php index 5e45aaf233..a80ff5f943 100644 --- a/mail/inc/class.mail_sieve.inc.php +++ b/mail/inc/class.mail_sieve.inc.php @@ -48,27 +48,24 @@ class mail_sieve * @var boolean */ var $is_admin_vac = false; - + /** * Constructor */ function __construct() { $this->displayCharset = translation::charset(); - $profileID = (int)$_GET['acc_id']; $this->mail_admin = isset($GLOBALS['egw_info']['user']['apps']['emailadmin']); - if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'])) + $acc_id = isset($_GET['acc_id']) ? (int)$_GET['acc_id'] : egw_cache::getSession(__CLASS__, 'acc_id'); + if ($acc_id > 0) { - $profileID = (int) $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']; + $this->account = emailadmin_account::read($acc_id); } - $this->account = emailadmin_account::read($profileID); - - $this->mailConfig = config::read('mail'); $this->restoreSessionData(); } - + /** * Sieve rules list * @@ -77,6 +74,10 @@ class mail_sieve */ function index(array $content=null,$msg=null) { + if (!is_array($content)) + { + egw_cache::setSession(__CLASS__, 'acc_id', $this->account->acc_id); + } //Instantiate an etemplate_new object $tmpl = new etemplate_new('mail.sieve.index'); @@ -84,7 +85,7 @@ class mail_sieve { $content['msg'] = $msg; } - + if ($this->account->acc_sieve_enabled) { //Initializes the Grid contents @@ -214,7 +215,7 @@ class mail_sieve { //Instantiate an etemplate_new object, representing sieve.edit template $etmpl = new etemplate_new('mail.sieve.edit'); - + if (!is_array($content)) { if ( $this->getRules($_GET['ruleID']) && isset($_GET['ruleID'])) @@ -483,9 +484,12 @@ class mail_sieve } elseif(!is_array($content) && isset($_GET['acc_id'])) { - $this->account = emailadmin_account::read($_GET['acc_id']); $preserv['acc_id'] = $this->account->acc_id; } + elseif ($content['acc_id']) + { + $this->account = emailadmin_account::read($content['acc_id']); + } $icServer = $this->account->imapServer($this->is_admin_vac ? $account_id : false); @@ -518,6 +522,7 @@ class mail_sieve { $content['days'] = '3'; } + $preserv['is_admin_vac'] = $content['is_admin_vac'] = $this->is_admin_vac; } else { diff --git a/mail/js/app.js b/mail/js/app.js index 840f035c28..7244299095 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -2801,19 +2801,19 @@ app.classes.mail = AppJS.extend( /** * Open seive filter list * - * @param {egwAction} action - Action user did to get here - * @param {egwActionObject[]} selected - selected row(s) + * @param {action} _action + * @param {sender} _senders * - * @todo get the account id and open the relevant sieve, ATM alway open sieve rules which is set in preferences */ - edit_sieve: function(action, selected) + edit_sieve: function(_action, _senders) { - this.egw.open_link(this.egw.link('/index.php', - { - 'menuaction': 'mail.mail_sieve.index', - 'ajax': 'true' - } - )); + var acc_id = parseInt(_senders[0].id); + this.egw.open_link(this.egw.link('/index.php', + { + 'menuaction': 'mail.mail_sieve.index', + 'acc_id': acc_id, + 'ajax': 'true' + })); }, /** diff --git a/mail/templates/default/sieve.vacation.xet b/mail/templates/default/sieve.vacation.xet index 8dea9addf7..5565b01b3b 100644 --- a/mail/templates/default/sieve.vacation.xet +++ b/mail/templates/default/sieve.vacation.xet @@ -12,9 +12,9 @@ - + - +