From 786b6dc2a6c192fd8d88cc7363b9a9b9cc8bd3a8 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 24 Aug 2018 11:43:34 +0200 Subject: [PATCH] Do not offer Collabora as an option for 'document_doubleclick_action' or 'merge_open_handler' preferences when Collabora is not accessible --- .../inc/class.filemanager_hooks.inc.php | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/filemanager/inc/class.filemanager_hooks.inc.php b/filemanager/inc/class.filemanager_hooks.inc.php index ae5323b00d..3e2f001066 100644 --- a/filemanager/inc/class.filemanager_hooks.inc.php +++ b/filemanager/inc/class.filemanager_hooks.inc.php @@ -245,6 +245,17 @@ class filemanager_hooks $mimes[$mime] .= ', '.strtoupper(implode(', ', $value['extra_extensions'])); } } + $merge_open_handler = array ('download' => lang('download'), 'collabora' => 'Collabora'); + $document_doubleclick_action = array ( + 'collabora' => lang('open documents with Collabora, if permissions are given'), + 'download' => lang('download documents'), + 'collabeditor' => lang('open odt documents with CollabEditor') + ); + if (!$GLOBALS['egw_info']['user']['apps']['collabora']) + { + unset($document_doubleclick_action['collabora'], $merge_open_handler['collabora']); + } + if (!$GLOBALS['egw_info']['user']['apps']['collabeditor']) unset($document_doubleclick_action['collabeditor']); asort($mimes); $settings += array ( 'sections.2' => array( @@ -281,20 +292,16 @@ class filemanager_hooks 'label' => lang('Merge print open handler'), 'help' => lang('Defines how to open a merge print document'), 'name' => 'merge_open_handler', - 'values' => array ('download' => lang('download'), 'collabora' => 'Collabora'), - 'default' => 'collabora', + 'values' => $merge_open_handler, + 'default' => $GLOBALS['egw_info']['user']['apps']['collabora'] ? 'collabora' : 'download', ), 'document_doubleclick_action' => array ( 'type' => 'select', 'label' => lang('Default action on double-click'), 'help' => lang('Defines how to handle double click action on a document file. Images are always opened in the expose-view and emails with email application. All other mime-types are handled by the browser itself.'), 'name' => 'document_doubleclick_action', - 'values' => array ( - 'collabora' => lang('open documents with Collabora, if permissions are given'), - 'download' => lang('download documents'), - 'collabeditor' => lang('open odt documents with CollabEditor') - ), - 'default' => 'collabora', + 'values' => $document_doubleclick_action, + 'default' => $GLOBALS['egw_info']['user']['apps']['collabora'] ? 'collabora' : 'download', ) );