mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
feature(client) createFileTable: add error check
This commit is contained in:
parent
8deda93cd1
commit
aa0f2e9f4c
1 changed files with 42 additions and 37 deletions
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue