diff --git a/js/documents.js b/js/documents.js index 4644c953..1d72f52e 100644 --- a/js/documents.js +++ b/js/documents.js @@ -154,7 +154,6 @@ var documentsMain = { ready :false, fileName: null, baseName: null, - url: null, canShare : false, toolbar : '
', @@ -191,23 +190,31 @@ var documentsMain = { return; } - var urlsrc = $('li[data-id='+ documentsMain.fileId +']>a').attr('urlsrc'); - var token = encodeURIComponent(result.token); - var url = OC.generateUrl('apps/richdocuments/wopi/files/{file_id}', {file_id: documentsMain.fileId}); - documentsMain.url = window.location.protocol + '//' + window.location.host + url; + // WOPISrc - URL that loolwsd will access (ie. pointing to ownCloud) + var wopiurl = window.location.protocol + '//' + window.location.host + OC.generateUrl('apps/richdocuments/wopi/files/{file_id}', {file_id: documentsMain.fileId}); + var wopisrc = encodeURIComponent(wopiurl); - var wopisrc = encodeURIComponent(documentsMain.url); + // urlsrc - the URL from discovery.xml that we access for the particular + // document; we add various parameters to that + var urlsrc = $('li[data-id='+ documentsMain.fileId +']>a').attr('urlsrc') + + "WOPISrc=" + wopisrc + + "&title=" + encodeURIComponent(title) + + "&closebutton=1"; + + // access_token - must be passed via a form post + var access_token = encodeURIComponent(result.token); + + // form to post the access token for WOPISrc var form = '
' + - '' + - '' + - '' + - '' + - '' + - '
'; + ''; + + // iframe that contains the Collabora Online var frame = '