Add sensitivity field to event properties (inpsired by the Kolab format)
This commit is contained in:
parent
2bf657d69d
commit
bca398a61c
11 changed files with 45 additions and 3 deletions
|
@ -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:'',
|
||||
};
|
||||
|
|
|
@ -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'));
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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'],
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -63,6 +63,10 @@
|
|||
<label><roundcube:label name="calendar.priority" /></label>
|
||||
<span class="event-text"></span>
|
||||
</div>
|
||||
<div class="event-line" id="event-sensitivity">
|
||||
<label><roundcube:label name="calendar.sensitivity" /></label>
|
||||
<span class="event-text"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="eventedit">
|
||||
|
@ -121,6 +125,10 @@
|
|||
<label for="edit-priority"><roundcube:label name="calendar.priority" /></label>
|
||||
<roundcube:object name="plugin.priority_select" id="edit-priority" />
|
||||
</div>
|
||||
<div class="event-section">
|
||||
<label for="edit-sensitivity"><roundcube:label name="calendar.sensitivity" /></label>
|
||||
<roundcube:object name="plugin.sensitivity_select" id="edit-sensitivity" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- recurrence settings -->
|
||||
<div id="event-tab-2">
|
||||
|
|
Loading…
Add table
Reference in a new issue