mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-28 10:14:13 +00:00
added path template
This commit is contained in:
parent
34d7a1b89e
commit
4fb7815583
4 changed files with 41 additions and 34 deletions
|
|
@ -7,7 +7,7 @@ var Util, DOM, CloudFunc, $, KeyBinding, CloudCommander;
|
|||
(function(Util, DOM){
|
||||
'use strict';
|
||||
|
||||
var Config, Modules, FileTemplate;
|
||||
var Config, Modules, FileTemplate, PathTemplate;
|
||||
|
||||
/* Клиентский обьект, содержащий функциональную часть*/
|
||||
var CloudCmd = {
|
||||
|
|
@ -384,13 +384,14 @@ var Util, DOM, CloudFunc, $, KeyBinding, CloudCommander;
|
|||
|
||||
function lGetSysFile(pCallBack){
|
||||
Util.ifExec(pGlobal, pCallBack, function(pCallBack){
|
||||
DOM.ajax({
|
||||
url : pURL,
|
||||
success : function(pLocal){
|
||||
pGlobal = pLocal;
|
||||
Util.exec(pCallBack, pLocal);
|
||||
}
|
||||
});
|
||||
if(!pGlobal)
|
||||
DOM.ajax({
|
||||
url : pURL,
|
||||
success : function(pLocal){
|
||||
pGlobal = pLocal;
|
||||
Util.exec(pCallBack, pLocal);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -402,7 +403,7 @@ var Util, DOM, CloudFunc, $, KeyBinding, CloudCommander;
|
|||
CloudCmd.getConfig = getSystemFile(Config, CloudCmd.JSONDIR + 'config.json');
|
||||
CloudCmd.getModules = getSystemFile(Modules, CloudCmd.JSONDIR + 'modules.json');
|
||||
CloudCmd.getFileTemplate = getSystemFile(FileTemplate, CloudCmd.HTMLDIR + 'file.html');
|
||||
|
||||
CloudCmd.getpPathTemplate = getSystemFile(PathTemplate, CloudCmd.HTMLDIR + 'path.html');
|
||||
|
||||
CloudCmd.execFromModule = function(pModuleName, pFuncName, pParams){
|
||||
var lObject = CloudCmd[pModuleName];
|
||||
|
|
@ -586,8 +587,10 @@ var Util, DOM, CloudFunc, $, KeyBinding, CloudCommander;
|
|||
lJSON = Util.parseJSON(lJSON);
|
||||
|
||||
CloudCmd.getFileTemplate(function(pTemplate){
|
||||
CloudCmd._createFileTable(lPanel, lJSON, pTemplate);
|
||||
CloudCmd._changeLinks(lPanel);
|
||||
CloudCmd.getpPathTemplate(function(pPathTemplate){
|
||||
CloudCmd._createFileTable(lPanel, lJSON, pTemplate, pPathTemplate);
|
||||
CloudCmd._changeLinks(lPanel);
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
|
|
@ -604,9 +607,11 @@ var Util, DOM, CloudFunc, $, KeyBinding, CloudCommander;
|
|||
|
||||
success : function(pData){
|
||||
CloudCmd.getFileTemplate(function(pTemplate){
|
||||
CloudCmd._createFileTable(lPanel, pData, pTemplate);
|
||||
CloudCmd._changeLinks(lPanel);
|
||||
});
|
||||
CloudCmd.getpPathTemplate(function(pPathTemplate){
|
||||
CloudCmd._createFileTable(lPanel, lJSON, pTemplate, pPathTemplate);
|
||||
CloudCmd._changeLinks(lPanel);
|
||||
});
|
||||
});
|
||||
|
||||
/* переводим таблицу файлов в строку, для *
|
||||
* сохранения в localStorage */
|
||||
|
|
@ -626,7 +631,7 @@ var Util, DOM, CloudFunc, $, KeyBinding, CloudCommander;
|
|||
* @param pEleme - родительский элемент
|
||||
* @param pJSON - данные о файлах
|
||||
*/
|
||||
CloudCmd._createFileTable = function(pElem, pJSON, pTemplate){
|
||||
CloudCmd._createFileTable = function(pElem, pJSON, pTemplate, pPathTemplate){
|
||||
var lElem = DOM.getById(pElem),
|
||||
/* getting current element if was refresh */
|
||||
lPath = DOM.getByClass('path', lElem),
|
||||
|
|
@ -641,7 +646,7 @@ var Util, DOM, CloudFunc, $, KeyBinding, CloudCommander;
|
|||
while(i--)
|
||||
lElem.removeChild(lElem.lastChild);
|
||||
/* заполняем панель новыми элементами */
|
||||
lElem.innerHTML = CloudFunc.buildFromJSON(pJSON, pTemplate);
|
||||
lElem.innerHTML = CloudFunc.buildFromJSON(pJSON, pTemplate, pPathTemplate);
|
||||
|
||||
var lFound;
|
||||
/* searching current file */
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ var CloudFunc, exports, Util;
|
|||
* [{path:'путь',size:'dir'},
|
||||
* {name:'имя',size:'размер',mode:'права доступа'}]
|
||||
*/
|
||||
CloudFunc.buildFromJSON = function(pJSON, pTemplate)
|
||||
CloudFunc.buildFromJSON = function(pJSON, pTemplate, pPathTemplate)
|
||||
{
|
||||
var files = pJSON,
|
||||
/* сохраняем путь каталога в котором мы сейчас находимся*/
|
||||
|
|
@ -313,19 +313,10 @@ var CloudFunc, exports, Util;
|
|||
*/
|
||||
lRefreshPath = CloudFunc.removeLastSlash(lPath),
|
||||
|
||||
lFileTable =
|
||||
'<li class=path>'+
|
||||
'<span class="path-icon clear-cache"' +
|
||||
'id=clear-cache ' +
|
||||
'title="clear cache (Ctrl+D)">' +
|
||||
'</span>' +
|
||||
'<span class="path-icon ' + CloudFunc.REFRESHICON + '"' +
|
||||
' title="refresh (Ctrl+R)">' +
|
||||
'<a href="' + FS + lRefreshPath + '">' +
|
||||
'</a>' +
|
||||
'</span>' +
|
||||
'<span>' + lHtmlPath + '</span>' +
|
||||
'</li>',
|
||||
lFileTable = Util.render(pPathTemplate, {
|
||||
link: FS + lRefreshPath,
|
||||
path: lHtmlPath
|
||||
}),
|
||||
|
||||
fileTableTitles = ['name','size','owner','mode'];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue