forked from extern/egroupware
Set account object based on acc_id. Additionally, disable acc_id selectbox if not is_admin_vac
This commit is contained in:
parent
5825c8df18
commit
f820209a6a
@ -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
|
||||
{
|
||||
|
@ -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'
|
||||
}));
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -12,9 +12,9 @@
|
||||
<rows>
|
||||
<row valign="top" class="dialogHeader">
|
||||
<description value="Edit vacation settings" class="et2_fullWidth"/>
|
||||
<description align="right" disabled="!@acc_id" for="acc_id" value="Mail account"/>
|
||||
<description align="right" disabled="!@is_admin_vac" for="acc_id" value="Mail account"/>
|
||||
<menulist>
|
||||
<menupopup id="acc_id" disabled="!@acc_id" onchange="app.mail.vacation_change_account" class="et2_fullWidth"/>
|
||||
<menupopup id="acc_id" disabled="!@is_admin_vac" onchange="app.mail.vacation_change_account" class="et2_fullWidth"/>
|
||||
</menulist>
|
||||
<description/>
|
||||
</row>
|
||||
|
Loading…
Reference in New Issue
Block a user