summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2011-08-17 13:45:07 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2011-08-17 13:45:07 (GMT)
commitf619a75751a91c8deadd6c437fb1a47b055e1cc2 (patch)
tree80bfe3b1d98afb0533b4918904f9a5f86eea441f
parent0c1d0fef755ef461fffd135d692c90540c15d1d5 (diff)
downloadroundcubemail-plugins-kolab-f619a75751a91c8deadd6c437fb1a47b055e1cc2.tar.gz
Activate invisible calendars when event was added there (#346)
-rw-r--r--plugins/calendar/calendar_ui.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/plugins/calendar/calendar_ui.js b/plugins/calendar/calendar_ui.js
index 25dc257..86cfed8 100644
--- a/plugins/calendar/calendar_ui.js
+++ b/plugins/calendar/calendar_ui.js
@@ -1387,7 +1387,7 @@ function rcube_calendar_ui(settings)
rcmail.http_post('event', { action:action, e:data });
// render event temporarily into the calendar
- if (data.start && data.end) {
+ if (data.start && data.end && action != 'remove') {
var event = data.id ? $.extend(fc.fullCalendar('clientEvents', data.id)[0], data) : data;
event.start = fromunixtime(data.start);
event.end = fromunixtime(data.end);
@@ -2242,8 +2242,17 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
// register callback commands
rcmail.addEventListener('plugin.refresh_calendar', function(p){
- if (p.refetch)
- $('#calendar').fullCalendar('refetchEvents', cal.calendars[p.source]);
+ var source = cal.calendars[p.source];
+ if (p.refetch && source) {
+ // activate event source if new event was added to an invisible calendar
+ if (!source.active) {
+ source.active = true;
+ $('#calendar').fullCalendar('addEventSource', source);
+ $('#' + rcmail.get_folder_li(source.id, 'rcmlical').id + ' input').prop('checked', true);
+ }
+ else
+ $('#calendar').fullCalendar('refetchEvents', source);
+ }
// remove temp events
$('#calendar').fullCalendar('removeEvents', function(e){ return e.temp; });
});