diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 91c840b33..66d475e09 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -190,6 +190,10 @@ define(function () { out.fm_unknownFolderError = "Le dossier sélectionné ou le dernier dossier visité n'existe plus. Ouverture du dossier parent..."; out.fm_contextMenuError = "Impossible d'ouvrir le menu contextuel pour cet élément. Si le problème persiste, essayez de rechercher la page."; out.fm_selectError = "Impossible de sélectionner l'élément ciblé. Si le problème persiste, essayez de recharger la page."; + out.fm_info_root = "Créez ici autant de dossiers/sous-dossiers que vous le souhaitez pour trier vos fichiers."; + out.fm_info_unsorted = 'Contains all the files you\'ve visited that are not yet sorted in "My Documents" or moved to the "Trash".'; // "My Documents" should match with the "out.fm_rootName" key, and "Trash" with "out.fm_trashName" + out.fm_info_trash = 'Files deleted from the trash are also removed from "All files" and it is impossible to recover them from the file manager.'; // Same here for "All files" and "out.fm_filesDataName" + out.fm_info_allFiles = 'Contains all the files from "My Documents", "Unsorted" and "Trash". You can\'t move or remove files from here.'; // Same here // File - Context menu out.fc_newfolder = "Nouveau dossier"; out.fc_rename = "Renommer"; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index 1ebaf7091..bd189b064 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -189,6 +189,10 @@ define(function () { out.fm_unknownFolderError = "The selected or last visited directory no longer exist. Opening the parent folder..."; out.fm_contextMenuError = "Unable to open the context menu for that element. If the problem persist, try to reload the page."; out.fm_selectError = "Unable to select the targetted element. If the problem persist, try to reload the page."; + out.fm_info_root = "Create as many folders/subfolders here as you want to sort your files."; + out.fm_info_unsorted = 'Contains all the files you\'ve visited that are not yet sorted in "My Documents" or moved to the "Trash".'; // "My Documents" should match with the "out.fm_rootName" key, and "Trash" with "out.fm_trashName" + out.fm_info_trash = 'Files deleted from the trash are also removed from "All files" and it is impossible to recover them from the file manager.'; // Same here for "All files" and "out.fm_filesDataName" + out.fm_info_allFiles = 'Contains all the files from "My Documents", "Unsorted" and "Trash". You can\'t move or remove files from here.'; // Same here // File - Context menu out.fc_newfolder = "New folder"; out.fc_rename = "Rename"; diff --git a/www/file/file.css b/www/file/file.css index 72caad18e..72947e93c 100644 --- a/www/file/file.css +++ b/www/file/file.css @@ -186,6 +186,14 @@ li { padding-left: 10px; } +#content .info-box { + margin: 0px auto; + padding: 5px; + background: #ddddff; + border: 1px solid #bbb; + border-radius: 5px; +} + .topButtonContainer { border: 1px solid #ccc; float: right; diff --git a/www/file/main.js b/www/file/main.js index 73066590a..38b919d28 100644 --- a/www/file/main.js +++ b/www/file/main.js @@ -58,9 +58,9 @@ define([ var getLastOpenedFolder = function () { var path; try { - path = localStorage[LOCALSTORAGE_LAST] ? JSON.parse(localStorage[LOCALSTORAGE_LAST]) : [ROOT]; + path = localStorage[LOCALSTORAGE_LAST] ? JSON.parse(localStorage[LOCALSTORAGE_LAST]) : [UNSORTED]; } catch (e) { - path = [ROOT]; + path = [UNSORTED]; } return path; }; @@ -147,7 +147,9 @@ define([ // TOOLBAR var getLastName = function (cb) { - cb(null, files['cryptpad.username'] || ''); + Cryptpad.getAttribute('username', function (err, userName) { + cb(err, userName || ''); + }); }; var setName = APP.setName = function (newName) { @@ -157,11 +159,16 @@ define([ myUserNameTemp = myUserNameTemp.substr(0, 32); } var myUserName = myUserNameTemp; - files['cryptpad.username'] = myUserName; - APP.userName.lastName = myUserName; - var $button = APP.$userNameButton; - var $span = $('
').append($button.find('span').clone()).html(); - $button.html($span + myUserName); + Cryptpad.setAttribute('username', myUserName, function (err, data) { + if (err) { + logError("Couldn't set username", err); + return; + } + APP.userName.lastName = myUserName; + var $button = APP.$userNameButton; + var $span = $('
').append($button.find('span').clone()).html(); + $button.html($span + myUserName); + }); }; var $userBlock = APP.$bar.find('.' + Toolbar.constants.username); @@ -682,6 +689,33 @@ define([ return $title; }; + var createInfoBox = function (path) { + var $box = $('
', {'class': 'info-box'}); + var msg; + switch (path[0]) { + case 'root': + msg = Messages.fm_info_root; + break; + case 'unsorted': + msg = Messages.fm_info_unsorted; + break; + case 'trash': + msg = Messages.fm_info_trash; + break; + case Cryptpad.storageKey: + msg = Messages.fm_info_allFiles; + break; + default: + msg = undefined; + } + if (!msg} { + $box.hide(); + } else { + $box.text(msg); + } + return $box; + }; + // Create the button allowing the user to switch from list to icons modes var createViewModeButton = function () { var $block = $('
', { @@ -1012,6 +1046,7 @@ define([ setLastOpenedFolder(path); var $title = createTitle(path); + var $info = createInfoBox(path); var $dirContent = $('
', {id: FOLDER_CONTENT_ID}); $dirContent.data('path', path); @@ -1059,7 +1094,7 @@ define([ $element.appendTo($list); }); } - $content.append($title).append($dirContent); + $content.append($title).append($info).append($dirContent); appStatus.ready(true); };