plugins/calendar
Thomas Brüderli
bruederli at kolabsys.com
Thu Mar 19 15:16:20 CET 2015
plugins/calendar/calendar.php | 11 +++++++----
plugins/calendar/calendar_ui.js | 12 ++++++++++++
plugins/calendar/localization/en_US.inc | 2 ++
3 files changed, 21 insertions(+), 4 deletions(-)
New commits:
commit fb446d07bff9706131aacbb62d6a802bdb033044
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Thu Mar 19 15:16:13 2015 +0100
Update client after restoring an old revision of an event
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
More information about the commits
mailing list