summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-03-19 14:16:13 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2015-03-19 14:16:13 (GMT)
commitfb446d07bff9706131aacbb62d6a802bdb033044 (patch)
tree43b53231ff955807636b00b4b0fdab623870aa62
parentd91e12fa22c1ddb6ec57606e40ba0cc04aa3dfb0 (diff)
downloadroundcubemail-plugins-kolab-fb446d07bff9706131aacbb62d6a802bdb033044.tar.gz
Update client after restoring an old revision of an event
-rw-r--r--plugins/calendar/calendar.php11
-rw-r--r--plugins/calendar/calendar_ui.js12
-rw-r--r--plugins/calendar/localization/en_US.inc2
3 files changed, 21 insertions, 4 deletions
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index e70a4ca..3aa0bd6 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -1132,13 +1132,16 @@ class calendar extends rcube_plugin
case "restore":
if ($success = $this->driver->restore_event_revision($event, $event['rev'])) {
-
+ $_event = $this->driver->get_event($event);
+ $reload = $_event['recurrence'] ? 2 : 1;
+ $this->rc->output->command('display_message', $this->gettext(array('name' => 'eventrestoresuccess', 'vars' => array('rev' => $event['rev']))), 'confirmation');
+ $this->rc->output->command('plugin.close_history_dialog');
}
else {
- $this->rc->output->command('display_message', 'Not implemented yet', 'error');
- $got_msg = true;
+ $this->rc->output->command('display_message', $this->gettext('eventrestoreerror'), 'error');
+ $reload = 0;
}
- $reload = false;
+ $got_msg = true;
break;
}
diff --git a/plugins/calendar/calendar_ui.js b/plugins/calendar/calendar_ui.js
index 91ad382..835873b 100644
--- a/plugins/calendar/calendar_ui.js
+++ b/plugins/calendar/calendar_ui.js
@@ -1316,11 +1316,22 @@ function rcube_calendar_ui(settings)
me.dialog_resize($dialog.get(0), $dialog.height(), 400);
};
+ // close the event history dialog
+ var close_history_dialog = function()
+ {
+ $('#eventhistory, #eventdiff').each(function(i, elem) {
+ var $dialog = $(elem);
+ if ($dialog.is(':ui-dialog'))
+ $dialog.dialog('close');
+ });
+ }
+
// exports
this.event_show_diff = event_show_diff;
this.event_show_dialog = event_show_dialog;
this.event_history_dialog = event_history_dialog;
this.render_event_changelog = render_event_changelog;
+ this.close_history_dialog = close_history_dialog;
// open a dialog to display detailed free-busy information and to find free slots
var event_freebusy_dialog = function()
@@ -4354,6 +4365,7 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
rcmail.addEventListener('plugin.resource_owner', function(p){ cal.resource_owner_load(p); });
rcmail.addEventListener('plugin.render_event_changelog', function(data){ cal.render_event_changelog(data); });
rcmail.addEventListener('plugin.event_show_diff', function(data){ cal.event_show_diff(data); });
+ rcmail.addEventListener('plugin.close_history_dialog', function(data){ cal.close_history_dialog(); });
rcmail.addEventListener('plugin.event_show_revision', function(data){ cal.event_show_dialog(data, null, true); });
rcmail.addEventListener('plugin.itip_message_processed', function(data){ cal.itip_message_processed(data); });
rcmail.addEventListener('requestrefresh', function(q){ return cal.before_refresh(q); });
diff --git a/plugins/calendar/localization/en_US.inc b/plugins/calendar/localization/en_US.inc
index 2c79e34..046115b 100644
--- a/plugins/calendar/localization/en_US.inc
+++ b/plugins/calendar/localization/en_US.inc
@@ -291,6 +291,8 @@ $labels['eventnotfound'] = 'Failed to load event data';
$labels['eventchangelognotavailable'] = 'Change history is not available for this event';
$labels['eventdiffnotavailable'] = 'No comparison possible for the selected revisions';
$labels['eventrestoreconfirm'] = 'Do you really want to restore revision $rev of this event? This will replace the current event with the old version.';
+$labels['eventrestoresuccess'] = 'Revision $rev successfully restored';
+$labels['eventrestoreerror'] = 'Failed to restore the old revision';
// (hidden) titles and labels for accessibility annotations