fix(client) when none files in the root, menu doesn't work

This commit is contained in:
coderaiser 2015-07-01 03:03:17 -04:00
parent 6f7155e4d0
commit cbcda32df2
4 changed files with 45 additions and 24 deletions

View file

@ -419,16 +419,20 @@ var Util, DOM, CloudFunc, join;
names = ['file', 'path', 'link', 'pathLink'];
Files.get(names, function(error, templFile, templPath, templLink, templPathLink) {
var Dialog = DOM.Dialog,
var childNodes, i,
Dialog = DOM.Dialog,
current,
panel = panelParam || Info.panel,
dir = Info.dir,
name = Info.name,
i = panel.childNodes.length;
panel = panelParam || DOM.getPanel(),
dir = Info.dir,
name = Info.name;
if (error) {
Dialog.alert(error.responseText);
} else {
childNodes = panel.childNodes;
i = childNodes.length;
while (i--)
panel.removeChild(panel.lastChild);
@ -467,21 +471,18 @@ var Util, DOM, CloudFunc, join;
* используеться при первом заходе в корень
*/
function getJSONfromFileTable() {
var current, name, size, owner, mode, ret,
var name, size, owner, mode, ret,
path = DOM.getCurrentDirPath(),
infoFiles = Info.files,
infoFiles = Info.files || [],
fileTable = {
path : path,
files : []
},
files = fileTable.files,
i, n = infoFiles.length;
files = fileTable.files;
for (i = 0; i < n; i++) {
current = infoFiles[i];
[].forEach.call(infoFiles, function(current) {
name = DOM.getCurrentName(current);
size = DOM.getCurrentSize(current);
owner = DOM.getCurrentOwner(current);
@ -494,7 +495,7 @@ var Util, DOM, CloudFunc, join;
mode : mode,
owner : owner
});
}
});
ret = Util.json.stringify(fileTable);