From d61999d7097c1a04c2d268e06151e5cad3843782 Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Thu, 8 Feb 2018 14:53:52 +0530 Subject: [PATCH] Restore code deleted by accident (#165) This reverts some parts of a08c0b7a5e0478e4b0e68694ca7d73f23a954e33 --- js/documents.js | 184 +++++++++++++++++++++++++++++++++++++++++- templates/.#admin.php | 1 - 2 files changed, 182 insertions(+), 3 deletions(-) delete mode 120000 templates/.#admin.php diff --git a/js/documents.js b/js/documents.js index e7900b18..382ed91b 100644 --- a/js/documents.js +++ b/js/documents.js @@ -128,9 +128,189 @@ var documentsMain = { $('#revViewerContainer').prepend($('
')); } - var ocurl = documentsMain._generateDocKey(fileId); // WOPISrc - URL that loolwsd will access (ie. pointing to ownCloud) - var wopiurl = window.location.protocol + '//' + window.location.host + ocurl; + var wopiurl = window.location.protocol + '//' + window.location.host + OC.generateUrl('apps/richdocuments/wopi/files/{file_id}', {file_id: fileId}); + var wopisrc = encodeURIComponent(wopiurl); + + // urlsrc - the URL from discovery xml that we access for the particular + // document; we add various parameters to that. + // The discovery is available at + // https://:9980/hosting/discovery + var urlsrc = documentsMain.urlsrc + + "WOPISrc=" + wopisrc + + "&title=" + encodeURIComponent(title) + + "&lang=" + OC.getLocale().replace('_', '-') + // loleaflet expects a BCP47 language tag syntax + "&permission=readonly"; + + // access_token - must be passed via a form post + var access_token = encodeURIComponent(documentsMain.token); + + // form to post the access token for WOPISrc + var form = '
' + + '
'; + + // iframe that contains the Collabora Online Viewer + var frame = '