refactored

This commit is contained in:
coderaiser 2013-01-25 07:45:58 -05:00
parent 490c48d5ce
commit 67e32118d9

View file

@ -537,39 +537,22 @@ CloudCmd._changeLinks = function(pPanelID){
* @param pOptions
* { refresh, nohistory } - необходимость обновить данные о каталоге
*/
CloudCmd._ajaxLoad = function(pFullPath, pOptions){
CloudCmd._ajaxLoad = function(pPath, pOptions){
if(!pOptions)
pOptions = {};
/* Отображаем красивые пути */
/* added supporting of russian language */
pFullPath = decodeURI(pFullPath);
var lPath = pFullPath,
lFSPath = pFullPath,
lFS_s = CloudFunc.FS,
lNoJS_s = CloudFunc.NOJS;
/*
* убираем значения, которые,
* говорят об отсутствии js
*/
if(lPath.indexOf(lNoJS_s) === lFS_s.length)
lPath = lFSPath = Util.removeStr(lPath, lNoJS_s);
/* Отображаем красивые пути */
var lFSPath = decodeURI(pPath);
if(lPath.indexOf(lFS_s) === 0){
lPath = lPath.replace(lFS_s,'');
if(lPath === '/')
pFullPath = '/';
}
Util.log ('reading dir: "' + lPath + '";');
lFSPath = Util.removeStr( lFSPath, CloudFunc.NOJS );
pPath = Util.removeStr( lFSPath, CloudFunc.FS );
Util.log ('reading dir: "' + pPath + '";');
if(!pOptions.nohistory)
DOM.setHistory(pFullPath, null, pFullPath);
DOM.setHistory(pPath, null, pPath);
DOM.setTitle( CloudFunc.getTitle(lPath) );
DOM.setTitle( CloudFunc.getTitle(pPath) );
/* если доступен localStorage и
* в нём есть нужная нам директория -
@ -585,7 +568,7 @@ CloudCmd._ajaxLoad = function(pFullPath, pOptions){
var lPanel = DOM.getPanel().id;
if(!pOptions.refresh && lPanel){
var lJSON = DOM.Cache.get(lPath);
var lJSON = DOM.Cache.get(pPath);
if (lJSON){
/* переводим из текста в JSON */
@ -599,7 +582,7 @@ CloudCmd._ajaxLoad = function(pFullPath, pOptions){
DOM.getCurrentFileContent({
url : lFSPath,
success :function(pData){
success : function(pData){
CloudCmd._createFileTable(lPanel, pData);
CloudCmd._changeLinks(lPanel);
@ -611,7 +594,7 @@ CloudCmd._ajaxLoad = function(pFullPath, pOptions){
/* если размер данных не очень бошьой *
* сохраняем их в кэше */
if(lJSON_s.length < 50000 )
DOM.Cache.set(lPath, lJSON_s);
DOM.Cache.set(pPath, lJSON_s);
}
});
};