diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-01-25 17:49:07 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-01-27 09:33:44 +0300 |
commit | 315677f8102c1f11ee8cab1ddc74c6228a54f721 (patch) | |
tree | 2801711d9705658aa0acb91b4c2949e7eeeeed6d /src | |
parent | 0bd69be42b242b651c25410d0cb6646042b7ff81 (diff) |
Show warning with link to settings if no server is setup
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/viewer.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/viewer.js b/src/viewer.js index 644a4524..906affe8 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -36,6 +36,7 @@ const odfViewer = { open: false, receivedLoading: false, + isCollaboraConfigured: typeof OC.getCapabilities().richdocuments.collabora === 'object' && OC.getCapabilities().richdocuments.collabora.length !== 0, supportedMimes: OC.getCapabilities().richdocuments.mimetypes.concat(OC.getCapabilities().richdocuments.mimetypesNoDefaultOpen), excludeMimeFromDefaultOpen: OC.getCapabilities().richdocuments.mimetypesNoDefaultOpen, hideDownloadMimes: ['image/jpeg', 'image/svg+xml', 'image/cgm', 'image/vnd.dxf', 'image/x-emf', 'image/x-wmf', 'image/x-wpg', 'image/x-freehand', 'image/bmp', 'image/png', 'image/gif', 'image/tiff', 'image/jpg', 'image/jpeg', 'text/plain'], @@ -58,6 +59,22 @@ const odfViewer = { }, onEdit: function(fileName, context) { + if (!odfViewer.isCollaboraConfigured) { + const setupUrl = OC.generateUrl('/settings/admin/richdocuments') + const installHint = OC.isUserAdmin() + ? `<a href="${setupUrl}">Collabora Online is not setup yet. <br />Click here to configure your own server or connect to a demo server.</a>` + : t('richdocuments', 'Collabora Online is not setup yet. Please contact your administrator.') + + if (OCP.Toast) { + OCP.Toast.error(installHint, { + isHTML: true, + timeout: 0 + }) + } else { + OC.Notification.showHtml(installHint) + } + return + } if (odfViewer.open === true) { return } |