Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
This commit is contained in:
commit
2eccc6a69f
@ -176,7 +176,18 @@ define([
|
|||||||
window.location.reload();
|
window.location.reload();
|
||||||
} else if (o && !n) {
|
} else if (o && !n) {
|
||||||
//window.location.reload();
|
//window.location.reload();
|
||||||
window.location.href = '/';
|
//window.location.href = '/';
|
||||||
|
$(window).on('keyup', function (e) {
|
||||||
|
if (e.keyCode === 27) {
|
||||||
|
Cryptpad.removeLoadingScreen();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Cryptpad.logout();
|
||||||
|
Cryptpad.addLoadingScreen();
|
||||||
|
Cryptpad.errorLoadingScreen(Messages.onLogout, true);
|
||||||
|
if (exp.info) {
|
||||||
|
exp.info.network.disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@ define(function () {
|
|||||||
|
|
||||||
out.websocketError = 'Impossible de se connecter au serveur WebSocket...';
|
out.websocketError = 'Impossible de se connecter au serveur WebSocket...';
|
||||||
out.typeError = "Ce document temps-réel n'est pas compatible avec l'application sélectionnée";
|
out.typeError = "Ce document temps-réel n'est pas compatible avec l'application sélectionnée";
|
||||||
|
out.onLogout = 'Vous êtes déconnecté de votre compte utilisateur, <a href="/" target="_blank">cliquez ici</a> pour vous authentifier<br>ou appuyez sur <em>Échap</em> pour accéder au document en mode lecture seule.';
|
||||||
|
|
||||||
out.loading = "Chargement...";
|
out.loading = "Chargement...";
|
||||||
out.error = "Erreur";
|
out.error = "Erreur";
|
||||||
|
|||||||
@ -29,6 +29,7 @@ define(function () {
|
|||||||
|
|
||||||
out.websocketError = 'Unable to connect to the websocket server...';
|
out.websocketError = 'Unable to connect to the websocket server...';
|
||||||
out.typeError = "That realtime document is not compatible with the selected application";
|
out.typeError = "That realtime document is not compatible with the selected application";
|
||||||
|
out.onLogout = 'You are logged out, <a href="/" target="_blank">click here</a> to log in<br>or press <em>Escape</em> to access your pad in read-only mode.';
|
||||||
|
|
||||||
out.loading = "Loading...";
|
out.loading = "Loading...";
|
||||||
out.error = "Error";
|
out.error = "Error";
|
||||||
|
|||||||
@ -719,6 +719,8 @@ define([
|
|||||||
var realtime = module.realtime = Realtime.start(config);
|
var realtime = module.realtime = Realtime.start(config);
|
||||||
|
|
||||||
editor.on('change', onLocal);
|
editor.on('change', onLocal);
|
||||||
|
|
||||||
|
Cryptpad.onLogout(function () { setEditable(false); });
|
||||||
};
|
};
|
||||||
|
|
||||||
var interval = 100;
|
var interval = 100;
|
||||||
|
|||||||
@ -107,8 +107,18 @@ define([
|
|||||||
}
|
}
|
||||||
eraseTempSessionValues();
|
eraseTempSessionValues();
|
||||||
|
|
||||||
|
logoutHandlers.forEach(function (h) {
|
||||||
|
if (typeof (h) === "function") { h(); }
|
||||||
|
});
|
||||||
|
|
||||||
if (cb) { cb(); }
|
if (cb) { cb(); }
|
||||||
};
|
};
|
||||||
|
var logoutHandlers= [];
|
||||||
|
var onLogout = common.onLogout = function (h) {
|
||||||
|
if (typeof (h) !== "function") { return; }
|
||||||
|
if (logoutHandlers.indexOf(h) !== -1) { return; }
|
||||||
|
logoutHandlers.push(h);
|
||||||
|
};
|
||||||
|
|
||||||
var getUserHash = common.getUserHash = function () {
|
var getUserHash = common.getUserHash = function () {
|
||||||
var hash;
|
var hash;
|
||||||
@ -760,6 +770,10 @@ define([
|
|||||||
|
|
||||||
var LOADING = 'loading';
|
var LOADING = 'loading';
|
||||||
common.addLoadingScreen = function () {
|
common.addLoadingScreen = function () {
|
||||||
|
if ($('#' + LOADING).length) {
|
||||||
|
$('#' + LOADING).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
var $loading = $('<div>', {id: LOADING});
|
var $loading = $('<div>', {id: LOADING});
|
||||||
var $container = $('<div>', {'class': 'loadingContainer'});
|
var $container = $('<div>', {'class': 'loadingContainer'});
|
||||||
$container.append('<img class="cryptofist" src="/customize/cryptofist_small.png" />');
|
$container.append('<img class="cryptofist" src="/customize/cryptofist_small.png" />');
|
||||||
@ -773,9 +787,10 @@ define([
|
|||||||
common.removeLoadingScreen = function (cb) {
|
common.removeLoadingScreen = function (cb) {
|
||||||
$('#' + LOADING).fadeOut(750, cb);
|
$('#' + LOADING).fadeOut(750, cb);
|
||||||
};
|
};
|
||||||
common.errorLoadingScreen = function (error) {
|
common.errorLoadingScreen = function (error, transparent) {
|
||||||
$('.spinnerContainer').hide();
|
$('.spinnerContainer').hide();
|
||||||
$('#' + LOADING).find('p').text(error || Messages.error);
|
if (transparent) { $('#' + LOADING).css('opacity', 0.8); }
|
||||||
|
$('#' + LOADING).find('p').html(error || Messages.error);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -49,6 +49,7 @@ define([
|
|||||||
|
|
||||||
var $style;
|
var $style;
|
||||||
|
|
||||||
|
var connected = false;
|
||||||
var firstConnection = true;
|
var firstConnection = true;
|
||||||
var lagErrors = 0;
|
var lagErrors = 0;
|
||||||
|
|
||||||
@ -414,6 +415,8 @@ define([
|
|||||||
content: Messages.user_rename
|
content: Messages.user_rename
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
var parsed = Cryptpad.parsePadUrl(window.location.href);
|
||||||
|
if (parsed && parsed.type && parsed.type !== 'drive') {
|
||||||
options.push({
|
options.push({
|
||||||
tag: 'a',
|
tag: 'a',
|
||||||
attributes: {
|
attributes: {
|
||||||
@ -422,6 +425,7 @@ define([
|
|||||||
},
|
},
|
||||||
content: Messages.login_accessDrive
|
content: Messages.login_accessDrive
|
||||||
});
|
});
|
||||||
|
}
|
||||||
// Add login or logout button depending on the current status
|
// Add login or logout button depending on the current status
|
||||||
if (account) {
|
if (account) {
|
||||||
options.push({
|
options.push({
|
||||||
@ -453,6 +457,7 @@ define([
|
|||||||
left: true, // Open to the left of the button
|
left: true, // Open to the left of the button
|
||||||
};
|
};
|
||||||
var $userAdmin = Cryptpad.createDropdown(dropdownConfigUser);
|
var $userAdmin = Cryptpad.createDropdown(dropdownConfigUser);
|
||||||
|
$userAdmin.attr('id', 'userDropdown');
|
||||||
$userContainer.append($userAdmin);
|
$userContainer.append($userAdmin);
|
||||||
|
|
||||||
$userAdmin.find('a.logout').click(function (e) {
|
$userAdmin.find('a.logout').click(function (e) {
|
||||||
@ -522,7 +527,7 @@ define([
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
$input.on('keyup', function (e) {
|
$input.on('keyup', function (e) {
|
||||||
if (e.which === 13) {
|
if (e.which === 13 && connected === true) {
|
||||||
var name = $input.val().trim();
|
var name = $input.val().trim();
|
||||||
if (name === "") {
|
if (name === "") {
|
||||||
name = $input.attr('placeholder');
|
name = $input.attr('placeholder');
|
||||||
@ -544,6 +549,7 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
var displayInput = function () {
|
var displayInput = function () {
|
||||||
|
if (connected === false) { return; }
|
||||||
$text.hide();
|
$text.hide();
|
||||||
//$pencilIcon.css('display', 'none');
|
//$pencilIcon.css('display', 'none');
|
||||||
var inputVal = suggestName() || "";
|
var inputVal = suggestName() || "";
|
||||||
@ -575,8 +581,6 @@ define([
|
|||||||
var loadElement;
|
var loadElement;
|
||||||
var $stateElement = toolbar.find('.' + STATE_CLS);
|
var $stateElement = toolbar.find('.' + STATE_CLS);
|
||||||
|
|
||||||
var connected = false;
|
|
||||||
|
|
||||||
if (config.ifrw) {
|
if (config.ifrw) {
|
||||||
var removeDropdowns = function (e) {
|
var removeDropdowns = function (e) {
|
||||||
$container.find('.cryptpad-dropdown').hide();
|
$container.find('.cryptpad-dropdown').hide();
|
||||||
@ -701,12 +705,21 @@ define([
|
|||||||
checkLag(getLag, lagElement);
|
checkLag(getLag, lagElement);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
||||||
return {
|
var failed = function () {
|
||||||
failed: function () {
|
|
||||||
connected = false;
|
connected = false;
|
||||||
$stateElement.text(Messages.disconnected);
|
$stateElement.text(Messages.disconnected);
|
||||||
checkLag(undefined, lagElement);
|
checkLag(undefined, lagElement);
|
||||||
},
|
};
|
||||||
|
|
||||||
|
// On log out, remove permanently the realtime elements of the toolbar
|
||||||
|
Cryptpad.onLogout(function () {
|
||||||
|
failed();
|
||||||
|
$userAdminElement.find('#userDropdown').hide();
|
||||||
|
$(userListElement).hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
failed: failed,
|
||||||
reconnecting: function (userId) {
|
reconnecting: function (userId) {
|
||||||
myUserName = userId;
|
myUserName = userId;
|
||||||
connected = false;
|
connected = false;
|
||||||
|
|||||||
@ -30,7 +30,7 @@ define([
|
|||||||
editable: false,
|
editable: false,
|
||||||
Cryptpad: Cryptpad,
|
Cryptpad: Cryptpad,
|
||||||
loggedIn: Cryptpad.isLoggedIn(),
|
loggedIn: Cryptpad.isLoggedIn(),
|
||||||
mobile: $('body').width() <= 600 // Menu and content area are not inline-block anymore for mobiles
|
mobile: function () { return $('body').width() <= 600; } // Menu and content area are not inline-block anymore for mobiles
|
||||||
};
|
};
|
||||||
|
|
||||||
var stringify = APP.stringify = function (obj) {
|
var stringify = APP.stringify = function (obj) {
|
||||||
@ -801,7 +801,7 @@ define([
|
|||||||
if (!path || path.length === 0) { return; }
|
if (!path || path.length === 0) { return; }
|
||||||
var isTrash = filesOp.isPathInTrash(path);
|
var isTrash = filesOp.isPathInTrash(path);
|
||||||
var $title = $('<span>', {'class': 'path unselectable'});
|
var $title = $('<span>', {'class': 'path unselectable'});
|
||||||
if (APP.mobile) {
|
if (APP.mobile()) {
|
||||||
return $title;
|
return $title;
|
||||||
}
|
}
|
||||||
path.forEach(function (p, idx) {
|
path.forEach(function (p, idx) {
|
||||||
@ -1170,7 +1170,7 @@ define([
|
|||||||
var $toolbar = $driveToolbar;
|
var $toolbar = $driveToolbar;
|
||||||
$toolbar.html('');
|
$toolbar.html('');
|
||||||
var $leftside = $('<div>', {'class': 'leftside'}).appendTo($toolbar);
|
var $leftside = $('<div>', {'class': 'leftside'}).appendTo($toolbar);
|
||||||
if (!APP.mobile) {
|
if (!APP.mobile()) {
|
||||||
$leftside.width($tree.width());
|
$leftside.width($tree.width());
|
||||||
}
|
}
|
||||||
var $rightside = $('<div>', {'class': 'rightside'}).appendTo($toolbar);
|
var $rightside = $('<div>', {'class': 'rightside'}).appendTo($toolbar);
|
||||||
@ -1339,7 +1339,7 @@ define([
|
|||||||
var $modeButton = createViewModeButton().appendTo($toolbar.find('.rightside'));
|
var $modeButton = createViewModeButton().appendTo($toolbar.find('.rightside'));
|
||||||
var $title = createTitle(path).appendTo($toolbar.find('.rightside'));
|
var $title = createTitle(path).appendTo($toolbar.find('.rightside'));
|
||||||
|
|
||||||
if (APP.mobile) {
|
if (APP.mobile()) {
|
||||||
var $context = $('<button>', {'class': 'element right dropdown-bar', id: 'contextButton'});
|
var $context = $('<button>', {'class': 'element right dropdown-bar', id: 'contextButton'});
|
||||||
$context.append($('<span>', {'class': 'fa fa-caret-down'}));
|
$context.append($('<span>', {'class': 'fa fa-caret-down'}));
|
||||||
$context.appendTo($toolbar.find('.rightside'));
|
$context.appendTo($toolbar.find('.rightside'));
|
||||||
@ -1822,7 +1822,7 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
$iframe.find('#tree').mousedown(function (e) {
|
$iframe.find('#tree').mousedown(function (e) {
|
||||||
if (APP.mobile) { return; }
|
if (APP.mobile()) { return; }
|
||||||
if (APP.resizeTree) { return; }
|
if (APP.resizeTree) { return; }
|
||||||
APP.resizeTree = window.setInterval(function () {
|
APP.resizeTree = window.setInterval(function () {
|
||||||
$driveToolbar.find('.leftside').width($tree.width());
|
$driveToolbar.find('.leftside').width($tree.width());
|
||||||
@ -1997,6 +1997,8 @@ define([
|
|||||||
proxy.on('reconnect', function (info) {
|
proxy.on('reconnect', function (info) {
|
||||||
onReconnect(info);
|
onReconnect(info);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cryptpad.onLogout(function () { setEditable(false); });
|
||||||
});
|
});
|
||||||
Cryptpad.onError(function (info) {
|
Cryptpad.onError(function (info) {
|
||||||
if (info) {
|
if (info) {
|
||||||
|
|||||||
@ -620,6 +620,23 @@ define([
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Expand / collapse the toolbar
|
||||||
|
var $existingButton = $bar.find('#cke_1_toolbar_collapser');
|
||||||
|
var $collapse = Cryptpad.createButton(null, true);
|
||||||
|
$existingButton.hide();
|
||||||
|
$collapse.removeClass('fa-question');
|
||||||
|
var updateIcon = function () {
|
||||||
|
$collapse.removeClass('fa-caret-down').removeClass('fa-caret-up');
|
||||||
|
var isCollapsed = !$bar.find('.cke_toolbox_main').is(':visible');
|
||||||
|
if (isCollapsed) { $collapse.addClass('fa-caret-down') }
|
||||||
|
else { $collapse.addClass('fa-caret-up') }
|
||||||
|
};
|
||||||
|
updateIcon();
|
||||||
|
$collapse.click(function () {
|
||||||
|
$existingButton.click();
|
||||||
|
updateIcon();
|
||||||
|
});
|
||||||
|
$rightside.append($collapse);
|
||||||
|
|
||||||
/* add an export button */
|
/* add an export button */
|
||||||
var $export = Cryptpad.createButton('export', true, {}, exportFile);
|
var $export = Cryptpad.createButton('export', true, {}, exportFile);
|
||||||
@ -754,6 +771,8 @@ define([
|
|||||||
|
|
||||||
var rti = module.realtimeInput = realtimeInput.start(realtimeOptions);
|
var rti = module.realtimeInput = realtimeInput.start(realtimeOptions);
|
||||||
|
|
||||||
|
Cryptpad.onLogout(function () { setEditable(false); });
|
||||||
|
|
||||||
/* hitting enter makes a new line, but places the cursor inside
|
/* hitting enter makes a new line, but places the cursor inside
|
||||||
of the <br> instead of the <p>. This makes it such that you
|
of the <br> instead of the <p>. This makes it such that you
|
||||||
cannot type until you click, which is rather unnacceptable.
|
cannot type until you click, which is rather unnacceptable.
|
||||||
|
|||||||
@ -796,6 +796,8 @@ define([
|
|||||||
$('#howItWorks').hide();
|
$('#howItWorks').hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Cryptpad.onLogout(function () { setEditable(false); }); TODO
|
||||||
});
|
});
|
||||||
Cryptpad.onError(function (info) {
|
Cryptpad.onError(function (info) {
|
||||||
if (info) {
|
if (info) {
|
||||||
|
|||||||
@ -802,6 +802,8 @@ define([
|
|||||||
var realtime = module.realtime = Realtime.start(config);
|
var realtime = module.realtime = Realtime.start(config);
|
||||||
|
|
||||||
editor.on('change', onLocal);
|
editor.on('change', onLocal);
|
||||||
|
|
||||||
|
Cryptpad.onLogout(function () { setEditable(false); });
|
||||||
};
|
};
|
||||||
|
|
||||||
var interval = 100;
|
var interval = 100;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user