mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-28 00:39:19 +01:00
WIP mail folder management dialog:
- Use long task dialog - Fix multiple selection and highlighting - Update index tree after delete operation
This commit is contained in:
parent
8d7fc2000b
commit
c7cc902e1a
@ -704,6 +704,7 @@ class mail_ui
|
|||||||
unset($tree_actions['add']);
|
unset($tree_actions['add']);
|
||||||
unset($tree_actions['move']);
|
unset($tree_actions['move']);
|
||||||
unset($tree_actions['delete']);
|
unset($tree_actions['delete']);
|
||||||
|
unset($tree_actions['foldermanagement']);
|
||||||
// manage folders should not affect the ability to subscribe or unsubscribe
|
// manage folders should not affect the ability to subscribe or unsubscribe
|
||||||
// to existing folders, it should only affect add/rename/move/delete
|
// to existing folders, it should only affect add/rename/move/delete
|
||||||
}
|
}
|
||||||
@ -3723,9 +3724,10 @@ class mail_ui
|
|||||||
/**
|
/**
|
||||||
* ajax_deleteFolder - its called via json, so the function must start with ajax (or the class-name must contain ajax)
|
* ajax_deleteFolder - its called via json, so the function must start with ajax (or the class-name must contain ajax)
|
||||||
* @param string $_folderName folder to delete
|
* @param string $_folderName folder to delete
|
||||||
|
* @param boolean $_return = false wheter return the success value (true) or send response to client (false)
|
||||||
* @return nothing
|
* @return nothing
|
||||||
*/
|
*/
|
||||||
function ajax_deleteFolder($_folderName)
|
function ajax_deleteFolder($_folderName, $_return = false)
|
||||||
{
|
{
|
||||||
//error_log(__METHOD__.__LINE__.' OldFolderName:'.array2string($_folderName));
|
//error_log(__METHOD__.__LINE__.' OldFolderName:'.array2string($_folderName));
|
||||||
$success = false;
|
$success = false;
|
||||||
@ -3803,22 +3805,10 @@ class mail_ui
|
|||||||
$msg = lang("refused to delete folder INBOX");
|
$msg = lang("refused to delete folder INBOX");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($_return) return $success;
|
||||||
$response = egw_json_response::get();
|
$response = egw_json_response::get();
|
||||||
if ($success)
|
if ($success)
|
||||||
{
|
{
|
||||||
$folders2return = egw_cache::getCache(egw_cache::INSTANCE,'email','folderObjects'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*60*1);
|
|
||||||
if (isset($folders2return[$this->mail_bo->profileID]))
|
|
||||||
{
|
|
||||||
//error_log(__METHOD__.__LINE__.array2string($folders2return[$this->mail_bo->profileID]));
|
|
||||||
if (empty($subFolders)) $subFolders = array($folderName);
|
|
||||||
//error_log(__METHOD__.__LINE__.array2string($subFolders));
|
|
||||||
foreach($subFolders as $i => $f)
|
|
||||||
{
|
|
||||||
//error_log(__METHOD__.__LINE__.$f.'->'.array2string($folders2return[$this->mail_bo->profileID][$f]));
|
|
||||||
if (isset($folders2return[$this->mail_bo->profileID][$f])) unset($folders2return[$this->mail_bo->profileID][$f]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
egw_cache::setCache(egw_cache::INSTANCE,'email','folderObjects'.trim($GLOBALS['egw_info']['user']['account_id']),$folders2return, $expiration=60*60*1);
|
|
||||||
//error_log(__METHOD__.__LINE__.array2string($oA));
|
//error_log(__METHOD__.__LINE__.array2string($oA));
|
||||||
$response->call('app.mail.mail_removeLeaf',$oA);
|
$response->call('app.mail.mail_removeLeaf',$oA);
|
||||||
}
|
}
|
||||||
@ -4620,10 +4610,6 @@ class mail_ui
|
|||||||
{
|
{
|
||||||
$content = array ('acc_id' => $profileID);
|
$content = array ('acc_id' => $profileID);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$readonlys = array();
|
$readonlys = array();
|
||||||
// Preserv
|
// Preserv
|
||||||
@ -4632,4 +4618,29 @@ class mail_ui
|
|||||||
);
|
);
|
||||||
$dtmpl->exec('mail.mail_ui.folderManagement', $content,$sel_options,$readonlys,$preserv,2);
|
$dtmpl->exec('mail.mail_ui.folderManagement', $content,$sel_options,$readonlys,$preserv,2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to delete folder for management longTask dialog
|
||||||
|
* it sends successfully deleted folder as response to be
|
||||||
|
* used in long task response handler.
|
||||||
|
*
|
||||||
|
* @param type $_folderName
|
||||||
|
*/
|
||||||
|
function ajax_folderMgmt_delete ($_folderName)
|
||||||
|
{
|
||||||
|
if ($_folderName)
|
||||||
|
{
|
||||||
|
$success = $this->ajax_deleteFolder($_folderName,true);
|
||||||
|
$response = egw_json_response::get();
|
||||||
|
if ($success)
|
||||||
|
{
|
||||||
|
$res = $_folderName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$res = lang("Failed to delete %1",$_folderName);
|
||||||
|
}
|
||||||
|
$response->data($res);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4882,9 +4882,6 @@ app.classes.mail = AppJS.extend(
|
|||||||
*/
|
*/
|
||||||
folderMgmt_onSelect: function(_ids, _widget)
|
folderMgmt_onSelect: function(_ids, _widget)
|
||||||
{
|
{
|
||||||
// et2 content
|
|
||||||
var content = this.et2.getArrayMgr('content').data;
|
|
||||||
|
|
||||||
// Flag to reset selected items
|
// Flag to reset selected items
|
||||||
var resetSelection = false;
|
var resetSelection = false;
|
||||||
|
|
||||||
@ -4914,20 +4911,18 @@ app.classes.mail = AppJS.extend(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (content)
|
// extract items ids
|
||||||
|
var itemIds = _ids.split(_widget.input.dlmtr);
|
||||||
|
|
||||||
|
if(itemIds.length == 2) // there's a range selected
|
||||||
{
|
{
|
||||||
var itemIds = _ids.split(_widget.input.dlmtr);
|
var branch = _widget.input.getSubItems(_widget.input.getParentId(itemIds[0]));
|
||||||
|
// Set range of selected/unselected
|
||||||
if(itemIds.length == 2) // there's a range selected
|
rangeSelector(itemIds[0], itemIds[1], branch);
|
||||||
{
|
}
|
||||||
var branch = _widget.input.getSubItems(_widget.input.getParentId(itemIds[0]));
|
else if(itemIds.length != 1)
|
||||||
// Set range of selected/unselected
|
{
|
||||||
rangeSelector(itemIds[0], itemIds[1], branch);
|
resetSelection = true;
|
||||||
}
|
|
||||||
else if(itemIds.length != 1)
|
|
||||||
{
|
|
||||||
resetSelection = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resetSelection)
|
if (resetSelection)
|
||||||
@ -4950,7 +4945,6 @@ app.classes.mail = AppJS.extend(
|
|||||||
_widget.input.setCheck(_itemId, _stat);
|
_widget.input.setCheck(_itemId, _stat);
|
||||||
_widget.input.setSubChecked(_itemId,_stat);
|
_widget.input.setSubChecked(_itemId,_stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4963,6 +4957,46 @@ app.classes.mail = AppJS.extend(
|
|||||||
folderMgmt_onCheck: function (_id, _widget)
|
folderMgmt_onCheck: function (_id, _widget)
|
||||||
{
|
{
|
||||||
console.log();
|
console.log();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detele button handler
|
||||||
|
* triggers longTask dialog and send delete operation url
|
||||||
|
*
|
||||||
|
* @param {egw object} _egw egw object
|
||||||
|
* @param {widget object} _widget button widget
|
||||||
|
*/
|
||||||
|
folderMgmt_deleteBtn: function (_egw, _widget)
|
||||||
|
{
|
||||||
|
var tree = this.et2.getWidgetById('tree');
|
||||||
|
var menuaction= 'mail.mail_ui.ajax_folderMgmt_delete';
|
||||||
|
|
||||||
|
if (tree)
|
||||||
|
{
|
||||||
|
var selFolders = tree.input.getAllChecked();
|
||||||
|
if (selFolders)
|
||||||
|
{
|
||||||
|
var selFldArr = selFolders.split(tree.input.dlmtr);
|
||||||
|
var msg = egw.lang('Folders deleting in progress ...');
|
||||||
|
et2_dialog.long_task(function(_val, _resp){
|
||||||
|
console.log(_val, _resp);
|
||||||
|
if (_val && _resp.type !== 'error')
|
||||||
|
{
|
||||||
|
var stat = [];
|
||||||
|
var tree = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('tree');
|
||||||
|
|
||||||
|
// delete the item in folderMgmt dialog
|
||||||
|
if (tree) tree.deleteItem(_resp, false);
|
||||||
|
|
||||||
|
stat[_resp] = _resp;
|
||||||
|
// delete the item from index folderTree
|
||||||
|
egw.window.app.mail.mail_removeLeaf(stat);
|
||||||
|
}
|
||||||
|
}, msg, 'Deleting folders', menuaction, selFldArr, 'mail');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
<hbox class="dialogFooterToolbar">
|
<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 statustext="Delete" label="Delete" id="button[delete]" onclick="app.mail.folderMgmt_deleteBtn"/>
|
||||||
<button label="Cancel" id="button[cancel]" onclick="window.close()"/>
|
<button label="Cancel" id="button[cancel]" onclick="window.close()"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
Reference in New Issue
Block a user