plugins/calendar plugins/libcalendaring

Aleksander Machniak machniak at kolabsys.com
Tue Jul 8 13:48:29 CEST 2014


 plugins/calendar/calendar.php                      |   11 ++++++-----
 plugins/libcalendaring/lib/libcalendaring_itip.php |    6 ++++++
 plugins/libcalendaring/libcalendaring.js           |    7 +++++--
 plugins/libcalendaring/localization/en_US.inc      |    1 +
 4 files changed, 18 insertions(+), 7 deletions(-)

New commits:
commit f57791fb17c043016de72577c7a6d897acac0064
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Tue Jul 8 13:47:50 2014 +0200

    Add option to suppress iTip reply when handling iTip invitation (#3160)

diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index ac7ee9f..825d11c 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -2277,11 +2277,12 @@ class calendar extends rcube_plugin
    */
   public function mail_import_itip()
   {
-    $uid = get_input_value('_uid', RCUBE_INPUT_POST);
-    $mbox = get_input_value('_mbox', RCUBE_INPUT_POST);
+    $uid     = get_input_value('_uid', RCUBE_INPUT_POST);
+    $mbox    = get_input_value('_mbox', RCUBE_INPUT_POST);
     $mime_id = get_input_value('_part', RCUBE_INPUT_POST);
-    $status = get_input_value('_status', RCUBE_INPUT_POST);
-    $delete = intval(get_input_value('_del', RCUBE_INPUT_POST));
+    $status  = get_input_value('_status', RCUBE_INPUT_POST);
+    $delete  = intval(get_input_value('_del', RCUBE_INPUT_POST));
+    $noreply = intval(get_input_value('_noreply', RCUBE_INPUT_POST));
 
     $error_msg = $this->gettext('errorimportingevent');
     $success = false;
@@ -2428,7 +2429,7 @@ class calendar extends rcube_plugin
 
 
     // send iTip reply
-    if ($this->ical->method == 'REQUEST' && $organizer && !in_array(strtolower($organizer['email']), $emails) && !$error_msg) {
+    if ($this->ical->method == 'REQUEST' && $organizer && !$noreply && !in_array(strtolower($organizer['email']), $emails) && !$error_msg) {
       $event['comment'] = get_input_value('_comment', RCUBE_INPUT_POST);
       $itip = $this->load_itip();
       $itip->set_sender_email($reply_sender);
diff --git a/plugins/libcalendaring/lib/libcalendaring_itip.php b/plugins/libcalendaring/lib/libcalendaring_itip.php
index 66b20eb..eeb1445 100644
--- a/plugins/libcalendaring/lib/libcalendaring_itip.php
+++ b/plugins/libcalendaring/lib/libcalendaring_itip.php
@@ -443,6 +443,12 @@ class libcalendaring_itip
                 html::tag('textarea', array('id' => 'reply-comment-'.$dom_id, 'cols' => 40, 'rows' => 6, 'style' => 'display:none', 'placeholder' => $this->gettext('itipcomment')), '')
             );
 
+            // add checkbox to suppress itip reply message
+            $rsvp_buttons .= html::label(array('class' => 'noreply-toggle'),
+                html::tag('input', array('type' => 'checkbox', 'id' => 'noreply-'.$dom_id, 'value' => 1))
+                . ' ' . $this->gettext('itipsuppressreply')
+            );
+
             $buttons[] = html::div(array('id' => 'rsvp-'.$dom_id, 'class' => 'rsvp-buttons', 'style' => 'display:none'), $rsvp_buttons);
         }
         // for CANCEL messages, we can:
diff --git a/plugins/libcalendaring/libcalendaring.js b/plugins/libcalendaring/libcalendaring.js
index 49cbd15..e561ea3 100644
--- a/plugins/libcalendaring/libcalendaring.js
+++ b/plugins/libcalendaring/libcalendaring.js
@@ -744,9 +744,11 @@ rcube_libcalendaring.add_from_itip_mail = function(mime_id, task, status, dom_id
         del = confirm(rcmail.gettext('itip.declinedeleteconfirm'));
     }
 
-    var comment = '';
+    var noreply = 0, comment = '';
     if (dom_id) {
-      comment = $('#reply-comment-'+dom_id).val();
+      noreply = $('#noreply-'+dom_id).prop('checked') ? 1 : 0;
+      if (!noreply)
+        comment = $('#reply-comment-'+dom_id).val();
     }
 
     rcmail.http_post(task + '/mailimportitip', {
@@ -756,6 +758,7 @@ rcube_libcalendaring.add_from_itip_mail = function(mime_id, task, status, dom_id
         _folder: $('#itip-saveto').val(),
         _status: status,
         _del: del?1:0,
+        _noreply: noreply,
         _comment: comment
       }, rcmail.set_busy(true, 'itip.savingdata'));
 
diff --git a/plugins/libcalendaring/localization/en_US.inc b/plugins/libcalendaring/localization/en_US.inc
index 588185a..d3c9187 100644
--- a/plugins/libcalendaring/localization/en_US.inc
+++ b/plugins/libcalendaring/localization/en_US.inc
@@ -79,6 +79,7 @@ $labels['itipneeds-action'] = 'Postpone';
 $labels['itipcomment'] = 'Your response';
 $labels['itipeditresponse'] = 'Enter a response text';
 $labels['itipsendercomment'] = 'Sender\'s comment: ';
+$labels['itipsuppressreply'] = 'Don\'t send reply message';
 
 $labels['itipobjectnotfound'] = 'The object referred by this message was not found in your account.';
 $labels['itipsubjectaccepted'] = '"$title" has been accepted by $name';




More information about the commits mailing list