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'); $this->rc->output->add_label('libcalendaring.itipaccepted','libcalendaring.itiptentative','libcalendaring.itipdeclined','libcalendaring.itipdelegated','libcalendaring.expandattendeegroup','libcalendaring.expandattendeegroupnodata');
// initialize attendees autocompletion // initialize attendees autocompletion
rcube_autocomplete_init(); $this->rc->autocomplete_init();
$this->rc->output->set_env('timezone', $this->timezone->getName()); $this->rc->output->set_env('timezone', $this->timezone->getName());
$this->rc->output->set_env('calendar_driver', $this->rc->config->get('calendar_driver'), false); $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( $.when(
$.getScript(rcmail.assets_path('plugins/calendar/calendar_ui.js')), $.getScript(rcmail.assets_path('plugins/calendar/calendar_ui.js')),
$.getScript(rcmail.assets_path('plugins/calendar/lib/js/fullcalendar.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() { ).then(function() {
// disable attendees feature (autocompletion and stuff is not initialized) // disable attendees feature (autocompletion and stuff is not initialized)
for (var c in rcmail.env.calendars) for (var c in rcmail.env.calendars)
rcmail.env.calendars[c].attendees = rcmail.env.calendars[c].resources = false; rcmail.env.calendars[c].attendees = rcmail.env.calendars[c].resources = false;
me.ui_loaded = true; me.ui_loaded = true;
me.ui = new rcube_calendar_ui(me.settings); me.ui = new rcube_calendar_ui(me.settings);
me.create_from_mail(uid); // start over me.create_from_mail(uid); // start over
}); });
return; return;
} }
else {
// get message contents for event dialog // get message contents for event dialog
var lock = rcmail.set_busy(true, 'loading'); var lock = rcmail.set_busy(true, 'loading');
rcmail.http_post('calendar/mailtoevent', { rcmail.http_post('calendar/mailtoevent', {
'_mbox': rcmail.env.mailbox, '_mbox': rcmail.env.mailbox,
'_uid': uid '_uid': uid
}, lock); }, lock);
}
} }
}; };
// callback function triggered from server with contents for the new event // callback function triggered from server with contents for the new event
this.mail2event_dialog = function(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 // register create-from-mail command to message_commands array
if (rcmail.env.task == 'mail') { if (rcmail.env.task == 'mail') {
rcmail.register_command('calendar-create-from-mail', function() { cal.create_from_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.register_command('attachment-save-calendar', function() { cal.save_to_calendar(); });
rcmail.addEventListener('plugin.mail2event_dialog', function(p){ cal.mail2event_dialog(p) }); 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.addEventListener('plugin.unlock_saving', function(p) { cal.ui && cal.ui.unlock_saving(); });
if (rcmail.env.action != 'show') { if (rcmail.env.action != 'show') {
rcmail.env.message_commands.push('calendar-create-from-mail'); rcmail.env.message_commands.push('calendar-create-from-mail');
rcmail.add_element($('<a>')); 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.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; var action = p.action;
p.action = p.event = null; p.action = p.event = null;
new Image().src = rcmail.url(action, p); new Image().src = rcmail.url(action, p);

View file

@ -1450,7 +1450,7 @@ class database_driver extends calendar_driver
} }
// decode the old serialization format // decode the old serialization format
else { else {
foreach (explode("\n", $event['attendees']) as $line) { foreach (explode("\n", $s_attendees) as $line) {
$att = array(); $att = array();
foreach (rcube_utils::explode_quoted_string(';', $line) as $prop) { foreach (rcube_utils::explode_quoted_string(';', $line) as $prop) {
list($key, $value) = explode("=", $prop); list($key, $value) = explode("=", $prop);

View file

@ -607,7 +607,7 @@ class calendar_ui
$attrib['id'] = 'rcmUploadForm'; $attrib['id'] = 'rcmUploadForm';
// Get max filesize, enable upload progress bar // 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')); $button = new html_inputfield(array('type' => 'button'));
$input = new html_inputfield(array( $input = new html_inputfield(array(
@ -616,7 +616,7 @@ class calendar_ui
return html::div($attrib, return html::div($attrib,
html::div(null, $input->show()) . 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)"))) . 'onclick' => rcmail_output::JS_OBJECT_NAME . ".upload_file(this.form)"))) .
html::div('hint', $this->rc->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) html::div('hint', $this->rc->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize))))
); );

View file

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

View file

@ -453,7 +453,8 @@ pre {
#calendars .searchresults .boxtitle { #calendars .searchresults .boxtitle {
background: none; background: none;
padding: 2px 8px 2px 8px; padding: 2px 8px;
border-radius: 0;
} }
#calendars .searchresults .listing li { #calendars .searchresults .listing li {
@ -538,6 +539,7 @@ body.calendarmain #searchmenulink {
width: 15px; width: 15px;
} }
#eventedit.uidialog,
.calendarmain div.uidialog { .calendarmain div.uidialog {
display: none; display: none;
} }
@ -640,7 +642,7 @@ a.miniColors-trigger {
border-top: 2px solid #fafafa; border-top: 2px solid #fafafa;
} }
#edit-attachments-form .formbuttons { #edit-attachments-form .buttons {
margin: 0.5em 0; margin: 0.5em 0;
} }

View file

@ -117,10 +117,10 @@
<!-- attachments list (with upload form) --> <!-- attachments list (with upload form) -->
<div id="event-panel-attachments"> <div id="event-panel-attachments">
<div id="edit-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>
<div id="edit-attachments-form" role="region" aria-labelledby="aria-label-attachmentuploadform"> <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" /> <roundcube:object name="plugin.attachments_form" id="calendar-attachment-form" attachmentFieldSize="30" />
</div> </div>
<roundcube:object name="plugin.filedroparea" id="event-panel-attachments" /> <roundcube:object name="plugin.filedroparea" id="event-panel-attachments" />

View file

@ -94,6 +94,11 @@
background-color: #c7e3ef; background-color: #c7e3ef;
} }
#directorylistbox .searchresults .boxtitle {
padding: 2px 8px;
border-radius: 0;
}
#directorylist li.addressbook.readonly, #directorylist li.addressbook.readonly,
#directorylist li.addressbook.shared, #directorylist li.addressbook.shared,
#directorylist li.addressbook.other { #directorylist li.addressbook.other {

View file

@ -29,28 +29,7 @@ window.rcmail && window.files_api && rcmail.addEventListener('init', function()
if (rcmail.task == 'mail') { if (rcmail.task == 'mail') {
// mail compose // mail compose
if (rcmail.env.action == 'compose') { if (rcmail.env.action == 'compose') {
var elem = $('#compose-attachments > div'), kolab_files_from_cloud_widget($('#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();
}
// register some commands to skip warning message on compose page // register some commands to skip warning message on compose page
$.merge(rcmail.env.compose_commands, ['files-list', 'files-sort', 'files-search', 'files-search-reset']); $.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); 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(); kolab_files_init();
} }
else if (rcmail.task == 'files') { 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; 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 // folder selection dialog
function kolab_directory_selector_dialog(id) function kolab_directory_selector_dialog(id)
{ {
@ -235,7 +259,9 @@ function kolab_directory_selector_dialog(id)
if (!rcmail.env.folders_loaded) { if (!rcmail.env.folders_loaded) {
fn = function() { 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; rcmail.env.folders_loaded = true;
}; };
} }
@ -252,7 +278,7 @@ function kolab_directory_selector_dialog(id)
}, fn); }, fn);
// "enable" folder creation when dialog is displayed in parent window // "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.enable_command('folder-create', true);
parent.rcmail.folder_create = function() { parent.rcmail.folder_create = function() {
win.kolab_files_folder_create_dialog(); win.kolab_files_folder_create_dialog();
@ -306,6 +332,8 @@ function kolab_files_selector_dialog()
}, function() { rcmail.file_list.resize(); }); }, function() { rcmail.file_list.resize(); });
if (!rcmail.env.files_loaded) { 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(); file_api.folder_list();
rcmail.env.files_loaded = true; rcmail.env.files_loaded = true;
} }
@ -695,7 +723,7 @@ function kolab_files_list_coltypes()
rcmail.env.subject_col = null; 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; rcmail.env.subject_col = n;
list.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) 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) if (sort_col === undefined)
sort_col = rcmail.env.sort_col; 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; 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++) for (i=0; i<cols.length; i++)
if (cols[i].id && cols[i].id.match(/^rcm/)) { if (cols[i].id && cols[i].id.match(/^rcm/)) {
name = cols[i].id.replace(/^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 = found;
rcmail.env.subject_col = list.subject_col; 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) 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) // if (list.selection.length && list.selection.length != list.rowcount)
// rcmail.select_all_mode = false; // rcmail.select_all_mode = false;
// enable files-
if (selected == 1) { if (selected == 1) {
// get file mimetype // 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); 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 else
rcmail.env.viewer = 0; 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); rcmail.enable_command('files-open', rcmail.env.viewer);
}; };
@ -910,7 +935,7 @@ function kolab_files_drag_drop_init(container)
return; return;
$(document.body).bind('dragover dragleave drop', function(e) { $(document.body).bind('dragover dragleave drop', function(e) {
if (!file_api.env.folder) if (!file_api.is_writable())
return; return;
e.preventDefault(); e.preventDefault();
@ -930,10 +955,11 @@ function kolab_files_drag_drop_init(container)
}, false); }, false);
}; };
// handler for drag/drop on element // handler for drag/drop on element
function kolab_files_drag_hover(e) function kolab_files_drag_hover(e)
{ {
if (!file_api.env.folder) if (!file_api.is_writable())
return; return;
e.preventDefault(); e.preventDefault();
@ -1248,11 +1274,33 @@ function kolab_files_ui()
rcmail.http_error(request, status, err); rcmail.http_error(request, status, err);
}; };
// folders list request // check if specified/current folder/view is writable
this.folder_list = function() 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.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 // folder list response handler
@ -1262,19 +1310,24 @@ function kolab_files_ui()
return; return;
var first, body, rows = [], var first, body, rows = [],
elem = $('#files-folder-list'), list_selector = rcmail.env.folder_list_selector || '#files-folder-list',
searchbox = $('#foldersearch'), search_selector = rcmail.env.folder_search_selector || '#foldersearch',
elem = $(list_selector),
searchbox = $(search_selector),
list = $('<ul class="treelist listing folderlist"></ul>'), 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 // try parent window if the list element does not exist
// i.e. called from dialog in parent window // i.e. called from dialog in parent window
if (!elem.length && window.parent && parent.rcmail) { if (!elem.length && window.parent && parent.rcmail) {
body = window.parent.document.body; body = window.parent.document.body;
elem = $('#files-folder-list', body); elem = $(list_selector, body);
searchbox = $('#foldersearch', body); searchbox = $(search_selector, body);
} }
if (elem.data('no-collections') == true)
collections = [];
elem.html(''); elem.html('');
this.env.folders = this.folder_list_parse(response.result && response.result.list ? response.result.list : response.result); 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) { check_droptarget: function(node) {
return !node.virtual return !node.virtual
&& node.id != file_api.env.folder && node.id != file_api.env.folder
&& $.inArray('readonly', node.classes) == -1
&& $.inArray('collection', node.classes) == -1; && $.inArray('collection', node.classes) == -1;
} }
}); });
@ -1371,7 +1425,8 @@ function kolab_files_ui()
this.env.collection = collection; this.env.collection = collection;
rcmail.enable_command('files-list', true); 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}); rcmail.command('files-list', is_collection ? {collection: collection} : {folder: folder});
this.quota(); this.quota();
@ -1410,16 +1465,23 @@ function kolab_files_ui()
this.folder_list_row = function(i, folder, parent) this.folder_list_row = function(i, folder, parent)
{ {
var toggle, sublist, collapsed, parent, parent_name, var toggle, sublist, collapsed, parent, parent_name, classes = ['mailbox'],
row = $('<li class="mailbox"></li>'), row = $('<li>'),
id = 'rcmli' + rcmail.html_identifier_encode(i); 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) if (folder.virtual)
row.addClass('virtual'); classes.push('virtual');
else if (folder.subscribed !== undefined) else {
row.append(this.folder_list_subscription_button(folder.subscribed)); 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; folder.ref = row;
@ -1498,7 +1560,7 @@ function kolab_files_ui()
this.listsearch_request = null; 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.req = this.set_busy(true, rcmail.gettext('searching'));
this.listsearch_request = this.request('folder_list', params, 'folder_search_response'); this.listsearch_request = this.request('folder_list', params, 'folder_search_response');
@ -1585,17 +1647,22 @@ function kolab_files_ui()
$.each(folders, function(i, folder) { $.each(folders, function(i, folder) {
var node, separator = file_api.env.directory_separator, var node, separator = file_api.env.directory_separator,
path = i.split(separator), path = i.split(separator),
classes = ['mailbox'],
html = [$('<a>').text(folder.name)]; 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)); html.push(file_api.folder_list_subscription_button(false));
if (folder.readonly)
classes.push('readonly');
}
path.pop(); path.pop();
file_api.search_results_widget.insert({ file_api.search_results_widget.insert({
id: i, id: i,
classes: ['mailbox'], classes: classes,
text: folder.name, text: folder.name,
html: html, html: html,
collapsed: false, collapsed: false,
@ -2044,8 +2111,8 @@ function kolab_files_ui()
{ {
var c, col, row = ''; var c, col, row = '';
for (c in rcmail.env.coltypes) { for (c in rcmail.env.file_coltypes) {
c = rcmail.env.coltypes[c]; c = rcmail.env.file_coltypes[c];
if (c == 'name') if (c == 'name')
col = '<td class="name filename ' + this.file_type_class(data.type) + '">' col = '<td class="name filename ' + this.file_type_class(data.type) + '">'
+ '<span>' + escapeHTML(data.name) + '</span></td>'; + '<span>' + escapeHTML(data.name) + '</span></td>';

View file

@ -50,13 +50,15 @@ class kolab_files_engine
{ {
$this->plugin->add_texts('localization/'); $this->plugin->add_texts('localization/');
$templates = array();
// set templates of Files UI and widgets // set templates of Files UI and widgets
if ($this->rc->task == 'mail') { if ($this->rc->task == 'mail') {
if ($this->rc->action == 'compose') { if (in_array($this->rc->action, array('', 'show', 'compose'))) {
$template = 'compose_plugin'; $templates[] = 'compose_plugin';
} }
else if (in_array($this->rc->action, array('show', 'preview', 'get'))) { if (in_array($this->rc->action, array('show', 'preview', 'get'))) {
$template = 'message_plugin'; $templates[] = 'message_plugin';
if ($this->rc->action == 'get') { if ($this->rc->action == 'get') {
// add "Save as" button into attachment toolbar // 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->folder_list_env();
$this->plugin->add_label('save', 'cancel', 'saveto', $this->plugin->add_label('save', 'cancel', 'saveto',
@ -95,12 +111,6 @@ class kolab_files_engine
'folderauthtitle', 'authenticating' 'folderauthtitle', 'authenticating'
); );
} }
else if ($this->rc->task == 'files') {
$template = 'files';
// get list of external sources
$this->get_external_storage_drivers();
}
// add taskbar button // add taskbar button
if (empty($_REQUEST['framed'])) { if (empty($_REQUEST['framed'])) {
@ -115,7 +125,7 @@ class kolab_files_engine
$this->plugin->include_stylesheet($this->plugin->local_skin_path().'/style.css'); $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'); $collapsed_folders = (string) $this->rc->config->get('kolab_files_collapsed_folders');
$this->plugin->include_script($this->url . '/js/files_api.js'); $this->plugin->include_script($this->url . '/js/files_api.js');
@ -139,9 +149,11 @@ class kolab_files_engine
)); ));
if ($this->rc->task != 'files') { if ($this->rc->task != 'files') {
// add dialog content at the end of page body // add dialog(s) content at the end of page body
$this->rc->output->add_footer( foreach ($templates as $template) {
$this->rc->output->parse('kolab_files.' . $template, false, false)); $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->add_gui_object('filelist', $attrib['id']);
$this->rc->output->set_env('sort_col', $_SESSION['kolab_files_sort_col']); $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('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->set_env('search_threads', $this->rc->config->get('kolab_files_search_threads'));
$this->rc->output->include_script('list.js'); $this->rc->output->include_script('list.js');
@ -594,7 +606,7 @@ class kolab_files_engine
$head = html::tag('tr', null, $head); $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); $this->rc->output->command('files_list_update', $head);
} }
@ -1033,23 +1045,26 @@ class kolab_files_engine
*/ */
protected function action_attach_file() protected function action_attach_file()
{ {
$files = rcube_utils::get_input_value('files', rcube_utils::INPUT_POST); $files = rcube_utils::get_input_value('files', rcube_utils::INPUT_POST);
$uploadid = rcube_utils::get_input_value('uploadid', 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_ID = rcube_utils::get_input_value('id', rcube_utils::INPUT_POST);
$COMPOSE = null; $COMPOSE = null;
$errors = array(); $errors = array();
$attachments = array();
if ($COMPOSE_ID && $_SESSION['compose_data_'.$COMPOSE_ID]) { if ($this->rc->task == 'mail') {
$COMPOSE =& $_SESSION['compose_data_'.$COMPOSE_ID]; if ($COMPOSE_ID && $_SESSION['compose_data_'.$COMPOSE_ID]) {
} $COMPOSE =& $_SESSION['compose_data_'.$COMPOSE_ID];
}
if (!$COMPOSE) { if (!$COMPOSE) {
die("Invalid session var!"); die("Invalid session var!");
} }
// attachment upload action // attachment upload action
if (!is_array($COMPOSE['attachments'])) { if (!is_array($COMPOSE['attachments'])) {
$COMPOSE['attachments'] = array(); $COMPOSE['attachments'] = array();
}
} }
// clear all stored output properties (like scripts and env vars) // clear all stored output properties (like scripts and env vars)
@ -1122,13 +1137,18 @@ class kolab_files_engine
} }
$attachment = array( $attachment = array(
'path' => $path, 'path' => $path,
'size' => $file_params['size'], 'size' => $file_params['size'],
'name' => $file_params['name'], 'name' => $file_params['name'],
'mimetype' => $file_params['type'], '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); $attachment = $this->rc->plugins->exec_hook('attachment_save', $attachment);
if ($attachment['status'] && !$attachment['abort']) { 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('display_message', $this->plugin->gettext('attacherror'), 'error');
$this->rc->output->command('remove_from_attachment_list', $uploadid); $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 // send html page with JS calls as response
$this->rc->output->command('auto_save_start', false); $this->rc->output->command('auto_save_start', false);

View file

@ -210,6 +210,24 @@
margin-top: 8px; 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 { .filelist thead tr th {
padding: 0; padding: 0;
} }

View file

@ -11,7 +11,7 @@
</div> </div>
<div id="folderlistbox" class="uibox listbox" role="navigation" aria-labelledby="aria-label-folderlist"> <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> <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"> <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="+" /> <roundcube:button command="folder-create" name="foldercreatelink" id="foldercreatelink" type="link" title="createfolder" class="listbutton add" classAct="listbutton add" innerClass="inner" content="+" />
</div> </div>

View file

@ -71,7 +71,7 @@ function kolab_files_show_listoptions(p)
// set checkboxes // set checkboxes
$('input[name="list_col[]"]').each(function() { $('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({ $dialog.dialog({

View file

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

View file

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

View file

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

View file

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

View file

@ -447,7 +447,7 @@ class tasklist_ui
return html::div($attrib, return html::div($attrib,
html::div(null, $input->show()) . 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)"))) . 'onclick' => rcmail_output::JS_OBJECT_NAME . ".upload_file(this.form)"))) .
html::div('hint', $this->rc->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) html::div('hint', $this->rc->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize))))
); );