3 commits - plugins/calendar

Thomas Brüderli bruederli at kolabsys.com
Wed Oct 3 11:38:10 CEST 2012


 plugins/calendar/calendar.php                          |   27 +++++++++--------
 plugins/calendar/config.inc.php.dist                   |   10 ++++++
 plugins/calendar/lib/calendar_itip.php                 |   25 +++++++++++++++
 plugins/calendar/localization/de_CH.inc                |    1 
 plugins/calendar/localization/de_DE.inc                |    1 
 plugins/calendar/localization/en_US.inc                |    1 
 plugins/calendar/skins/larry/calendar.css              |    8 ++++-
 plugins/calendar/skins/larry/templates/itipattend.html |    3 +
 8 files changed, 61 insertions(+), 15 deletions(-)

New commits:
commit 67691f3efa350cc5752b54fd5228bc7bd31f883a
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Oct 3 11:37:49 2012 +0200

    Better styling of iTip response dialog in Larry

diff --git a/plugins/calendar/skins/larry/calendar.css b/plugins/calendar/skins/larry/calendar.css
index 76ccecb..d1e5dc4 100644
--- a/plugins/calendar/skins/larry/calendar.css
+++ b/plugins/calendar/skins/larry/calendar.css
@@ -1411,11 +1411,17 @@ div.calendar-invitebox .rsvp-status.tentative {
 
 .calendaritipattend .centerbox {
 	width: 40em;
-	margin: 80px auto;
+	margin: 80px auto 0 auto;
 	padding: 10px 10px 10px 90px;
 	background: url(images/invitation.png) 10px 10px no-repeat #fff;
 }
 
+.calendaritipattend #message {
+	width: 46em;
+	margin: 0 auto;
+	padding: 10px;
+}
+
 .calendaritipattend .calendar-invitebox {
 	background: none;
 	padding-left: 0;
diff --git a/plugins/calendar/skins/larry/templates/itipattend.html b/plugins/calendar/skins/larry/templates/itipattend.html
index bfbb08f..0ca14ff 100644
--- a/plugins/calendar/skins/larry/templates/itipattend.html
+++ b/plugins/calendar/skins/larry/templates/itipattend.html
@@ -26,10 +26,11 @@
 	<roundcube:object name="plugin.event_inviteform" />
 	<roundcube:object name="plugin.event_invitebox" class="calendar-invitebox" />
 	<roundcube:object name="plugin.event_rsvp_buttons" type="submit" iname="rsvp" id="event-rsvp" />
-	<roundcube:object name="message" id="message" />
 	</form>
 </div>
 
+<roundcube:object name="message" id="message" />
+
 </div>
 
 </body>


commit 8502d7c94ab644f69dabceefb1493de4b473e8c6
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Oct 3 11:37:14 2012 +0200

    Show iTip send confirmation in UI

diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index 53ffbf0..ba84758 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -774,18 +774,6 @@ class calendar extends rcube_plugin
         }
         break;
     }
-    
-    // send out notifications
-    if ($success && $event['_notify'] && ($event['attendees'] || $old['attendees'])) {
-      // make sure we have the complete record
-      $event = $action == 'remove' ? $old : $this->driver->get_event($event);
-      
-      // only notify if data really changed (TODO: do diff check on client already)
-      if (!$old || $action == 'remove' || self::event_diff($event, $old)) {
-        if ($this->notify_attendees($event, $old, $action) < 0)
-          $this->rc->output->show_message('calendar.errornotifying', 'error');
-        }
-    }
 
     // show confirmation/error message
     if (!$got_msg) {
@@ -795,6 +783,21 @@ class calendar extends rcube_plugin
         $this->rc->output->show_message('calendar.errorsaving', 'error');
     }
 
+    // send out notifications
+    if ($success && $event['_notify'] && ($event['attendees'] || $old['attendees'])) {
+      // make sure we have the complete record
+      $event = $action == 'remove' ? $old : $this->driver->get_event($event);
+
+      // only notify if data really changed (TODO: do diff check on client already)
+      if (!$old || $action == 'remove' || self::event_diff($event, $old)) {
+        $sent = $this->notify_attendees($event, $old, $action);
+        if ($sent > 0)
+          $this->rc->output->show_message('calendar.itipsendsuccess', 'confirmation');
+        else if ($sent < 0)
+          $this->rc->output->show_message('calendar.errornotifying', 'error');
+      }
+    }
+
     // unlock client
     $this->rc->output->command('plugin.unlock_saving');
 
diff --git a/plugins/calendar/localization/de_CH.inc b/plugins/calendar/localization/de_CH.inc
index 12614dd..254bc01 100644
--- a/plugins/calendar/localization/de_CH.inc
+++ b/plugins/calendar/localization/de_CH.inc
@@ -180,6 +180,7 @@ $labels['newerversionexists'] = 'Eine neuere Version dieses Termins exisitert be
 $labels['nowritecalendarfound'] = 'Kein Kalender zum Speichern gefunden';
 $labels['importedsuccessfully'] = 'Der Termin wurde erfolgreich in \'$calendar\' gespeichert';
 $labels['attendeupdateesuccess'] = 'Teilnehmerstatus erfolgreich aktualisiert';
+$labels['itipsendsuccess'] = 'Einladung an Teilnehmer versendet.';
 $labels['itipresponseerror'] = 'Die Antwort auf diese Einladung konnte nicht versendet werden';
 $labels['sentresponseto'] = 'Antwort auf diese Einladung erfolgreich an $mailto gesendet';
 $labels['localchangeswarning'] = 'Die Änderungen an diesem Termin können nur in Ihrem persönlichen Kalender gespeichert werden.';
diff --git a/plugins/calendar/localization/de_DE.inc b/plugins/calendar/localization/de_DE.inc
index 7c0d00f..028c625 100644
--- a/plugins/calendar/localization/de_DE.inc
+++ b/plugins/calendar/localization/de_DE.inc
@@ -180,6 +180,7 @@ $labels['newerversionexists'] = 'Eine neuere Version dieses Termins exisitert be
 $labels['nowritecalendarfound'] = 'Kein Kalender zum Speichern gefunden';
 $labels['importedsuccessfully'] = 'Der Termin wurde erfolgreich in \'$calendar\' gespeichert';
 $labels['attendeupdateesuccess'] = 'Teilnehmerstatus erfolgreich aktualisiert';
+$labels['itipsendsuccess'] = 'Einladung an Teilnehmer versendet.';
 $labels['itipresponseerror'] = 'Die Antwort auf diese Einladung konnte nicht versendet werden';
 $labels['sentresponseto'] = 'Antwort auf diese Einladung erfolgreich an $mailto gesendet';
 $labels['localchangeswarning'] = 'Die Änderungen an diesem Termin können nur in Ihrem persönlichen Kalender gespeichert werden.';
diff --git a/plugins/calendar/localization/en_US.inc b/plugins/calendar/localization/en_US.inc
index 2137b39..174cc1a 100644
--- a/plugins/calendar/localization/en_US.inc
+++ b/plugins/calendar/localization/en_US.inc
@@ -180,6 +180,7 @@ $labels['newerversionexists'] = 'A newer version of this event already exists! A
 $labels['nowritecalendarfound'] = 'No calendar found to save the event';
 $labels['importedsuccessfully'] = 'The event was successfully added to \'$calendar\'';
 $labels['attendeupdateesuccess'] = 'Successfully updated the participant\'s status';
+$labels['itipsendsuccess'] = 'Invitation sent to participants.';
 $labels['itipresponseerror'] = 'Failed to send the response to this event invitation';
 $labels['itipinvalidrequest'] = 'This invitation is no longer valid';
 $labels['sentresponseto'] = 'Successfully sent invitation response to $mailto';


commit 4f72e5d161e7b957c66eba5be5bb2d875dc22cf7
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Oct 3 11:30:19 2012 +0200

    Allow to configure smtp settings for unauthenticated itip sending (#599)

diff --git a/plugins/calendar/config.inc.php.dist b/plugins/calendar/config.inc.php.dist
index 4ae8123..fb642ec 100644
--- a/plugins/calendar/config.inc.php.dist
+++ b/plugins/calendar/config.inc.php.dist
@@ -107,4 +107,14 @@ $rcmail_config['calendar_categories'] = array(
 // enable asynchronous free-busy triggering after data changed
 $rcmail_config['calendar_freebusy_trigger'] = false;
 
+// SMTP username used to send (anonymous) itip messages
+$rcmail_config['calendar_itip_smtp_server'] = null;
+
+// SMTP username used to send (anonymous) itip messages
+$rcmail_config['calendar_itip_smtp_user'] = 'smtpauth';
+
+// SMTP password used to send (anonymous) itip messages
+$rcmail_config['calendar_itip_smtp_pass'] = '123456';
+
+
 ?>
\ No newline at end of file
diff --git a/plugins/calendar/lib/calendar_itip.php b/plugins/calendar/lib/calendar_itip.php
index b27c17c..50f012f 100644
--- a/plugins/calendar/lib/calendar_itip.php
+++ b/plugins/calendar/lib/calendar_itip.php
@@ -29,12 +29,15 @@ class calendar_itip
   private $rc;
   private $cal;
   private $event;
+  private $itip_send = false;
 
   function __construct($cal)
   {
     $this->cal = $cal;
     $this->rc = $cal->rc;
     $this->sender = $this->rc->user->get_identity();
+
+    $this->cal->add_hook('smtp_connect', array($this, 'smtp_connect_hook'));
   }
 
   /**
@@ -99,7 +102,27 @@ class calendar_itip
     $message->setTXTBody(rcube_mime::format_flowed($mailbody, 79));
 
     // finally send the message
-    return rcmail_deliver_message($message, $headers['X-Sender'], $mailto, $smtp_error);
+    $this->itip_send = true;
+    $sent = rcmail_deliver_message($message, $headers['X-Sender'], $mailto, $smtp_error);
+    $this->itip_send = false;
+
+    return $sent;
+  }
+
+  /**
+   * Plugin hook to alter SMTP authentication.
+   * This is used if iTip messages are to be sent from an unauthenticated session
+   */
+  public function smtp_connect_hook($p)
+  {
+    // replace smtp auth settings if we're not in an authenticated session
+    if ($this->itip_send && !$this->rc->user->ID) {
+      foreach (array('smtp_server', 'smtp_user', 'smtp_pass') as $prop) {
+        $p[$prop] = $this->rc->config->get("calendar_itip_$prop", $p[$prop]);
+      }
+    }
+
+    return $p;
   }
 
   /**





More information about the commits mailing list