JS handle urlsrc attribute
This commit is contained in:
parent
14eda814f5
commit
3a2d2a219f
@ -30,6 +30,7 @@ $.widget('oc.documentGrid', {
|
|||||||
a.css('background-image', 'url("'+document.icon+'")')
|
a.css('background-image', 'url("'+document.icon+'")')
|
||||||
.attr('href', OC.generateUrl('apps/files/download{file}',{file:document.path}))
|
.attr('href', OC.generateUrl('apps/files/download{file}',{file:document.path}))
|
||||||
.attr('original-title', document.path)
|
.attr('original-title', document.path)
|
||||||
|
.attr('urlsrc', document.urlsrc)
|
||||||
.find('label').text(document.name)
|
.find('label').text(document.name)
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -190,12 +191,12 @@ var documentsMain = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Get WOPISrc from the discovery XML.
|
var urlsrc = $('li[data-id='+ documentsMain.fileId +']>a').attr('urlsrc');
|
||||||
var url = OC.generateUrl('apps/richdocuments/wopi/files/{file_id}/contents?access_token={token}',
|
var url = OC.generateUrl('apps/richdocuments/wopi/files/{file_id}/contents?access_token={token}',
|
||||||
{file_id: documentsMain.fileId, token: encodeURIComponent(result.token)});
|
{file_id: documentsMain.fileId, token: encodeURIComponent(result.token)});
|
||||||
documentsMain.url = window.location.protocol + '//' + window.location.host + url;
|
documentsMain.url = window.location.protocol + '//' + window.location.host + url;
|
||||||
|
|
||||||
var viewer = window.location.protocol + '//' + window.location.host + '/loleaflet/dist/loleaflet.html?' +
|
var viewer = urlsrc +
|
||||||
'file_path=' + encodeURIComponent(documentsMain.url) +
|
'file_path=' + encodeURIComponent(documentsMain.url) +
|
||||||
'&host=' + 'ws://' + window.location.hostname + ':9980' +
|
'&host=' + 'ws://' + window.location.hostname + ':9980' +
|
||||||
'&permission=' + 'view' +
|
'&permission=' + 'view' +
|
||||||
@ -718,6 +719,12 @@ $(document).ready(function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var item = $(this).find('a');
|
||||||
|
if (item.attr('urlsrc') === undefined) {
|
||||||
|
OC.Notification.showTemporary(t('richdocuments', 'Failed to open ' + item.attr('original-title') + ', file not supported.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
documentsMain.prepareSession();
|
documentsMain.prepareSession();
|
||||||
if ($(this).attr('data-id')){
|
if ($(this).attr('data-id')){
|
||||||
documentsMain.joinSession($(this).attr('data-id'));
|
documentsMain.joinSession($(this).attr('data-id'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user