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

pull/1/head
ansuz 8 years ago
commit 6778a7062d

@ -33,7 +33,7 @@ define([
// implement in alternative store // implement in alternative store
Store.setBatch = function (map, cb) { Store.setBatch = function (map, cb) {
Object.keys(map).forEach(function (key) { Object.keys(map).forEach(function (key) {
safeSet(key, val); safeSet(key, map[key]);
}); });
cb(void 0, map); cb(void 0, map);
}; };

@ -40,7 +40,7 @@
<div id="main"> <div id="main">
<center> <center>
<img class="imgcenter cryptofist" src="/customize/cryptofist_small.png" /> <img class="imgcenter cryptofist" src="/customize/cryptofist_small.png" />
<h1 data-localization="main_slogan">Unity is Strength - Collaboration is Key</h1> <h1>Unity is Strength - Collaboration is Key</h1>
</center> </center>
<p data-localization="main_p1"><!-- Zero Knowledge collaborative realtime editor. Protected from the NSA. --></p> <p data-localization="main_p1"><!-- Zero Knowledge collaborative realtime editor. Protected from the NSA. --></p>
@ -65,9 +65,9 @@
<strong>OUPS</strong> Afin de pouvoir réaliser le chiffrement dans votre navigateur, Javascript est <strong>vraiment</strong> nécessaire. <strong>OUPS</strong> Afin de pouvoir réaliser le chiffrement dans votre navigateur, Javascript est <strong>vraiment</strong> nécessaire.
</p> </p>
</noscript> </noscript>
<h5 id="tryit" data-localization="tryIt"></h5> <h5 id="tryit" data-localization="tryIt"></h5> (<a href="/file" target="_blank" data-localization="main_openFileManager">Open in a new tab</a>)
<!-- <table class="recent scroll" style="display:none"> <!--<table class="recent scroll" style="display:none">
<tbody> <tbody>
<tr> <tr>
@ -79,9 +79,8 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>-->
--> <iframe src="/file/#iframe" id="fileManagerIframe" style="display: none;"></iframe>
<iframe src="/file#iframe" style="width: 100%; height: 500px;"></iframe>
<div id="buttons" class="buttons"> <div id="buttons" class="buttons">
<a id="create-pad" class="button create" href="/pad/" data-localization="button_newpad"></a> <a id="create-pad" class="button create" href="/pad/" data-localization="button_newpad"></a>

@ -321,6 +321,11 @@ tr {
font-size: medium; font-size: medium;
padding-bottom: 1em; padding-bottom: 1em;
} }
#fileManagerIframe {
width: 100%;
height: 500px;
margin-top: 15px;
}
/* buttons */ /* buttons */
.create, .create,
.action { .action {

@ -123,16 +123,19 @@ define([
if (recentPads.length) { if (recentPads.length) {
recentPads.sort(Cryptpad.mostRecent); recentPads.sort(Cryptpad.mostRecent);
makeRecentPadsTable(recentPads); $('iframe').attr('style', '');
$tryit.removeAttr('data-localization');
$tryit.text(Messages.recentPadsIframe);
//makeRecentPadsTable(recentPads);
} }
if (hasRecent) { /*if (hasRecent) {
$('table').attr('style', ''); $('table').attr('style', '');
// Race condition here, this is triggered before the localization in HTML // Race condition here, this is triggered before the localization in HTML
// so we have to remove the data-localization attr // so we have to remove the data-localization attr
$tryit.removeAttr('data-localization'); $tryit.removeAttr('data-localization');
$tryit.text(Messages.recentPads); $tryit.text(Messages.recentPads);
} }*/
}); });
}; };

@ -150,6 +150,12 @@ p, pre, td, a, table, tr {
padding-bottom: 1em; padding-bottom: 1em;
} }
#fileManagerIframe {
width: 100%;
height: 500px;
margin-top: 15px;
}
/* buttons */ /* buttons */
.create, .action { .create, .action {
@thick: 2px; @thick: 2px;

@ -25,9 +25,9 @@
<strong>OUPS</strong> Afin de pouvoir réaliser le chiffrement dans votre navigateur, Javascript est <strong>vraiment</strong> nécessaire. <strong>OUPS</strong> Afin de pouvoir réaliser le chiffrement dans votre navigateur, Javascript est <strong>vraiment</strong> nécessaire.
</p> </p>
</noscript> </noscript>
<h5 id="tryit" data-localization="tryIt"></h5> <h5 id="tryit" data-localization="tryIt"></h5> (<a href="/file" target="_blank" data-localization="main_openFileManager">Open in a new tab</a>)
<table class="recent scroll" style="display:none"> <!--<table class="recent scroll" style="display:none">
<tbody> <tbody>
<tr> <tr>
@ -39,7 +39,8 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>-->
<iframe src="/file/#iframe" id="fileManagerIframe" style="display: none;"></iframe>
<div id="buttons" class="buttons"> <div id="buttons" class="buttons">
<a id="create-pad" class="button create" href="/pad/" data-localization="button_newpad"></a> <a id="create-pad" class="button create" href="/pad/" data-localization="button_newpad"></a>

@ -104,6 +104,7 @@ define(function () {
out.tryIt = 'Essayez-le !'; out.tryIt = 'Essayez-le !';
out.recentPads = 'Vos documents récents (stockés uniquement dans votre navigateur)'; out.recentPads = 'Vos documents récents (stockés uniquement dans votre navigateur)';
out.recentPadsIframe = 'Vos documents récents';
out.okButton = 'OK (Entrée)'; out.okButton = 'OK (Entrée)';
out.cancelButton = 'Annuler (Echap)'; out.cancelButton = 'Annuler (Echap)';
@ -217,6 +218,7 @@ define(function () {
out.main_about = 'À propos'; out.main_about = 'À propos';
out.main_about_p1 = 'Vous pouvez en apprendre davantage sur notre <a href="/privacy.html" title="">politique de confidentialité</a> et nos <a href="/terms.html">conditions d\'utilisation</a>.'; out.main_about_p1 = 'Vous pouvez en apprendre davantage sur notre <a href="/privacy.html" title="">politique de confidentialité</a> et nos <a href="/terms.html">conditions d\'utilisation</a>.';
out.main_about_p2 = 'Si vous avez des questions ou commentaires, vous pouvez <a href="https://twitter.com/cryptpad">nous tweeter</a>, ouvrir une issue sur <a href="https://github.com/xwiki-labs/cryptpad/issues/" title="our issue tracker">Github</a>, venir dire bonjour sur IRC (<a href="http://webchat.freenode.net?channels=%23cryptpad&uio=MT1mYWxzZSY5PXRydWUmMTE9Mjg3JjE1PXRydWUe7" title="freenode webchat">irc.freenode.net</a>), ou <a href="mailto:research@xwiki.com">nous envoyer un email</a>.'; out.main_about_p2 = 'Si vous avez des questions ou commentaires, vous pouvez <a href="https://twitter.com/cryptpad">nous tweeter</a>, ouvrir une issue sur <a href="https://github.com/xwiki-labs/cryptpad/issues/" title="our issue tracker">Github</a>, venir dire bonjour sur IRC (<a href="http://webchat.freenode.net?channels=%23cryptpad&uio=MT1mYWxzZSY5PXRydWUmMTE9Mjg3JjE1PXRydWUe7" title="freenode webchat">irc.freenode.net</a>), ou <a href="mailto:research@xwiki.com">nous envoyer un email</a>.';
out.main_openFileManager = 'Ouvrir dans un nouvel onglet';
out.table_type = 'Type'; out.table_type = 'Type';
out.table_link = 'Lien'; out.table_link = 'Lien';

@ -107,6 +107,7 @@ define(function () {
out.tryIt = 'Try it out!'; out.tryIt = 'Try it out!';
out.recentPads = 'Your recent pads (stored only in your browser)'; out.recentPads = 'Your recent pads (stored only in your browser)';
out.recentPadsIframe = 'Your recent pads';
out.okButton = 'OK (enter)'; out.okButton = 'OK (enter)';
out.cancelButton = 'Cancel (esc)'; out.cancelButton = 'Cancel (esc)';
@ -240,8 +241,8 @@ define(function () {
out.main_howitworks_p1 = 'CryptPad uses a variant of the <a href="https://en.wikipedia.org/wiki/Operational_transformation">Operational transformation</a> algorithm which is able to find distributed consensus using a <a href="https://bitcoin.org/bitcoin.pdf">Nakamoto Blockchain</a>, a construct popularized by <a href="https://en.wikipedia.org/wiki/Bitcoin">Bitcoin</a>. This way the algorithm can avoid the need for a central server to resolve Operational Transform Edit Conflicts and without the need for resolving conflicts, the server can be kept unaware of the content which is being edited on the pad.'; out.main_howitworks_p1 = 'CryptPad uses a variant of the <a href="https://en.wikipedia.org/wiki/Operational_transformation">Operational transformation</a> algorithm which is able to find distributed consensus using a <a href="https://bitcoin.org/bitcoin.pdf">Nakamoto Blockchain</a>, a construct popularized by <a href="https://en.wikipedia.org/wiki/Bitcoin">Bitcoin</a>. This way the algorithm can avoid the need for a central server to resolve Operational Transform Edit Conflicts and without the need for resolving conflicts, the server can be kept unaware of the content which is being edited on the pad.';
out.main_about = 'About'; out.main_about = 'About';
out.main_about_p1 = 'You can read more about our <a href="/privacy.html" title="">privacy policy</a> and <a href="/terms.html">terms of service</a>.'; out.main_about_p1 = 'You can read more about our <a href="/privacy.html" title="">privacy policy</a> and <a href="/terms.html">terms of service</a>.';
out.main_about_p2 = 'If you have any questions or comments, you can <a href="https://twitter.com/cryptpad">tweet us</a>, open an issue <a href="https://github.com/xwiki-labs/cryptpad/issues/" title="our issue tracker">on github</a>, come say hi on irc (<a href="http://webchat.freenode.net?channels=%23cryptpad&uio=MT1mYWxzZSY5PXRydWUmMTE9Mjg3JjE1PXRydWUe7" title="freenode webchat">irc.freenode.net</a>), or <a href="mailto:research@xwiki.com">send us an email</a>.'; out.main_about_p2 = 'If you have any questions or comments, you can <a href="https://twitter.com/cryptpad">tweet us</a>, open an issue <a href="https://github.com/xwiki-labs/cryptpad/issues/" title="our issue tracker">on github</a>, come say hi on irc (<a href="http://webchat.freenode.net?channels=%23cryptpad&uio=MT1mYWxzZSY5PXRydWUmMTE9Mjg3JjE1PXRydWUe7" title="freenode webchat">irc.freenode.net</a>), or <a href="mailto:research@xwiki.com">send us an email</a>.';
out.main_openFileManager = 'Open in a new tab';
out.table_type = 'Type'; out.table_type = 'Type';
out.table_link = 'Link'; out.table_link = 'Link';

@ -227,7 +227,7 @@ define([
appStatus._onReady.forEach(function (h) { appStatus._onReady.forEach(function (h) {
h(); h();
}); });
_onReady = []; appStatus._onReady = [];
} }
} }
}; };
@ -348,6 +348,7 @@ define([
// Open the selected context menu on the closest "li" element // Open the selected context menu on the closest "li" element
var openContextMenu = function (e, $menu) { var openContextMenu = function (e, $menu) {
module.hideMenu(); module.hideMenu();
e.stopPropagation();
var path = $(e.target).closest('li').data('path'); var path = $(e.target).closest('li').data('path');
if (!path) { return; } if (!path) { return; }
@ -744,13 +745,14 @@ define([
var SORT_FILE_DESC = 'sortFilesDesc'; var SORT_FILE_DESC = 'sortFilesDesc';
var onSortByClick = function (e) { var onSortByClick = function (e) {
var $span = $(this); var $span = $(this);
var value;
if ($span.hasClass('foldername')) { if ($span.hasClass('foldername')) {
var value = files[SORT_FOLDER_DESC]; value = files[SORT_FOLDER_DESC];
files[SORT_FOLDER_DESC] = value ? false : true; files[SORT_FOLDER_DESC] = value ? false : true;
refresh(); refresh();
return; return;
} }
var value = files[SORT_FILE_BY]; value = files[SORT_FILE_BY];
var descValue = files[SORT_FILE_DESC]; var descValue = files[SORT_FILE_DESC];
if ($span.hasClass('filename')) { if ($span.hasClass('filename')) {
if (value === '') { if (value === '') {
@ -1234,7 +1236,7 @@ define([
var i = 0; var i = 0;
var space = 10; var space = 10;
path.forEach(function (s) { path.forEach(function (s) {
if (i === 0) { s = rootName(s) } if (i === 0) { s = rootName(s); }
$div.append($('<span>', {'style': 'margin: 0 0 0 ' + i * space + 'px;'}).text(s)); $div.append($('<span>', {'style': 'margin: 0 0 0 ' + i * space + 'px;'}).text(s));
$div.append($('<br>')); $div.append($('<br>'));
i++; i++;
@ -1263,7 +1265,7 @@ define([
else if ($(this).hasClass('newfolder')) { else if ($(this).hasClass('newfolder')) {
var onCreated = function (info) { var onCreated = function (info) {
module.newFolder = info.newPath; module.newFolder = info.newPath;
module.displayDirectory(path);; module.displayDirectory(path);
}; };
filesOp.createNewFolder(path, null, onCreated); filesOp.createNewFolder(path, null, onCreated);
} }
@ -1437,14 +1439,9 @@ define([
Cryptpad.styleAlerts(); Cryptpad.styleAlerts();
if (window.location.hash && window.location.hash === "#iframe") { if (window.location.hash && window.location.hash === "#iframe") {
$('.top-bar').hide();
$('#pad-iframe').css({
top: "0px",
height: "100%"
});
$iframe.find('body').addClass('iframe'); $iframe.find('body').addClass('iframe');
window.location.hash = ""; window.location.hash = "";
homePageIframe = true; APP.homePageIframe = true;
} }
var hash = window.location.hash.slice(1) || localStorage.FS_hash; var hash = window.location.hash.slice(1) || localStorage.FS_hash;
@ -1465,8 +1462,8 @@ define([
rt.proxy.on('create', function (info) { rt.proxy.on('create', function (info) {
var realtime = module.realtime = info.realtime; var realtime = module.realtime = info.realtime;
var editHash = !readOnly ? Cryptpad.getEditHashFromKeys(info.channel, secret.keys) : undefined; var editHash = APP.editHash = !readOnly ? Cryptpad.getEditHashFromKeys(info.channel, secret.keys) : undefined;
var viewHash = Cryptpad.getViewHashFromKeys(info.channel, secret.keys); var viewHash = APP.viewHash = Cryptpad.getViewHashFromKeys(info.channel, secret.keys);
APP.hash = readOnly ? viewHash : editHash; APP.hash = readOnly ? viewHash : editHash;
if (!readOnly && (!window.location.hash || !localStorage.FS_hash)) { if (!readOnly && (!window.location.hash || !localStorage.FS_hash)) {
@ -1478,7 +1475,7 @@ define([
logging: true, logging: true,
}); });
userList = APP.userList = info.userList; var userList = APP.userList = info.userList;
var config = { var config = {
readOnly: readOnly, readOnly: readOnly,
ifrw: window, ifrw: window,
@ -1490,8 +1487,23 @@ define([
var $bar = APP.$bar; var $bar = APP.$bar;
var $rightside = $bar.find('.' + Toolbar.constants.rightside); var $rightside = $bar.find('.' + Toolbar.constants.rightside);
var $userBlock = $bar.find('.' + Toolbar.constants.username); var $userBlock = $bar.find('.' + Toolbar.constants.username);
var $editShare = $bar.find('.' + Toolbar.constants.editShare);
var $viewShare = $bar.find('.' + Toolbar.constants.viewShare); if (APP.homePageIframe) {
var $linkToMain = $bar.find('.cryptpad-link a');
$linkToMain.attr('href', '#');
$linkToMain.attr('title', '');
$linkToMain.css('cursor', 'default');
$linkToMain.off('click');
}
if (!readOnly) {
var $backupButton = Cryptpad.createButton('', true);
$backupButton.on('click', function() {
var url = window.location.origin + window.location.pathname + '#' + editHash;
Cryptpad.alert("Backup URL for this pad. It is highly recommended that you do not share it with other people.<br>Anybody with that URL can remove all the files in your file manager.<br>" + url);
});
$userBlock.append($backupButton);
}
}).on('ready', function () { }).on('ready', function () {
module.files = rt.proxy; module.files = rt.proxy;
@ -1506,6 +1518,7 @@ define([
} }
initLocalStorage(); initLocalStorage();
init(rt.proxy); init(rt.proxy);
APP.userList.onChange();
}) })
.on('disconnect', function (info) { .on('disconnect', function (info) {
setEditable(false); setEditable(false);

@ -660,7 +660,7 @@ define([
}); });
}; };
var disconnect = function () { var disconnect = function (info) {
//setEditable(false); // TODO //setEditable(false); // TODO
if (info.error) { if (info.error) {
Cryptpad.alert(Messages.websocketError); Cryptpad.alert(Messages.websocketError);

Loading…
Cancel
Save