mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
added ability to add ?json flag only if we work with dir
This commit is contained in:
parent
7ddd67f3b0
commit
0dec6bc042
3 changed files with 32 additions and 28 deletions
|
|
@ -884,15 +884,11 @@ var CloudCommander, Util,
|
|||
*/
|
||||
DOM.getCurrentFileContent = function(pParams, pCurrentFile){
|
||||
var lRet,
|
||||
lParams = pParams ? pParams : {},
|
||||
/* adding ?json param
|
||||
* if file would be ignored and
|
||||
* if directory would be
|
||||
* geted back in json format
|
||||
*/
|
||||
lPath = DOM.getCurrentPath(pCurrentFile) + '?json',
|
||||
lErrorWas = pParams.error,
|
||||
lError = function(jqXHR){
|
||||
lCurrentFile = pCurrentFile ? pCurrentFile : DOM.getCurrentFile(),
|
||||
lParams = pParams ? pParams : {},
|
||||
lPath = DOM.getCurrentPath(lCurrentFile),
|
||||
lErrorWas = pParams.error,
|
||||
lError = function(jqXHR){
|
||||
Util.exec(lErrorWas);
|
||||
DOM.Images.showError(jqXHR);
|
||||
};
|
||||
|
|
@ -901,6 +897,10 @@ var CloudCommander, Util,
|
|||
|
||||
lParams.error = lError;
|
||||
|
||||
|
||||
if( DOM.isCurrentDir(lCurrentFile) )
|
||||
lPath += '?json';
|
||||
|
||||
if(!lParams.url)
|
||||
lParams.url = lPath;
|
||||
|
||||
|
|
@ -916,9 +916,11 @@ var CloudCommander, Util,
|
|||
* @pCurrentFile
|
||||
*/
|
||||
DOM.getCurrentData = function(pCallBack, pCurrentFile){
|
||||
|
||||
var lParams,
|
||||
lCurrentFile = pCurrentFile ? pCurrentFile : DOM.getCurrentFile(),
|
||||
lFunc = function(pData){
|
||||
var lName = DOM.getCurrentName(pCurrentFile);
|
||||
var lName = DOM.getCurrentName(lCurrentFile);
|
||||
if( Util.isObject(pData) ){
|
||||
pData = Util.stringifyJSON(pData);
|
||||
|
||||
|
|
@ -942,7 +944,7 @@ var CloudCommander, Util,
|
|||
};
|
||||
|
||||
|
||||
return DOM.getCurrentFileContent(lParams, pCurrentFile);
|
||||
return DOM.getCurrentFileContent(lParams, lCurrentFile);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1042,12 +1044,24 @@ var CloudCommander, Util,
|
|||
* @param pCurrentFile
|
||||
*/
|
||||
DOM.isCurrentFile = function(pCurrentFile){
|
||||
var lCurrentFileClass = pCurrentFile.className,
|
||||
lIsCurrent = lCurrentFileClass.indexOf(CURRENT_FILE) >= 0;
|
||||
var lClass = pCurrentFile && pCurrentFile.className,
|
||||
lIsCurrent = lClass && lClass.indexOf(CURRENT_FILE) >= 0;
|
||||
|
||||
return lIsCurrent;
|
||||
};
|
||||
|
||||
/**
|
||||
* check is current file is a directory
|
||||
*
|
||||
* @param pCurrentFile
|
||||
*/
|
||||
DOM.isCurrentDir = function(pCurrentFile){
|
||||
var lSize = DOM.getCurrentSize(pCurrentFile),
|
||||
lRet = lSize === '<dir>';
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* get link from current (or param) file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue