diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index f4aeaa19..59043092 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -302,7 +302,7 @@ class calendar extends rcube_plugin $this->rc->output->add_label('libcalendaring.itipaccepted','libcalendaring.itiptentative','libcalendaring.itipdeclined','libcalendaring.itipdelegated','libcalendaring.expandattendeegroup','libcalendaring.expandattendeegroupnodata'); // initialize attendees autocompletion - rcube_autocomplete_init(); + $this->rc->autocomplete_init(); $this->rc->output->set_env('timezone', $this->timezone->getName()); $this->rc->output->set_env('calendar_driver', $this->rc->config->get('calendar_driver'), false); diff --git a/plugins/calendar/calendar_base.js b/plugins/calendar/calendar_base.js index fa9aa5e2..3f00925b 100644 --- a/plugins/calendar/calendar_base.js +++ b/plugins/calendar/calendar_base.js @@ -49,29 +49,29 @@ function rcube_calendar(settings) $.when( $.getScript(rcmail.assets_path('plugins/calendar/calendar_ui.js')), $.getScript(rcmail.assets_path('plugins/calendar/lib/js/fullcalendar.js')), - $.get(rcmail.url('calendar/inlineui'), function(html){ $(document.body).append(html); }, 'html') + $.get(rcmail.url('calendar/inlineui'), function(html) { $(document.body).append(html); }, 'html') ).then(function() { // disable attendees feature (autocompletion and stuff is not initialized) for (var c in rcmail.env.calendars) rcmail.env.calendars[c].attendees = rcmail.env.calendars[c].resources = false; - + me.ui_loaded = true; me.ui = new rcube_calendar_ui(me.settings); me.create_from_mail(uid); // start over }); + return; } - else { - // get message contents for event dialog - var lock = rcmail.set_busy(true, 'loading'); - rcmail.http_post('calendar/mailtoevent', { - '_mbox': rcmail.env.mailbox, - '_uid': uid - }, lock); - } + + // get message contents for event dialog + var lock = rcmail.set_busy(true, 'loading'); + rcmail.http_post('calendar/mailtoevent', { + '_mbox': rcmail.env.mailbox, + '_uid': uid + }, lock); } }; - + // callback function triggered from server with contents for the new event this.mail2event_dialog = function(event) { @@ -105,11 +105,11 @@ window.rcmail && rcmail.addEventListener('init', function(evt) { // register create-from-mail command to message_commands array if (rcmail.env.task == 'mail') { - rcmail.register_command('calendar-create-from-mail', function() { cal.create_from_mail() }); - rcmail.register_command('attachment-save-calendar', function() { cal.save_to_calendar() }); - rcmail.addEventListener('plugin.mail2event_dialog', function(p){ cal.mail2event_dialog(p) }); - rcmail.addEventListener('plugin.unlock_saving', function(p){ cal.ui && cal.ui.unlock_saving(); }); - + rcmail.register_command('calendar-create-from-mail', function() { cal.create_from_mail(); }); + rcmail.register_command('attachment-save-calendar', function() { cal.save_to_calendar(); }); + rcmail.addEventListener('plugin.mail2event_dialog', function(p) { cal.mail2event_dialog(p); }); + rcmail.addEventListener('plugin.unlock_saving', function(p) { cal.ui && cal.ui.unlock_saving(); }); + if (rcmail.env.action != 'show') { rcmail.env.message_commands.push('calendar-create-from-mail'); rcmail.add_element($('')); @@ -129,8 +129,8 @@ window.rcmail && rcmail.addEventListener('init', function(evt) { } rcmail.register_command('plugin.calendar', function() { rcmail.switch_task('calendar'); }, true); - - rcmail.addEventListener('plugin.ping_url', function(p){ + + rcmail.addEventListener('plugin.ping_url', function(p) { var action = p.action; p.action = p.event = null; new Image().src = rcmail.url(action, p); diff --git a/plugins/calendar/drivers/database/database_driver.php b/plugins/calendar/drivers/database/database_driver.php index 3b261f57..84b70f22 100644 --- a/plugins/calendar/drivers/database/database_driver.php +++ b/plugins/calendar/drivers/database/database_driver.php @@ -1450,7 +1450,7 @@ class database_driver extends calendar_driver } // decode the old serialization format else { - foreach (explode("\n", $event['attendees']) as $line) { + foreach (explode("\n", $s_attendees) as $line) { $att = array(); foreach (rcube_utils::explode_quoted_string(';', $line) as $prop) { list($key, $value) = explode("=", $prop); diff --git a/plugins/calendar/lib/calendar_ui.php b/plugins/calendar/lib/calendar_ui.php index 8d47099f..557d9dae 100644 --- a/plugins/calendar/lib/calendar_ui.php +++ b/plugins/calendar/lib/calendar_ui.php @@ -607,7 +607,7 @@ class calendar_ui $attrib['id'] = 'rcmUploadForm'; // Get max filesize, enable upload progress bar - $max_filesize = rcube_upload_init(); + $max_filesize = $this->rc->upload_init(); $button = new html_inputfield(array('type' => 'button')); $input = new html_inputfield(array( @@ -616,7 +616,7 @@ class calendar_ui return html::div($attrib, html::div(null, $input->show()) . - html::div('formbuttons', $button->show($this->rc->gettext('upload'), array('class' => 'button mainaction', + html::div('buttons', $button->show($this->rc->gettext('upload'), array('class' => 'button mainaction', 'onclick' => rcmail_output::JS_OBJECT_NAME . ".upload_file(this.form)"))) . html::div('hint', $this->rc->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) ); diff --git a/plugins/calendar/skins/classic/calendar.css b/plugins/calendar/skins/classic/calendar.css index f8a4fa31..c511ff02 100644 --- a/plugins/calendar/skins/classic/calendar.css +++ b/plugins/calendar/skins/classic/calendar.css @@ -373,6 +373,7 @@ pre { right: 4px; } +#eventedit.uidialog, .calendarmain div.uidialog { display: none; } diff --git a/plugins/calendar/skins/larry/calendar.css b/plugins/calendar/skins/larry/calendar.css index 0669a8fd..50c5910b 100644 --- a/plugins/calendar/skins/larry/calendar.css +++ b/plugins/calendar/skins/larry/calendar.css @@ -453,7 +453,8 @@ pre { #calendars .searchresults .boxtitle { background: none; - padding: 2px 8px 2px 8px; + padding: 2px 8px; + border-radius: 0; } #calendars .searchresults .listing li { @@ -538,6 +539,7 @@ body.calendarmain #searchmenulink { width: 15px; } +#eventedit.uidialog, .calendarmain div.uidialog { display: none; } @@ -640,7 +642,7 @@ a.miniColors-trigger { border-top: 2px solid #fafafa; } -#edit-attachments-form .formbuttons { +#edit-attachments-form .buttons { margin: 0.5em 0; } diff --git a/plugins/calendar/skins/larry/templates/eventedit.html b/plugins/calendar/skins/larry/templates/eventedit.html index 4d0585bf..42c20080 100644 --- a/plugins/calendar/skins/larry/templates/eventedit.html +++ b/plugins/calendar/skins/larry/templates/eventedit.html @@ -117,10 +117,10 @@
- +
-

+

diff --git a/plugins/kolab_addressbook/skins/larry/kolab_addressbook.css b/plugins/kolab_addressbook/skins/larry/kolab_addressbook.css index 11ca84e4..a2e78856 100644 --- a/plugins/kolab_addressbook/skins/larry/kolab_addressbook.css +++ b/plugins/kolab_addressbook/skins/larry/kolab_addressbook.css @@ -94,6 +94,11 @@ background-color: #c7e3ef; } +#directorylistbox .searchresults .boxtitle { + padding: 2px 8px; + border-radius: 0; +} + #directorylist li.addressbook.readonly, #directorylist li.addressbook.shared, #directorylist li.addressbook.other { diff --git a/plugins/kolab_files/kolab_files.js b/plugins/kolab_files/kolab_files.js index cdd7b5a3..13bcca53 100644 --- a/plugins/kolab_files/kolab_files.js +++ b/plugins/kolab_files/kolab_files.js @@ -29,28 +29,7 @@ window.rcmail && window.files_api && rcmail.addEventListener('init', function() if (rcmail.task == 'mail') { // mail compose if (rcmail.env.action == 'compose') { - var elem = $('#compose-attachments > div'), - input = $('') - .attr('tabindex', $('input', elem).attr('tabindex') || 0) - .val(rcmail.gettext('kolab_files.fromcloud')) - .click(function() { kolab_files_selector_dialog(); }) - .appendTo(elem); - - if (rcmail.gui_objects.filelist) { - rcmail.file_list = new rcube_list_widget(rcmail.gui_objects.filelist, { - multiselect: true, - keyboard: true, - column_movable: false, - dblclick_time: rcmail.dblclick_time - }); - rcmail.file_list.addEventListener('select', function(o) { kolab_files_list_select(o); }) - .addEventListener('listupdate', function(e) { rcmail.triggerEvent('listupdate', e); }); - - rcmail.enable_command('files-sort', 'files-search', 'files-search-reset', true); - - rcmail.file_list.init(); - kolab_files_list_coltypes(); - } + kolab_files_from_cloud_widget($('#compose-attachments > div')); // register some commands to skip warning message on compose page $.merge(rcmail.env.compose_commands, ['files-list', 'files-sort', 'files-search', 'files-search-reset']); @@ -74,6 +53,26 @@ window.rcmail && window.files_api && rcmail.addEventListener('init', function() rcmail.enable_command('folder-create', true); } + if (!rcmail.env.action || rcmail.env.action == 'show' || rcmail.env.action == 'preview') { + // add "attach from cloud" button for event/task dialog in mail + rcmail.addEventListener('plugin.mail2event_dialog', function() { + if (!$('#calendar-attachment-form input.fromcloud').length) + 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') { @@ -168,6 +167,31 @@ function kolab_files_token() return window.parent && parent.rcmail && parent.rcmail.env.files_token ? parent.rcmail.env.files_token : rcmail.env.files_token; }; +function kolab_files_from_cloud_widget(elem) +{ + var input = $('') + .attr('tabindex', $('input', elem).attr('tabindex') || 0) + .val(rcmail.gettext('kolab_files.fromcloud')) + .click(function() { kolab_files_selector_dialog(); }) + .appendTo(elem); + + if (rcmail.gui_objects.filelist) { + rcmail.file_list = new rcube_list_widget(rcmail.gui_objects.filelist, { + multiselect: true, + keyboard: true, + column_movable: false, + dblclick_time: rcmail.dblclick_time + }); + rcmail.file_list.addEventListener('select', function(o) { kolab_files_list_select(o); }) + .addEventListener('listupdate', function(e) { rcmail.triggerEvent('listupdate', e); }); + + rcmail.enable_command('files-sort', 'files-search', 'files-search-reset', true); + + rcmail.file_list.init(); + kolab_files_list_coltypes(); + } +} + // folder selection dialog function kolab_directory_selector_dialog(id) { @@ -235,7 +259,9 @@ function kolab_directory_selector_dialog(id) if (!rcmail.env.folders_loaded) { fn = function() { - file_api.folder_list(); + rcmail.env.folder_list_selector = '#files-dialog #files-folder-list'; + rcmail.env.folder_search_selector = '#files-dialog #foldersearch'; + file_api.folder_list({writable: 1}); rcmail.env.folders_loaded = true; }; } @@ -252,7 +278,7 @@ function kolab_directory_selector_dialog(id) }, fn); // "enable" folder creation when dialog is displayed in parent window - if (rcmail.is_framed() && !parent.rcmail.folder_create) { + if (rcmail.is_framed()) { parent.rcmail.enable_command('folder-create', true); parent.rcmail.folder_create = function() { win.kolab_files_folder_create_dialog(); @@ -306,6 +332,8 @@ function kolab_files_selector_dialog() }, function() { rcmail.file_list.resize(); }); if (!rcmail.env.files_loaded) { + rcmail.env.folder_list_selector = '#files-compose-dialog #files-folder-list'; + rcmail.env.folder_search_selector = '#files-compose-dialog #foldersearch'; file_api.folder_list(); rcmail.env.files_loaded = true; } @@ -695,7 +723,7 @@ function kolab_files_list_coltypes() rcmail.env.subject_col = null; - if ((n = $.inArray('name', rcmail.env.coltypes)) >= 0) { + if ((n = $.inArray('name', rcmail.env.file_coltypes)) >= 0) { rcmail.env.subject_col = n; list.subject_col = n; } @@ -705,7 +733,7 @@ function kolab_files_list_coltypes() function kolab_files_set_list_options(cols, sort_col, sort_order) { - var update = 0, i, idx, name, newcols = [], oldcols = rcmail.env.coltypes; + var update = 0, i, idx, name, newcols = [], oldcols = rcmail.env.file_coltypes; if (sort_col === undefined) sort_col = rcmail.env.sort_col; @@ -752,19 +780,19 @@ function kolab_files_set_coltypes(list) { var i, found, name, cols = list.list.tHead.rows[0].cells; - rcmail.env.coltypes = []; + rcmail.env.file_coltypes = []; for (i=0; i= 0) +// if ((found = $.inArray('name', rcmail.env.file_coltypes)) >= 0) // rcmail.env.subject_col = found; rcmail.env.subject_col = list.subject_col; - rcmail.http_post('files/prefs', {kolab_files_list_cols: rcmail.env.coltypes}); + rcmail.http_post('files/prefs', {kolab_files_list_cols: rcmail.env.file_coltypes}); }; function kolab_files_list_dblclick(list) @@ -783,23 +811,20 @@ function kolab_files_list_select(list) // if (list.selection.length && list.selection.length != list.rowcount) // rcmail.select_all_mode = false; - // enable files- if (selected == 1) { // get file mimetype - var type = $('tr.selected', list.list).data('type'); + var elem = $('tr.selected', list.list), + type = elem.data('type'), + file = elem.data('file'); + rcmail.env.viewer = file_api.file_type_supported(type, rcmail.env.files_caps); + + if (!file_api.is_writable(file.replace(/\/[^/]+$/, ''))) + rcmail.enable_command('files-delete', false); } else rcmail.env.viewer = 0; -/* - ) { -// caps = this.browser_capabilities().join(); - href = '?' + $.param({_task: 'files', _action: 'open', file: file, viewer: viewer == 2 ? 1 : 0}); - var win = window.open(href, rcmail.html_identifier('rcubefile'+file)); - if (win) - setTimeout(function() { win.focus(); }, 10); - } -*/ + rcmail.enable_command('files-open', rcmail.env.viewer); }; @@ -910,7 +935,7 @@ function kolab_files_drag_drop_init(container) return; $(document.body).bind('dragover dragleave drop', function(e) { - if (!file_api.env.folder) + if (!file_api.is_writable()) return; e.preventDefault(); @@ -930,10 +955,11 @@ function kolab_files_drag_drop_init(container) }, false); }; + // handler for drag/drop on element function kolab_files_drag_hover(e) { - if (!file_api.env.folder) + if (!file_api.is_writable()) return; e.preventDefault(); @@ -1248,11 +1274,33 @@ function kolab_files_ui() rcmail.http_error(request, status, err); }; - // folders list request - this.folder_list = function() + // check if specified/current folder/view is writable + this.is_writable = function(folder) { + if (!folder) + folder = this.env.folder; + + if (!folder) + return false; + + var all_folders = $.extend({}, this.env.folders, this.search_results); + + if (!all_folders[folder] || all_folders[folder].readonly || all_folders[folder].virtual) + return false; + + return true; + }; + + // folders list request + this.folder_list = function(params) + { + if (!params) + params = {} + + params.permissions = 1; + this.req = this.set_busy(true, 'loading'); - this.request('folder_list', {}, 'folder_list_response'); + this.request('folder_list', this.list_params = params, 'folder_list_response'); }; // folder list response handler @@ -1262,19 +1310,24 @@ function kolab_files_ui() return; var first, body, rows = [], - elem = $('#files-folder-list'), - searchbox = $('#foldersearch'), + list_selector = rcmail.env.folder_list_selector || '#files-folder-list', + search_selector = rcmail.env.folder_search_selector || '#foldersearch', + elem = $(list_selector), + searchbox = $(search_selector), list = $('
    '), - collections = !rcmail.env.action.match(/^(preview|show)$/) ? ['audio', 'video', 'image', 'document'] : []; + collections = ['audio', 'video', 'image', 'document']; // try parent window if the list element does not exist // i.e. called from dialog in parent window if (!elem.length && window.parent && parent.rcmail) { body = window.parent.document.body; - elem = $('#files-folder-list', body); - searchbox = $('#foldersearch', body); + elem = $(list_selector, body); + searchbox = $(search_selector, body); } + if (elem.data('no-collections') == true) + collections = []; + elem.html(''); this.env.folders = this.folder_list_parse(response.result && response.result.list ? response.result.list : response.result); @@ -1319,6 +1372,7 @@ function kolab_files_ui() check_droptarget: function(node) { return !node.virtual && node.id != file_api.env.folder + && $.inArray('readonly', node.classes) == -1 && $.inArray('collection', node.classes) == -1; } }); @@ -1371,7 +1425,8 @@ function kolab_files_ui() this.env.collection = collection; rcmail.enable_command('files-list', true); - rcmail.enable_command('files-folder-delete', 'folder-rename', 'files-upload', !is_collection); + rcmail.enable_command('files-folder-delete', 'folder-rename', !is_collection); + rcmail.enable_command('files-upload', !is_collection && this.is_writable()); rcmail.command('files-list', is_collection ? {collection: collection} : {folder: folder}); this.quota(); @@ -1410,16 +1465,23 @@ function kolab_files_ui() this.folder_list_row = function(i, folder, parent) { - var toggle, sublist, collapsed, parent, parent_name, - row = $('
  • '), + var toggle, sublist, collapsed, parent, parent_name, classes = ['mailbox'], + row = $('
  • '), id = 'rcmli' + rcmail.html_identifier_encode(i); - row.attr('id', id).append($('').text(folder.name)); + row.attr('id', id).append($('').text(folder.name)); if (folder.virtual) - row.addClass('virtual'); - else if (folder.subscribed !== undefined) - row.append(this.folder_list_subscription_button(folder.subscribed)); + classes.push('virtual'); + else { + if (folder.subscribed !== undefined) + row.append(this.folder_list_subscription_button(folder.subscribed)); + + if (folder.readonly) + classes.push('readonly'); + } + + row.addClass(classes.join(' ')); folder.ref = row; @@ -1498,7 +1560,7 @@ function kolab_files_ui() this.listsearch_request = null; } - var params = {search: search.query, unsubscribed: 1}; + var params = $.extend({search: search.query, unsubscribed: 1}, this.list_params); this.req = this.set_busy(true, rcmail.gettext('searching')); this.listsearch_request = this.request('folder_list', params, 'folder_search_response'); @@ -1585,17 +1647,22 @@ function kolab_files_ui() $.each(folders, function(i, folder) { var node, separator = file_api.env.directory_separator, path = i.split(separator), + classes = ['mailbox'], html = [$('').text(folder.name)]; - // add subscription button - if (!folder.virtual) + if (!folder.virtual) { + // add subscription button html.push(file_api.folder_list_subscription_button(false)); + if (folder.readonly) + classes.push('readonly'); + } + path.pop(); file_api.search_results_widget.insert({ id: i, - classes: ['mailbox'], + classes: classes, text: folder.name, html: html, collapsed: false, @@ -2044,8 +2111,8 @@ function kolab_files_ui() { var c, col, row = ''; - for (c in rcmail.env.coltypes) { - c = rcmail.env.coltypes[c]; + for (c in rcmail.env.file_coltypes) { + c = rcmail.env.file_coltypes[c]; if (c == 'name') col = '' + '' + escapeHTML(data.name) + ''; diff --git a/plugins/kolab_files/lib/kolab_files_engine.php b/plugins/kolab_files/lib/kolab_files_engine.php index 20ddae80..611af95c 100644 --- a/plugins/kolab_files/lib/kolab_files_engine.php +++ b/plugins/kolab_files/lib/kolab_files_engine.php @@ -50,13 +50,15 @@ class kolab_files_engine { $this->plugin->add_texts('localization/'); + $templates = array(); + // set templates of Files UI and widgets if ($this->rc->task == 'mail') { - if ($this->rc->action == 'compose') { - $template = 'compose_plugin'; + if (in_array($this->rc->action, array('', 'show', 'compose'))) { + $templates[] = 'compose_plugin'; } - else if (in_array($this->rc->action, array('show', 'preview', 'get'))) { - $template = 'message_plugin'; + if (in_array($this->rc->action, array('show', 'preview', 'get'))) { + $templates[] = 'message_plugin'; if ($this->rc->action == 'get') { // add "Save as" button into attachment toolbar @@ -87,6 +89,20 @@ class kolab_files_engine } } + $list_widget = true; + } + else if (!$this->rc->action && in_array($this->rc->task, array('calendar', 'tasks'))) { + $list_widget = true; + $templates[] = 'compose_plugin'; + } + else if ($this->rc->task == 'files') { + $templates[] = 'files'; + + // get list of external sources + $this->get_external_storage_drivers(); + } + + if ($list_widget) { $this->folder_list_env(); $this->plugin->add_label('save', 'cancel', 'saveto', @@ -95,12 +111,6 @@ class kolab_files_engine 'folderauthtitle', 'authenticating' ); } - else if ($this->rc->task == 'files') { - $template = 'files'; - - // get list of external sources - $this->get_external_storage_drivers(); - } // add taskbar button if (empty($_REQUEST['framed'])) { @@ -115,7 +125,7 @@ class kolab_files_engine $this->plugin->include_stylesheet($this->plugin->local_skin_path().'/style.css'); - if (!empty($template)) { + if (!empty($templates)) { $collapsed_folders = (string) $this->rc->config->get('kolab_files_collapsed_folders'); $this->plugin->include_script($this->url . '/js/files_api.js'); @@ -139,9 +149,11 @@ class kolab_files_engine )); if ($this->rc->task != 'files') { - // add dialog content at the end of page body - $this->rc->output->add_footer( - $this->rc->output->parse('kolab_files.' . $template, false, false)); + // add dialog(s) content at the end of page body + foreach ($templates as $template) { + $this->rc->output->add_footer( + $this->rc->output->parse('kolab_files.' . $template, false, false)); + } } } } @@ -471,7 +483,7 @@ class kolab_files_engine $this->rc->output->add_gui_object('filelist', $attrib['id']); $this->rc->output->set_env('sort_col', $_SESSION['kolab_files_sort_col']); $this->rc->output->set_env('sort_order', $_SESSION['kolab_files_sort_order']); - $this->rc->output->set_env('coltypes', $a_show_cols); + $this->rc->output->set_env('file_coltypes', $a_show_cols); $this->rc->output->set_env('search_threads', $this->rc->config->get('kolab_files_search_threads')); $this->rc->output->include_script('list.js'); @@ -594,7 +606,7 @@ class kolab_files_engine $head = html::tag('tr', null, $head); - $this->rc->output->set_env('coltypes', $a_show_cols); + $this->rc->output->set_env('file_coltypes', $a_show_cols); $this->rc->output->command('files_list_update', $head); } @@ -1033,23 +1045,26 @@ class kolab_files_engine */ protected function action_attach_file() { - $files = rcube_utils::get_input_value('files', rcube_utils::INPUT_POST); - $uploadid = rcube_utils::get_input_value('uploadid', rcube_utils::INPUT_POST); - $COMPOSE_ID = rcube_utils::get_input_value('id', rcube_utils::INPUT_POST); - $COMPOSE = null; - $errors = array(); + $files = rcube_utils::get_input_value('files', rcube_utils::INPUT_POST); + $uploadid = rcube_utils::get_input_value('uploadid', rcube_utils::INPUT_POST); + $COMPOSE_ID = rcube_utils::get_input_value('id', rcube_utils::INPUT_POST); + $COMPOSE = null; + $errors = array(); + $attachments = array(); - if ($COMPOSE_ID && $_SESSION['compose_data_'.$COMPOSE_ID]) { - $COMPOSE =& $_SESSION['compose_data_'.$COMPOSE_ID]; - } + if ($this->rc->task == 'mail') { + if ($COMPOSE_ID && $_SESSION['compose_data_'.$COMPOSE_ID]) { + $COMPOSE =& $_SESSION['compose_data_'.$COMPOSE_ID]; + } - if (!$COMPOSE) { - die("Invalid session var!"); - } + if (!$COMPOSE) { + die("Invalid session var!"); + } - // attachment upload action - if (!is_array($COMPOSE['attachments'])) { - $COMPOSE['attachments'] = array(); + // attachment upload action + if (!is_array($COMPOSE['attachments'])) { + $COMPOSE['attachments'] = array(); + } } // clear all stored output properties (like scripts and env vars) @@ -1122,13 +1137,18 @@ class kolab_files_engine } $attachment = array( - 'path' => $path, - 'size' => $file_params['size'], - 'name' => $file_params['name'], + 'path' => $path, + 'size' => $file_params['size'], + 'name' => $file_params['name'], 'mimetype' => $file_params['type'], - 'group' => $COMPOSE_ID, + 'group' => $COMPOSE_ID, ); + if ($this->rc->task != 'mail') { + $attachments[] = $attachment; + continue; + } + $attachment = $this->rc->plugins->exec_hook('attachment_save', $attachment); if ($attachment['status'] && !$attachment['abort']) { @@ -1176,6 +1196,30 @@ class kolab_files_engine $this->rc->output->command('display_message', $this->plugin->gettext('attacherror'), 'error'); $this->rc->output->command('remove_from_attachment_list', $uploadid); } + else if ($this->rc->task == 'calendar' || $this->rc->task == 'tasks') { + // for uploads in events/tasks we'll use its standard upload handler, + // for this we have to fake $_FILES and some other POST args + foreach ($attachments as $attach) { + $_FILES['_attachments']['tmp_name'][] = $attachment['path']; + $_FILES['_attachments']['name'][] = $attachment['name']; + $_FILES['_attachments']['size'][] = $attachment['size']; + $_FILES['_attachments']['type'][] = $attachment['mimetype']; + $_FILES['_attachments']['error'][] = null; + } + + $_GET['_uploadid'] = $uploadid; + $_GET['_id'] = $COMPOSE_ID; + + switch ($this->rc->task) { + case 'tasks': + libcalendaring::get_instance()->attachment_upload(tasklist::SESSION_KEY); + break; + + case 'calendar': + libcalendaring::get_instance()->attachment_upload(calendar::SESSION_KEY, 'cal-'); + break; + } + } // send html page with JS calls as response $this->rc->output->command('auto_save_start', false); diff --git a/plugins/kolab_files/skins/larry/style.css b/plugins/kolab_files/skins/larry/style.css index 1bbbf3f5..1a5db7b8 100644 --- a/plugins/kolab_files/skins/larry/style.css +++ b/plugins/kolab_files/skins/larry/style.css @@ -210,6 +210,24 @@ margin-top: 8px; } +#files-folder-list li.readonly { + background-image: url(images/listicons.png); + background-position: right -1000px; + background-repeat: no-repeat; +} + +#files-folder-list li.readonly { + background-position: 88% -14px; +} + +#files-folder-list li.readonly a { + padding-right: 40px; +} + +#files-folder-list li.readonly a.subscription { + padding-right: 0; +} + .filelist thead tr th { padding: 0; } diff --git a/plugins/kolab_files/skins/larry/templates/message_plugin.html b/plugins/kolab_files/skins/larry/templates/message_plugin.html index 1192a309..df8452b0 100644 --- a/plugins/kolab_files/skins/larry/templates/message_plugin.html +++ b/plugins/kolab_files/skins/larry/templates/message_plugin.html @@ -11,7 +11,7 @@