Various fixes

This commit is contained in:
Aleksander Machniak 2015-12-02 14:23:00 +01:00
parent 94eff6b1e7
commit 580904174e
3 changed files with 12 additions and 4 deletions

View file

@ -103,7 +103,8 @@ window.rcmail && window.files_api && rcmail.addEventListener('init', function()
rcmail.env.file_commands_all = ['files-delete', 'files-move', 'files-copy'];
if (rcmail.env.action == 'open' || rcmail.env.action == 'edit') {
rcmail.enable_command('files-get', 'files-delete', rcmail.env.file);
rcmail.enable_command('files-get', true);
rcmail.enable_command('files-delete', rcmail.env.file_data.writable);
}
else {
rcmail.enable_command('folder-mount', rcmail.env.external_sources);
@ -1570,13 +1571,17 @@ rcube_webmail.prototype.files_edit = function(session)
files = kolab_files_selected();
if (files.length == 1)
file = files[0];
readonly = !file_api.is_writable(file_api.file_path(file));
}
else {
readonly = !this.env.file_data.writable;
}
// check if the folder is read-only or there are ongoing sessions
// in such cases display dialog for the user to decide what to do
if (!session) {
sessions = file_api.file_sessions(file);
if (sessions.length || (readonly = !file_api.is_writable(file_api.file_path(file)))) {
if (sessions.length || readonly) {
kolab_files_file_edit_dialog(file, sessions, readonly);
return;
}

View file

@ -3,6 +3,7 @@
/**
* Kolab files collaborators autocompletion
*
* @version @package_version@
* @author Aleksander Machniak <machniak@kolabsys.com>
*
* Copyright (C) 2013-2015, Kolab Systems AG <contact@kolabsys.com>

View file

@ -3,9 +3,10 @@
/**
* Kolab files storage engine
*
* @version @package_version@
* @author Aleksander Machniak <machniak@kolabsys.com>
*
* Copyright (C) 2013, Kolab Systems AG <contact@kolabsys.com>
* Copyright (C) 2013-2015, Kolab Systems AG <contact@kolabsys.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@ -1298,6 +1299,7 @@ class kolab_files_engine
));
$placeholder = $this->rc->output->asset_url('program/resources/blank.gif');
$manticore = ($viewer & 4) && $this->file_data['viewer']['manticore'];
// this one is for styling purpose
$this->rc->output->set_env('extwin', true);
@ -1305,7 +1307,7 @@ class kolab_files_engine
$this->rc->output->set_env('file_data', $this->file_data);
$this->rc->output->set_env('photo_placeholder', $placeholder);
$this->rc->output->set_pagetitle(rcube::Q($file));
$this->rc->output->send('kolab_files.' . ($viewer & 4 ? 'docedit' : 'filepreview'));
$this->rc->output->send('kolab_files.' . ($manticore ? 'docedit' : 'filepreview'));
}
/**