From 70936adbb4ea3e43fb45256994ffe56ac177332c Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Mon, 13 Jun 2011 16:36:11 -0600 Subject: [PATCH] Remove plugin. prefix since calendar defines its own task --- plugins/calendar/calendar.js | 35 +++++++++---------- plugins/calendar/calendar.php | 30 ++++++++++++---- plugins/calendar/lib/calendar_ui.php | 4 +-- .../skins/default/templates/calendar.html | 12 +++---- 4 files changed, 48 insertions(+), 33 deletions(-) diff --git a/plugins/calendar/calendar.js b/plugins/calendar/calendar.js index f4340b0e..3e66d963 100644 --- a/plugins/calendar/calendar.js +++ b/plugins/calendar/calendar.js @@ -377,7 +377,7 @@ function rcube_calendar(settings) else data.calendar = calendars.val(); - rcmail.http_post('plugin.event', { action:action, e:data }); + rcmail.http_post('event', { action:action, e:data }); $dialog.dialog("close"); }; @@ -446,7 +446,7 @@ function rcube_calendar(settings) $dialog.find('a.button').button().click(function(e){ event.savemode = String(this.href).replace(/.+#/, ''); - rcmail.http_post('plugin.event', { action:action, e:event }); + rcmail.http_post('event', { action:action, e:event }); $dialog.dialog("destroy").hide(); return false; }); @@ -497,7 +497,7 @@ function rcube_calendar(settings) // send remove request to plugin if (confirm(rcmail.gettext('deleteventconfirm', 'calendar'))) { - rcmail.http_post('plugin.event', { action:'remove', e:{ id:event.id, calendar:event.calendar } }); + rcmail.http_post('event', { action:'remove', e:{ id:event.id, calendar:event.calendar } }); return true; } @@ -591,7 +591,7 @@ function rcube_calendar(settings) this.dismiss_alarm = function(id, snooze) { $('#alarm-snooze-dropdown').hide(); - rcmail.http_post('plugin.event', { action:'dismiss', e:{ id:id, snooze:snooze } }); + rcmail.http_post('event', { action:'dismiss', e:{ id:id, snooze:snooze } }); // remove dismissed alarm from list if (this.dismiss_link) { @@ -641,7 +641,7 @@ function rcube_calendar(settings) if (calendar.id) data.id = calendar.id; - rcmail.http_post('plugin.calendar', { action:(calendar.id ? 'edit' : 'new'), c:data }); + rcmail.http_post('calendar', { action:(calendar.id ? 'edit' : 'new'), c:data }); $dialog.dialog("close"); }; @@ -668,7 +668,7 @@ function rcube_calendar(settings) this.calendar_remove = function(calendar) { if (confirm(rcmail.gettext('deletecalendarconfirm', 'calendar'))) { - rcmail.http_post('plugin.calendar', { action:'remove', c:{ id:calendar.id } }); + rcmail.http_post('calendar', { action:'remove', c:{ id:calendar.id } }); return true; } return false; @@ -692,7 +692,7 @@ function rcube_calendar(settings) for (var id in rcmail.env.calendars) { cal = rcmail.env.calendars[id]; this.calendars[id] = $.extend({ - url: "./?_task=calendar&_action=plugin.load_events&source="+escape(id), + url: "./?_task=calendar&_action=load_events&source="+escape(id), editable: !cal.readonly, className: 'fc-event-cal-'+id, id: id @@ -723,14 +723,14 @@ function rcube_calendar(settings) $(li).click(function(e){ var id = $(this).data('id'); rcmail.select_folder(id, me.selected_calendar, 'rcmlical'); - rcmail.enable_command('plugin.calendar-edit','plugin.calendar-remove', true); + rcmail.enable_command('calendar-edit','calendar-remove', true); me.selected_calendar = id; }).data('id', id); } if (!cal.readonly && !this.selected_calendar && (!settings.default_calendar || settings.default_calendar == id)) { this.selected_calendar = id; - rcmail.enable_command('plugin.addevent', true); + rcmail.enable_command('addevent', true); } } @@ -861,7 +861,7 @@ function rcube_calendar(settings) if (event.recurrence) recurring_edit_confirm(data, 'move'); else - rcmail.http_post('plugin.event', { action:'move', e:data }); + rcmail.http_post('event', { action:'move', e:data }); }, // callback for event resizing eventResize: function(event, delta) { @@ -875,7 +875,7 @@ function rcube_calendar(settings) if (event.recurrence) recurring_edit_confirm(data, 'resize'); else - rcmail.http_post('plugin.event', { action:'resize', e:data }); + rcmail.http_post('event', { action:'resize', e:data }); }, viewDisplay: function(view) { me.eventcount = []; @@ -1039,21 +1039,20 @@ function rcube_calendar(settings) window.rcmail && rcmail.addEventListener('init', function(evt) { // configure toobar buttons - rcmail.register_command('plugin.addevent', function(){ cal.add_event(); }, true); + rcmail.register_command('addevent', function(){ cal.add_event(); }, true); // configure list operations - rcmail.register_command('plugin.calendar-create', function(){ cal.calendar_edit_dialog(null); }, true); - rcmail.register_command('plugin.calendar-edit', function(){ cal.calendar_edit_dialog(cal.calendars[cal.selected_calendar]); }, false); - rcmail.register_command('plugin.calendar-remove', function(){ cal.calendar_remove(cal.calendars[cal.selected_calendar]); }, false); + rcmail.register_command('calendar-create', function(){ cal.calendar_edit_dialog(null); }, true); + rcmail.register_command('calendar-edit', function(){ cal.calendar_edit_dialog(cal.calendars[cal.selected_calendar]); }, false); + rcmail.register_command('calendar-remove', function(){ cal.calendar_remove(cal.calendars[cal.selected_calendar]); }, false); // export events - rcmail.register_command('plugin.export', function(){ rcmail.goto_url('plugin.export_events', { source:cal.selected_calendar }); }, true); - rcmail.enable_command('plugin.export', true); + rcmail.register_command('export', function(){ rcmail.goto_url('export_events', { source:cal.selected_calendar }); }, true); // register callback commands rcmail.addEventListener('plugin.display_alarms', function(alarms){ cal.display_alarms(alarms); }); rcmail.addEventListener('plugin.reload_calendar', function(p){ $('#calendar').fullCalendar('refetchEvents', cal.calendars[p.source]); }); - rcmail.addEventListener('plugin.calendar_destroy_source', function(p){ cal.calendar_destroy_source(p.id); }); + rcmail.addEventListener('plugin.destroy_source', function(p){ cal.calendar_destroy_source(p.id); }); // let's go diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index 184dce4f..03d65d6d 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -71,11 +71,12 @@ class calendar extends rcube_plugin // register calendar actions $this->register_action('index', array($this, 'calendar_view')); - $this->register_action('plugin.event', array($this, 'event_action')); - $this->register_action('plugin.calendar', array($this, 'calendar_action')); - $this->register_action('plugin.load_events', array($this, 'load_events')); - $this->register_action('plugin.export_events', array($this, 'export_events')); - $this->register_action('plugin.randomdata', array($this, 'generate_randomdata')); + $this->register_action('event', array($this, 'event_action')); + $this->register_action('calendar', array($this, 'calendar_action')); + $this->register_action('load_events', array($this, 'load_events')); + $this->register_action('search_events', array($this, 'search_events')); + $this->register_action('export_events', array($this, 'export_events')); + $this->register_action('randomdata', array($this, 'generate_randomdata')); $this->add_hook('keep_alive', array($this, 'keep_alive')); // set user's timezone @@ -373,7 +374,7 @@ class calendar extends rcube_plugin break; case "remove": if ($success = $this->driver->remove_calendar($cal)) - $this->rc->output->command('plugin.calendar_destroy_source', array('id' => $cal['id'])); + $this->rc->output->command('plugin.destroy_source', array('id' => $cal['id'])); break; } @@ -450,6 +451,21 @@ class calendar extends rcube_plugin exit; } + /** + * Handler for search-requests from client + * This will return pure JSON formatted output for fullcalendar + */ + function search_events() + { + $events = $this->driver->load_events( + get_input_value('start', RCUBE_INPUT_GET), + get_input_value('end', RCUBE_INPUT_GET), + get_input_value('source', RCUBE_INPUT_GET) + ); + echo $this->encode($events); + exit; + } + /** * Handler for keep-alive requests * This will check for pending notifications and pass them to the client @@ -758,7 +774,7 @@ class calendar extends rcube_plugin /** * TEMPORARY: generate random event data for testing - * Create events by opening http:///?_task=calendar&_action=plugin.randomdata&_num=500 + * Create events by opening http:///?_task=calendar&_action=randomdata&_num=500 */ public function generate_randomdata() { diff --git a/plugins/calendar/lib/calendar_ui.php b/plugins/calendar/lib/calendar_ui.php index f04f45ba..27fd3ae6 100644 --- a/plugins/calendar/lib/calendar_ui.php +++ b/plugins/calendar/lib/calendar_ui.php @@ -74,8 +74,8 @@ class calendar_ui { $skin = $this->rc->config->get('skin'); $this->calendar->add_button(array( - 'command' => 'plugin.export_events', - 'href' => './?_task=calendar&_action=plugin.export_events', + 'command' => 'export_events', + 'href' => './?_task=calendar&_action=export_events', 'title' => 'calendar.export', 'imagepas' => 'skins/' . $skin . '/images/export.png', 'imageact' => 'skins/' . $skin . '/images/export.png'), diff --git a/plugins/calendar/skins/default/templates/calendar.html b/plugins/calendar/skins/default/templates/calendar.html index a376b4e5..119dde57 100644 --- a/plugins/calendar/skins/default/templates/calendar.html +++ b/plugins/calendar/skins/default/templates/calendar.html @@ -18,7 +18,7 @@
- +
@@ -29,8 +29,8 @@
    -
  • -
  • +
  • +
@@ -189,9 +189,9 @@
- - - + + +