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

Pranav Kant pranavk at collabora.com
Fri Apr 1 13:32:11 UTC 2016


 loleaflet/dist/loleaflet.html     |    4 ++++
 loleaflet/dist/toolbar/toolbar.js |    9 ++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit fcc48022fa7641fed8f40b7dfb99f37ae14b32a4
Author: Pranav Kant <pranavk at collabora.com>
Date:   Fri Apr 1 18:20:08 2016 +0530

    Allow leaflet to be served from loolwsd
    
    Change-Id: I0179f07d83e9d640ab82ad2a866ef493fdf9e655
    Reviewed-on: https://gerrit.libreoffice.org/23721
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/dist/loleaflet.html b/loleaflet/dist/loleaflet.html
index 1bf51ff..e2fc517 100644
--- a/loleaflet/dist/loleaflet.html
+++ b/loleaflet/dist/loleaflet.html
@@ -270,9 +270,13 @@
     var wopiSrc = getParameterByName('WOPISrc');
     var filePath = getParameterByName('file_path');
     var fileName = decodeURIComponent(filePath.substring(filePath.lastIndexOf('/')+1));
+    if (wopiSrc !== '') {
+        fileName = getParameterByName('filename');
+    }
     var host = getParameterByName('host');
     var permission = getParameterByName('permission');
     var timestamp = getParameterByName('timestamp');
+    var closebutton = getParameterByName('closebutton');
     if (wopiSrc === '' && filePath === '') {
         vex.dialog.alert('Wrong WOPISrc, usage: WOPISrc=valid encoded URI,  or file_path, usage: file_path=/path/to/doc/');
     }
diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 6e3e174..08aa509 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -82,7 +82,7 @@ $(function () {
 			{ type: 'button',  id: 'help',  img: 'help', hint: _("Help") },
 			{ type: 'html', id: 'right' },
 			{ type: 'button',  id: 'more', img: 'more', hint: _("More") },
-			{ type: 'button',  id: 'close',  img: 'closedoc', hint: _("Close Document") },
+			{ type: 'button',  id: 'close',  img: 'closedoc', hint: _("Close Document"), hidden: true },
 		],
 		onClick: function (e) {
 			onClick(e.target);
@@ -327,8 +327,6 @@ function onClick(id) {
 	}
 	else if (id.startsWith('menu:file:downloadas-')) {
 		var format = id.substring('menu:file:downloadas-'.length);
-		// try to get the filename from the url
-		var fileName = map.options.doc.replace(/^.*[\\\/]/, '');
 		// remove the extension if any
 		fileName = fileName.substr(0, fileName.lastIndexOf('.')) || fileName;
 		// check if it is empty
@@ -393,6 +391,7 @@ function onClick(id) {
 		});
 	}
 	else if (id === 'close') {
+		window.parent.postMessage('close', '*');
 		map.remove();
 	}
 }
@@ -911,6 +910,10 @@ $(window).resize(function() {
 
 $(document).ready(function() {
 	resizeToolbar();
+	var toolbar = w2ui['toolbar-up'];
+	if (closebutton) {
+		toolbar.show('close');
+	}
 });
 
 function resizeToolbar() {


More information about the Libreoffice-commits mailing list