From d666e9e7ee0a2437f756bb2d3ada808da29bc7b5 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 15 Dec 2017 18:16:01 +0100 Subject: [PATCH] Remove tag and filepicker buttons for anon users --- customize.dist/translations/messages.fr.js | 2 +- www/common/sframe-app-framework.js | 2 + www/drive/inner.js | 4 ++ www/poll/inner.js | 40 +++++++-------- www/whiteboard/inner.js | 57 ++++++++++++---------- 5 files changed, 58 insertions(+), 47 deletions(-) diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 0ba3413a3..e490cd040 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -156,7 +156,7 @@ define(function () { out.filePickerButton = "Intégrer un fichier stocké dans CryptDrive"; out.filePicker_close = "Fermer"; - out.filePicker_description = "Choisissez un fichier de votre CryptDrive pour l'intégrer ou uploadez-en un nouveau"; + out.filePicker_description = "Choisissez un fichier de votre CryptDrive pour l'intégrer ou importez-en un nouveau"; out.filePicker_filter = "Filtrez les fichiers par leur nom"; out.or = 'ou'; diff --git a/www/common/sframe-app-framework.js b/www/common/sframe-app-framework.js index 526e45678..fbe872d76 100644 --- a/www/common/sframe-app-framework.js +++ b/www/common/sframe-app-framework.js @@ -342,6 +342,7 @@ define([ }; var createFilePicker = function () { + if (!common.isLoggedIn()) { return; } common.initFilePicker({ onSelect: function (data) { if (data.type !== 'file') { @@ -369,6 +370,7 @@ define([ }).appendTo(toolbar.$rightside).hide(); }; var setMediaTagEmbedder = function (mte) { + if (!common.isLoggedIn()) { return; } if (!mte || readOnly) { $embedButton.hide(); return; diff --git a/www/drive/inner.js b/www/drive/inner.js index d403c61ad..aa8034f23 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -2638,6 +2638,10 @@ define([ APP.hideMenu(); }); + if (!APP.loggedIn) { + $defaultContextMenu.find('.cp-app-drive-context-delete').text(Messages.fc_remove) + .attr('data-icon', 'fa-eraser'); + } $defaultContextMenu.on("click", "a", function(e) { e.stopPropagation(); var paths = $(this).data('paths'); diff --git a/www/poll/inner.js b/www/poll/inner.js index df193985e..aa1c62a57 100644 --- a/www/poll/inner.js +++ b/www/poll/inner.js @@ -1142,27 +1142,29 @@ define([ APP.$publishButton = $publish; updatePublishButton(); - var fileDialogCfg = { - onSelect: function (data) { - if (data.type === 'file' && APP.editor) { - var mt = ''; - APP.editor.replaceSelection(mt); - return; + if (common.isLoggedIn()) { + var fileDialogCfg = { + onSelect: function (data) { + if (data.type === 'file' && APP.editor) { + var mt = ''; + APP.editor.replaceSelection(mt); + return; + } } - } - }; - common.initFilePicker(fileDialogCfg); - APP.$mediaTagButton = $('