basic dragndrop action mailmove+mailcopy preparation (actual moving or copying not done yet)

This commit is contained in:
Klaus Leithoff 2013-04-09 16:00:12 +00:00
parent 86fbb6c966
commit 7219683699
2 changed files with 56 additions and 10 deletions

View File

@ -192,14 +192,14 @@ class mail_ui
'acceptedTypes' => 'mail', 'acceptedTypes' => 'mail',
'icon' => 'move', 'icon' => 'move',
'caption' => 'Move to', 'caption' => 'Move to',
'onExecute' => 'javaScript:mail_move' 'onExecute' => 'javaScript:app.mail.mail_move'
), ),
'drop_copy_mail' => array( 'drop_copy_mail' => array(
'type' => 'drop', 'type' => 'drop',
'acceptedTypes' => 'mail', 'acceptedTypes' => 'mail',
'icon' => 'copy', 'icon' => 'copy',
'caption' => 'Copy to', 'caption' => 'Copy to',
'onExecute' => 'javaScript:mail_copy' 'onExecute' => 'javaScript:app.mail.mail_copy'
), ),
'drop_cancel' => array( 'drop_cancel' => array(
'caption' => 'Cancel', 'caption' => 'Cancel',
@ -1510,7 +1510,7 @@ unset($query['actions']);
*/ */
function ajax_setFolderStatus($_folder) function ajax_setFolderStatus($_folder)
{ {
error_log(__METHOD__.__LINE__.array2string($_folder)); //error_log(__METHOD__.__LINE__.array2string($_folder));
if ($_folder) if ($_folder)
{ {
$del = $this->mail_bo->getHierarchyDelimiter(false); $del = $this->mail_bo->getHierarchyDelimiter(false);
@ -1533,7 +1533,7 @@ unset($query['actions']);
} }
} }
} }
error_log(__METHOD__.__LINE__.array2string($oA)); //error_log(__METHOD__.__LINE__.array2string($oA));
if ($oA) if ($oA)
{ {
$response = egw_json_response::get(); $response = egw_json_response::get();
@ -1673,4 +1673,33 @@ unset($query['actions']);
$response = egw_json_response::get(); $response = egw_json_response::get();
$response->call('egw_refresh',lang('deleted %1 messages in %2',count($_messageList['msg']),$folder),'mail'); $response->call('egw_refresh',lang('deleted %1 messages in %2',count($_messageList['msg']),$folder),'mail');
} }
/**
* move messages
*
* @param array _folderName target folder
* @param array _messageList list of UID's
*
* @return xajax response
*/
function ajax_moveMessages($_folderName, $_messageList)
{
if(mail_bo::$debug); error_log(__METHOD__."->".$_folderName.':'.print_r($_messageList,true));
}
/**
* copy messages
*
* @param array _folderName target folder
* @param array _messageList list of UID's
*
* @return xajax response
*/
function ajax_copyMessages($_folderName, $_messageList)
{
if(mail_bo::$debug); error_log(__METHOD__."->".$_folderName.':'.print_r($_messageList,true));
}
} }

View File

@ -491,13 +491,30 @@ mail_setRowClass: function(_actionObjects,_class) {
}, },
// Tree widget stubs // Tree widget stubs
mail_dragStart: function(action,sender) { mail_dragStart: function(action,_senders) {
console.log(action,sender); //console.log(action,_senders);
return $j("<div class=\"ddhelper\">" + _senders.length + " Mails selected </div>")
}, },
mail_move: function(action,sender) { mail_move: function(_action,_senders,_target) {
console.log(action,sender); //console.log(_action,_senders,_target);
var target = _action.id == 'drop_move_mail' ? _target.iface.id : _action.id.substr(5);
var messages = this.mail_getFormData(_senders);
//alert('mail_move('+messages.msg.join(',')+' --> '+target+')');
// TODO: Write move/copy function which cares about doing the same stuff
// as the "onNodeSelect" function!
var request = new egw_json_request('mail.mail_ui.ajax_moveMessages',[target, messages]);
request.sendRequest(false);
this.mail_refreshMessageGrid()
}, },
mail_copy: function(action,sender) { mail_copy: function(_action,_senders,_target) {
console.log(action,sender); //console.log(_action,_senders,_target);
var target = _action.id == 'drop_copy_mail' ? _target.id : _action.id.substr(5);
var messages = this.mail_getFormData(_senders);
//alert('mail_copy('+messages.msg.join(',')+' --> '+target+')');
// TODO: Write move/copy function which cares about doing the same stuff
// as the "onNodeSelect" function!
var request = new egw_json_request('mail.mail_ui.ajax_copyMessages',[target, messages]);
request.sendRequest(false);
this.mail_refreshMessageGrid()
} }
}); });