[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - 3 commits - loleaflet/dist

Tor Lillqvist tml at collabora.com
Thu Apr 5 08:16:45 UTC 2018


 loleaflet/dist/framed.html |   57 ++++++++++++++++-----------------------------
 1 file changed, 21 insertions(+), 36 deletions(-)

New commits:
commit 5259b949641b00f17e71fc4185808e0060ea5622
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Mar 28 16:02:15 2018 +0300

    For some reason the small patch to wsd/FileServer.cpp is not needed any more
    
    At least not for me, on Safari, against online master 'make run'
    running on Linux.
    
    Change-Id: Idd8c4b8e5db8540b85173b9c01859cce59bfe707
    (cherry picked from commit d31415e89db08fff9770abb61e401d677ef4d2e9)
    Reviewed-on: https://gerrit.libreoffice.org/52112
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/dist/framed.html b/loleaflet/dist/framed.html
index 2dbdebbb6..f99180a09 100644
--- a/loleaflet/dist/framed.html
+++ b/loleaflet/dist/framed.html
@@ -16,32 +16,6 @@
      to loleaflet in a unocommandresult: message, and passed on to the
      event listener on this page, which writes it to the output field.
 
-     For this to work, in the trivial proof of concept case of 'make
-     run', the below patch is needed to the C++ code. It is probably
-     not necessary in a "real" WOPI-based setup where iframes are
-     already used and things work fine.
-
---- a/wsd/FileServer.cpp
-+++ b/wsd/FileServer.cpp
-@@ -172,7 +172,7 @@ void FileServerRequestHandler::handleRequest(const HTTPRequest& request, Poco::M
-         const auto& config = Application::instance().config();
-         const std::string loleafletHtml = config.getString("loleaflet_html", "loleaflet.html");
-         const std::string endPoint = requestSegments[requestSegments.size() - 1];
--        if (endPoint == loleafletHtml)
-+        if (endPoint == loleafletHtml || endPoint == "framed.html")
-         {
-             preprocessFile(request, message, socket);
-             return;
-@@ -548,7 +548,7 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
-         LOG_TRC("Denied frame ancestor: " << frameAncestor);
- 
-         cspOss << "img-src 'self' data: ;";
--        oss << "X-Frame-Options: deny\r\n";
-+        oss << "X-Frame-Options: sameorigin\r\n";
-     }
- 
-     cspOss << "\r\n";
-
 -->
 
 <html>
@@ -179,6 +153,6 @@
     the hex string needs to be changed of course, to the right one as
     shown by 'make run'. -->
 
-    <iframe src="http://snorken.local:9980/loleaflet/94781ec6/loleaflet.html?file_path=file:///home/tml/lo/internal-online/test/data/empty.ods&NotWOPIButIframe=true" height="1000" width="1000"></iframe>
+    <iframe src="http://snorken.local:9980/loleaflet/3304e9093/loleaflet.html?file_path=file:///home/tml/lo/online/test/data/empty.ods&NotWOPIButIframe=true" height="1000" width="1000"></iframe>
   </body>
 </html>
commit 0c2b0f25c0ffb00d2df72f643f4a0e2406d86df3
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Jan 22 14:53:19 2018 +0200

    Add input field for the name of the named range to add
    
    Change-Id: I37fdb1a3e28ef0b3cc298ec4d5dc8620ba919190
    (cherry picked from commit 790069ecbc31828c29eb2e19c8b843ee7471d7f6)
    Reviewed-on: https://gerrit.libreoffice.org/52111
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/dist/framed.html b/loleaflet/dist/framed.html
index 946d20e9d..2dbdebbb6 100644
--- a/loleaflet/dist/framed.html
+++ b/loleaflet/dist/framed.html
@@ -85,6 +85,7 @@
         window.frames[0].postMessage(JSON.stringify({'MessageId': 'Host_PostmessageReady'}), '*');
         // Our form below takes input in A1 format, the Python script wants zero-based indexes and width and height
         var abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+        var name = document.forms['add-named-range-form'].elements['name'].value;
         var x0 = document.forms['add-named-range-form'].elements['x0'].value;
         var x1 = document.forms['add-named-range-form'].elements['x1'].value;
         var y0 = parseInt(document.forms['add-named-range-form'].elements['y0'].value);
@@ -101,7 +102,7 @@
 								'y0': {'type': 'long', 'value': y0-1},
 								'width': {'type': 'long', 'value': x1-x0+1},
 								'height': {'type': 'long', 'value': y1-y0+1},
-								'name': {'type': 'string', 'value': 'N' + Date.now().toString()}
+								'name': {'type': 'string', 'value': name}
                                                                }
                                                      }),
                                      '*');
@@ -167,8 +168,8 @@
     </form>
 
     <form id="add-named-range-form">
-      <!-- FIXME: Add input fields for the position, size, and name of the range -->
-      Click <button onclick="callAddNamedRange(); return false;">here</button> to add a new named range on Sheet1 from (A1 syntax)
+      Click <button onclick="callAddNamedRange(); return false;">here</button> to add a new named range called
+      <input type="text" name="name"> on Sheet1 from (A1 syntax)
       <input type="text" name="x0" value="A" size="1" pattern="[A-Z]{1}"> <input type="number" name="y0", min="1" max="999" value="1"> to
       <input type="text" name="x1" value="B" size="1" pattern="[A-Z]{1}"> <input type="number" name="y1", min="1" max="999" value="3">.
     </form>
commit b5c127763711e0e0e2c14ddba90e4d02b52b1d35
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Jan 22 12:03:14 2018 +0200

    Add form fields to define the named range to add
    
    Also add a comment and drop some console logging.
    
    Change-Id: I2a8f90391907cf1150a128744b0895186b81c862
    (cherry picked from commit 5cf40f3ba16722a6a4466b47bdaf1f04f1e40fa6)
    (cherry picked from commit 1d6d01a928f20b9c9068e3c2d42de331741c1c0e)
    Reviewed-on: https://gerrit.libreoffice.org/52110
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/dist/framed.html b/loleaflet/dist/framed.html
index 5852bcfa6..946d20e9d 100644
--- a/loleaflet/dist/framed.html
+++ b/loleaflet/dist/framed.html
@@ -83,16 +83,24 @@
 
       function callAddNamedRange() {
         window.frames[0].postMessage(JSON.stringify({'MessageId': 'Host_PostmessageReady'}), '*');
-        // FIXME: Add parameters for the position, size, and name of the range
+        // Our form below takes input in A1 format, the Python script wants zero-based indexes and width and height
+        var abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+        var x0 = document.forms['add-named-range-form'].elements['x0'].value;
+        var x1 = document.forms['add-named-range-form'].elements['x1'].value;
+        var y0 = parseInt(document.forms['add-named-range-form'].elements['y0'].value);
+        var y1 = parseInt(document.forms['add-named-range-form'].elements['y1'].value);
+        console.log('x0=' + x0 + ', x1=' + x1)
+        x0 = abc.indexOf(x0);
+        x1 = abc.indexOf(x1);
         window.frames[0].postMessage(JSON.stringify({'MessageId': 'CallPythonScript',
                                                      'SendTime': Date.now(),
                                                      'ScriptFile': 'NamedRanges.py',
                                                      'Function': 'DefineNamedRange',
                                                      'Values': {'sheet': {'type': 'string', 'value': 'Sheet1'},
-								'x0': {'type': 'long', 'value': '2'},
-								'y0': {'type': 'long', 'value': '3'},
-								'width': {'type': 'long', 'value': '2'},
-								'height': {'type': 'long', 'value': '2'},
+								'x0': {'type': 'long', 'value': x0},
+								'y0': {'type': 'long', 'value': y0-1},
+								'width': {'type': 'long', 'value': x1-x0+1},
+								'height': {'type': 'long', 'value': y1-y0+1},
 								'name': {'type': 'string', 'value': 'N' + Date.now().toString()}
                                                                }
                                                      }),
@@ -158,9 +166,11 @@
       <textarea name="result" value="" rows="10" cols="80"></textarea>
     </form>
 
-    <form id="get-named-ranges-form">
+    <form id="add-named-range-form">
       <!-- FIXME: Add input fields for the position, size, and name of the range -->
-      Click <button onclick="callAddNamedRange(); return false;">here</button> to add a new named range.
+      Click <button onclick="callAddNamedRange(); return false;">here</button> to add a new named range on Sheet1 from (A1 syntax)
+      <input type="text" name="x0" value="A" size="1" pattern="[A-Z]{1}"> <input type="number" name="y0", min="1" max="999" value="1"> to
+      <input type="text" name="x1" value="B" size="1" pattern="[A-Z]{1}"> <input type="number" name="y1", min="1" max="999" value="3">.
     </form>
 
     <!-- The hostname and pathnames below are obviously specific to my


More information about the Libreoffice-commits mailing list