Remove plugin. prefix since calendar defines its own task

This commit is contained in:
Thomas Bruederli 2011-06-13 16:36:11 -06:00
parent 2e0b6536d5
commit 70936adbb4
4 changed files with 48 additions and 33 deletions

View file

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

View file

@ -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://<roundcubeurl>/?_task=calendar&_action=plugin.randomdata&_num=500
* Create events by opening http://<roundcubeurl>/?_task=calendar&_action=randomdata&_num=500
*/
public function generate_randomdata()
{

View file

@ -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&amp;_action=plugin.export_events',
'command' => 'export_events',
'href' => './?_task=calendar&amp;_action=export_events',
'title' => 'calendar.export',
'imagepas' => 'skins/' . $skin . '/images/export.png',
'imageact' => 'skins/' . $skin . '/images/export.png'),

View file

@ -18,7 +18,7 @@
<roundcube:object name="plugin.calendar_list" id="calendarslist" />
</div>
<div class="boxfooter">
<roundcube:button command="plugin.calendar-create" type="link" title="calendar.createcalendar" class="buttonPas addgroup" classAct="button addgroup" content=" " />
<roundcube:button command="calendar-create" type="link" title="calendar.createcalendar" class="buttonPas addgroup" classAct="button addgroup" content=" " />
<roundcube:button name="calendaroptionslink" id="calendaroptionslink" type="link" title="calendaractions" class="button groupactions" onclick="rcmail_ui.show_popup('calendaroptions');return false" content=" " />
</div>
</div>
@ -29,8 +29,8 @@
<div id="calendaroptionsmenu" class="popupmenu">
<ul>
<li><roundcube:button command="plugin.calendar-edit" label="calendar.edit" classAct="active" /></li>
<li><roundcube:button command="plugin.calendar-remove" label="calendar.remove" classAct="active" /></li>
<li><roundcube:button command="calendar-edit" label="calendar.edit" classAct="active" /></li>
<li><roundcube:button command="calendar-remove" label="calendar.remove" classAct="active" /></li>
</ul>
</div>
@ -189,9 +189,9 @@
</div>
<div id="calendartoolbar">
<roundcube:button command="plugin.addevent" type="link" class="buttonPas addevent" classAct="button addevent" classSel="button addeventSel" title="calendar.new_event" content=" " />
<roundcube:button command="plugin.print" type="link" class="buttonPas print" classAct="button print" classSel="button printSel" title="calendar.print" content=" " />
<roundcube:button command="plugin.export" type="link" class="buttonPas export" classAct="button export" classSel="button exportSel" title="calendar.export" content=" " />
<roundcube:button command="addevent" type="link" class="buttonPas addevent" classAct="button addevent" classSel="button addeventSel" title="calendar.new_event" content=" " />
<roundcube:button command="print" type="link" class="buttonPas print" classAct="button print" classSel="button printSel" title="calendar.print" content=" " />
<roundcube:button command="export" type="link" class="buttonPas export" classAct="button export" classSel="button exportSel" title="calendar.export" content=" " />
<roundcube:container name="toolbar" id="calendartoolbar" />
</div>