PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` /** * ownCloud Wopi * * @author Thomas Müller * @copyright 2018 ownCloud GmbH. * * This code is covered by the ownCloud Commercial License. * * You should have received a copy of the ownCloud Commercial License * along with this program. If not, see . * */ (function ($, OC, OCA) { OCA.Wopi = { initialize: function () { var data = $("data[key='wopi']"); var fileId = data.attr('data-id'); var mime = data.attr('data-mime'); var ext = data.attr('data-ext').toLowerCase(); var action = data.attr('data-action'); var fileName = data.attr('data-fileName'); var shareToken = data.attr('data-shareToken'); if (!fileId || !mime || !ext || !action) { OC.Notification.showTemporary(t('wopi', 'Access denied')); return; } OCA.Wopi.loadDiscovery().then(function (config) { // Check action for given file mime and extension var actionUrl = config[action][mime][ext]; if (typeof actionUrl !== 'undefined') { $("link[rel='icon']").attr("href", config.favicons[mime]); document.title = fileName + ' - ' + document.title; var wopisrc = window.location.protocol + '//' + window.location.host + OC.generateUrl('/apps/wopi/files/{fileId}', {fileId: fileId}); if (!shareToken) { $.post(OC.generateUrl('/apps/wopi/token/user'), { fileId: fileId, folderUrl: window.location.href }).success(function (response) { OCA.Wopi.openDoc(fileId, shareToken, actionUrl, response.token, response.expires, response.wopi_src ?? wopisrc, oc_appconfig.wopi.businessFlowEnabled); }); } else { $.post(OC.generateUrl('/apps/wopi/token/publiclink'), { fileId: fileId, shareToken: shareToken, folderUrl: window.location.href }).success(function (response) { OCA.Wopi.openDoc(fileId, shareToken, actionUrl, response.token, response.expires, response.wopi_src ?? wopisrc, false); }); } } }, function (error) { console.error(error); }); }, openDoc: function (fileId, shareToken, actionUrlTemplate, token, expires, wopisrc, businessFlowEnabled) { var actionUrlTemplateElements = actionUrlTemplate.split('<'); var lang = OCA.WopiLang.getLocale(); // Construct action url with all required placeholders var actionUrl = actionUrlTemplateElements[0]; actionUrl += 'ui=' + lang + '&rs=' + lang; if (businessFlowEnabled === true) { actionUrl += '&IsLicensedUser=1' } actionUrl += '&WOPISrc=' + encodeURIComponent(wopisrc); var view = '
\n' + ' \n' + ' \n' + '
'; view = view.replace('ACTION_URL', actionUrl); view = view.replace('ACCESS_TOKEN_VALUE', token); view = view.replace('ACCESS_TOKEN_TTL_VALUE', expires); $('#content').append(view); var frameholder = document.getElementById('frameholder'); var officeFrame = document.createElement('iframe'); officeFrame.name = 'office_frame'; officeFrame.id ='office_frame'; // The title should be set for accessibility officeFrame.title = 'Office Online Frame'; // This attribute allows true fullscreen mode in slideshow view // when using PowerPoint Online's 'view' action. officeFrame.setAttribute('allowfullscreen', 'true'); officeFrame.setAttribute('style', 'width:100%;height:100%;display:block;position:absolute;top:0;z-index:200;'); frameholder.appendChild(officeFrame); document.getElementById('office_form').submit(); $("#office_close_button").click(function (e) { e.preventDefault(); $('#office_container').remove(); }); }, loadDiscovery: function () { return new Promise(function (resolve, reject) { $.ajax({ type: "get", url: OC.generateUrl('/apps/wopi/discovery.json'), success: function(data) { resolve(data); }, error: function(xhr, status) { reject(Error(status)); } }); }); }, }; $(document).ready(function () { OCA.Wopi.initialize(); }); })(jQuery, OC, OCA);