Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

pull/1/head
ansuz 8 years ago
commit 67a096a8a4

@ -780,6 +780,9 @@ body {
} }
.cryptpad-toolbar-leftside { .cryptpad-toolbar-leftside {
height: 32px; height: 32px;
&:empty {
height: 0;
}
float: left; float: left;
margin-bottom: -1px; margin-bottom: -1px;
.cryptpad-dropdown-users { .cryptpad-dropdown-users {
@ -812,6 +815,9 @@ body {
} }
.cryptpad-toolbar-rightside { .cryptpad-toolbar-rightside {
height: 32px; height: 32px;
&:empty {
height: 0;
}
text-align: right; text-align: right;
&> button { &> button {
height: 100%; height: 100%;
@ -825,7 +831,7 @@ body {
.drawer-content { .drawer-content {
position: absolute; position: absolute;
right:0px; right:0px;
top:96px; margin-top: 32px;
min-width: 50px; min-width: 50px;
background: white; background: white;
border: 1px solid black; border: 1px solid black;

@ -1303,6 +1303,9 @@ body.app-file .cryptpad-toolbar .dropdown-bar-content p .accountData {
float: left; float: left;
margin-bottom: -1px; margin-bottom: -1px;
} }
.cryptpad-toolbar-leftside:empty {
height: 0;
}
.cryptpad-toolbar-leftside .cryptpad-dropdown-users pre { .cryptpad-toolbar-leftside .cryptpad-dropdown-users pre {
/* needed for ckeditor */ /* needed for ckeditor */
white-space: pre; white-space: pre;
@ -1332,6 +1335,9 @@ body.app-file .cryptpad-toolbar .dropdown-bar-content p .accountData {
height: 32px; height: 32px;
text-align: right; text-align: right;
} }
.cryptpad-toolbar-rightside:empty {
height: 0;
}
.cryptpad-toolbar-rightside > button { .cryptpad-toolbar-rightside > button {
height: 100%; height: 100%;
margin: 0; margin: 0;
@ -1344,7 +1350,7 @@ body.app-file .cryptpad-toolbar .dropdown-bar-content p .accountData {
.cryptpad-toolbar-rightside .drawer-content { .cryptpad-toolbar-rightside .drawer-content {
position: absolute; position: absolute;
right: 0px; right: 0px;
top: 96px; margin-top: 32px;
min-width: 50px; min-width: 50px;
background: white; background: white;
border: 1px solid black; border: 1px solid black;

@ -406,6 +406,7 @@ define(function () {
out.upload_progress = "État"; out.upload_progress = "État";
out.upload_mustLogin = "Vous devez vous connecter pour importer un fichier"; out.upload_mustLogin = "Vous devez vous connecter pour importer un fichier";
out.download_button = "Déchiffrer et télécharger"; out.download_button = "Déchiffrer et télécharger";
out.download_mt_button = "Télécharger";
// general warnings // general warnings
out.warn_notPinned = "Ce pad n'est stocké dans aucun CryptDrive. Il va expirer après 3 mois d'inactivité. <a href='/about.html#pinning'>En savoir plus...</a>"; out.warn_notPinned = "Ce pad n'est stocké dans aucun CryptDrive. Il va expirer après 3 mois d'inactivité. <a href='/about.html#pinning'>En savoir plus...</a>";

@ -412,6 +412,7 @@ define(function () {
out.upload_progress = "Progress"; out.upload_progress = "Progress";
out.upload_mustLogin = "You must be logged in to upload files"; out.upload_mustLogin = "You must be logged in to upload files";
out.download_button = "Decrypt & Download"; out.download_button = "Decrypt & Download";
out.download_mt_button = "Download";
// general warnings // general warnings
out.warn_notPinned = "This pad is not in anyone's CryptDrive. It will expire after 3 months. <a href='/about.html#pinning'>Learn more...</a>"; out.warn_notPinned = "This pad is not in anyone's CryptDrive. It will expire after 3 months. <a href='/about.html#pinning'>Learn more...</a>";

@ -18,7 +18,7 @@
"scripts": { "scripts": {
"lint": "jshint --config .jshintrc --exclude-path .jshintignore .", "lint": "jshint --config .jshintrc --exclude-path .jshintignore .",
"test": "node TestSelenium.js", "test": "node TestSelenium.js",
"style": "lessc ./customize.dist/src/less/cryptpad.less > ./customize.dist/main.css && lessc ./customize.dist/src/less/toolbar.less > ./customize.dist/toolbar.css && lessc ./www/drive/file.less > ./www/drive/file.css && lessc ./www/settings/main.less > ./www/settings/main.css && lessc ./www/slide/slide.less > ./www/slide/slide.css && lessc ./www/whiteboard/whiteboard.less > ./www/whiteboard/whiteboard.css && lessc ./www/poll/poll.less > ./www/poll/poll.css && lessc ./www/file/file.less > ./www/file/file.css && lessc ./www/code/code.less > ./www/code/code.css", "style": "lessc ./customize.dist/src/less/cryptpad.less > ./customize.dist/main.css && lessc ./customize.dist/src/less/toolbar.less > ./customize.dist/toolbar.css && lessc ./www/drive/file.less > ./www/drive/file.css && lessc ./www/settings/main.less > ./www/settings/main.css && lessc ./www/whiteboard/whiteboard.less > ./www/whiteboard/whiteboard.css && lessc ./www/poll/poll.less > ./www/poll/poll.css && lessc ./www/file/file.less > ./www/file/file.css && lessc ./www/code/code.less > ./www/code/code.css",
"template": "cd customize.dist/src && for page in ../index.html ../privacy.html ../terms.html ../about.html ../contact.html ../../www/login/index.html ../../www/register/index.html ../../www/settings/index.html ../../www/user/index.html;do echo $page; cp template.html $page; done;" "template": "cd customize.dist/src && for page in ../index.html ../privacy.html ../terms.html ../about.html ../contact.html ../../www/login/index.html ../../www/register/index.html ../../www/settings/index.html ../../www/user/index.html;do echo $page; cp template.html $page; done;"
} }
} }

@ -19,11 +19,11 @@ define([
Alertify._$$alertify.delay = AppConfig.notificationTimeout || 5000; Alertify._$$alertify.delay = AppConfig.notificationTimeout || 5000;
var findCancelButton = UI.findCancelButton = function () { var findCancelButton = UI.findCancelButton = function () {
return $('button.cancel'); return $('button.cancel').last();
}; };
var findOKButton = UI.findOKButton = function () { var findOKButton = UI.findOKButton = function () {
return $('button.ok'); return $('button.ok').last();
}; };
var listenForKeys = UI.listenForKeys = function (yes, no) { var listenForKeys = UI.listenForKeys = function (yes, no) {
@ -74,14 +74,22 @@ define([
findCancelButton().click(); findCancelButton().click();
}); });
// Make sure we don't call both the "yes" and "no" handlers if we use "findOKButton().click()"
// in the callback
var isClicked = false;
Alertify Alertify
.defaultValue(def || '') .defaultValue(def || '')
.okBtn(opt.ok || Messages.okButton || 'OK') .okBtn(opt.ok || Messages.okButton || 'OK')
.cancelBtn(opt.cancel || Messages.cancelButton || 'Cancel') .cancelBtn(opt.cancel || Messages.cancelButton || 'Cancel')
.prompt(msg, function (val, ev) { .prompt(msg, function (val, ev) {
if (isClicked) { return; }
isClicked = true;
cb(val, ev); cb(val, ev);
stopListening(keyHandler); stopListening(keyHandler);
}, function (ev) { }, function (ev) {
if (isClicked) { return; }
isClicked = true;
cb(null, ev); cb(null, ev);
stopListening(keyHandler); stopListening(keyHandler);
}); });
@ -98,13 +106,21 @@ define([
findCancelButton().click(); findCancelButton().click();
}); });
// Make sure we don't call both the "yes" and "no" handlers if we use "findOKButton().click()"
// in the callback
var isClicked = false;
Alertify Alertify
.okBtn(opt.ok || Messages.okButton || 'OK') .okBtn(opt.ok || Messages.okButton || 'OK')
.cancelBtn(opt.cancel || Messages.cancelButton || 'Cancel') .cancelBtn(opt.cancel || Messages.cancelButton || 'Cancel')
.confirm(msg, function () { .confirm(msg, function () {
if (isClicked) { return; }
isClicked = true;
cb(true); cb(true);
stopListening(keyHandler); stopListening(keyHandler);
}, function () { }, function () {
if (isClicked) { return; }
isClicked = true;
cb(false); cb(false);
stopListening(keyHandler); stopListening(keyHandler);
}); });

@ -519,9 +519,9 @@ define([
if (_onDisplayNameChanged.indexOf(h) !== -1) { return; } if (_onDisplayNameChanged.indexOf(h) !== -1) { return; }
_onDisplayNameChanged.push(h); _onDisplayNameChanged.push(h);
}; };
common.changeDisplayName = function (newName) { common.changeDisplayName = function (newName, isLocal) {
_onDisplayNameChanged.forEach(function (h) { _onDisplayNameChanged.forEach(function (h) {
h(newName); h(newName, isLocal);
}); });
}; };

@ -736,7 +736,7 @@ define([
Cryptpad.prompt(Messages.changeNamePrompt, lastName || '', function (newName) { Cryptpad.prompt(Messages.changeNamePrompt, lastName || '', function (newName) {
if (newName === null && typeof(lastName) === "string") { return; } if (newName === null && typeof(lastName) === "string") { return; }
if (newName === null) { newName = ''; } if (newName === null) { newName = ''; }
Cryptpad.changeDisplayName(newName); Cryptpad.changeDisplayName(newName, true);
}); });
}); });
}); });

@ -2714,6 +2714,7 @@ define([
var toolbar = APP.toolbar = Toolbar.create(config); var toolbar = APP.toolbar = Toolbar.create(config);
var $rightside = toolbar.$rightside; var $rightside = toolbar.$rightside;
$rightside.html(''); // Remove the drawer if we don't use it to hide the toolbar
var $leftside = toolbar.$leftside; 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);
@ -2749,8 +2750,7 @@ define([
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}); var $hist = Cryptpad.createButton('history', true, {histConfig: histConfig});
$rightside.append($hist); if (APP.loggedIn) { $rightside.append($hist); }
if (!APP.loggedIn) { $hist.hide(); }
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');

@ -51,16 +51,9 @@ define([
uploadMode = true; uploadMode = true;
} }
var getTitle = function () {
var pad = Cryptpad.getRelativeHref(window.location.href);
var fo = Cryptpad.getStore().getProxy().fo;
var data = fo.getFileData(pad);
return data ? data.title : undefined;
};
Title = Cryptpad.createTitle({}, function(){}, Cryptpad); Title = Cryptpad.createTitle({}, function(){}, Cryptpad);
var displayed = ['title', 'useradmin', 'newpad', 'limit', 'upgrade']; var displayed = ['useradmin', 'newpad', 'limit', 'upgrade'];
if (secret && hexFileName) { if (secret && hexFileName) {
displayed.push('fileshare'); displayed.push('fileshare');
} }
@ -69,30 +62,24 @@ define([
displayed: displayed, displayed: displayed,
ifrw: ifrw, ifrw: ifrw,
common: Cryptpad, common: Cryptpad,
title: Title.getTitleConfig(),
hideDisplayName: true, hideDisplayName: true,
$container: $bar $container: $bar
}; };
var toolbar = APP.toolbar = Toolbar.create(configTb); var toolbar = APP.toolbar = Toolbar.create(configTb);
toolbar.$rightside.html(''); // Remove the drawer if we don't use it to hide the toolbar
Title.setToolbar(toolbar);
if (uploadMode) { toolbar.title.hide(); }
Title.updateTitle(Cryptpad.initialName || getTitle() || Title.defaultTitle);
if (!uploadMode) { if (!uploadMode) {
var src = Cryptpad.getBlobPathFromHex(hexFileName); var src = Cryptpad.getBlobPathFromHex(hexFileName);
var cryptKey = secret.keys && secret.keys.fileKeyStr; var cryptKey = secret.keys && secret.keys.fileKeyStr;
var key = Nacl.util.decodeBase64(cryptKey); var key = Nacl.util.decodeBase64(cryptKey);
FileCrypto.fetchDecryptedMetadata(src, key, function (e, metadata) { FileCrypto.fetchDecryptedMetadata(src, key, function (e, metadata) {
if (e) { return void console.error(e); } if (e) { return void console.error(e); }
var title = document.title = metadata.name; var title = document.title = metadata.name;
Title.updateTitle(title || Title.defaultTitle); Title.updateTitle(title || Title.defaultTitle);
var displayFile = function (ev) { var displayFile = function (ev, sizeMb) {
var $mt = $dlview.find('media-tag'); var $mt = $dlview.find('media-tag');
var cryptKey = secret.keys && secret.keys.fileKeyStr; var cryptKey = secret.keys && secret.keys.fileKeyStr;
var hexFileName = Cryptpad.base64ToHex(secret.channel); var hexFileName = Cryptpad.base64ToHex(secret.channel);
@ -112,6 +99,10 @@ define([
$appContainer.css('background', 'white'); $appContainer.css('background', 'white');
} }
$dlButton.addClass('btn btn-success'); $dlButton.addClass('btn btn-success');
var text = Messages.download_mt_button + '<br>';
text += '<b>' + Cryptpad.fixHTML(title) + '</b><br>';
text += '<em>' + Messages._getKey('formattedMB', [sizeMb]) + '</em>';
$dlButton.html(text);
toolbar.$rightside.append(Cryptpad.createButton('export', true, {}, function () { toolbar.$rightside.append(Cryptpad.createButton('export', true, {}, function () {
saveAs(decrypted.blob, decrypted.metadata.name); saveAs(decrypted.blob, decrypted.metadata.name);
@ -169,14 +160,14 @@ define([
$dlform.show(); $dlform.show();
Cryptpad.removeLoadingScreen(); Cryptpad.removeLoadingScreen();
$dllabel.append($('<br>')); $dllabel.append($('<br>'));
$dllabel.append(metadata.name); $dllabel.append(Cryptpad.fixHTML(metadata.name));
$dllabel.append($('<br>')); $dllabel.append($('<br>'));
$dllabel.append(Messages._getKey('formattedMB', [sizeMb])); $dllabel.append(Messages._getKey('formattedMB', [sizeMb]));
var decrypting = false; var decrypting = false;
var onClick = function (ev) { var onClick = function (ev) {
if (decrypting) { return; } if (decrypting) { return; }
decrypting = true; decrypting = true;
displayFile(ev); displayFile(ev, sizeMb);
}; };
if (sizeMb < 5) { return void onClick(); } if (sizeMb < 5) { return void onClick(); }
$dlform.find('#dl, #progress').click(onClick); $dlform.find('#dl, #progress').click(onClick);

Loading…
Cancel
Save