From bf764df72081e879716f582c0b1881d6c9c7cb17 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 9 Feb 2023 10:39:12 -0700 Subject: [PATCH] Mail: Multiple attachments changes - Offer to open in Collabora any file, not just editable (PDF) - Put collabora option first in the option list if user prefers to open in collabora - Change label to "Open with Collabora Office" with translation from Birgit --- api/js/jsapi/egw_links.js | 18 ++++++++++++++++++ mail/js/app.js | 10 +++++++--- mail/lang/egw_de.lang | 1 + mail/lang/egw_en.lang | 1 + 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/api/js/jsapi/egw_links.js b/api/js/jsapi/egw_links.js index bb7239ec5f..88aa62903f 100644 --- a/api/js/jsapi/egw_links.js +++ b/api/js/jsapi/egw_links.js @@ -545,6 +545,24 @@ egw.extend('links', egw.MODULE_GLOBAL, function() return false; } return ['edit'].indexOf(fe.mime[mime].name) !== -1; + }, + + /** + * Check if a mimetype is openable in Collabora + * (without needing to have Collabora JS loaded) + * + * @param mime + * + * @return string|false + */ + isCollaborable: function (mime) + { + // Additional check to see if Collabora can open the file at all, not just edit it + let fe = this.file_editor_prefered_mimes(mime); + if (fe && fe.mime && fe.mime[mime] && fe.mime[mime].name || this.isEditable(mime)) + { + return fe.mime[mime].name; + } } } }); \ No newline at end of file diff --git a/mail/js/app.js b/mail/js/app.js index fa187c59c5..8675ac618e 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -1127,7 +1127,7 @@ app.classes.mail = AppJS.extend( ]; const collabora = { id: 'collabora', - label: 'Open', + label: 'Open with Collabora Office', icon: 'collabora/navbar', value: 'collabora' }; @@ -1139,14 +1139,18 @@ app.classes.mail = AppJS.extend( // for some reason label needs to be set explicitly for the dropdown button. It needs more investigation. _item.actionsDefaultLabel = 'Download'; - if (typeof this.egw.user('apps')['collabora'] !== "undefined" && this.egw.isEditable(_item.type)) + if (typeof this.egw.user('apps')['collabora'] !== "undefined" && this.egw.isCollaborable(_item.type)) { + // Start with download on top, Collabora on bottom + sel_options.attachmentsBlock[_item.attachment_number + "[actions]"] = [...actions, collabora]; + if (egw.preference('document_doubleclick_action', 'filemanager') === 'collabora') { _item.actions = 'collabora'; _item.actionsDefaultLabel = 'Collabora'; + // Put Collabora on top + sel_options.attachmentsBlock[_item.attachment_number + "[actions]"] = [collabora, ...actions]; } - sel_options.attachmentsBlock[_item.attachment_number + "[actions]"] = [...actions, collabora]; } }); diff --git a/mail/lang/egw_de.lang b/mail/lang/egw_de.lang index d4fb87db11..551eaba0fd 100644 --- a/mail/lang/egw_de.lang +++ b/mail/lang/egw_de.lang @@ -414,6 +414,7 @@ only one window mail de nur ein einziges Fenster only send message, do not copy a version of the message to the configured sent folder mail de Versende Nachricht, kopiere sie nicht in den konfigurierten Gesendet Ordner open in html mode mail de In HTML-Modus öffnen open in text mode mail de In Text-Modus öffnen +open with collabora office mail de Mit Collabora Online öffnen organisation admin de Organisation organization mail de Organisation original message mail de ursprüngliche Nachricht diff --git a/mail/lang/egw_en.lang b/mail/lang/egw_en.lang index e601473996..dfe2fbdaca 100644 --- a/mail/lang/egw_en.lang +++ b/mail/lang/egw_en.lang @@ -414,6 +414,7 @@ only one window mail en only one window only send message, do not copy a version of the message to the configured sent folder mail en only send message, do not copy a version of the message to the configured sent folder open in html mode mail en Open in HTML mode open in text mode mail en Open in Text mode +open with collabora office mail en Open with Collabora Office organisation admin en organisation organization mail en organization original message mail en original message