Merge branch 'master' into manticore

Conflicts:
	plugins/kolab_files/kolab_files.js
This commit is contained in:
Aleksander Machniak 2015-11-10 10:55:30 +01:00
commit f5a807291e
18 changed files with 277 additions and 140 deletions

View file

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

View file

@ -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($('<a>'));
@ -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);

View file

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

View file

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

View file

@ -373,6 +373,7 @@ pre {
right: 4px;
}
#eventedit.uidialog,
.calendarmain div.uidialog {
display: none;
}

View file

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

View file

@ -117,10 +117,10 @@
<!-- attachments list (with upload form) -->
<div id="event-panel-attachments">
<div id="edit-attachments">
<roundcube:object name="plugin.attachments_list" id="attachment-list" class="attachmentslist" />
<roundcube:object name="plugin.attachments_list" id="attachmentlist" class="attachmentslist" />
</div>
<div id="edit-attachments-form" role="region" aria-labelledby="aria-label-attachmentuploadform">
<h3 id="aria-label-attachmentuploadform" class="voice"><roundcube:label name="arialabelattachmentuploadform" /></h2>
<h3 id="aria-label-attachmentuploadform" class="voice"><roundcube:label name="arialabelattachmentuploadform" /></h3>
<roundcube:object name="plugin.attachments_form" id="calendar-attachment-form" attachmentFieldSize="30" />
</div>
<roundcube:object name="plugin.filedroparea" id="event-panel-attachments" />

View file

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

View file

@ -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 = $('<input class="button" type="button">')
.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 = $('<input class="button fromcloud" type="button">')
.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<cols.length; i++)
if (cols[i].id && cols[i].id.match(/^rcm/)) {
name = cols[i].id.replace(/^rcm/, '');
rcmail.env.coltypes.push(name);
rcmail.env.file_coltypes.push(name);
}
// if ((found = $.inArray('name', rcmail.env.coltypes)) >= 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 = $('<ul class="treelist listing folderlist"></ul>'),
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 = $('<li class="mailbox"></li>'),
var toggle, sublist, collapsed, parent, parent_name, classes = ['mailbox'],
row = $('<li>'),
id = 'rcmli' + rcmail.html_identifier_encode(i);
row.attr('id', id).append($('<a>').text(folder.name));
row.attr('id', id).append($('<a class="name">').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 = [$('<a>').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 = '<td class="name filename ' + this.file_type_class(data.type) + '">'
+ '<span>' + escapeHTML(data.name) + '</span></td>';

View file

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

View file

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

View file

@ -11,7 +11,7 @@
</div>
<div id="folderlistbox" class="uibox listbox" role="navigation" aria-labelledby="aria-label-folderlist">
<h3 id="aria-label-folderlist" class="voice"><roundcube:label name="kolab_files.arialabelfolderlist" /></h3>
<div id="files-folder-list" class="scroller withfooter"></div>
<div id="files-folder-list" class="scroller withfooter" data-no-collections="true"></div>
<div id="folderlist-footer" class="boxfooter">
<roundcube:button command="folder-create" name="foldercreatelink" id="foldercreatelink" type="link" title="createfolder" class="listbutton add" classAct="listbutton add" innerClass="inner" content="+" />
</div>

View file

@ -71,7 +71,7 @@ function kolab_files_show_listoptions(p)
// set checkboxes
$('input[name="list_col[]"]').each(function() {
$(this).prop('checked', $.inArray(this.value, rcmail.env.coltypes) != -1);
$(this).prop('checked', $.inArray(this.value, rcmail.env.file_coltypes) != -1);
});
$dialog.dialog({

View file

@ -604,12 +604,9 @@ class kolab_notes extends rcube_plugin
$success = $silent = false;
switch ($action) {
case 'new':
$temp_id = $rec['tempid'];
case 'edit':
if ($success = $this->save_note($note)) {
$refresh = $this->get_note($note);
$refresh['tempid'] = $temp_id;
}
break;

View file

@ -584,6 +584,8 @@ class libvcalendar implements Iterator
// validate event dates
if ($event['_type'] == 'event') {
$event['allday'] = false;
// check for all-day dates
if ($event['start']->_dateonly) {
$event['allday'] = true;

View file

@ -26,6 +26,7 @@ ul.toolbarmenu li span.icon.taskadd,
background-position: -4px -90px;
}
#taskedit.uidialog,
.tasklistview div.uidialog {
display: none;
}
@ -912,7 +913,7 @@ a.morelink:hover {
width: 97%;
}
#taskeditform .formbuttons {
#taskeditform .buttons {
margin: 0.5em 0;
}

View file

@ -51,7 +51,7 @@ function rcube_tasklist(settings)
if (!ui_loaded) {
$.when(
$.getScript(rcmail.assets_path('plugins/tasklist/tasklist.js')),
$.get(rcmail.url('tasks/inlineui'), function(html){ $(document.body).append(html); }, 'html')
$.get(rcmail.url('tasks/inlineui'), function(html) { $(document.body).append(html); }, 'html')
).then(function() {
// register attachments form
// rcmail.gui_object('attachmentlist', 'attachmentlist');
@ -60,16 +60,16 @@ function rcube_tasklist(settings)
me.ui = new rcube_tasklist_ui($.extend(rcmail.env.tasklist_settings, settings));
create_from_mail(uid); // start over
});
return;
}
else {
// get message contents for task dialog
var lock = rcmail.set_busy(true, 'loading');
rcmail.http_post('tasks/mail2task', {
'_mbox': rcmail.env.mailbox,
'_uid': uid
}, lock);
}
// get message contents for task dialog
var lock = rcmail.set_busy(true, 'loading');
rcmail.http_post('tasks/mail2task', {
'_mbox': rcmail.env.mailbox,
'_uid': uid
}, lock);
}
}

View file

@ -447,7 +447,7 @@ class tasklist_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))))
);