Display animated message while saving event data

This commit is contained in:
Thomas 2011-07-05 19:43:22 +02:00
parent 1b5ea4983d
commit c2daec1711
3 changed files with 19 additions and 6 deletions

View file

@ -430,7 +430,7 @@ class calendar extends rcube_plugin
$action = get_input_value('action', RCUBE_INPUT_POST);
$event = get_input_value('e', RCUBE_INPUT_POST);
$success = $reload = false;
switch ($action) {
case "new":
// create UID for new event
@ -464,6 +464,9 @@ class calendar extends rcube_plugin
break;
}
// unlock client
$this->rc->output->command('plugin.unlock_saving');
if ($success)
$this->rc->output->show_message('successfullysaved', 'confirmation');
else if ($removed)

View file

@ -34,6 +34,7 @@ function rcube_calendar_ui(settings)
this.search_request = null;
this.search_source = null;
this.eventcount = [];
this.saving_lock = null;
/*** private vars ***/
@ -504,7 +505,7 @@ function rcube_calendar_ui(settings)
else
data.calendar = calendars.val();
rcmail.http_post('event', { action:action, e:data });
update_event(action, data);
$dialog.dialog("close");
};
@ -541,6 +542,13 @@ function rcube_calendar_ui(settings)
title.select();
};
// post the given event data to server
var update_event = function(action, data)
{
me.saving_lock = rcmail.set_busy(true, 'calendar.savingdata');
rcmail.http_post('event', { action:action, e:data });
};
// mouse-click handler to check if the show dialog is still open and prevent default action
var dialog_check = function(e)
@ -573,7 +581,7 @@ function rcube_calendar_ui(settings)
$dialog.find('a.button').button().click(function(e){
event.savemode = String(this.href).replace(/.+#/, '');
rcmail.http_post('event', { action:action, e:event });
update_event(action, event);
$dialog.dialog("destroy").hide();
return false;
});
@ -624,7 +632,7 @@ function rcube_calendar_ui(settings)
// send remove request to plugin
if (confirm(rcmail.gettext('deleteventconfirm', 'calendar'))) {
rcmail.http_post('event', { action:'remove', e:{ id:event.id, calendar:event.calendar } });
update_event('remove', { id:event.id, calendar:event.calendar });
return true;
}
@ -985,7 +993,7 @@ function rcube_calendar_ui(settings)
if (event.recurrence)
recurring_edit_confirm(data, 'move');
else
rcmail.http_post('event', { action:'move', e:data });
update_event('move', data);
},
// callback for event resizing
eventResize: function(event, delta) {
@ -999,7 +1007,7 @@ function rcube_calendar_ui(settings)
if (event.recurrence)
recurring_edit_confirm(data, 'resize');
else
rcmail.http_post('event', { action:'resize', e:data });
update_event('resize', data);
},
viewDisplay: function(view) {
me.eventcount = [];
@ -1188,6 +1196,7 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
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.destroy_source', function(p){ cal.calendar_destroy_source(p.id); });
rcmail.addEventListener('plugin.unlock_saving', function(p){ rcmail.set_busy(false, null, cal.saving_lock); });
// let's go

View file

@ -95,6 +95,7 @@ $labels['tabattachments'] = 'Attachments';
// messages
$labels['deleteventconfirm'] = "Do you really want to delete this event?";
$labels['deletecalendarconfirm'] = "Do you really want to delete this calendar with all its events?";
$labels['savingdata'] = "Saving data...";
$labels['errorsaving'] = "Failed to save changes";
$labels['operationfailed'] = "The requested operation failed";
$labels['invalideventdates'] = "Invalid dates entered! Please check your input.";