mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(dom) copyCurrent
This commit is contained in:
parent
6ea42da3bb
commit
7dc59f727d
1 changed files with 20 additions and 17 deletions
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue