diff --git a/lib/client.js b/lib/client.js index 89bdc10a..1cc75d56 100644 --- a/lib/client.js +++ b/lib/client.js @@ -421,7 +421,7 @@ var Util, DOM, CloudFunc, $, KeyBinding, CloudCommander; /* меняем ссылки на ajax-запросы */ var lPanel = DOM.getById(pPanelID), - a = lPanel.getElementsByTagName('a'), + a = DOM.getByTag('a', lPanel), /* right mouse click function varible */ lOnContextMenu_f = function(pEvent){ @@ -487,17 +487,17 @@ var Util, DOM, CloudFunc, $, KeyBinding, CloudCommander; lUrl = CloudCmd.HOST, lLoadDirOnce = CloudCmd.loadDir(); - (function(a){ - var a0 = a[0], - lParent = a0.parentElement, - lNEEDREFRESH = true, - lLink = Util.removeStr(a0.href, lUrl); - - CloudCmd.refresh = CloudCmd.loadDir(lLink, lNEEDREFRESH); - - /* ставим загрузку гифа на клик*/ - DOM.addClickListener( CloudCmd.refresh, lParent ); - })(a); + CloudCmd.refresh = function(){ + var lNEEDREFRESH = true, + lPath = DOM.getCurrentDirPath(), + lLink = CloudFunc.FS + lPath, + lNotSlashlLink = CloudFunc.removeLastSlash(lLink), + lLoad = CloudCmd.loadDir(lNotSlashlLink, lNEEDREFRESH); + lLoad(); + }; + + /* ставим загрузку гифа на клик*/ + DOM.addClickListener( CloudCmd.refresh, a[0].parentElement ); /* start from 1 cous 0 is a path and it's setted up */ for(var i = 1, n = a.length; i < n ; i++){ @@ -554,8 +554,6 @@ var Util, DOM, CloudFunc, $, KeyBinding, CloudCommander; if(lCleanPath === lSLASH) lNOJSPath = lSLASH; - else - lCleanPath += lSLASH; Util.log ('reading dir: "' + lCleanPath + '";'); diff --git a/lib/client/dom.js b/lib/client/dom.js index af99b682..0989bebd 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -945,8 +945,9 @@ var CloudCommander, Util, /** * get current direcotory path */ - DOM.getCurrentDirPath = function(){ - var lPath = DOM.getByClass('path')[0], + DOM.getCurrentDirPath = function(pPanel){ + var lPanel = pPanel || DOM.getPanel(), + lPath = DOM.getByClass('path', lPanel)[0], lRet; if(lPath) @@ -1468,24 +1469,29 @@ var CloudCommander, Util, var lCurrent = pCurrentFile || DOM.getCurrentFile(), lName = DOM.getCurrentName(lCurrent), lFromPath = DOM.getCurrentPath(), - lToPath = DOM.getNotCurrentDirPath() + lName, - lTo = prompt( 'Rename/Move file "' + lName + '"', lToPath ); + lToPath = DOM.getNotCurrentDirPath() + lName; + lToPath = prompt( 'Rename/Move file "' + lName + '"', lToPath ); - if( lTo && !Util.strCmp(lFromPath, lToPath) ){ + if( lToPath && !Util.strCmp(lFromPath, lToPath) ){ var lFiles = { from : lFromPath, to : lToPath }; DOM.RESTfull.mv(lFiles, function(){ - //CloudCommander.refresh(); DOM.deleteCurrent(lCurrent); + + var lPanel = DOM.getPanel(true), + lDotDot = DOM.getById( '..(' + lPanel.id + ')'); + + DOM.setCurrentFile ( lDotDot ); + CloudCommander.refresh(); }); } }; /** - * move current file + * copy current file * * @pCurrent */ @@ -1496,17 +1502,21 @@ var CloudCommander, Util, var lCurrent = pCurrentFile || DOM.getCurrentFile(), lName = DOM.getCurrentName(lCurrent), lFromPath = DOM.getCurrentPath(), - lToPath = DOM.getNotCurrentDirPath() + lName, - lTo = prompt( 'Copy file "' + lName + '" to', lToPath ); + lToPath = DOM.getNotCurrentDirPath() + lName; + lToPath = prompt( 'Copy file "' + lName + '" to', lToPath ); - if( lTo && !Util.strCmp(lFromPath, lToPath) ){ + if( lToPath && !Util.strCmp(lFromPath, lToPath) ){ var lFiles = { from : lFromPath, to : lToPath }; DOM.RESTfull.cp(lFiles, function(){ + var lPanel = DOM.getPanel(true), + lDotDot = DOM.getById( '..(' + lPanel.id + ')'); + DOM.setCurrentFile ( lDotDot ); + CloudCommander.refresh(); }); } }; diff --git a/lib/server/commander.js b/lib/server/commander.js index 784b0008..6649bc7c 100644 --- a/lib/server/commander.js +++ b/lib/server/commander.js @@ -154,8 +154,6 @@ lJSON[i+1] = lJSONFile; } - lDirPath = lDirPath.substr(lDirPath, lDirPath.lastIndexOf('/') ); - Util.exec(p.callback, null, lJSON); }