fix(cloudcmd) add ability work with % path

This commit is contained in:
coderaiser 2014-06-25 03:38:57 -04:00
parent c06c77bf5e
commit 5f6ec6d9f3
5 changed files with 18 additions and 15 deletions

View file

@ -321,8 +321,7 @@ var Util, DOM, CloudFunc;
*/
function ajaxLoad(path, options, panel) {
var SLASH = '/',
fsPath = decodeURI(path),
cleanPath = Util.rmStrOnce(fsPath, CloudFunc.FS) || SLASH;
cleanPath = Util.rmStrOnce(path, CloudFunc.FS) || SLASH;
if (!options)
options = {};

View file

@ -1101,14 +1101,10 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
* @param currentFile - current file by default
*/
this.getCurrentPath = function(currentFile) {
var current = currentFile || this.getCurrentFile(),
lPath = this.getCurrentLink( current ).href;
var name = this.getCurrentName(currentFile),
path = this.getCurrentDirPath();
lPath = decodeURI(lPath);
/* убираем адрес хоста*/
lPath = Util.rmStrOnce(lPath, [CloudCmd.HOST, CloudFunc.FS]);
return lPath;
return path + name;
};
/**

View file

@ -371,7 +371,9 @@ var CloudCmd, Util, DOM;
/* открываем папку*/
case Key.ENTER:
if (Info.isDir)
CloudCmd.loadDir();
CloudCmd.loadDir({
path: DOM.getCurrentPath()
});
break;
case Key.BACKSPACE:

View file

@ -107,6 +107,12 @@ var Util, DOM, CloudCmd;
url = CloudCmd.HOST;
href = element.href;
link = Util.rmStr(href, url);
/*
* browser do not replace % -> %25%
* do it for him
*/
link = Util.replaceStr(link, '%%', '%25%');
link = decodeURI(link);
CloudCmd.loadDir({
path : link,
@ -159,7 +165,9 @@ var Util, DOM, CloudCmd;
isDir = DOM.isCurrentIsDir(current);
if (isDir) {
CloudCmd.loadDir();
CloudCmd.loadDir({
path: DOM.getCurrentPath()
});
Events.preventDefault(event);
}
}

View file

@ -145,10 +145,8 @@ var Util, DOM, CloudFunc;
var p = params,
apiURL = CloudFunc.apiURL;
if (Util.isString(p.url))
p.url = decodeURI(p.url);
p.url = apiURL + p.url;
p.url = apiURL + p.url;
p.url = encodeURI(p.url);
DOM.load.ajax({
method : p.method,