diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-09-10 17:55:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-10 17:55:16 +0300 |
commit | 8d57bd765db33584b74c0bf9e0ee0f1da14fc9cb (patch) | |
tree | 6725c79c3f170634f4bf5b778dd016c52ddb2595 | |
parent | b65d322922a274c2edddf4fc717f2faeabd93e12 (diff) | |
parent | 983d63c375292145a2b99619b3531a82a54e7c0a (diff) |
[stable17] Disable pdf viewer if collabora is available on hide… (#155)v17.0.4RC2v17.0.4RC1v17.0.4v17.0.3RC1v17.0.3v17.0.2RC1v17.0.2v17.0.1rc1v17.0.1v17.0.0rc2v17.0.0rc1v17.0.0
[stable17] Disable pdf viewer if collabora is available on hide download shares
-rw-r--r-- | js/previewplugin.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/js/previewplugin.js b/js/previewplugin.js index ad3b338..eb82a16 100644 --- a/js/previewplugin.js +++ b/js/previewplugin.js @@ -8,6 +8,10 @@ * */ +var isSecureViewerAvailable = function () { + return $('#hideDownload').val() === 'true' && typeof OCA.RichDocuments !== 'undefined'; +}; + (function(OCA) { OCA.FilesPdfViewer = OCA.FilesPdfViewer || {}; @@ -77,6 +81,10 @@ // if a filelist is present, the PDF viewer can be closed to go back there $('#pdframe').load(function(){ var iframe = $('#pdframe').contents(); + if ($('#hideDownload').val() === 'true') { + iframe.find('.toolbarButton.download').hide() + iframe.find('.toolbarButton.print').hide() + } if ($('#fileList').length) { iframe.find('#secondaryToolbarClose').click(function() { @@ -117,6 +125,9 @@ */ _extendFileActions: function(fileActions) { var self = this; + if (isSecureViewerAvailable()) { + return; + } fileActions.registerAction({ name: 'view', displayName: 'Favorite', @@ -139,7 +150,7 @@ OC.Plugins.register('OCA.Files.FileList', OCA.FilesPdfViewer.PreviewPlugin); // FIXME: Hack for single public file view since it is not attached to the fileslist $(document).ready(function(){ - if ($('#isPublic').val() && $('#mimetype').val() === 'application/pdf') { + if ($('#isPublic').val() && $('#mimetype').val() === 'application/pdf' && !isSecureViewerAvailable()) { $.urlParam = function(name){ var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); if (results == null) { |