Add collabora action into default and set attachments label

This commit is contained in:
Hadi Nategh 2023-02-06 16:15:21 +01:00
parent bd8198d230
commit 5ade68dd76
4 changed files with 21 additions and 10 deletions

View File

@ -792,19 +792,13 @@ class mail_hooks
*/ */
public static function attachmentsBlockActions() public static function attachmentsBlockActions()
{ {
return [ $actions = [
'downloadOneAsFile' => [ 'downloadOneAsFile' => [
'id' => 'downloadOneAsFile', 'id' => 'downloadOneAsFile',
'label' => 'Download', 'label' => 'Download',
'icon' => 'fileexport', 'icon' => 'fileexport',
'value' => 'downloadOneAsFile' 'value' => 'downloadOneAsFile'
], ],
'collabora' => [
'id' => 'collabora',
'label' => 'Open with Collabora',
'icon' => 'open',
'value' => 'collabora'
],
'saveOneToVfs' => [ 'saveOneToVfs' => [
'id' => 'saveOneToVfs', 'id' => 'saveOneToVfs',
'label' => 'Save in Filemanager', 'label' => 'Save in Filemanager',
@ -824,5 +818,15 @@ class mail_hooks
'value' => 'downloadAllToZip' 'value' => 'downloadAllToZip'
] ]
]; ];
if (file_exists(EGW_SERVER_ROOT.'/collabora'))
{
$actions['collabora'] = [
'id' => 'collabora',
'label' => 'Open with Collabora',
'icon' => 'open',
'value' => 'collabora'
];
}
return $actions;
} }
} }

View File

@ -2525,7 +2525,8 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
$attachmentHTML[$key]['mail_id'] = $rowID; $attachmentHTML[$key]['mail_id'] = $rowID;
$attachmentHTML[$key]['winmailFlag']=$value['is_winmail']; $attachmentHTML[$key]['winmailFlag']=$value['is_winmail'];
$attachmentHTML[$key]['smime_type'] = $value['smime_type']; $attachmentHTML[$key]['smime_type'] = $value['smime_type'];
$attachmentHTML[$key]['actions'] = 'downloadOneAsFile'; $attachmentHTML[$key]['actions'] = $GLOBALS['egw_info']['user']['preferences']['filemanager']['document_doubleclick_action'] === 'collabora' ?
'collabora' : 'downloadOneAsFile';
$attachmentHTML[$key]['actionsDefaultLabel'] = 'Download'; $attachmentHTML[$key]['actionsDefaultLabel'] = 'Download';
// reset mode array as it should be considered differently for // reset mode array as it should be considered differently for

View File

@ -1141,6 +1141,11 @@ app.classes.mail = AppJS.extend(
if (typeof this.egw.user('apps')['collabora'] !== "undefined" && this.egw.isEditable(_item.type)) if (typeof this.egw.user('apps')['collabora'] !== "undefined" && this.egw.isEditable(_item.type))
{ {
if (egw.preference('document_doubleclick_action', 'filemanager') === 'collabora')
{
_item.actions = 'downloadOneAsFile';
_item.actionsDefaultLabel = 'Collabora';
}
sel_options.attachmentsBlock[_item.attachment_number + "[actions]"] = [...actions, collabora]; sel_options.attachmentsBlock[_item.attachment_number + "[actions]"] = [...actions, collabora];
} }
}); });

View File

@ -60,7 +60,7 @@
<column disabled="!@showtempname"/> <column disabled="!@showtempname"/>
<column disabled="!@showtempname"/> <column disabled="!@showtempname"/>
<column width="70%" /> <column width="70%" />
<column width="11%" /> <column width="20%" />
<column width="10%"/> <column width="10%"/>
</columns> </columns>
<rows> <rows>
@ -70,7 +70,8 @@
<et2-description id="attachmentsBlock[0][type]"></et2-description> <et2-description id="attachmentsBlock[0][type]"></et2-description>
<et2-description id="attachmentsBlock[0][winmailFlag]"></et2-description> <et2-description id="attachmentsBlock[0][winmailFlag]"></et2-description>
<et2-description-expose class="et2_link useEllipsis" id="attachmentsBlock[0][filename]" mime="@attachmentsBlock[0][type]" href="@attachmentsBlock[0][mime_url]" noLang="1" mimeData="@attachmentsBlock[0][mime_data]"></et2-description-expose> <et2-description-expose class="et2_link useEllipsis" id="attachmentsBlock[0][filename]" mime="@attachmentsBlock[0][type]" href="@attachmentsBlock[0][mime_url]" noLang="1" mimeData="@attachmentsBlock[0][mime_data]"></et2-description-expose>
<et2-description align="right" id="attachmentsBlock[0][size]"></et2-description> <et2-description value="@attachmentsBlockTitle"></et2-description>
<et2-button align="right" label="@attachmentsBlock[0][actionsDefaultLabel]" onchange="app.mail.attachmentsBlockActions" onclick="app.mail.attachmentsBlockActions"/>
</row> </row>
</rows> </rows>
</grid> </grid>