diff --git a/plugins/calendar/calendar.js b/plugins/calendar/calendar.js index d0ea38a0..e4bf8348 100644 --- a/plugins/calendar/calendar.js +++ b/plugins/calendar/calendar.js @@ -98,6 +98,10 @@ window.rcmail && rcmail.addEventListener('init', function(evt) { var priolabels = { 0:rcmail.gettext('low'), 1:rcmail.gettext('normal'), 2:rcmail.gettext('high') }; $('#event-priority').show().children('.event-text').html(Q(priolabels[event.priority])); } + if (event.sensitivity != 0) { + var sensitivitylabels = { 0:rcmail.gettext('public'), 1:rcmail.gettext('private'), 2:rcmail.gettext('confidential') }; + $('#event-sensitivity').show().children('.event-text').html(Q(sensitivitylabels[event.sensitivity])); + } var buttons = {}; if (calendar.editable) { @@ -157,6 +161,7 @@ window.rcmail && rcmail.addEventListener('init', function(evt) { var calendars = $('#edit-calendar').val(event.calendar); var freebusy = $('#edit-free-busy').val(event.free_busy); var priority = $('#edit-priority').val(event.priority); + var sensitivity = $('#edit-sensitivity').val(event.sensitivity); var duration = Math.round((event.end.getTime() - event.start.getTime()) / 1000); var startdate = $('#edit-startdate').val($.fullCalendar.formatDate(event.start, settings['date_format'])).data('duration', duration); @@ -266,6 +271,7 @@ window.rcmail && rcmail.addEventListener('init', function(evt) { categories: categories.val(), free_busy: freebusy.val(), priority: priority.val(), + sensitivity: sensitivity.val(), recurrence: '', alarms:'', }; diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index b243ee2d..833255a6 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -130,6 +130,7 @@ class calendar extends rcube_plugin $this->register_handler('plugin.category_select', array($this->ui, 'category_select')); $this->register_handler('plugin.freebusy_select', array($this->ui, 'freebusy_select')); $this->register_handler('plugin.priority_select', array($this->ui, 'priority_select')); + $this->register_handler('plugin.sensitivity_select', array($this->ui, 'sensitivity_select')); $this->register_handler('plugin.alarm_select', array($this->ui, 'alarm_select')); $this->register_handler('plugin.snooze_select', array($this->ui, 'snooze_select')); $this->register_handler('plugin.recurrence_form', array($this->ui, 'recurrence_form')); diff --git a/plugins/calendar/drivers/calendar_driver.php b/plugins/calendar/drivers/calendar_driver.php index 4064e661..43d4b5aa 100644 --- a/plugins/calendar/drivers/calendar_driver.php +++ b/plugins/calendar/drivers/calendar_driver.php @@ -62,6 +62,7 @@ abstract class calendar_driver * categories: Event categories (comma-separated list) * free_busy: Show time as free/busy/outofoffice * priority: Event priority + * sensitivity: Event sensitivity (0=public, 1=private, 2=confidential) * alarms: Reminder settings (TBD.) * @return mixed New event ID on success, False on error */ diff --git a/plugins/calendar/drivers/database/database_driver.php b/plugins/calendar/drivers/database/database_driver.php index 2a7d309f..8909fc4a 100644 --- a/plugins/calendar/drivers/database/database_driver.php +++ b/plugins/calendar/drivers/database/database_driver.php @@ -140,8 +140,8 @@ class database_driver extends calendar_driver $event = $this->_save_preprocess($event); $query = $this->rc->db->query(sprintf( "INSERT INTO " . $this->db_events . " - (calendar_id, created, changed, uid, start, end, all_day, recurrence, title, description, location, categories, free_busy, priority, alarms, notifyat) - VALUES (?, %s, %s, ?, %s, %s, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + (calendar_id, created, changed, uid, start, end, all_day, recurrence, title, description, location, categories, free_busy, priority, sensitivity, alarms, notifyat) + VALUES (?, %s, %s, ?, %s, %s, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", $this->rc->db->now(), $this->rc->db->now(), $this->rc->db->fromunixtime($event['start']), @@ -157,6 +157,7 @@ class database_driver extends calendar_driver strval($event['categories']), intval($event['free_busy']), intval($event['priority']), + intval($event['sensitivity']), $event['alarms'], $event['notifyat'] ); @@ -178,7 +179,7 @@ class database_driver extends calendar_driver $event = $this->_save_preprocess($event); $query = $this->rc->db->query(sprintf( "UPDATE " . $this->db_events . " - SET changed=%s, start=%s, end=%s, all_day=?, recurrence=?, title=?, description=?, location=?, categories=?, free_busy=?, priority=?, alarms=?, notifyat=? + SET changed=%s, start=%s, end=%s, all_day=?, recurrence=?, title=?, description=?, location=?, categories=?, free_busy=?, priority=?, sensitivity=?, alarms=?, notifyat=? WHERE event_id=? AND calendar_id IN (" . $this->calendar_ids . ")", $this->rc->db->now(), @@ -192,6 +193,7 @@ class database_driver extends calendar_driver strval($event['location']), strval($event['categories']), intval($event['free_busy']), + intval($event['sensitivity']), intval($event['priority']), $event['alarms'], $event['notifyat'], diff --git a/plugins/calendar/drivers/database/sql/mysql.sql b/plugins/calendar/drivers/database/sql/mysql.sql index 3f19aab1..5b27a4aa 100644 --- a/plugins/calendar/drivers/database/sql/mysql.sql +++ b/plugins/calendar/drivers/database/sql/mysql.sql @@ -39,6 +39,7 @@ CREATE TABLE `events` ( `all_day` tinyint(1) NOT NULL DEFAULT '0', `free_busy` tinyint(1) NOT NULL DEFAULT '0', `priority` tinyint(1) NOT NULL DEFAULT '1', + `sensitivity` tinyint(1) NOT NULL DEFAULT '0', `alarms` varchar(255) DEFAULT NULL, `attendees` text DEFAULT NULL, `notifyat` datetime DEFAULT NULL, diff --git a/plugins/calendar/drivers/database/sql/postgresql.sql b/plugins/calendar/drivers/database/sql/postgresql.sql index 37e33067..9a1a9b72 100644 --- a/plugins/calendar/drivers/database/sql/postgresql.sql +++ b/plugins/calendar/drivers/database/sql/postgresql.sql @@ -54,6 +54,7 @@ CREATE TABLE events ( all_day smallint NOT NULL DEFAULT 0, free_busy smallint NOT NULL DEFAULT 0, priority smallint NOT NULL DEFAULT 1, + sensitivity smallint NOT NULL DEFAULT 0, alarms varchar(255) DEFAULT NULL, attendees text DEFAULT NULL, notifyat timestamp without time zone DEFAULT NULL diff --git a/plugins/calendar/drivers/database/sql/sqlite.sql b/plugins/calendar/drivers/database/sql/sqlite.sql index b583d646..8ab89c98 100644 --- a/plugins/calendar/drivers/database/sql/sqlite.sql +++ b/plugins/calendar/drivers/database/sql/sqlite.sql @@ -39,6 +39,7 @@ CREATE TABLE events ( all_day tinyint(1) NOT NULL default '0', free_busy tinyint(1) NOT NULL default '0', priority tinyint(1) NOT NULL default '1', + sensitivity tinyint(1) NOT NULL default '0', alarms varchar(255) default NULL, attendees text default NULL, notifyat datetime default NULL, diff --git a/plugins/calendar/drivers/kolab/kolab_calendar.php b/plugins/calendar/drivers/kolab/kolab_calendar.php index 23915465..ac790ab8 100644 --- a/plugins/calendar/drivers/kolab/kolab_calendar.php +++ b/plugins/calendar/drivers/kolab/kolab_calendar.php @@ -25,6 +25,7 @@ class kolab_calendar private $events; private $id2uid; private $imap_folder = 'INBOX/Calendar'; + private $sensitivity_map = array('public', 'private', 'confidential'); /** * Default constructor @@ -147,6 +148,8 @@ class kolab_calendar if ($allday) // in Roundcube all-day events only go until 23:59:59 of the last day $rec['end-date']--; + $sensitivity_map = array_flip($this->sensitivity_map); + return array( 'id' => $rec['uid'], 'uid' => $rec['uid'], @@ -159,6 +162,7 @@ class kolab_calendar 'categories' => $rec['categories'], 'free_busy' => $rec['show-time-as'], 'priority' => 1, // normal + 'sensitivity' => $sensitivity_map[$rec['sensitivity']], 'calendar' => $this->id, ); } diff --git a/plugins/calendar/lib/calendar_ui.php b/plugins/calendar/lib/calendar_ui.php index 4dbe335a..939aa38f 100644 --- a/plugins/calendar/lib/calendar_ui.php +++ b/plugins/calendar/lib/calendar_ui.php @@ -202,6 +202,19 @@ class calendar_ui return $select->show(null); } + /** + * Render HTML input for sensitivity selection + */ + function sensitivity_select($attrib = array()) + { + $attrib['name'] = 'sensitivity'; + $select = new html_select($attrib); + $select->add($this->calendar->gettext('public'), '0'); + $select->add($this->calendar->gettext('private'), '1'); + $select->add($this->calendar->gettext('confidential'), '2'); + return $select->show(null); + } + /** * Render HTML form for alarm configuration */ diff --git a/plugins/calendar/localization/en_US.inc b/plugins/calendar/localization/en_US.inc index bf274acb..c135954c 100644 --- a/plugins/calendar/localization/en_US.inc +++ b/plugins/calendar/localization/en_US.inc @@ -40,6 +40,10 @@ $labels['free'] = 'Free'; $labels['busy'] = 'Busy'; $labels['outofoffice'] = 'Out of Office'; $labels['priority'] = 'Priority'; +$labels['sensitivity'] = 'Sensitivity'; +$labels['public'] = 'public'; +$labels['private'] = 'private'; +$labels['confidential'] = 'confidential'; $labels['alarms'] = 'Reminder'; $labels['generated'] = 'generated at'; $labels['selectdate'] = 'Select date'; diff --git a/plugins/calendar/skins/default/templates/calendar.html b/plugins/calendar/skins/default/templates/calendar.html index 7302caaf..227932c5 100644 --- a/plugins/calendar/skins/default/templates/calendar.html +++ b/plugins/calendar/skins/default/templates/calendar.html @@ -63,6 +63,10 @@ +