summaryrefslogtreecommitdiff
path: root/plugins/libcalendaring
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-09-10 08:30:40 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-09-10 08:30:40 (GMT)
commit09cf967ed5799a3e8701f906123df2b9746e70c2 (patch)
tree011a426ee64557c2299697dc01a340d648b51e1f /plugins/libcalendaring
parent7161b90e4616776efbd4d4a10a150a45cde4eb7b (diff)
downloadroundcubemail-plugins-kolab-09cf967ed5799a3e8701f906123df2b9746e70c2.tar.gz
Add button to iTip RSVP UI in mail view to open the calendar preview with an option to accept/decline the invitation from there (#3161)
Diffstat (limited to 'plugins/libcalendaring')
-rw-r--r--plugins/libcalendaring/lib/libcalendaring_itip.php14
-rw-r--r--plugins/libcalendaring/libcalendaring.js12
-rw-r--r--plugins/libcalendaring/localization/en_US.inc1
3 files changed, 26 insertions, 1 deletions
diff --git a/plugins/libcalendaring/lib/libcalendaring_itip.php b/plugins/libcalendaring/lib/libcalendaring_itip.php
index ce68655..a5b056f 100644
--- a/plugins/libcalendaring/lib/libcalendaring_itip.php
+++ b/plugins/libcalendaring/lib/libcalendaring_itip.php
@@ -361,6 +361,7 @@ class libcalendaring_itip
return array(
'uid' => $event['uid'],
'id' => asciiwords($event['uid'], true),
+ 'existing' => $existing ? true : false,
'saved' => $existing ? true : false,
'latest' => $latest,
'status' => $status,
@@ -372,7 +373,7 @@ class libcalendaring_itip
/**
* Build inline UI elements for iTip messages
*/
- public function mail_itip_inline_ui($event, $method, $mime_id, $task, $message_date = null)
+ public function mail_itip_inline_ui($event, $method, $mime_id, $task, $message_date = null, $preview_url = null)
{
$buttons = array();
$dom_id = asciiwords($event['uid'], true);
@@ -450,6 +451,17 @@ class libcalendaring_itip
));
}
+ // add button to open calendar/preview
+ if (!empty($preview_url)) {
+ $msgref = $this->lib->ical_message->folder . '/' . $this->lib->ical_message->uid . '#' . $mime_id;
+ $rsvp_buttons .= html::tag('input', array(
+ 'type' => 'button',
+ 'class' => "button preview",
+ 'onclick' => "rcube_libcalendaring.open_itip_preview('" . JQ($preview_url) . "', '" . JQ($msgref) . "')",
+ 'value' => $this->gettext('openpreview'),
+ ));
+ }
+
// 2. update the local copy with minor changes
$update_button = html::tag('input', array(
'type' => 'button',
diff --git a/plugins/libcalendaring/libcalendaring.js b/plugins/libcalendaring/libcalendaring.js
index cd06827..b23a3fe 100644
--- a/plugins/libcalendaring/libcalendaring.js
+++ b/plugins/libcalendaring/libcalendaring.js
@@ -892,6 +892,7 @@ rcube_libcalendaring.fetch_itip_object_status = function(p)
rcube_libcalendaring.update_itip_object_status = function(p)
{
rcmail.env.rsvp_saved = p.saved;
+ rcmail.env.itip_existing = p.existing;
// hide all elements first
$('#itip-buttons-'+p.id+' > div').hide();
@@ -953,6 +954,17 @@ rcube_libcalendaring.itip_after_action = function(action)
}
};
+/**
+ * Open the calendar preview for the current iTip event
+ */
+rcube_libcalendaring.open_itip_preview = function(url, msgref)
+{
+ if (!rcmail.env.itip_existing)
+ url += '&itip=' + escape(msgref);
+
+ var win = rcmail.open_window(url);
+};
+
// extend jQuery
(function($){
diff --git a/plugins/libcalendaring/localization/en_US.inc b/plugins/libcalendaring/localization/en_US.inc
index 82fb7a8..9c3507c 100644
--- a/plugins/libcalendaring/localization/en_US.inc
+++ b/plugins/libcalendaring/localization/en_US.inc
@@ -134,6 +134,7 @@ $labels['outdatedinvitation'] = 'This invitation has been replaced by a newer ve
$labels['importtocalendar'] = 'Save to my calendar';
$labels['removefromcalendar'] = 'Remove from my calendar';
$labels['updatemycopy'] = 'Update my copy';
+$labels['openpreview'] = 'Open Preview';
$labels['deleteobjectconfirm'] = 'Do you really want to delete this object?';
$labels['declinedeleteconfirm'] = 'Do you also want to delete this declined object from your account?';