loleaflet: add parameter to disable 'About' menu

Change-Id: I07fa655b8318f78d7e479a3dc34830ebe5f81a2e
This commit is contained in:
Henry Castro 2017-05-24 10:28:14 -04:00
parent 05deed08b4
commit 5d22b274f8
3 changed files with 9 additions and 1 deletions

View file

@ -106,6 +106,7 @@
var permission = getParameterByName('permission') || 'edit';
var timestamp = getParameterByName('timestamp');
var closebutton = getParameterByName('closebutton');
var disableAbout = getParameterByName('disableabout');
if (wopiSrc === '' && filePath === '') {
vex.dialog.alert(wrongwopisrc);
}

View file

@ -75,6 +75,8 @@ var closebutton = getParameterByName('closebutton');
var revHistoryEnabled = getParameterByName('revisionhistory');
// Should the document go inactive or not
var alwaysActive = getParameterByName('alwaysactive');
// Disable the about dialog
var disableAbout = getParameterByName('disableabout');
// Loleaflet Debug mode
var debugMode = getParameterByName('debug');
if (wopiSrc === '' && filePath === '') {
@ -88,6 +90,7 @@ if (host === '') {
// TODO: Get rid of these globals
global.closebutton = closebutton;
global.revHistoryEnabled = revHistoryEnabled;
global.disableAbout = disableAbout;
global.title = title;
global.errorMessages = errorMessages;
var docURL, docParams;

View file

@ -2,7 +2,7 @@
* Control.Menubar
*/
/* global $ _ map title vex revHistoryEnabled closebutton */
/* global $ _ map title vex revHistoryEnabled closebutton disableAbout*/
L.Control.Menubar = L.Control.extend({
// TODO: Some mechanism to stop the need to copy duplicate menus (eg. Help)
options: {
@ -541,6 +541,10 @@ L.Control.Menubar = L.Control.extend({
_createMenu: function(menu) {
var itemList = [];
for (var i in menu) {
if (menu[i].id === 'help' && disableAbout) {
menu[i].menu.pop();
}
if (map._permission === 'readonly' && menu[i].type === 'menu') {
var found = false;
for (var j in this.options.allowedReadonlyMenus) {