From 9622df6df1edb14aeea722d750f8a891b3d44ee3 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 18 Oct 2016 11:43:35 +0200 Subject: [PATCH] Support file_editors without 'editable' property enabled --- plugins/kolab_files/kolab_files.js | 6 +++--- plugins/kolab_files/lib/kolab_files_engine.php | 12 +++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/kolab_files/kolab_files.js b/plugins/kolab_files/kolab_files.js index 1bc00217..1de55348 100644 --- a/plugins/kolab_files/kolab_files.js +++ b/plugins/kolab_files/kolab_files.js @@ -1166,15 +1166,15 @@ function kolab_files_frame_load(frame) info = rcmail.env.file_data; try { - rcmail.file_editor = win.file_editor && win.file_editor.editable ? win.file_editor : null; + rcmail.file_editor = win.file_editor; } catch (e) {}; // on edit page switch immediately to edit mode - if (rcmail.file_editor && rcmail.env.action == 'edit') + if (rcmail.file_editor && rcmail.file_editor.editable && rcmail.env.action == 'edit') rcmail.files_edit(); - rcmail.enable_command('files-edit', rcmail.file_editor + rcmail.enable_command('files-edit', (rcmail.file_editor && rcmail.file_editor.editable) || (info && info.viewer && info.viewer.manticore)); rcmail.enable_command('files-print', (rcmail.file_editor && rcmail.file_editor.printable) || (info && /^image\//i.test(info.type))); diff --git a/plugins/kolab_files/lib/kolab_files_engine.php b/plugins/kolab_files/lib/kolab_files_engine.php index 359f328e..8c058ea9 100644 --- a/plugins/kolab_files/lib/kolab_files_engine.php +++ b/plugins/kolab_files/lib/kolab_files_engine.php @@ -1401,11 +1401,13 @@ class kolab_files_engine } } - if (is_array($this->mimetypes) && array_key_exists($type, $this->mimetypes)) { - $mimetypes = $this->mimetypes[$type]; - } - else { - $mimetypes = (array) $this->mimetypes; + if (is_array($this->mimetypes)) { + if (array_key_exists($type, $this->mimetypes)) { + $mimetypes = $this->mimetypes[$type]; + } + else { + $mimetypes = $this->mimetypes; + } } // fallback to static definition if old Chwala is used