[Libreoffice-commits] online.git: loleaflet/dist loleaflet/src

Pranav Kant pranavk at collabora.co.uk
Fri Feb 17 12:26:27 UTC 2017


 loleaflet/dist/toolbar/toolbar.js        |   15 +++++++++++++++
 loleaflet/src/control/Control.Menubar.js |    6 +-----
 2 files changed, 16 insertions(+), 5 deletions(-)

New commits:
commit 625a9099026b3c1799cfa3dd16734b691eadc632
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Feb 17 17:54:45 2017 +0530

    loleaflet: Kill manual browser checking code; user our Browser class
    
    Change-Id: Ia75e1f1bf79647c2eb6562fed8c549b3e272a953

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 733dda9..09c7a3f 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -940,6 +940,10 @@ map.on('wopiprops', function(e) {
 });
 
 map.on('doclayerinit', function () {
+	if (map.getPermission() === 'readonly') {
+		return;
+	}
+
 	var toolbarUp = w2ui['toolbar-up'];
 	var toolbarUpMore = w2ui['toolbar-up-more'];
 	var statusbar = w2ui['toolbar-down'];
@@ -1452,6 +1456,17 @@ map.on('hyperlinkclicked', function (e) {
 map.on('updatepermission', function (e) {
 	var toolbar = w2ui['toolbar-up'];
 	var toolbarUpMore = w2ui['toolbar-up-more'];
+
+	if (e.perm === 'readonly') {
+		// if readonly, hide all the items in toolbars except close
+		for (id in w2ui['toolbar-up'].items) {
+			if (w2ui['toolbar-up'].items[id].id !== 'close') {
+				w2ui['toolbar-up'].hide(w2ui['toolbar-up'].items[id].id);
+			}
+		}
+		return;
+	}
+
 	// {En,Dis}able toolbar buttons
 	for (var id in formatButtons) {
 		if (e.perm === 'edit' && formatButtons[id]) {
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 6b7261e..07ffcee 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -353,10 +353,6 @@ L.Control.Menubar = L.Control.extend({
 	_beforeShow: function(e, menu) {
 		var self = e.data.self;
 		var items = $(menu).children().children('a').not('.has-submenu');
-		var ua = window.navigator.userAgent;
-		var msie = ua.indexOf('MSIE '); // IE 10 or older
-		var trident = ua.indexOf('Trident/'); // IE 11
-		var edge = ua.indexOf('Edge/'); // Microsoft Edge
 		$(items).each(function() {
 			var aItem = this;
 			var type = $(aItem).data('type');
@@ -370,7 +366,7 @@ L.Control.Menubar = L.Control.extend({
 						$(aItem).removeClass('disabled');
 					}
 				} else if (type === 'action') { // enable all except fullscreen on windows
-					if (id === 'fullscreen' && (msie > 0 || trident > 0 || edge > 0)) { // Full screen works weirdly on IE 11 and on Edge
+					if (id === 'fullscreen' && (L.Browser.ie || L.Browser.edge)) { // Full screen works weirdly on IE 11 and on Edge
 						$(aItem).addClass('disabled');
 						var index = self.options.allowedViewModeActions.indexOf('fullscreen');
 						if (index > 0) {


More information about the Libreoffice-commits mailing list