feature(client) createFileTable: add error check

This commit is contained in:
coderaiser 2014-09-09 10:45:40 -04:00
parent 8deda93cd1
commit aa0f2e9f4c

View file

@ -362,52 +362,57 @@ var Util, DOM, CloudFunc;
Files.get(names, function(error, templFile, templPath, templLink, templPathLink) {
var n, found, varCurrent, varName, current,
Dialog = DOM.Dialog,
dir = DOM.getCurrentDirName(),
name = DOM.getCurrentName(),
i = panel.childNodes.length;
while (i--)
panel.removeChild(panel.lastChild);
panel.innerHTML = CloudFunc.buildFromJSON({
data : json,
id : panel.id,
template : {
file : templFile,
path : templPath,
pathLink : templPathLink,
link : templLink
}
});
files = DOM.getFiles(panel);
/* searching current file */
if (wasRefresh) {
n = files.length;
if (error) {
Dialog.alert(error.responseText);
} else {
while (i--)
panel.removeChild(panel.lastChild);
for (i = 0; i < n ; i++) {
varCurrent = files[i],
varName = DOM.getCurrentName(varCurrent);
found = varName === name;
panel.innerHTML = CloudFunc.buildFromJSON({
data : json,
id : panel.id,
template : {
file : templFile,
path : templPath,
pathLink : templPathLink,
link : templLink
}
});
files = DOM.getFiles(panel);
/* searching current file */
if (wasRefresh) {
n = files.length;
if (found) {
current = files[i];
break;
for (i = 0; i < n ; i++) {
varCurrent = files[i],
varName = DOM.getCurrentName(varCurrent);
found = varName === name;
if (found) {
current = files[i];
break;
}
}
}
if (!found) /* .. */
current = files[0];
DOM.setCurrentFile(current, {
history: history
});
Listeners.setOnPanel(panel.id);
if (name === '..' && dir !== '/')
currentToParent(dir);
}
if (!found) /* .. */
current = files[0];
DOM.setCurrentFile(current, {
history: history
});
Listeners.setOnPanel(panel.id);
if (name === '..' && dir !== '/')
currentToParent(dir);
});
}