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

Henry Castro hcastro at collabora.com
Wed Mar 16 12:57:32 UTC 2016


 loleaflet/debug/document/document_simple_example.html |    8 +++++---
 loleaflet/dist/loleaflet.html                         |    9 ++++++---
 2 files changed, 11 insertions(+), 6 deletions(-)

New commits:
commit dc129d00ccdb8df982c0b0f0a8570f84695aac95
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Mar 16 08:57:14 2016 -0400

    loleaflet: add WOPISrc parameter

diff --git a/loleaflet/debug/document/document_simple_example.html b/loleaflet/debug/document/document_simple_example.html
index 7934843..271fac2 100644
--- a/loleaflet/debug/document/document_simple_example.html
+++ b/loleaflet/debug/document/document_simple_example.html
@@ -64,17 +64,19 @@
         return results === null ? "" : results[1].replace(/\+/g, " ");
     }
 
+    var wopiSrc = getParameterByName('WOPISrc');
     var filePath = getParameterByName('file_path');
     var host = getParameterByName('host');
     var token = getParameterByName('token');
     var permission = getParameterByName('permission');
     var timestamp = getParameterByName('timestamp');
-    if (filePath === '') {
-        vex.dialog.alert('Wrong file_path, usage: file_path=/path/to/doc/');
+    if (wopiSrc === '' && filePath === '') {
+        vex.dialog.alert('Wrong WOPISrc, usage: WOPISrc=valid encoded URI,  or file_path, usage: file_path=/path/to/doc/');
     }
     if (host === '') {
         vex.dialog.alert('Wrong host, usage: host=ws://localhost:9980');
     }
+    var docURL = wopiSrc !== '' ? wopiSrc : filePath;
 
     var renderingOptions = {
         ".uno:HideWhitespace": {
@@ -88,7 +90,7 @@
     };
 
     var globalMap = L.map('map', {
-            doc: filePath,
+            doc: docURL,
             renderingOptions: renderingOptions,
             server: host,
             token: token,
diff --git a/loleaflet/dist/loleaflet.html b/loleaflet/dist/loleaflet.html
index 53045eb..0ac93c3 100644
--- a/loleaflet/dist/loleaflet.html
+++ b/loleaflet/dist/loleaflet.html
@@ -267,21 +267,24 @@
         return results === null ? "" : results[1].replace(/\+/g, " ");
     }
 
+    var wopiSrc = getParameterByName('WOPISrc');
     var filePath = getParameterByName('file_path');
     var fileName = decodeURIComponent(filePath.substring(filePath.lastIndexOf('/')+1));
     var host = getParameterByName('host');
     var permission = getParameterByName('permission');
     var timestamp = getParameterByName('timestamp');
-    if (filePath === '') {
-        vex.dialog.alert('Wrong file_path, usage: file_path=/path/to/doc/');
+    if (wopiSrc === '' && filePath === '') {
+        vex.dialog.alert('Wrong WOPISrc, usage: WOPISrc=valid encoded URI,  or file_path, usage: file_path=/path/to/doc/');
     }
     if (host === '') {
         vex.dialog.alert('Wrong host, usage: host=ws://localhost:9980');
     }
+    var docURL = wopiSrc !== '' ? wopiSrc : filePath;
+
     document.title = fileName;
     var map = L.map('map', {
 			server: host,
-			doc: filePath,
+			doc: docURL,
 			permission: permission,
 			timestamp: timestamp,
 			documentContainer: 'document-container'


More information about the Libreoffice-commits mailing list