mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(dom) processMessage -> message
This commit is contained in:
parent
d38f2e2f0e
commit
7673d5934b
1 changed files with 22 additions and 29 deletions
|
|
@ -1581,7 +1581,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
* @param data
|
||||
* @param operation
|
||||
*/
|
||||
function processFiles(data, operation) {
|
||||
function processFiles(data, operation, message) {
|
||||
var name, files,
|
||||
panel,
|
||||
shouldAsk,
|
||||
|
|
@ -1619,7 +1619,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
Dialog.alert('No files selected!');
|
||||
} else {
|
||||
if (shouldAsk)
|
||||
to = processMessage(to, operation, names);
|
||||
to = message(to, names);
|
||||
|
||||
ok = from !== to && to;
|
||||
|
||||
|
|
@ -1663,40 +1663,33 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
}
|
||||
}
|
||||
|
||||
function processMessage(to, operation, names) {
|
||||
var ret,
|
||||
msg = '',
|
||||
n = names.length,
|
||||
name = names[0];
|
||||
|
||||
switch(operation) {
|
||||
case 'copy':
|
||||
msg = 'Copy ';
|
||||
break;
|
||||
|
||||
case 'move':
|
||||
msg = 'Rename/Move ';
|
||||
break;
|
||||
}
|
||||
|
||||
if (names.length > 1)
|
||||
msg += n + ' file(s)';
|
||||
else
|
||||
msg += '"' + name + '"';
|
||||
function message(msg) {
|
||||
return function(to, names) {
|
||||
var ret,
|
||||
n = names.length,
|
||||
name = names[0];
|
||||
|
||||
msg += ' to';
|
||||
|
||||
ret = Dialog.prompt(msg, to);
|
||||
|
||||
return ret;
|
||||
msg += ' ';
|
||||
|
||||
if (names.length > 1)
|
||||
msg += n + ' file(s)';
|
||||
else
|
||||
msg += '"' + name + '"';
|
||||
|
||||
msg += ' to';
|
||||
|
||||
ret = Dialog.prompt(msg, to);
|
||||
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
this.copyFiles = function(data) {
|
||||
processFiles(data, DOM.RESTful.cp);
|
||||
processFiles(data, DOM.RESTful.cp, message('Copy'));
|
||||
};
|
||||
|
||||
this.moveFiles = function(data) {
|
||||
processFiles(data, DOM.RESTful.mv);
|
||||
processFiles(data, DOM.RESTful.mv, message('Rename/Move'));
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue