enable/disable Sieve and ACL actions on tree account-specific, also added a couple more icons to tree icons

This commit is contained in:
Ralf Becker 2014-05-22 07:36:02 +00:00
parent ccdb54a366
commit 7a305bdf95
2 changed files with 75 additions and 26 deletions

View File

@ -617,25 +617,30 @@ class mail_ui
'sieve' => array(
'caption' => 'Mail filter',
'onExecute' => 'javaScript:app.mail.edit_sieve',
'group' => $group++,
'group' => ++$group, // new group for filter
'enabled' => 'javaScript:app.mail.sieve_enabled',
'icon' => 'etemplate/fav_filter', // funnel
),
'vacation' => array(
'caption' => 'Vacation notice',
'icon' => 'configure',
'icon' => 'mail/navbar', // mail as in admin
'onExecute' => 'javaScript:app.mail.edit_vacation',
'group' => $group++,
'group' => $group,
'enabled' => 'javaScript:app.mail.sieve_enabled',
),
'edit_account' => array(
'caption' => 'Edit account ...',
'icon' => 'configure',
'onExecute' => 'javaScript:app.mail.edit_account',
//'enableId' => '^\\d+$', // only show action on account itself
'group' => ++$group, // new groups for account & acl
),
'edit_acl' => array(
'caption' => 'Edit folder ACL ...',
'icon' => 'blocks',
'enabled' => 'javaScript:app.mail.mail_CheckFolderNoSelect',
'icon' => 'lock',
'enabled' => 'javaScript:app.mail.acl_enabled',
'onExecute' => 'javaScript:app.mail.edit_acl',
'group' => $group,
),
);
// the preference prefaskformove controls actually if there is a popup on target or not
@ -663,36 +668,39 @@ class mail_ui
unset($tree_actions['subscribe']);
unset($tree_actions['unsubscribe']);
}
$deleteOptions = $GLOBALS['egw_info']['user']['preferences']['mail']['deleteOptions'];
if($deleteOptions == 'move_to_trash')
++$group; // put delete in own group
switch($GLOBALS['egw_info']['user']['preferences']['mail']['deleteOptions'])
{
case 'move_to_trash':
$tree_actions['empty_trash'] = array(
'caption' => 'empty trash',
'icon' => 'dhtmlxtree/MailFolderTrash',
'onExecute' => 'javaScript:app.mail.mail_emptyTrash',
//'enableId' => '^\\d+$', // only show action on account itself
'group' => $group,
);
}
if($preferences['deleteOptions'] == 'mark_as_deleted')
{
break;
case 'mark_as_deleted':
$tree_actions['compress_folder'] = array(
'caption' => 'compress folder',
'icon' => 'dhtmlxtree/MailFolderTrash',
'onExecute' => 'javaScript:app.mail.mail_compressFolder',
//'enableId' => '^\\d+$', // only show action on account itself
'group' => $group,
);
break;
}
// enforce global (group-specific) ACL
if (!$this->mail_bo->icServer->queryCapability('ACL') || !mail_hooks::access('aclmanagement'))
if (!mail_hooks::access('aclmanagement'))
{
unset($tree_actions['edit_acl']);
}
if (!$this->mail_bo->icServer->acc_sieve_enabled || !mail_hooks::access('editfilterrules'))
if (!mail_hooks::access('editfilterrules'))
{
unset($tree_actions['sieve']);
}
if (!$this->mail_bo->icServer->acc_sieve_enabled || !mail_hooks::access('absentnotice'))
if (!mail_hooks::access('absentnotice'))
{
unset($tree_actions['vacation']);
}
@ -885,7 +893,9 @@ class mail_ui
'im2' => 'thunderbird.png',
'path'=> array($acc_id),
'child'=> (int)($acc_id != $_profileID || $folderObjects), // dynamic loading on unfold
'parent' => ''
'parent' => '',
// mark on account if Sieve is enabled
'data' => array('sieve' => $accountObj->acc_sieve_enabled),
);
$this->setOutStructure($oA, $out, self::$delimiter);
@ -946,6 +956,8 @@ class mail_ui
if ($path=='INBOX')
{
$oA['im0'] = $oA['im1']= $oA['im2'] = "kfm_home.png";
// mark on inbox if ACL is supported
$oA['data'] = array('acl' => $this->mail_bo->icServer->queryCapability('ACL'));
}
elseif (in_array($obj->shortFolderName,mail_bo::$autoFolders))
{

View File

@ -1003,6 +1003,43 @@ app.classes.mail = AppJS.extend(
return true;
},
/**
* Check if Sieve is enabled on that account
*
* Sieve enabled is stored as data { acl: true/false } on account node.
*
* @param {object} _action
* @param {object} _senders the representation of the tree leaf to be manipulated
* @param {object} _currentNode
*/
sieve_enabled: function(_action,_senders,_currentNode)
{
var ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]');
var acc_id = _senders[0].id.split('::')[0];
var node = ftree ? ftree.getNode(acc_id) : null;
return node && node.data && node.data.sieve;
},
/**
* Check if ACL is enabled on that account
*
* ACL enabled is stored as data { acl: true/false } on INBOX node.
* We also need to check if folder is marked as no-select!
*
* @param {object} _action
* @param {object} _senders the representation of the tree leaf to be manipulated
* @param {object} _currentNode
*/
acl_enabled: function(_action,_senders,_currentNode)
{
var ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]');
var inbox = _senders[0].id.split('::')[0]+'::INBOX';
var node = ftree ? ftree.getNode(inbox) : null;
return node && node.data.acl && this.mail_CheckFolderNoSelect(_action,_senders,_currentNode);
},
/**
* mail_setFolderStatus, function to set the status for the visible folders
*