Improve the UI in read-only mode
This commit is contained in:
parent
202925302e
commit
83705ae058
@ -65,10 +65,9 @@ define(function () {
|
|||||||
|
|
||||||
out.commitButton = 'VALIDER';
|
out.commitButton = 'VALIDER';
|
||||||
|
|
||||||
out.linksButton = 'LIENS';
|
out.getViewButton = 'LECTURE SEULE';
|
||||||
out.linksButtonTitle = 'Obtenir les liens disponibles pour accéder à ce document';
|
out.getViewButtonTitle = "Obtenir l'adresse d'accès à ce document en lecture seule";
|
||||||
out.readonlyUrl = 'Lien de lecture seule';
|
out.readonlyUrl = 'URL de lecture seule';
|
||||||
out.editUrl = "Lien d'édition";
|
|
||||||
|
|
||||||
out.disconnectAlert = 'Perte de la connexion au réseau !';
|
out.disconnectAlert = 'Perte de la connexion au réseau !';
|
||||||
|
|
||||||
|
|||||||
@ -64,11 +64,10 @@ define(function () {
|
|||||||
out.presentSuccess = 'Hit ESC to exit presentation mode';
|
out.presentSuccess = 'Hit ESC to exit presentation mode';
|
||||||
|
|
||||||
out.commitButton = 'COMMIT';
|
out.commitButton = 'COMMIT';
|
||||||
|
|
||||||
out.linksButton = 'LINKS';
|
out.getViewButton = 'READ-ONLY URL';
|
||||||
out.linksButtonTitle = 'Get the available links for this document';
|
out.getViewButtonTitle = 'Get the read-only URL for this document';
|
||||||
out.readonlyUrl = 'Read only URL';
|
out.readonlyUrl = 'Read only URL';
|
||||||
out.editUrl = 'Edit URL';
|
|
||||||
|
|
||||||
out.disconnectAlert = 'Network connection lost!';
|
out.disconnectAlert = 'Network connection lost!';
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,10 @@ define([
|
|||||||
toolbar;
|
toolbar;
|
||||||
|
|
||||||
var secret = Cryptpad.getSecrets();
|
var secret = Cryptpad.getSecrets();
|
||||||
var readOnly = !secret.keys.editKeyStr;
|
var readOnly = secret.keys && !secret.keys.editKeyStr;
|
||||||
|
if (!secret.keys) {
|
||||||
|
secret.keys = secret.key;
|
||||||
|
}
|
||||||
|
|
||||||
var andThen = function (CMeditor) {
|
var andThen = function (CMeditor) {
|
||||||
var CodeMirror = module.CodeMirror = CMeditor;
|
var CodeMirror = module.CodeMirror = CMeditor;
|
||||||
@ -398,21 +401,20 @@ define([
|
|||||||
});
|
});
|
||||||
$rightside.append($forgetPad);
|
$rightside.append($forgetPad);
|
||||||
|
|
||||||
/* add a 'links' button */
|
if (!readOnly && viewHash) {
|
||||||
var $links = $('<button>', {
|
/* add a 'links' button */
|
||||||
title: Messages.linksButtonTitle
|
var $links = $('<button>', {
|
||||||
})
|
title: Messages.getViewButtonTitle
|
||||||
.text(Messages.linksButton)
|
})
|
||||||
.addClass('rightside-button')
|
.text(Messages.getViewButton)
|
||||||
.click(function () {
|
.addClass('rightside-button')
|
||||||
var baseUrl = window.location.origin + window.location.pathname + '#';
|
.click(function () {
|
||||||
var content = '<b>' + Messages.readonlyUrl + '</b> : <a target="_blank">' + baseUrl + viewHash + '</a>';
|
var baseUrl = window.location.origin + window.location.pathname + '#';
|
||||||
if (!readOnly) {
|
var content = '<b>' + Messages.readonlyUrl + '</b><br><a target="_blank">' + baseUrl + viewHash + '</a><br>';
|
||||||
content += '<br><b>' + Messages.editUrl + '</b> : <a target="_blank">' + baseUrl + editHash + '</a>';
|
Cryptpad.alert(content);
|
||||||
}
|
});
|
||||||
Cryptpad.alert(content);
|
$rightside.append($links);
|
||||||
});
|
}
|
||||||
$rightside.append($links);
|
|
||||||
|
|
||||||
var configureLanguage = function (cb) {
|
var configureLanguage = function (cb) {
|
||||||
// FIXME this is async so make it happen as early as possible
|
// FIXME this is async so make it happen as early as possible
|
||||||
|
|||||||
@ -139,11 +139,14 @@ define([
|
|||||||
|
|
||||||
var getEditHashFromKeys = common.getEditHashFromKeys = function (chanKey, keys) {
|
var getEditHashFromKeys = common.getEditHashFromKeys = function (chanKey, keys) {
|
||||||
if (typeof keys === 'string') {
|
if (typeof keys === 'string') {
|
||||||
return chanKey + Crypto.b64RemoveSlashes(keys);
|
return chanKey + keys;
|
||||||
}
|
}
|
||||||
return '/1/edit/' + hexToBase64(chanKey) + '/' + Crypto.b64RemoveSlashes(keys.editKeyStr);
|
return '/1/edit/' + hexToBase64(chanKey) + '/' + Crypto.b64RemoveSlashes(keys.editKeyStr);
|
||||||
};
|
};
|
||||||
var getViewHashFromKeys = common.getViewHashFromKeys = function (chanKey, keys) {
|
var getViewHashFromKeys = common.getViewHashFromKeys = function (chanKey, keys) {
|
||||||
|
if (typeof keys === 'string') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
return '/1/view/' + hexToBase64(chanKey) + '/' + Crypto.b64RemoveSlashes(keys.viewKeyStr);
|
return '/1/view/' + hexToBase64(chanKey) + '/' + Crypto.b64RemoveSlashes(keys.viewKeyStr);
|
||||||
};
|
};
|
||||||
var getHashFromKeys = common.getHashFromKeys = getEditHashFromKeys;
|
var getHashFromKeys = common.getHashFromKeys = getEditHashFromKeys;
|
||||||
@ -178,7 +181,7 @@ define([
|
|||||||
var version = hashArray[1];
|
var version = hashArray[1];
|
||||||
/*if (version === "1") {
|
/*if (version === "1") {
|
||||||
secret.channel = base64ToHex(hashArray[2]);
|
secret.channel = base64ToHex(hashArray[2]);
|
||||||
secret.key = hashArray[3].replace(/-/g, '/'); //TODO replace / by -
|
secret.key = hashArray[3].replace(/-/g, '/');
|
||||||
if (secret.channel.length !== 32 || secret.key.length !== 24) {
|
if (secret.channel.length !== 32 || secret.key.length !== 24) {
|
||||||
common.alert("The channel key and/or the encryption key is invalid");
|
common.alert("The channel key and/or the encryption key is invalid");
|
||||||
throw new Error("The channel key and/or the encryption key is invalid");
|
throw new Error("The channel key and/or the encryption key is invalid");
|
||||||
|
|||||||
@ -65,7 +65,10 @@ define([
|
|||||||
|
|
||||||
var andThen = function (Ckeditor) {
|
var andThen = function (Ckeditor) {
|
||||||
var secret = Cryptpad.getSecrets();
|
var secret = Cryptpad.getSecrets();
|
||||||
var readOnly = !secret.keys.editKeyStr;
|
var readOnly = secret.keys && !secret.keys.editKeyStr;
|
||||||
|
if (!secret.keys) {
|
||||||
|
secret.keys = secret.key;
|
||||||
|
}
|
||||||
|
|
||||||
var fixThings = false;
|
var fixThings = false;
|
||||||
|
|
||||||
@ -566,21 +569,20 @@ define([
|
|||||||
});
|
});
|
||||||
$rightside.append($forgetPad);
|
$rightside.append($forgetPad);
|
||||||
|
|
||||||
/* add a 'links' button */
|
if (!readOnly && viewHash) {
|
||||||
var $links = $('<button>', {
|
/* add a 'links' button */
|
||||||
title: Messages.linksButtonTitle
|
var $links = $('<button>', {
|
||||||
})
|
title: Messages.getViewButtonTitle
|
||||||
.text(Messages.linksButton)
|
})
|
||||||
.addClass('rightside-button')
|
.text(Messages.getViewButton)
|
||||||
.click(function () {
|
.addClass('rightside-button')
|
||||||
var baseUrl = window.location.origin + window.location.pathname + '#';
|
.click(function () {
|
||||||
var content = '<b>' + Messages.readonlyUrl + '</b> : <a target="_blank">' + baseUrl + viewHash + '</a>';
|
var baseUrl = window.location.origin + window.location.pathname + '#';
|
||||||
if (!readOnly) {
|
var content = '<b>' + Messages.readonlyUrl + '</b><br><a target="_blank">' + baseUrl + viewHash + '</a><br>';
|
||||||
content += '<br><b>' + Messages.editUrl + '</b> : <a target="_blank">' + baseUrl + editHash + '</a>';
|
Cryptpad.alert(content);
|
||||||
}
|
});
|
||||||
Cryptpad.alert(content);
|
$rightside.append($links);
|
||||||
});
|
}
|
||||||
$rightside.append($links);
|
|
||||||
|
|
||||||
// set the hash
|
// set the hash
|
||||||
if (!readOnly) {
|
if (!readOnly) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user