plugins/calendar

Aleksander Machniak machniak at kolabsys.com
Thu Jul 10 18:37:09 CEST 2014


 plugins/calendar/calendar.php           |   46 ++++++++++++++++++++++++++++++++
 plugins/calendar/config.inc.php.dist    |   10 ++++++
 plugins/calendar/localization/en_US.inc |    7 ++++
 3 files changed, 62 insertions(+), 1 deletion(-)

New commits:
commit cfe6d63d6f968d3b95235007749d255a76819924
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Thu Jul 10 18:36:06 2014 +0200

    Add calendar_itip_after_action option - to be implemented (#419)

diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index ef98967..6b28657 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -54,6 +54,7 @@ class calendar extends rcube_plugin
     'calendar_event_coloring'  => 0,
     'calendar_time_indicator'  => true,
     'calendar_allow_invite_shared' => false,
+    'calendar_itip_after_action'   => 0,
   );
 
   private $ical;
@@ -512,6 +513,46 @@ class calendar extends rcube_plugin
       );
     }
 
+    $p['blocks']['itip']['name'] = $this->gettext('itipoptions');
+
+    // Invitations handling
+    if (!isset($no_override['calendar_itip_after_action'])) {
+      if (!$p['current']) {
+        $p['blocks']['itip']['content'] = true;
+        return $p;
+      }
+
+      $field_id = 'rcmfd_after_action';
+      $select   = new html_select(array('name' => '_after_action', 'id' => $field_id,
+        'onchange' => "\$('#{$field_id}_select')[this.value == 4 ? 'show' : 'hide']()"));
+
+      $select->add($this->gettext('afternothing'), '');
+      $select->add($this->gettext('aftertrash'), 1);
+      $select->add($this->gettext('afterdelete'), 2);
+      $select->add($this->gettext('afterflagdeleted'), 3);
+      $select->add($this->gettext('aftermoveto'), 4);
+
+      $val = $this->rc->config->get('calendar_itip_after_action', $this->defaults['calendar_itip_after_action']);
+      if ($val !== null && $val !== '' && !is_int($val)) {
+        $folder = $val;
+        $val    = 4;
+      }
+
+      $folders = $this->rc->folder_selector(array(
+          'id'            => $field_id . '_select',
+          'name'          => '_after_action_folder',
+          'maxlength'     => 30,
+          'folder_filter' => 'mail',
+          'folder_rights' => 'w',
+          'style'         => $val !== 4 ? 'display:none' : '',
+      ));
+
+      $p['blocks']['itip']['options']['after_action'] = array(
+        'title'   => html::label($field_id, Q($this->gettext('afteraction'))),
+        'content' => $select->show($val) . $folders->show($folder),
+      );
+    }
+
     // category definitions
     if (!$this->driver->nocategories && !isset($no_override['calendar_categories'])) {
         $p['blocks']['categories']['name'] = $this->gettext('categories');
@@ -660,8 +701,13 @@ class calendar extends rcube_plugin
         'calendar_birthday_adressbooks' => (array)get_input_value('_birthday_adressbooks', RCUBE_INPUT_POST),
         'calendar_birthdays_alarm_type'   => get_input_value('_birthdays_alarm_type', RCUBE_INPUT_POST),
         'calendar_birthdays_alarm_offset' => $birthdays_alarm_value ?: null,
+        'calendar_itip_after_action'      => intval(get_input_value('_after_action', RCUBE_INPUT_POST)),
       );
 
+      if ($p['prefs']['calendar_itip_after_action'] == 4) {
+        $p['prefs']['calendar_itip_after_action'] = get_input_value('_after_action_folder', RCUBE_INPUT_POST, true);
+      }
+
       // categories
       if (!$this->driver->nocategories) {
         $old_categories = $new_categories = array();
diff --git a/plugins/calendar/config.inc.php.dist b/plugins/calendar/config.inc.php.dist
index 5216642..c3cdea3 100644
--- a/plugins/calendar/config.inc.php.dist
+++ b/plugins/calendar/config.inc.php.dist
@@ -143,6 +143,14 @@ $rcmail_config['kolab_invitation_calendars'] = true;
 // $rcmail_config['calendar_resources_driver'] = 'ldap';
 
 // LDAP directory configuration to find avilable resources for events
-// $rcmail_config['calendar_resources_directory'] = array(/* ldap_public-like address book configuration */)
+// $rcmail_config['calendar_resources_directory'] = array(/* ldap_public-like address book configuration */);
+
+// Action taken after iTip request is handled. Possible values:
+// 0 - no action
+// 1 - move to Trash
+// 2 - delete the message
+// 3 - flag as deleted
+// folder_name - move the message to the specified folder
+$rcmail_config['calendar_itip_after_action'] = 0;
 
 ?>
diff --git a/plugins/calendar/localization/en_US.inc b/plugins/calendar/localization/en_US.inc
index 8b3f416..3cbcab7 100644
--- a/plugins/calendar/localization/en_US.inc
+++ b/plugins/calendar/localization/en_US.inc
@@ -17,6 +17,13 @@ $labels['coloringmode0'] = 'According to calendar';
 $labels['coloringmode1'] = 'According to category';
 $labels['coloringmode2'] = 'Calendar for outline, category for content';
 $labels['coloringmode3'] = 'Category for outline, calendar for content';
+$labels['afternothing'] = 'Do nothing';
+$labels['aftertrash'] = 'Move to Trash';
+$labels['afterdelete'] = 'Delete the message';
+$labels['afterflagdeleted'] = 'Flag as deleted';
+$labels['aftermoveto'] = 'Move to...';
+$labels['itipoptions'] = 'Invitations';
+$labels['afteraction'] = 'After the request is handled';
 
 // calendar
 $labels['calendar'] = 'Calendar';




More information about the commits mailing list