Lock the UI for unregistered users

pull/1/head
yflory 7 years ago
parent 303adaea4c
commit 0dfae72f88

@ -319,6 +319,9 @@ define(function () {
// OnlyOffice // OnlyOffice
out.oo_saveError = "Une erreur s'est produite lors de la sauvegarde de vos modifications. Merci de réessayer dans quelques instants."; out.oo_saveError = "Une erreur s'est produite lors de la sauvegarde de vos modifications. Merci de réessayer dans quelques instants.";
out.oo_newVersion = "Une nouvelle version du document est disponible. Cliquez sur OK pour l'ouvrir."; out.oo_newVersion = "Une nouvelle version du document est disponible. Cliquez sur OK pour l'ouvrir.";
out.oo_locked = "Ce document est actuellement verrouillé. ";
out.oo_locked_unregistered = "Seuls les utilisateurs enregistrés peuvent le modifier.";
out.oo_locked_edited = "Un seul utilisateur à la fois peut modifier le document.";
// Profile // Profile
out.profileButton = "Profil"; // dropdown menu out.profileButton = "Profil"; // dropdown menu

@ -307,6 +307,9 @@ define(function () {
// OnlyOffice // OnlyOffice
out.oo_saveError = "We were unable to save your modifications, please try again in a few moments."; out.oo_saveError = "We were unable to save your modifications, please try again in a few moments.";
out.oo_newVersion = "A new version of this document is available, click OK to load it."; out.oo_newVersion = "A new version of this document is available, click OK to load it.";
out.oo_locked = "This document is currently locked. ";
out.oo_locked_unregistered = "Only registered users can edit.";
out.oo_locked_edited = "Only one person can edit at a time.";
// Canvas // Canvas
out.canvas_clear = "Clear"; out.canvas_clear = "Clear";

@ -80,7 +80,8 @@ define([
var startOO = function (blob, file) { var startOO = function (blob, file) {
if (APP.ooconfig) { return void console.error('already started'); } if (APP.ooconfig) { return void console.error('already started'); }
var url = URL.createObjectURL(blob); var url = URL.createObjectURL(blob);
var lock = locked !== common.getMetadataMgr().getNetfluxId(); var lock = locked !== common.getMetadataMgr().getNetfluxId() ||
!common.isLoggedIn();
// Config // Config
APP.ooconfig = { APP.ooconfig = {
@ -122,12 +123,11 @@ define([
'#fm-btn-save { display: none !important; }' + '#fm-btn-save { display: none !important; }' +
'#header { display: none !important; }'; '#header { display: none !important; }';
$('<style>').text(css).appendTo($tb); $('<style>').text(css).appendTo($tb);
console.log($('iframe[name="frameEditor"]')); if (UI.findOKButton().length) {
console.log($tb); UI.findOKButton().on('focusout', function () {
return; window.setTimeout(function () { UI.findOKButton().focus(); });
$tb.find('> .toolbar-group:visible').first().hide(); });
$tb.find('> .separator').first().hide(); }
console.log($tb.find('> .toolbar-group:visible'));
}, },
"onAppReady": function(/*evt*/) { console.log("in onAppReady"); }, "onAppReady": function(/*evt*/) { console.log("in onAppReady"); },
"onDownloadAs": function (evt) { console.log("in onDownloadAs", evt); } "onDownloadAs": function (evt) { console.log("in onDownloadAs", evt); }
@ -362,8 +362,15 @@ define([
locked = me; locked = me;
APP.onLocal(); APP.onLocal();
} }
if (!common.isLoggedIn()) {
UI.alert(Messages.oo_locked + Messages.oo_locked_unregistered);
} else if (locked !== me) {
UI.alert(Messages.oo_locked + Messages.oo_locked_edited);
}
} }
loadDocument(newDoc); loadDocument(newDoc);
initializing = false; initializing = false;

Loading…
Cancel
Save