refactor(dom) getCurrentFileContent

This commit is contained in:
coderaiser 2014-05-13 10:39:46 -04:00
parent f81a84d575
commit 996686fd27

View file

@ -971,33 +971,18 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
* @callback - callback function or data struct {sucess, error}
* @currentFile
*/
this.getCurrentFileContent = function(pParams, currentFile) {
var ret,
current = currentFile || this.getCurrentFile(),
lParams = pParams ? pParams : {},
lPath = this.getCurrentPath(current),
lErrorWas = pParams.error,
lError = function(jqXHR) {
Util.exec(lErrorWas);
Images.showError(jqXHR);
};
this.getCurrentFileContent = function(callback, currentFile) {
var RESTful = DOM.RESTful,
current = currentFile || this.getCurrentFile(),
isDir = this.isCurrentIsDir(currentFile),
path = this.getCurrentPath(current);
if (Util.isFunction(lParams))
lParams.success = Util.retExec(pParams);
if (isDir)
path += '?json';
lParams.error = lError;
RESTful.read(path, callback);
if (this.isCurrentIsDir(currentFile))
lPath += '?json';
else if (!lParams.dataType)
lParams.dataType = 'text';
if (!lParams.url)
lParams.url = CloudFunc.FS + lPath;
ret = this.ajax(lParams);
return ret;
return this;
};
/**