mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
WIP of mail folder management dialog (multiple folders delete action)
This commit is contained in:
parent
d41c593fe5
commit
85286a70da
@ -46,6 +46,7 @@ class mail_ui
|
|||||||
'importMessage' => True,
|
'importMessage' => True,
|
||||||
'importMessageFromVFS2DraftAndDisplay'=>True,
|
'importMessageFromVFS2DraftAndDisplay'=>True,
|
||||||
'subscription' => True,
|
'subscription' => True,
|
||||||
|
'folderManagement' => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -592,6 +593,12 @@ class mail_ui
|
|||||||
'onExecute' => 'javaScript:app.mail.unsubscribe_folder',
|
'onExecute' => 'javaScript:app.mail.unsubscribe_folder',
|
||||||
'group' => $group,
|
'group' => $group,
|
||||||
),
|
),
|
||||||
|
'foldermanagement' => array(
|
||||||
|
'caption' => 'Folder Management...',
|
||||||
|
'enabled' => 'javaScript:app.mail.mail_CheckFolderNoSelect',
|
||||||
|
'onExecute' => 'javaScript:app.mail.folderManagement',
|
||||||
|
'group' => ++$group,
|
||||||
|
),
|
||||||
'sieve' => array(
|
'sieve' => array(
|
||||||
'caption' => 'Mail filter',
|
'caption' => 'Mail filter',
|
||||||
'onExecute' => 'javaScript:app.mail.edit_sieve',
|
'onExecute' => 'javaScript:app.mail.edit_sieve',
|
||||||
@ -4584,4 +4591,45 @@ class mail_ui
|
|||||||
if(mail_bo::$debug) error_log(__METHOD__."-> No messages selected.");
|
if(mail_bo::$debug) error_log(__METHOD__."-> No messages selected.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Autoloading function to load branches of tree node
|
||||||
|
* of management folder tree
|
||||||
|
*
|
||||||
|
* @param type $_id
|
||||||
|
*/
|
||||||
|
function ajax_folderMgmtTree_autoloading ($_id = null)
|
||||||
|
{
|
||||||
|
$mail_ui = new mail_ui();
|
||||||
|
$_id = $_id? $_id:$_GET['id'];
|
||||||
|
etemplate_widget_tree::send_quote_json($mail_ui->mail_tree->getTree($_id,'',1,true,false,false,false));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main function to handle folder management dialog
|
||||||
|
*
|
||||||
|
* @param array $content content of dialog
|
||||||
|
*/
|
||||||
|
function folderManagement (array $content = null)
|
||||||
|
{
|
||||||
|
$dtmpl = new etemplate_new('mail.folder_management');
|
||||||
|
$profileID = $_GET['acc_id']? $_GET['acc_id']: $content['acc_id'];
|
||||||
|
$sel_options['tree'] = $this->mail_tree->getTree(null,$profileID, 1, true, false, false);
|
||||||
|
|
||||||
|
if (!is_array($content))
|
||||||
|
{
|
||||||
|
$content = array ('acc_id' => $profileID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$readonlys = array();
|
||||||
|
// Preserv
|
||||||
|
$preserv = array(
|
||||||
|
'acc_id' => $content['acc_id'] // preserve acc id to be used in client-side
|
||||||
|
);
|
||||||
|
$dtmpl->exec('mail.mail_ui.folderManagement', $content,$sel_options,$readonlys,$preserv,2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
126
mail/js/app.js
126
mail/js/app.js
@ -4838,5 +4838,131 @@ app.classes.mail = AppJS.extend(
|
|||||||
{
|
{
|
||||||
et2_dialog.alert('You need to save the message as draft first before to be able to save it into VFS','Save into VFS','info');
|
et2_dialog.alert('You need to save the message as draft first before to be able to save it into VFS','Save into VFS','info');
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Folder Management, opens the folder magnt. dialog
|
||||||
|
* with the selected acc_id from index tree
|
||||||
|
*
|
||||||
|
* @param {egw action object} _action actions
|
||||||
|
* @param {object} _senders selected node
|
||||||
|
*/
|
||||||
|
folderManagement: function (_action,_senders)
|
||||||
|
{
|
||||||
|
var acc_id = parseInt(_senders[0].id);
|
||||||
|
this.egw.open_link('mail.mail_ui.folderManagement&acc_id='+acc_id, '_blank', '720x500');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show ajax-loader when the autoloading get started
|
||||||
|
*
|
||||||
|
* @param {type} _id item id
|
||||||
|
* @param {type} _widget tree widget
|
||||||
|
* @returns {Boolean}
|
||||||
|
*/
|
||||||
|
folderMgmt_autoloadingStart: function(_id, _widget)
|
||||||
|
{
|
||||||
|
return this.subscription_autoloadingStart (_id, _widget);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Revert back the icon after autoloading is finished
|
||||||
|
* @returns {Boolean}
|
||||||
|
*/
|
||||||
|
folderMgmt_autoloadingEnd: function(_id, _widget)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {type} _ids
|
||||||
|
* @param {type} _widget
|
||||||
|
* @returns {undefined}
|
||||||
|
*/
|
||||||
|
folderMgmt_onSelect: function(_ids, _widget)
|
||||||
|
{
|
||||||
|
// et2 content
|
||||||
|
var content = this.et2.getArrayMgr('content').data;
|
||||||
|
|
||||||
|
// Flag to reset selected items
|
||||||
|
var resetSelection = false;
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* helper function to multiselect range of nodes in same level
|
||||||
|
*
|
||||||
|
* @param {string} _a start node id
|
||||||
|
* @param {string} _b end node id
|
||||||
|
* @param {string} _branch totall node ids in the level
|
||||||
|
*/
|
||||||
|
var rangeSelector = function(_a,_b, _branch)
|
||||||
|
{
|
||||||
|
var branchItems = _branch.split(_widget.input.dlmtr);
|
||||||
|
var _aIndex = _widget.input.getIndexById(_a);
|
||||||
|
var _bIndex = _widget.input.getIndexById(_b);
|
||||||
|
if (_bIndex<_aIndex)
|
||||||
|
{
|
||||||
|
var tmpIndex = _aIndex;
|
||||||
|
_aIndex = _bIndex;
|
||||||
|
_bIndex = tmpIndex;
|
||||||
}
|
}
|
||||||
|
for(var i =_aIndex;i<=_bIndex;i++)
|
||||||
|
{
|
||||||
|
self.folderMgmt_setCheckbox(_widget, branchItems[i], !_widget.input.isItemChecked(branchItems[i]));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (content)
|
||||||
|
{
|
||||||
|
var itemIds = _ids.split(_widget.input.dlmtr);
|
||||||
|
|
||||||
|
if(itemIds.length == 2) // there's a range selected
|
||||||
|
{
|
||||||
|
var branch = _widget.input.getSubItems(_widget.input.getParentId(itemIds[0]));
|
||||||
|
// Set range of selected/unselected
|
||||||
|
rangeSelector(itemIds[0], itemIds[1], branch);
|
||||||
|
}
|
||||||
|
else if(itemIds.length != 1)
|
||||||
|
{
|
||||||
|
resetSelection = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resetSelection)
|
||||||
|
{
|
||||||
|
_widget.input._unselectItems();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set enable/disable checkbox
|
||||||
|
*
|
||||||
|
* @param {object} _widget tree widget
|
||||||
|
* @param {string} _itemId item tree id
|
||||||
|
* @param {boolean} _stat - status to be set on checkbox true/false
|
||||||
|
*/
|
||||||
|
folderMgmt_setCheckbox: function (_widget, _itemId, _stat)
|
||||||
|
{
|
||||||
|
if (_widget)
|
||||||
|
{
|
||||||
|
_widget.input.setCheck(_itemId, _stat);
|
||||||
|
_widget.input.setSubChecked(_itemId,_stat);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {type} _id
|
||||||
|
* @param {type} _widget
|
||||||
|
* @TODO: Implement onCheck handler in order to select or deselect subItems
|
||||||
|
* of a checked parent node
|
||||||
|
*/
|
||||||
|
folderMgmt_onCheck: function (_id, _widget)
|
||||||
|
{
|
||||||
|
console.log();
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -703,17 +703,19 @@ div.mailPreviewHeaders #mail-index_previewAttachmentArea.visible {
|
|||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mail_subscription_header
|
.mail_subscription_header, .mail_folder_management_header
|
||||||
{
|
{
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 150%;
|
font-size: 150%;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#mail-subscribe table.et2_grid tr td {
|
#mail-subscribe table.et2_grid tr td,
|
||||||
|
#mail-folder_management table.et2_grid tr td {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
#mail-subscribe table.et2_grid tr td div.et2_box {
|
#mail-subscribe table.et2_grid tr td div.et2_box,
|
||||||
|
#mail-folder_management table.et2_grid tr td .mail_subscription_header {
|
||||||
height: 500px;
|
height: 500px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
26
mail/templates/default/folder_management.xet
Normal file
26
mail/templates/default/folder_management.xet
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE overlay PUBLIC "-//Stylite AG//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
|
||||||
|
<!-- $Id$ -->
|
||||||
|
<overlay>
|
||||||
|
<template id="mail.folder_management" template="" lang="" group="0" version="1.9.001">
|
||||||
|
<grid width="100%">
|
||||||
|
<columns>
|
||||||
|
<column width="20%"/>
|
||||||
|
</columns>
|
||||||
|
<rows>
|
||||||
|
<row class="dialogHeader" >
|
||||||
|
<description value="Folder Management" class="mail_folder_management_header"/>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<box scrolling="auto">
|
||||||
|
<tree id="tree" multiple="true" autoloading="mail_ui::ajax_folderMgmtTree_autoloading" multimarking="strict" oncheck="app.mail.folderMgmt_onCheck" onselect="app.mail.folderMgmt_onSelect" onopenstart="app.mail.folderMgmt_autoloadingStart" onopenend="app.mail.folderMgmt_autoloadingEnd"/>
|
||||||
|
</box>
|
||||||
|
</row>
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
<hbox class="dialogFooterToolbar">
|
||||||
|
<button statustext="Delete" label="Delete" id="button[delete]" onclick="et2_dialog.confirm(widget,'Are yuo sure you want to delete selected folders?', 'Delete Folders')"/>
|
||||||
|
<button label="Cancel" id="button[cancel]" onclick="window.close()"/>
|
||||||
|
</hbox>
|
||||||
|
</template>
|
||||||
|
</overlay>
|
@ -701,15 +701,18 @@ div.mailPreviewHeaders #mail-index_previewAttachmentArea.visible {
|
|||||||
background-position: left top;
|
background-position: left top;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
.mail_subscription_header {
|
.mail_subscription_header,
|
||||||
|
.mail_folder_management_header {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 150%;
|
font-size: 150%;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
}
|
}
|
||||||
#mail-subscribe table.et2_grid tr td {
|
#mail-subscribe table.et2_grid tr td,
|
||||||
|
#mail-folder_management table.et2_grid tr td {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
#mail-subscribe table.et2_grid tr td div.et2_box {
|
#mail-subscribe table.et2_grid tr td div.et2_box,
|
||||||
|
#mail-folder_management table.et2_grid tr td .mail_subscription_header {
|
||||||
height: 500px;
|
height: 500px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
@ -1672,11 +1675,13 @@ div#displayToolbar-menulist img {
|
|||||||
*
|
*
|
||||||
* ##################################################################################
|
* ##################################################################################
|
||||||
*/
|
*/
|
||||||
#mail-subscribe table.et2_grid tr td {
|
#mail-subscribe table.et2_grid tr td,
|
||||||
|
#mail-folder_management table.et2_grid tr td {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
/*Label*/
|
/*Label*/
|
||||||
}
|
}
|
||||||
#mail-subscribe table.et2_grid tr td .mail_subscription_header {
|
#mail-subscribe table.et2_grid tr td .mail_subscription_header,
|
||||||
|
#mail-folder_management table.et2_grid tr td .mail_subscription_header {
|
||||||
/*line-height: 270%;*/
|
/*line-height: 270%;*/
|
||||||
margin: 0.6em 0 0;
|
margin: 0.6em 0 0;
|
||||||
font-weight: lighter;
|
font-weight: lighter;
|
||||||
@ -1685,12 +1690,14 @@ div#displayToolbar-menulist img {
|
|||||||
font-size: 150%;
|
font-size: 150%;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
}
|
}
|
||||||
#mail-subscribe table.et2_grid tr td div.et2_box {
|
#mail-subscribe table.et2_grid tr td div.et2_box,
|
||||||
|
#mail-folder_management table.et2_grid tr td div.et2_box {
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
height: 484px;
|
height: 484px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
.mail_subscription_header {
|
.mail_subscription_header,
|
||||||
|
.mail_folder_management_header {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 150%;
|
font-size: 150%;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
|
@ -862,7 +862,7 @@ div#displayToolbar-menulist{
|
|||||||
*
|
*
|
||||||
* ##################################################################################
|
* ##################################################################################
|
||||||
*/
|
*/
|
||||||
#mail-subscribe{
|
#mail-subscribe, #mail-folder_management{
|
||||||
|
|
||||||
table.et2_grid tr td {
|
table.et2_grid tr td {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
@ -892,7 +892,7 @@ div#displayToolbar-menulist{
|
|||||||
|
|
||||||
} // #mail-subscribe
|
} // #mail-subscribe
|
||||||
|
|
||||||
.mail_subscription_header
|
.mail_subscription_header, .mail_folder_management_header
|
||||||
{
|
{
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 150%;
|
font-size: 150%;
|
||||||
|
Loading…
Reference in New Issue
Block a user