|
|
@ -158,13 +158,6 @@ define([
|
|
|
|
//var $folderOpenedIcon = $('<span>', {"class": "fa fa-folder-open folder"});
|
|
|
|
//var $folderOpenedIcon = $('<span>', {"class": "fa fa-folder-open folder"});
|
|
|
|
var $folderOpenedIcon = $('<img>', {src: "/customize/images/icons/folderOpen.svg", "class": "folder icon"});
|
|
|
|
var $folderOpenedIcon = $('<img>', {src: "/customize/images/icons/folderOpen.svg", "class": "folder icon"});
|
|
|
|
var $folderOpenedEmptyIcon = $folderOpenedIcon.clone();
|
|
|
|
var $folderOpenedEmptyIcon = $folderOpenedIcon.clone();
|
|
|
|
var $fileIcon = $('<span>', {"class": "fa fa-file-text-o file icon"});
|
|
|
|
|
|
|
|
var $fileAppIcon = $('<span>', {"class": "fa fa-file-text-o file icon fileColor"});
|
|
|
|
|
|
|
|
var $padIcon = $('<span>', {"class": "fa fa-file-word-o file icon padColor"});
|
|
|
|
|
|
|
|
var $codeIcon = $('<span>', {"class": "fa fa-file-code-o file icon codeColor"});
|
|
|
|
|
|
|
|
var $slideIcon = $('<span>', {"class": "fa fa-file-powerpoint-o file icon slideColor"});
|
|
|
|
|
|
|
|
var $pollIcon = $('<span>', {"class": "fa fa-calendar file icon pollColor"});
|
|
|
|
|
|
|
|
var $whiteboardIcon = $('<span>', {"class": "fa fa-paint-brush whiteboardColor"});
|
|
|
|
|
|
|
|
//var $upIcon = $('<span>', {"class": "fa fa-arrow-circle-up"});
|
|
|
|
//var $upIcon = $('<span>', {"class": "fa fa-arrow-circle-up"});
|
|
|
|
var $unsortedIcon = $('<span>', {"class": "fa fa-files-o"});
|
|
|
|
var $unsortedIcon = $('<span>', {"class": "fa fa-files-o"});
|
|
|
|
var $templateIcon = $('<span>', {"class": "fa fa-cubes"});
|
|
|
|
var $templateIcon = $('<span>', {"class": "fa fa-cubes"});
|
|
|
@ -172,8 +165,8 @@ define([
|
|
|
|
var $trashEmptyIcon = $('<span>', {"class": "fa fa-trash-o"});
|
|
|
|
var $trashEmptyIcon = $('<span>', {"class": "fa fa-trash-o"});
|
|
|
|
//var $collapseIcon = $('<span>', {"class": "fa fa-minus-square-o expcol"});
|
|
|
|
//var $collapseIcon = $('<span>', {"class": "fa fa-minus-square-o expcol"});
|
|
|
|
var $expandIcon = $('<span>', {"class": "fa fa-plus-square-o expcol"});
|
|
|
|
var $expandIcon = $('<span>', {"class": "fa fa-plus-square-o expcol"});
|
|
|
|
var $listIcon = $('<span>', {"class": "fa fa-list"});
|
|
|
|
var $listIcon = $('<button>', {"class": "fa fa-list"});
|
|
|
|
var $gridIcon = $('<span>', {"class": "fa fa-th"});
|
|
|
|
var $gridIcon = $('<button>', {"class": "fa fa-th-large"});
|
|
|
|
var $sortAscIcon = $('<span>', {"class": "fa fa-angle-up sortasc"});
|
|
|
|
var $sortAscIcon = $('<span>', {"class": "fa fa-angle-up sortasc"});
|
|
|
|
var $sortDescIcon = $('<span>', {"class": "fa fa-angle-down sortdesc"});
|
|
|
|
var $sortDescIcon = $('<span>', {"class": "fa fa-angle-down sortdesc"});
|
|
|
|
var $closeIcon = $('<span>', {"class": "fa fa-window-close"});
|
|
|
|
var $closeIcon = $('<span>', {"class": "fa fa-window-close"});
|
|
|
@ -1141,7 +1134,7 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var getFileIcon = function (id) {
|
|
|
|
var getFileIcon = function (id) {
|
|
|
|
var $icon = $fileIcon.clone();
|
|
|
|
var $icon = Cryptpad.getIcon();
|
|
|
|
|
|
|
|
|
|
|
|
var data = filesOp.getFileData(id);
|
|
|
|
var data = filesOp.getFileData(id);
|
|
|
|
if (!data) { return $icon; }
|
|
|
|
if (!data) { return $icon; }
|
|
|
@ -1149,15 +1142,16 @@ define([
|
|
|
|
var href = data.href;
|
|
|
|
var href = data.href;
|
|
|
|
if (!href) { return $icon; }
|
|
|
|
if (!href) { return $icon; }
|
|
|
|
|
|
|
|
|
|
|
|
if (href.indexOf('/pad/') !== -1) { $icon = $padIcon.clone(); }
|
|
|
|
if (href.indexOf('/pad/') !== -1) { $icon = Cryptpad.getIcon('pad'); }
|
|
|
|
else if (href.indexOf('/code/') !== -1) { $icon = $codeIcon.clone(); }
|
|
|
|
else if (href.indexOf('/code/') !== -1) { $icon = Cryptpad.getIcon('code'); }
|
|
|
|
else if (href.indexOf('/slide/') !== -1) { $icon = $slideIcon.clone(); }
|
|
|
|
else if (href.indexOf('/slide/') !== -1) { $icon = Cryptpad.getIcon('slide'); }
|
|
|
|
else if (href.indexOf('/poll/') !== -1) { $icon = $pollIcon.clone(); }
|
|
|
|
else if (href.indexOf('/poll/') !== -1) { $icon = Cryptpad.getIcon('poll'); }
|
|
|
|
else if (href.indexOf('/whiteboard/') !== -1) { $icon = $whiteboardIcon.clone(); }
|
|
|
|
else if (href.indexOf('/whiteboard/') !== -1) { $icon = Cryptpad.getIcon('whiteboard'); }
|
|
|
|
else if (href.indexOf('/file/') !== -1) { $icon = $fileAppIcon.clone(); }
|
|
|
|
else if (href.indexOf('/file/') !== -1) { $icon = Cryptpad.getIcon('file'); }
|
|
|
|
|
|
|
|
|
|
|
|
return $icon;
|
|
|
|
return $icon;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
var getIcon = Cryptpad.getIcon;
|
|
|
|
|
|
|
|
|
|
|
|
// Create the "li" element corresponding to the file/folder located in "path"
|
|
|
|
// Create the "li" element corresponding to the file/folder located in "path"
|
|
|
|
var createElement = function (path, elPath, root, isFolder) {
|
|
|
|
var createElement = function (path, elPath, root, isFolder) {
|
|
|
@ -1285,7 +1279,10 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (idx === 0) { name = getPrettyName(p); }
|
|
|
|
if (idx === 0) { name = getPrettyName(p); }
|
|
|
|
else { $title.append(' > '); }
|
|
|
|
else {
|
|
|
|
|
|
|
|
var $span2 = $('<span>', {'class': 'element'}).text(' > ');
|
|
|
|
|
|
|
|
$title.append($span2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$span.text(name).appendTo($title);
|
|
|
|
$span.text(name).appendTo($title);
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -1335,17 +1332,13 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Create the button allowing the user to switch from list to icons modes
|
|
|
|
// Create the button allowing the user to switch from list to icons modes
|
|
|
|
var createViewModeButton = function () {
|
|
|
|
var createViewModeButton = function ($container) {
|
|
|
|
var $block = $('<div>', {
|
|
|
|
/*var $block = $('<div>', {
|
|
|
|
'class': 'dropdown-bar right changeViewModeContainer'
|
|
|
|
'class': 'dropdown-bar right changeViewModeContainer'
|
|
|
|
});
|
|
|
|
});*/
|
|
|
|
|
|
|
|
|
|
|
|
var $listButton = $('<button>', {
|
|
|
|
var $listButton = $listIcon.clone().addClass('element');
|
|
|
|
'class': 'element btn btn-secondary'
|
|
|
|
var $gridButton = $gridIcon.clone().addClass('element');
|
|
|
|
}).append($listIcon.clone());
|
|
|
|
|
|
|
|
var $gridButton = $('<button>', {
|
|
|
|
|
|
|
|
'class': 'element btn btn-secondary'
|
|
|
|
|
|
|
|
}).append($gridIcon.clone());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$listButton.click(function () {
|
|
|
|
$listButton.click(function () {
|
|
|
|
$gridButton.removeClass('active');
|
|
|
|
$gridButton.removeClass('active');
|
|
|
@ -1369,11 +1362,10 @@ define([
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$gridButton.addClass('active');
|
|
|
|
$gridButton.addClass('active');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$block.append($listButton).append($gridButton);
|
|
|
|
$container.append($listButton).append($gridButton);
|
|
|
|
return $block;
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var createNewButton = function (isInRoot) {
|
|
|
|
var createNewButton = function (isInRoot, $container) {
|
|
|
|
if (!APP.editable) { return; }
|
|
|
|
if (!APP.editable) { return; }
|
|
|
|
if (!APP.loggedIn) { return; } // Anonymous users can use the + menu in the toolbar
|
|
|
|
if (!APP.loggedIn) { return; } // Anonymous users can use the + menu in the toolbar
|
|
|
|
|
|
|
|
|
|
|
@ -1383,13 +1375,13 @@ define([
|
|
|
|
options.push({
|
|
|
|
options.push({
|
|
|
|
tag: 'a',
|
|
|
|
tag: 'a',
|
|
|
|
attributes: {'class': 'newFolder'},
|
|
|
|
attributes: {'class': 'newFolder'},
|
|
|
|
content: Messages.fm_folder
|
|
|
|
content: $('<div>').append($folderIcon.clone()).html() + Messages.fm_folder
|
|
|
|
});
|
|
|
|
});
|
|
|
|
options.push({tag: 'hr'});
|
|
|
|
options.push({tag: 'hr'});
|
|
|
|
options.push({
|
|
|
|
options.push({
|
|
|
|
tag: 'a',
|
|
|
|
tag: 'a',
|
|
|
|
attributes: {'class': 'uploadFile'},
|
|
|
|
attributes: {'class': 'uploadFile'},
|
|
|
|
content: Messages.uploadButton
|
|
|
|
content: $('<div>').append(getIcon('file')).html() + Messages.uploadButton
|
|
|
|
});
|
|
|
|
});
|
|
|
|
options.push({tag: 'hr'});
|
|
|
|
options.push({tag: 'hr'});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1407,21 +1399,21 @@ define([
|
|
|
|
options.push({
|
|
|
|
options.push({
|
|
|
|
tag: 'a',
|
|
|
|
tag: 'a',
|
|
|
|
attributes: attributes,
|
|
|
|
attributes: attributes,
|
|
|
|
content: Messages.type[type]
|
|
|
|
content: $('<div>').append(getIcon(type)).html() + Messages.type[type]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
var $plusIcon = $('<div>').append($('<span>', {'class': 'fa fa-plus'}));
|
|
|
|
var $plusIcon = $('<div>').append($('<span>', {'class': 'fa fa-plus'}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dropdownConfig = {
|
|
|
|
var dropdownConfig = {
|
|
|
|
text: $plusIcon.html() + Messages.fm_newButton,
|
|
|
|
text: $plusIcon.html() + '<span>'+Messages.fm_newButton+'</span>',
|
|
|
|
options: options,
|
|
|
|
options: options,
|
|
|
|
feedback: 'DRIVE_NEWPAD_LOCALFOLDER',
|
|
|
|
feedback: 'DRIVE_NEWPAD_LOCALFOLDER',
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var $block = Cryptpad.createDropdown(dropdownConfig);
|
|
|
|
var $block = Cryptpad.createDropdown(dropdownConfig);
|
|
|
|
|
|
|
|
|
|
|
|
// Custom style:
|
|
|
|
// Custom style:
|
|
|
|
$block.find('button').addClass('btn').addClass('btn-primary').addClass('new');
|
|
|
|
$block.find('button').addClass('new');
|
|
|
|
$block.find('button').attr('title', Messages.fm_newButtonTitle);
|
|
|
|
$block.find('button').attr('title', Messages.fm_newButtonTitle);
|
|
|
|
|
|
|
|
|
|
|
|
// Handlers
|
|
|
|
// Handlers
|
|
|
@ -1459,7 +1451,7 @@ define([
|
|
|
|
window.open('/' + type + '/');
|
|
|
|
window.open('/' + type + '/');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return $block;
|
|
|
|
$container.append($block);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var hideNewButton = function () {
|
|
|
|
var hideNewButton = function () {
|
|
|
@ -1636,7 +1628,8 @@ define([
|
|
|
|
$toolbar.html('');
|
|
|
|
$toolbar.html('');
|
|
|
|
$('<div>', {'class': 'leftside'}).appendTo($toolbar);
|
|
|
|
$('<div>', {'class': 'leftside'}).appendTo($toolbar);
|
|
|
|
$('<div>', {'class': 'path unselectable'}).appendTo($toolbar);
|
|
|
|
$('<div>', {'class': 'path unselectable'}).appendTo($toolbar);
|
|
|
|
$('<div>', {'class': 'rightside'}).appendTo($toolbar);
|
|
|
|
var $rightside = $('<div>', {'class': 'rightside'}).appendTo($toolbar);
|
|
|
|
|
|
|
|
if (APP.$hist) { $rightside.append(APP.$hist); }
|
|
|
|
return $toolbar;
|
|
|
|
return $toolbar;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -1857,12 +1850,12 @@ define([
|
|
|
|
if (mode) {
|
|
|
|
if (mode) {
|
|
|
|
$dirContent.addClass(getViewModeClass());
|
|
|
|
$dirContent.addClass(getViewModeClass());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
createViewModeButton().appendTo($toolbar.find('.rightside'));
|
|
|
|
createViewModeButton($toolbar.find('.rightside'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var $list = $('<ul>').appendTo($dirContent);
|
|
|
|
var $list = $('<ul>').appendTo($dirContent);
|
|
|
|
|
|
|
|
|
|
|
|
// NewButton can be undefined if we're in read only mode
|
|
|
|
// NewButton can be undefined if we're in read only mode
|
|
|
|
$toolbar.find('.leftside').append(createNewButton(isInRoot));
|
|
|
|
createNewButton(isInRoot, $toolbar.find('.leftside'));
|
|
|
|
|
|
|
|
|
|
|
|
createTitle(path).appendTo($toolbar.find('.path'));
|
|
|
|
createTitle(path).appendTo($toolbar.find('.path'));
|
|
|
|
|
|
|
|
|
|
|
@ -2127,10 +2120,15 @@ define([
|
|
|
|
var s = $tree.scrollTop() || 0;
|
|
|
|
var s = $tree.scrollTop() || 0;
|
|
|
|
$tree.html('');
|
|
|
|
$tree.html('');
|
|
|
|
if (displayedCategories.indexOf(SEARCH) !== -1) { createSearch($tree); }
|
|
|
|
if (displayedCategories.indexOf(SEARCH) !== -1) { createSearch($tree); }
|
|
|
|
if (displayedCategories.indexOf(ROOT) !== -1) { createTree($tree, [ROOT]); }
|
|
|
|
var $div = $('<div>', {'class': 'categories-container'}).appendTo($tree);
|
|
|
|
if (displayedCategories.indexOf(TEMPLATE) !== -1) { createTemplate($tree, [TEMPLATE]); }
|
|
|
|
if (displayedCategories.indexOf(ROOT) !== -1) { createTree($div, [ROOT]); }
|
|
|
|
if (displayedCategories.indexOf(FILES_DATA) !== -1) { createAllFiles($tree, [FILES_DATA]); }
|
|
|
|
if (displayedCategories.indexOf(TEMPLATE) !== -1) { createTemplate($div, [TEMPLATE]); }
|
|
|
|
if (displayedCategories.indexOf(TRASH) !== -1) { createTrash($tree, [TRASH]); }
|
|
|
|
if (displayedCategories.indexOf(FILES_DATA) !== -1) { createAllFiles($div, [FILES_DATA]); }
|
|
|
|
|
|
|
|
if (displayedCategories.indexOf(TRASH) !== -1) { createTrash($div, [TRASH]); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//$tree.append($('<div>', {'class': 'filler'}));
|
|
|
|
|
|
|
|
$tree.append(APP.$limit);
|
|
|
|
|
|
|
|
|
|
|
|
$tree.scrollTop(s);
|
|
|
|
$tree.scrollTop(s);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -2721,7 +2719,6 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var $rightside = toolbar.$rightside;
|
|
|
|
var $rightside = toolbar.$rightside;
|
|
|
|
$rightside.html(''); // Remove the drawer if we don't use it to hide the toolbar
|
|
|
|
$rightside.html(''); // Remove the drawer if we don't use it to hide the toolbar
|
|
|
|
var $leftside = toolbar.$leftside;
|
|
|
|
|
|
|
|
var $userBlock = toolbar.$userAdmin;
|
|
|
|
var $userBlock = toolbar.$userAdmin;
|
|
|
|
APP.$displayName = APP.$bar.find('.' + Toolbar.constants.username);
|
|
|
|
APP.$displayName = APP.$bar.find('.' + Toolbar.constants.username);
|
|
|
|
|
|
|
|
|
|
|
@ -2736,8 +2733,7 @@ define([
|
|
|
|
/* add the usage */
|
|
|
|
/* add the usage */
|
|
|
|
Cryptpad.createUsageBar(function (err, $limitContainer) {
|
|
|
|
Cryptpad.createUsageBar(function (err, $limitContainer) {
|
|
|
|
if (err) { return void logError(err); }
|
|
|
|
if (err) { return void logError(err); }
|
|
|
|
$leftside.html('');
|
|
|
|
APP.$limit = $limitContainer;
|
|
|
|
$leftside.append($limitContainer);
|
|
|
|
|
|
|
|
}, true);
|
|
|
|
}, true);
|
|
|
|
|
|
|
|
|
|
|
|
/* add a history button */
|
|
|
|
/* add a history button */
|
|
|
@ -2755,8 +2751,9 @@ define([
|
|
|
|
$toolbar: APP.$bar,
|
|
|
|
$toolbar: APP.$bar,
|
|
|
|
href: window.location.origin + window.location.pathname + '#' + APP.hash
|
|
|
|
href: window.location.origin + window.location.pathname + '#' + APP.hash
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var $hist = Cryptpad.createButton('history', true, {histConfig: histConfig});
|
|
|
|
APP.$hist = Cryptpad.createButton('history', true, {histConfig: histConfig});
|
|
|
|
if (APP.loggedIn) { $rightside.append($hist); }
|
|
|
|
APP.$hist.addClass('element');
|
|
|
|
|
|
|
|
//if (APP.loggedIn) { $rightside.append($hist); } TODO
|
|
|
|
|
|
|
|
|
|
|
|
if (!readOnly && !APP.loggedIn) {
|
|
|
|
if (!readOnly && !APP.loggedIn) {
|
|
|
|
var $backupButton = Cryptpad.createButton('', true).removeClass('fa').removeClass('fa-question').addClass('cryptpad-backup');
|
|
|
|
var $backupButton = Cryptpad.createButton('', true).removeClass('fa').removeClass('fa-question').addClass('cryptpad-backup');
|
|
|
|