|
|
@ -38,6 +38,7 @@ define([
|
|
|
|
return JSONSortify(obj);
|
|
|
|
return JSONSortify(obj);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var SEARCH = "search";
|
|
|
|
var ROOT = "root";
|
|
|
|
var ROOT = "root";
|
|
|
|
var ROOT_NAME = Messages.fm_rootName;
|
|
|
|
var ROOT_NAME = Messages.fm_rootName;
|
|
|
|
var UNSORTED = "unsorted";
|
|
|
|
var UNSORTED = "unsorted";
|
|
|
@ -1417,6 +1418,13 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var displaySearch = function ($list, value) {
|
|
|
|
|
|
|
|
var filesList = filesOp.search(value);
|
|
|
|
|
|
|
|
filesList.forEach(function (r) {
|
|
|
|
|
|
|
|
$('<li>').text(JSON.stringify(r)).appendTo($list);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Display the selected directory into the content part (rightside)
|
|
|
|
// Display the selected directory into the content part (rightside)
|
|
|
|
// NOTE: Elements in the trash are not using the same storage structure as the others
|
|
|
|
// NOTE: Elements in the trash are not using the same storage structure as the others
|
|
|
|
// _WORKGROUP_ : do not change the lastOpenedFolder value in localStorage
|
|
|
|
// _WORKGROUP_ : do not change the lastOpenedFolder value in localStorage
|
|
|
@ -1433,6 +1441,7 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
appStatus.ready(false);
|
|
|
|
appStatus.ready(false);
|
|
|
|
currentPath = path;
|
|
|
|
currentPath = path;
|
|
|
|
|
|
|
|
var s = $content.scrollTop() || 0;
|
|
|
|
$content.html("");
|
|
|
|
$content.html("");
|
|
|
|
if (!path || path.length === 0) {
|
|
|
|
if (!path || path.length === 0) {
|
|
|
|
path = [ROOT];
|
|
|
|
path = [ROOT];
|
|
|
@ -1442,9 +1451,10 @@ define([
|
|
|
|
var isUnsorted = filesOp.comparePath(path, [UNSORTED]);
|
|
|
|
var isUnsorted = filesOp.comparePath(path, [UNSORTED]);
|
|
|
|
var isTemplate = filesOp.comparePath(path, [TEMPLATE]);
|
|
|
|
var isTemplate = filesOp.comparePath(path, [TEMPLATE]);
|
|
|
|
var isAllFiles = filesOp.comparePath(path, [FILES_DATA]);
|
|
|
|
var isAllFiles = filesOp.comparePath(path, [FILES_DATA]);
|
|
|
|
|
|
|
|
var isSearch = path[0] === SEARCH;
|
|
|
|
|
|
|
|
|
|
|
|
var root = filesOp.findElement(files, path);
|
|
|
|
var root = isSearch ? undefined : filesOp.findElement(files, path);
|
|
|
|
if (typeof(root) === "undefined") {
|
|
|
|
if (!isSearch && typeof(root) === "undefined") {
|
|
|
|
log(Messages.fm_unknownFolderError);
|
|
|
|
log(Messages.fm_unknownFolderError);
|
|
|
|
debug("Unable to locate the selected directory: ", path);
|
|
|
|
debug("Unable to locate the selected directory: ", path);
|
|
|
|
var parentPath = path.slice();
|
|
|
|
var parentPath = path.slice();
|
|
|
@ -1517,6 +1527,8 @@ define([
|
|
|
|
displayAllFiles($list);
|
|
|
|
displayAllFiles($list);
|
|
|
|
} else if (isTrashRoot) {
|
|
|
|
} else if (isTrashRoot) {
|
|
|
|
displayTrashRoot($list, $folderHeader, $fileHeader);
|
|
|
|
displayTrashRoot($list, $folderHeader, $fileHeader);
|
|
|
|
|
|
|
|
} else if (isSearch) {
|
|
|
|
|
|
|
|
displaySearch($list, path[1]);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$dirContent.contextmenu(openContentContextMenu);
|
|
|
|
$dirContent.contextmenu(openContentContextMenu);
|
|
|
|
if (filesOp.hasSubfolder(root)) { $list.append($folderHeader); }
|
|
|
|
if (filesOp.hasSubfolder(root)) { $list.append($folderHeader); }
|
|
|
@ -1539,6 +1551,7 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//$content.append($toolbar).append($title).append($info).append($dirContent);
|
|
|
|
//$content.append($toolbar).append($title).append($info).append($dirContent);
|
|
|
|
$content.append($info).append($dirContent);
|
|
|
|
$content.append($info).append($dirContent);
|
|
|
|
|
|
|
|
$content.scrollTop(s);
|
|
|
|
appStatus.ready(true);
|
|
|
|
appStatus.ready(true);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -1624,7 +1637,8 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
// Display root content
|
|
|
|
// Display root content
|
|
|
|
var $list = $('<ul>').appendTo($container);
|
|
|
|
var $list = $('<ul>').appendTo($container);
|
|
|
|
Object.keys(root).forEach(function (key) {
|
|
|
|
var keys = Object.keys(root).sort();
|
|
|
|
|
|
|
|
keys.forEach(function (key) {
|
|
|
|
// Do not display files in the menu
|
|
|
|
// Do not display files in the menu
|
|
|
|
if (filesOp.isFile(root[key])) { return; }
|
|
|
|
if (filesOp.isFile(root[key])) { return; }
|
|
|
|
var newPath = path.slice();
|
|
|
|
var newPath = path.slice();
|
|
|
@ -1679,8 +1693,22 @@ define([
|
|
|
|
$container.append($trashList);
|
|
|
|
$container.append($trashList);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var createSearch = function ($container) {
|
|
|
|
|
|
|
|
var $input = $('<input>', {
|
|
|
|
|
|
|
|
type: 'text',
|
|
|
|
|
|
|
|
placeholder: 'Search...'
|
|
|
|
|
|
|
|
}).keyup(function (e) {
|
|
|
|
|
|
|
|
if (e.which === 13) {
|
|
|
|
|
|
|
|
var val = $(this).val();
|
|
|
|
|
|
|
|
displayDirectory([SEARCH, val]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$container.append($input);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var resetTree = module.resetTree = function () {
|
|
|
|
var resetTree = module.resetTree = function () {
|
|
|
|
$tree.html('');
|
|
|
|
$tree.html('');
|
|
|
|
|
|
|
|
if (displayedCategories.indexOf(SEARCH) !== -1) { createSearch($tree); }
|
|
|
|
if (displayedCategories.indexOf(ROOT) !== -1) { createTree($tree, [ROOT]); }
|
|
|
|
if (displayedCategories.indexOf(ROOT) !== -1) { createTree($tree, [ROOT]); }
|
|
|
|
if (displayedCategories.indexOf(UNSORTED) !== -1) { createUnsorted($tree, [UNSORTED]); }
|
|
|
|
if (displayedCategories.indexOf(UNSORTED) !== -1) { createUnsorted($tree, [UNSORTED]); }
|
|
|
|
if (displayedCategories.indexOf(TEMPLATE) !== -1) { createTemplate($tree, [TEMPLATE]); }
|
|
|
|
if (displayedCategories.indexOf(TEMPLATE) !== -1) { createTemplate($tree, [TEMPLATE]); }
|
|
|
|