Display an info message in the anonymous drive

pull/1/head
yflory 8 years ago
parent 57979f6314
commit 03274c3776

@ -226,10 +226,16 @@ define(function () {
out.fm_info_template = "Contient tous les fichiers que vous avez sauvés en tant que modèle afin de les réutiliser lors de la création d'un nouveau pad.";
out.fm_info_trash = 'Les fichiers supprimés dans la corbeille sont également enlevés de "Tous les fichiers" et il est impossible de les récupérer depuis l\'explorateur de fichiers.'; // Same here for "All files" and "out.fm_filesDataName"
out.fm_info_allFiles = 'Contient tous les fichiers de "Documents", "Fichiers non triés" et "Corbeille". Vous ne pouvez pas supprimer ou déplacer des fichiers depuis cet endroit.'; // Same here
out.fm_info_anonymous = 'Vous n\'êtes pas connectés, ces pads risquent donc d\'être supprimés (<a href="https://blog.cryptpad.fr/2017/05/17/You-gotta-log-in/" target="_blank">découvrez pourquoi</a>). ' +
'<a href="/register/">Inscrivez-vous</a> ou <a href="/login/">connectez-vous</a> pour les maintenir en vie.';
out.fm_alert_backupUrl = "Lien de secours pour ce disque.<br>" +
"Il est <strong>fortement recommandé</strong> de garder ce lien pour vous-même.<br>" +
"Elle vous servira en cas de perte des données de votre navigateur afin de retrouver vos fichiers.<br>" +
"Quiconque se trouve en possession de celle-ci peut modifier ou supprimer tous les fichiers de ce gestionnaire.<br>";
out.fm_alert_anonymous = "Bonjour ! Vous utilisez actuellement Cryptpad de manière anonyme, ce qui ne pose pas de problème mais vos pads peuvent être supprimés après un certain temps " +
"d'inactivité. Nous avons désactivé certaines fonctionnalités avancées de CryptDrive pour les utilisateurs anonymes afin de rendre clair le fait que ce n'est pas " +
'un endroit sûr pour le stockage des documents. Vous pouvez <a href="https://blog.cryptpad.fr/2017/05/17/You-gotta-log-in/" target="_blank">en lire plus</a> concernant ' +
'nos raisons pour ces changements et pourquoi vous devriez vraiment <a href="/register/">vous enregistrer</a> et <a href="/login/">vous connecter</a>.';
out.fm_backup_title = 'Lien de secours';
out.fm_nameFile = 'Comment souhaitez-vous nommer ce fichier ?';
// File - Context menu

@ -228,10 +228,18 @@ define(function () {
out.fm_info_template = 'Contains all the pads stored as templates and that you can re-use when you create a new pad.';
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 "Documents", "Unsorted" and "Trash". You can\'t move or remove files from here.'; // Same here
out.fm_info_login = "Log in";
out.fm_info_register = "Sign up";
out.fm_info_anonymous = 'You are not logged in so these pads may be deleted (<a href="https://blog.cryptpad.fr/2017/05/17/You-gotta-log-in/" target="_blank">find out why</a>). ' +
'<a href="/register/">Sign up</a> or <a href="/login/">Log in</a> to keep them alive.';
out.fm_alert_backupUrl = "Backup link for this drive.<br>" +
"It is <strong>highly recommended</strong> that you keep ip for yourself only.<br>" +
"You can use it to retrieve all your files in case your browser memory got erased.<br>" +
"Anybody with that link can edit or remove all the files in your file manager.<br>";
out.fm_alert_anonymous = "Hello there, you are currently using CryptPad anonymously, that's ok but your pads may be deleted after a period of " +
"inactivity. We have disabled advanced features of the drive for anonymous users because we want to be clear that it is " +
'not a safe place to store things. You can <a href="https://blog.cryptpad.fr/2017/05/17/You-gotta-log-in/" target="_blank">read more</a> about ' +
'why we are doing this and why you really should <a href="/register/">Sign up</a> and <a href="/login/">Log in</a>.';
out.fm_backup_title = 'Backup link';
out.fm_nameFile = 'How would you like to name that file?';
// File - Context menu

@ -259,6 +259,9 @@ span.fa-folder-open {
margin-left: 10px;
float: right;
}
#content .info-box.noclose {
padding-right: 10px;
}
#content li {
cursor: default;
}
@ -462,7 +465,7 @@ span.fa-folder-open {
height: 100%;
}
#driveToolbar button {
height: 30px;
height: 26px;
}
#driveToolbar button.element {
border-radius: 2px;

@ -303,6 +303,9 @@ span {
margin-left: 10px;
float: right;
}
&.noclose {
padding-right: 10px;
}
}
li {
cursor: default;
@ -527,7 +530,7 @@ span {
}
button {
height: 30px;
height: 26px;
&.element {
border-radius: 2px;
background: @toolbar-button-bg;

@ -226,9 +226,14 @@ define([
if (AppConfig.enableTemplates) { displayedCategories.push(TEMPLATE); }
if (isWorkgroup()) { displayedCategories = [ROOT, TRASH, SEARCH]; }
if (!Cryptpad.isLoggedIn()) {
if (!APP.loggedIn) {
displayedCategories = [FILES_DATA];
currentPath = [FILES_DATA];
$tree.hide();
if (Object.keys(files.root).length && !proxy.anonymousAlert) {
Cryptpad.alert(Messages.fm_alert_anonymous, null, true);
proxy.anonymousAlert = true;
}
}
if (!APP.readOnly) {
@ -607,7 +612,6 @@ define([
}
hasFolder = true;
hide.push($menu.find('a.open_ro'));
// TODO: folder properties in the future?
hide.push($menu.find('a.properties'));
}
// If we're in the trash, hide restore and properties for non-root elements
@ -1292,6 +1296,12 @@ define([
default:
msg = undefined;
}
if (!APP.loggedIn) {
msg = Messages.fm_info_anonymous;
$box.html(msg);
$box.addClass('noclose');
return $box;
}
if (!msg || Cryptpad.getLSAttribute('hide-info-' + path[0]) === '1') {
$box.hide();
} else {
@ -2200,7 +2210,7 @@ define([
.appendTo($d);
}
if (Cryptpad.isLoggedIn() && AppConfig.enablePinning) {
if (APP.loggedIn && AppConfig.enablePinning) {
// check the size of this file...
Cryptpad.getFileSize(el, function (e, bytes) {
if (e) {
@ -2315,8 +2325,7 @@ define([
else if ($(this).hasClass('delete')) {
var pathsList = [];
paths.forEach(function (p) { pathsList.push(p.path); });
if (!Cryptpad.isLoggedIn()) {
console.log(paths);
if (!APP.loggedIn) {
var msg = Messages._getKey("fm_removeSeveralPermanentlyDialog", [paths.length]);
if (paths.length === 1) {
msg = Messages.fm_removePermanentlyDialog;
@ -2450,7 +2459,7 @@ define([
$appContainer.on('keydown', function (e) {
// "Del"
if (e.which === 46) {
if (filesOp.isPathIn(currentPath, [FILES_DATA]) && Cryptpad.isLoggedIn()) {
if (filesOp.isPathIn(currentPath, [FILES_DATA]) && APP.loggedIn) {
return; // We can't remove elements directly from filesData
}
var $selected = $iframe.find('.selected');
@ -2462,7 +2471,7 @@ define([
paths.push($(elmt).data('path'));
});
// If we are in the trash or anon pad or if we are holding the "shift" key, delete permanently,
if (!Cryptpad.isLoggedIn() || isTrash || e.shiftKey) {
if (!APP.loggedIn || isTrash || e.shiftKey) {
var msg = Messages._getKey("fm_removeSeveralPermanentlyDialog", [paths.length]);
if (paths.length === 1) {
msg = Messages.fm_removePermanentlyDialog;
@ -2616,7 +2625,7 @@ define([
// don't initialize until the store is ready.
Cryptpad.ready(function () {
Cryptpad.reportAppUsage();
if (!Cryptpad.isLoggedIn()) { Cryptpad.feedback('ANONYMOUS_DRIVE'); }
if (!APP.loggedIn) { Cryptpad.feedback('ANONYMOUS_DRIVE'); }
APP.$bar = $iframe.find('#toolbar');
var storeObj = Cryptpad.getStore().getProxy && Cryptpad.getStore().getProxy().proxy ? Cryptpad.getStore().getProxy() : undefined;
@ -2752,6 +2761,7 @@ define([
};
var $hist = Cryptpad.createButton('history', true, {histConfig: histConfig});
$rightside.append($hist);
if (!APP.loggedIn) { $hist.hide(); }
if (!readOnly && !APP.loggedIn) {
var $backupButton = Cryptpad.createButton('', true).removeClass('fa').removeClass('fa-question');

Loading…
Cancel
Save