diff --git a/plugins/kolab_files/config.inc.php.dist b/plugins/kolab_files/config.inc.php.dist index c05ed1de..7e6d1ce3 100644 --- a/plugins/kolab_files/config.inc.php.dist +++ b/plugins/kolab_files/config.inc.php.dist @@ -15,4 +15,13 @@ $config['kolab_files_sort_order'] = 'asc'; // Number of concurent requests for searching and collections listing. Default: 1 $config['kolab_files_search_threads'] = 1; -?> +// LDAP addressbook that would be searched for user names autocomplete. +// That should be an array refering to the $config['ldap_public'] array key +// or complete addressbook configuration array. +$config['kolab_files_users_source'] = ''; + +// The LDAP attribute which will be used as ACL user identifier +$config['kolab_files_users_field'] = 'mail'; + +// The LDAP search filter will be &'d with search queries +$config['kolab_files_users_filter'] = ''; diff --git a/plugins/kolab_files/kolab_files.js b/plugins/kolab_files/kolab_files.js index f711fd7b..4ecdb2b4 100644 --- a/plugins/kolab_files/kolab_files.js +++ b/plugins/kolab_files/kolab_files.js @@ -6,7 +6,7 @@ * @licstart The following is the entire license notice for the * JavaScript code in this file. * - * Copyright (C) 2011, Kolab Systems AG + * Copyright (C) 2011-2015, Kolab Systems AG * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -60,20 +60,16 @@ window.rcmail && window.files_api && rcmail.addEventListener('init', function() kolab_files_from_cloud_widget($('#calendar-attachment-form > div.buttons')); }); } - - kolab_files_init(); } else if (rcmail.task == 'calendar') { // add "attach from cloud" button for event dialog if (!rcmail.env.action) kolab_files_from_cloud_widget($('#calendar-attachment-form > div.buttons')); - kolab_files_init(); } else if (rcmail.task == 'tasks') { // add "attach from cloud" button for task dialog if (!rcmail.env.action) kolab_files_from_cloud_widget($('#taskedit-attachment-form > div.buttons')); - kolab_files_init(); } else if (rcmail.task == 'files') { if (rcmail.gui_objects.filelist) { @@ -102,21 +98,20 @@ window.rcmail && window.files_api && rcmail.addEventListener('init', function() } // "one file only" commands - rcmail.env.file_commands = ['files-get']; + rcmail.env.file_commands = ['files-get', 'files-rename']; // "one or more file" commands rcmail.env.file_commands_all = ['files-delete', 'files-move', 'files-copy']; - kolab_files_init(); - - if (rcmail.env.action == 'open') { - rcmail.enable_command('files-get', 'files-delete', rcmail.env.file); + if (rcmail.env.action == 'open' || rcmail.env.action == 'edit') { + rcmail.enable_command('files-get', true); + rcmail.enable_command('files-delete', rcmail.env.file_data.writable); } else { - file_api.folder_list(); - file_api.browser_capabilities_check(); rcmail.enable_command('folder-mount', rcmail.env.external_sources); } } + + kolab_files_init(); }); @@ -130,6 +125,8 @@ function kolab_files_init() if (window.file_api) return; + var manticore_config = {}; + // Initialize application object (don't change var name!) file_api = $.extend(new files_api(), new kolab_files_ui()); @@ -145,6 +142,61 @@ function kolab_files_init() }); file_api.translations = rcmail.labels; + + if (rcmail.task == 'files') { + if (rcmail.env.action == 'edit' && rcmail.env.file_data.viewer && rcmail.env.file_data.viewer.manticore) { + manticore_config = { + // UI elements + iframe: $('#fileframe').get(0), + export_menu: rcmail.gui_objects.exportmenu ? $('ul', rcmail.gui_objects.exportmenu).get(0) : null, + title_input: $('#document-title').get(0), + members_list: $('#members').get(0), + photo_url: '?_task=addressbook&_action=photo&_error=1&_email=%email', + photo_default_url: rcmail.env.photo_placeholder, + // events + ready: function(data) { manticore_init(); }, + sessionClosed: function(data) { return manticore_close(); } + }; + + if (rcmail.env.file_data.writable) + manticore_config.documentChanged = function(data) { rcmail.enable_command('document-save', true); }; + } + else if (rcmail.env.action == 'open') { + // initialize folders list (for dialogs) + file_api.folder_list(); + + // get ongoing sessions + file_api.request('folder_info', {folder: file_api.file_path(rcmail.env.file), sessions: 1}, 'folder_info_response'); + } + else { + file_api.folder_list(); + file_api.browser_capabilities_check(); + } + } + + if (rcmail.env.files_caps && rcmail.env.files_caps.MANTICORE && !rcmail.env.framed) + $.extend(manticore_config, { + // invitation notifications + api: file_api, + owner: rcmail.env.files_user, + interval: rcmail.env.files_interval || 60, + invitationMore: true, + invitationChange: manticore_invitation_handler + }); + + $.extend(manticore_config, { + // notifications/alerts + gettext: function(label) { return rcmail.get_label('kolab_files.' + label); }, + set_busy: function(state, message) { return rcmail.set_busy(state, message ? 'kolab_files.' + message : ''); }, + hide_message: function(id) { return rcmail.hide_message(id); }, + display_message: function(label, type, is_txt, timeout) { + if (!is_txt) + label = 'kolab_files.' + label; + return rcmail.display_message(label, type, timeout * 1000); + } + }); + + manticore = new manticore_api(manticore_config); }; // returns API authorization token @@ -380,25 +432,14 @@ function kolab_files_folder_create_dialog() $('form', dialog).submit(kolab_dialog_submit_handler); // build parent selector - select.append($('