From 6143bceabb4301662921de3c400c3bb6861830ed Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 17 Jul 2018 15:38:23 +0200 Subject: [PATCH] Fix XXX --- customize.dist/translations/messages.fr.js | 4 +++- customize.dist/translations/messages.js | 13 +++++++++++- www/common/common-ui-elements.js | 2 +- www/common/outer/userObject.js | 4 ++-- www/common/proxy-manager.js | 4 ++-- www/common/userObject.js | 4 ++-- www/drive/inner.js | 23 +++++++++++++--------- 7 files changed, 36 insertions(+), 18 deletions(-) diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 520a6ceaf..2945c4d6d 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -387,6 +387,7 @@ define(function () { out.fm_newFolder = "Nouveau dossier"; out.fm_newFile = "Nouveau pad"; out.fm_folder = "Dossier"; + out.fm_sharedFolder = "Dossier partagé"; out.fm_folderName = "Nom du dossier"; out.fm_numberOfFolders = "# de dossiers"; out.fm_numberOfFiles = "# de fichiers"; @@ -447,6 +448,7 @@ define(function () { out.fm_tags_used = "Nombre d'utilisations"; // File - Context menu out.fc_newfolder = "Nouveau dossier"; + out.fc_newsharedfolder = "Nouveau dossier partagé"; out.fc_rename = "Renommer"; out.fc_open = "Ouvrir"; out.fc_open_ro = "Ouvrir (lecture seule)"; @@ -460,7 +462,7 @@ define(function () { out.fc_hashtag = "Mots-clés"; out.fc_sizeInKilobytes = "Taille en kilo-octets"; // fileObject.js (logs) - out.fo_moveUnsortedError = "La liste des éléments non triés ne peut pas contenir de dossiers."; + out.fo_moveUnsortedError = "La liste des modèles ne peut pas contenir de dossiers."; out.fo_existingNameError = "Ce nom est déjà utilisé dans ce répertoire. Veuillez en choisir un autre."; out.fo_moveFolderToChildError = "Vous ne pouvez pas déplacer un dossier dans un de ses descendants"; out.fo_unableToRestore = "Impossible de restaurer ce fichier à son emplacement d'origine. Vous pouvez essayer de le déplacer à un nouvel emplacement."; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index a9299e71a..a66cc28eb 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -387,6 +387,7 @@ define(function () { out.fm_newFolder = "New folder"; out.fm_newFile = "New pad"; out.fm_folder = "Folder"; + out.fm_sharedFolder = "Shared folder"; out.fm_folderName = "Folder name"; out.fm_numberOfFolders = "# of folders"; out.fm_numberOfFiles = "# of files"; @@ -447,6 +448,7 @@ define(function () { out.fm_tags_used = "Number of uses"; // File - Context menu out.fc_newfolder = "New folder"; + out.fc_newsharedfolder = "New shared folder"; out.fc_rename = "Rename"; out.fc_open = "Open"; out.fc_open_ro = "Open (read-only)"; @@ -460,7 +462,7 @@ define(function () { out.fc_hashtag = "Tags"; out.fc_sizeInKilobytes = "Size in Kilobytes"; // fileObject.js (logs) - out.fo_moveUnsortedError = "You can't move a folder to the list of unsorted pads"; + out.fo_moveUnsortedError = "You can't move a folder to the list of templates"; out.fo_existingNameError = "Name already used in that directory. Please choose another one."; out.fo_moveFolderToChildError = "You can't move a folder into one of its descendants"; out.fo_unableToRestore = "Unable to restore that file to its original location. You can try to move it to a new location."; @@ -1200,5 +1202,14 @@ define(function () { out.loading_drive_2 = "Updating data format"; out.loading_drive_3 = "Verifying data integrity"; + // Shared folders + // XXX + out.sharedFolders_forget = "This pad is only stored in a shared folder, you can't move it to the trash. You can use your CryptDrive if you want to delete it from the folder."; + out.sharedFolders_duplicate = "Some of the pads you were trying to move were already stored."; + out.sharedFolders_create = "Create a shared folder"; + out.sharedFolders_create_name = "Folder name"; + out.sharedFolders_create_owned = "Owned folder"; + out.sharedFolders_create_password = "Folder password"; + return out; }); diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 5d2f15f40..741688797 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -683,7 +683,7 @@ define([ if (err || res.error) { return void console.log(err || res.error); } var msg = Messages.forgetPrompt; if (res) { - UI.alert("WIP: This pad is only in a shared folder. You can't move it to the trash. You can use your CryptDrive if you want to delete it from the folder."); // XXX + UI.alert(Messages.sharedFolders_forget); return; } else if (!common.isLoggedIn()) { msg = Messages.fm_removePermanentlyDialog; diff --git a/www/common/outer/userObject.js b/www/common/outer/userObject.js index 6f17eaf55..aee238007 100644 --- a/www/common/outer/userObject.js +++ b/www/common/outer/userObject.js @@ -220,14 +220,14 @@ define([ // Remove existing pads from the "element" variable if (exp.isFile(element) && toRemove.indexOf(element) !== -1) { - // XXX display error in the UI + exp.log(Messages.sharedFolders_duplicate); return; } else if (exp.isFolder(element)) { var _removeExisting = function (root) { for (var k in root) { if (exp.isFile(root[k])) { if (toRemove.indexOf(root[k]) !== -1) { - // XXX display message in UI + exp.log(Messages.sharedFolders_duplicate); delete root[k]; } } else if (exp.isFolder(root[k])) { diff --git a/www/common/proxy-manager.js b/www/common/proxy-manager.js index 3485c2f1d..df2b4ecd1 100644 --- a/www/common/proxy-manager.js +++ b/www/common/proxy-manager.js @@ -252,7 +252,7 @@ define([ var resolved = _resolvePaths(Env, data.paths); var newResolved = _resolvePath(Env, data.newPath); - if (!newResolved.userObject.isFolder(newResolved.path)) { return void cb(); } // XXX + if (!newResolved.userObject.isFolder(newResolved.path)) { return void cb(); } nThen(function (waitFor) { if (resolved.main.length) { @@ -384,7 +384,7 @@ define([ // 2b. load the proxy Env.loadSharedFolder(id, folderData, waitFor(function (rt, metadata) { if (!rt.proxy.metadata) { // Creating a new shared folder - rt.proxy.metadata = {title: data.name || Messages.fm_newFolder}; // XXX + rt.proxy.metadata = { title: data.name || Messages.fm_newFolder }; } // If we're importing a folder, check its serverside metadata if (data.folderData && metadata) { diff --git a/www/common/userObject.js b/www/common/userObject.js index 6c99d4ae9..453e2cd29 100644 --- a/www/common/userObject.js +++ b/www/common/userObject.js @@ -37,7 +37,7 @@ define([ var logging = function () { console.log.apply(console, arguments); }; - var log = config.log || logging; + var log = exp.log = config.log || logging; var logError = config.logError || logging; var debug = exp.debug = config.debug || logging; @@ -143,7 +143,7 @@ define([ // Data from filesData var getTitle = exp.getTitle = function (file, type) { if (isSharedFolder(file)) { - return '??'; // XXX + return '??'; } var data = getFileData(file); if (!file || !data || !(data.href || data.roHref)) { diff --git a/www/drive/inner.js b/www/drive/inner.js index a46e448cf..be8585156 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -267,7 +267,7 @@ define([ h('li', h('a.cp-app-drive-context-newsharedfolder.dropdown-item.cp-app-drive-context-editable', { 'tabindex': '-1', 'data-icon': faSharedFolder, - }, 'New SF')), // XXX + }, Messages.fc_newsharedfolder)), h('li', h('a.cp-app-drive-context-hashtag.dropdown-item.cp-app-drive-context-editable', { 'tabindex': '-1', 'data-icon': faTags, @@ -1706,17 +1706,16 @@ define([ }; // Ask for name, password and owner - // XXX var content = h('div', [ - h('h4', "NEW SF TITLE"), - h('label', {for: 'cp-app-drive-sf-name'}, 'SF NAME'), - h('input#cp-app-drive-sf-name', {type: 'text', placeholder: "NEW FOLDER NAME"}), - //h('label', {for: 'cp-app-drive-sf-password'}, 'SF PASSWORD'), + h('h4', Messages.sharedFolders_create), + h('label', {for: 'cp-app-drive-sf-name'}, Messages.sharedFolders_create_name), + h('input#cp-app-drive-sf-name', {type: 'text', placeholder: Messages.fm_newFolder}), + //h('label', {for: 'cp-app-drive-sf-password'}, Messages.sharedFolders_create_password), //UI.passwordInput({id: 'cp-app-drive-sf-password'}), h('span', { style: 'display:flex;align-items:center;justify-content:space-between' }, [ - UI.createCheckbox('cp-app-drive-sf-owned', "OWNED?", true), + UI.createCheckbox('cp-app-drive-sf-owned', Messages.sharedFolders_create_owned, true), createHelper('/faq.html#keywords-owned', Messages.creation_owned1) // TODO ]), ]); @@ -1774,6 +1773,7 @@ define([ $block.find('a.cp-app-drive-new-shared-folder, li.cp-app-drive-new-shared-folder') .click(function () { addSharedFolderModal(function (obj) { + if (!obj) { return; } manager.addSharedFolder(currentPath, obj, refresh); }); }); @@ -1821,7 +1821,7 @@ define([ options.push({ tag: 'a', attributes: {'class': 'cp-app-drive-new-shared-folder'}, - content: $('
').append($folderIcon.clone()).html() + "NEW SF" // XXX + content: $('
').append($folderIcon.clone()).html() + Messages.fm_sharedFolder }); } options.push({tag: 'hr'}); @@ -2079,7 +2079,7 @@ define([ 'cp-app-drive-element-grid' }).prepend($folderIcon.clone()).appendTo($container); $element3.append($('', { 'class': 'cp-app-drive-new-name' }) - .text("SF")); // XXX + .text(Messages.fm_sharedFolder)); } // File var $element2 = $('
  • ', { @@ -2922,6 +2922,10 @@ define([ data.roHref = base + data.roHref; } + if (manager.isSharedFolder(el)) { + delete data.roHref; + } + UIElements.getProperties(common, data, cb); }; @@ -3002,6 +3006,7 @@ define([ else if ($(this).hasClass('cp-app-drive-context-newsharedfolder')) { if (paths.length !== 1) { return; } addSharedFolderModal(function (obj) { + if (!obj) { return; } manager.addSharedFolder(paths[0].path, obj, refresh); }); }