refactor(dom) processFiles

This commit is contained in:
coderaiser 2014-08-27 07:14:04 -04:00
parent 5985fbae42
commit 4b4e3d42f3

View file

@ -1465,9 +1465,12 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
* @param operation
*/
function processFiles(operation) {
var n, name, from, to, files, cmp, msg, opFunc,
path = CurrentInfo.dirPath,
var n, name, files, cmp, msg, opFunc,
RESTful = DOM.RESTful,
from = CurrentInfo.dirPath,
to = DOM.getNotCurrentDirPath(),
names = Cmd.getSelectedNames(),
length = names && names.length;
@ -1487,18 +1490,13 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
name = names[0];
}
n = names.length;
if (n > 1)
if (length > 1)
msg += n + ' file(s)';
else
msg += '"' + name + '"';
msg += ' to';
from = path;
to = DOM.getNotCurrentDirPath();
if (name === '..') {
Dialog.alert('No files selected!');
} else {
@ -1509,8 +1507,8 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
if (!cmp && to) {
files = {
from : from,
names : names,
to : to
to : to,
names : names
};
opFunc(files, function() {
@ -1524,7 +1522,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
DOM.setCurrentFile(dotDot);
CloudCmd.refresh(dotDot, panelPassive);
DOM.Storage.remove(path);
DOM.Storage.remove(from);
});
}
}