diff --git a/lib/client/dom.js b/lib/client/dom.js index 80aa26c8..85f8ec06 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -1675,29 +1675,32 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * copy current file * - * @pCurrent + * @param current */ - this.copyCurrent = function(pCurrentFile) { - if (!Cmd.isCurrentFile(pCurrentFile)) - pCurrentFile = null; + this.copyCurrent = function(current) { + var name, from, to, files, cmp; - var lCurrent = pCurrentFile || Cmd.getCurrentFile(), - lName = Cmd.getCurrentName(lCurrent), - lFromPath = Cmd.getCurrentPath(), - lToPath = Cmd.getNotCurrentDirPath() + lName; - lToPath = Dialog.prompt( 'Copy file "' + lName + '" to', lToPath ); + if (!Cmd.isCurrentFile(current)) + current = Cmd.getCurrentFile(); - if (lToPath && !Util.strCmp(lFromPath, lToPath)) { - var lFiles = { - from : lFromPath, - to : lToPath + name = Cmd.getCurrentName(current), + from = Cmd.getCurrentPath(), + to = Cmd.getNotCurrentDirPath() + name; + to = Dialog.prompt('Copy file "' + name + '" to', to); + cmp = Util.strCmp(from, to); + + if (!cmp) { + files = { + from : from, + to : to }; - RESTful.cp(lFiles, function() { - var lPanel = DOM.getPanel(true), - lDotDot = DOM.getById( '..(' + lPanel.id + ')'); + RESTful.cp(files, function() { + var panel = DOM.getPanel(true), + id = panel.id, + dotDot = DOM.getById( '..(' + id + ')'); - DOM.setCurrentFile ( lDotDot ); + DOM.setCurrentFile(dotDot); CloudCmd.refresh(); }); }