',
@@ -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 = '';
$('#mainContainer').append(form);
$('#mainContainer').append(frame);
+
+ // handler for the 'Close' button - we have enabled it via closebutton=1
$('#loleafletframe').load(function(){
documentsMain.overlay.documentOverlay('hide');
window.addEventListener('message', function(e){
@@ -217,6 +224,7 @@ var documentsMain = {
});
});
+ // submit that
$('#loleafletform').submit();
});
},