Support file_editors without 'editable' property enabled

This commit is contained in:
Aleksander Machniak 2016-10-18 11:43:35 +02:00
parent 49f0038cf6
commit 9622df6df1
2 changed files with 10 additions and 8 deletions

View file

@ -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)));

View file

@ -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