loleaflet/debug/document/loleaflet.html | 8 +------- loleaflet/main.js | 7 ------- loleaflet/src/control/Control.Menubar.js | 7 +++---- loleaflet/src/map/handler/Map.WOPI.js | 7 ++++--- 4 files changed, 8 insertions(+), 21 deletions(-)
New commits: commit f5620db55ffbf5b4c7c2b2181976cb51a62fa141 Author: Henry Castro <hcas...@collabora.com> Date: Tue Nov 21 18:09:23 2017 -0400 loleaflet: replace title parameter with wopi BaseFileName Change-Id: I4807eec44dd481edc8bc4f8f360b8780c2575c8a Reviewed-on: https://gerrit.libreoffice.org/45056 Reviewed-by: Jan Holesovsky <ke...@collabora.com> Tested-by: Jan Holesovsky <ke...@collabora.com> diff --git a/loleaflet/debug/document/loleaflet.html b/loleaflet/debug/document/loleaflet.html index 2134f31b..ff9b80f4 100644 --- a/loleaflet/debug/document/loleaflet.html +++ b/loleaflet/debug/document/loleaflet.html @@ -100,14 +100,8 @@ wopiSrc += '?access_header=' + access_header; } - - var filePath = getParameterByName('file_path'); - var title = getParameterByName('title'); - if (title === '') { - title = decodeURIComponent(filePath.substring(filePath.lastIndexOf('/')+1)); - } - var host = '%HOST%'; + var filePath = getParameterByName('file_path'); var permission = getParameterByName('permission') || 'edit'; var timestamp = getParameterByName('timestamp'); var closebutton = getParameterByName('closebutton'); diff --git a/loleaflet/main.js b/loleaflet/main.js index a08e5054..ca143017 100644 --- a/loleaflet/main.js +++ b/loleaflet/main.js @@ -65,11 +65,6 @@ else if (wopiSrc !== '' && access_header !== '') { } var filePath = getParameterByName('file_path'); -var title = getParameterByName('title'); -if (title === '') { - title = decodeURIComponent(filePath.substring(filePath.lastIndexOf('/')+1)); -} - var permission = getParameterByName('permission') || 'edit'; var timestamp = getParameterByName('timestamp'); // Shows close button if non-zero value provided @@ -91,7 +86,6 @@ if (host === '') { // TODO: Get rid of these globals global.closebutton = closebutton; global.revHistoryEnabled = revHistoryEnabled; -global.title = title; global.errorMessages = errorMessages; var docURL, docParams; var isWopi = false; @@ -104,7 +98,6 @@ if (wopiSrc != '') { docParams = {}; } -document.title = title; var map = L.map('map', { server: host, doc: docURL, diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index 19464469..fda37f4b 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -2,7 +2,7 @@ * Control.Menubar */ -/* global $ _ map title vex revHistoryEnabled closebutton L */ +/* global $ _ map vex revHistoryEnabled closebutton L */ L.Control.Menubar = L.Control.extend({ // TODO: Some mechanism to stop the need to copy duplicate menus (eg. Help) options: { @@ -672,9 +672,8 @@ L.Control.Menubar = L.Control.extend({ map.print(); } else if (id.startsWith('downloadas-')) { var format = id.substring('downloadas-'.length); - // remove the extension if any - var fileName = title.substr(0, title.lastIndexOf('.')) || title; - // check if it is empty + var fileName = map['wopi'].BaseFileName; + fileName = fileName.substr(0, fileName.lastIndexOf('.')); fileName = fileName === '' ? 'document' : fileName; map.downloadAs(fileName + '.' + format, format); } else if (id === 'findandreplace') { diff --git a/loleaflet/src/map/handler/Map.WOPI.js b/loleaflet/src/map/handler/Map.WOPI.js index 2a00b05d..54278376 100644 --- a/loleaflet/src/map/handler/Map.WOPI.js +++ b/loleaflet/src/map/handler/Map.WOPI.js @@ -2,7 +2,7 @@ * L.WOPI contains WOPI related logic */ -/* global title w2ui toolbarUpMobileItems resizeToolbar */ +/* global w2ui toolbarUpMobileItems resizeToolbar */ L.Map.WOPI = L.Handler.extend({ // If the CheckFileInfo call fails on server side, we won't have any PostMessageOrigin. // So use '*' because we still needs to send 'close' message to the parent frame which @@ -198,8 +198,9 @@ L.Map.WOPI = L.Handler.extend({ else if (msg.MessageId === 'Action_Export') { if (msg.Values) { var format = msg.Values.Format; - var filename = title.substr(0, title.lastIndexOf('.')) || title; - filename = filename === '' ? 'document' : filename; + var fileName = this._map['wopi'].BaseFileName; + fileName = fileName.substr(0, fileName.lastIndexOf('.')); + fileName = fileName === '' ? 'document' : fileName; this._map.downloadAs(filename + '.' + format, format); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits