Change event priority values to be compatible with RFC 5545 and RFC 5546 as suggested in KEP #8
This commit is contained in:
parent
110bc97c1e
commit
d2dc721d4a
9 changed files with 27 additions and 23 deletions
|
@ -246,7 +246,7 @@ class calendar extends rcube_plugin
|
|||
$this->ui->addJS();
|
||||
|
||||
$this->ui->init_templates();
|
||||
$this->rc->output->add_label('low','normal','high','delete','cancel','uploading','noemailwarning');
|
||||
$this->rc->output->add_label('lowest','low','normal','high','highest','delete','cancel','uploading','noemailwarning');
|
||||
|
||||
// initialize attendees autocompletion
|
||||
rcube_autocomplete_init();
|
||||
|
@ -1232,7 +1232,7 @@ class calendar extends rcube_plugin
|
|||
'categories' => $cats[array_rand($cats)],
|
||||
'calendar' => array_rand($cals),
|
||||
'alarms' => $alarm > 0 ? "-{$alarm}M:DISPLAY" : '',
|
||||
'priority' => 1,
|
||||
'priority' => rand(0,9),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -325,9 +325,9 @@ function rcube_calendar_ui(settings)
|
|||
$('#event-category').show().children('.event-text').html(Q(event.categories)).removeClass().addClass('event-text cat-'+String(event.categories).replace(rcmail.identifier_expr, ''));
|
||||
if (event.free_busy)
|
||||
$('#event-free-busy').show().children('.event-text').html(Q(rcmail.gettext(event.free_busy, 'calendar')));
|
||||
if (event.priority != 1) {
|
||||
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.priority > 0) {
|
||||
var priolabels = [ '', rcmail.gettext('high'), rcmail.gettext('highest'), '', '', rcmail.gettext('normal'), '', '', rcmail.gettext('low'), rcmail.gettext('lowest') ];
|
||||
$('#event-priority').show().children('.event-text').html(Q(event.priority+' '+priolabels[event.priority]));
|
||||
}
|
||||
if (event.sensitivity != 0) {
|
||||
var sensitivityclasses = { 0:'public', 1:'private', 2:'confidential' };
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
* 'recurrence_id' => 'ID of the recurrence group', // usually the ID of the starting event
|
||||
* 'categories' => 'Event category',
|
||||
* 'free_busy' => 'free|busy|outofoffice|tentative', // Show time as
|
||||
* 'priority' => 1|0|2, // Event priority (0=low, 1=normal, 2=high)
|
||||
* 'priority' => 0-9, // Event priority (0=undefined, 1=highest, 9=lowest)
|
||||
* 'sensitivity' => 0|1|2, // Event sensitivity (0=public, 1=private, 2=confidential)
|
||||
* 'alarms' => '-15M:DISPLAY', // Reminder settings inspired by valarm definition (e.g. display alert 15 minutes before event)
|
||||
* 'attachments' => array( // List of attachments
|
||||
|
|
|
@ -39,7 +39,7 @@ CREATE TABLE `events` (
|
|||
`categories` varchar(255) NOT NULL DEFAULT '',
|
||||
`all_day` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`free_busy` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`priority` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`priority` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`sensitivity` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`alarms` varchar(255) DEFAULT NULL,
|
||||
`attendees` text DEFAULT NULL,
|
||||
|
|
|
@ -54,7 +54,7 @@ CREATE TABLE events (
|
|||
categories character varying(255) NOT NULL,
|
||||
all_day smallint NOT NULL DEFAULT 0,
|
||||
free_busy smallint NOT NULL DEFAULT 0,
|
||||
priority smallint NOT NULL DEFAULT 1,
|
||||
priority smallint NOT NULL DEFAULT 0,
|
||||
sensitivity smallint NOT NULL DEFAULT 0,
|
||||
alarms varchar(255) DEFAULT NULL,
|
||||
attendees text DEFAULT NULL,
|
||||
|
|
|
@ -39,7 +39,7 @@ CREATE TABLE events (
|
|||
categories varchar(255) NOT NULL default '',
|
||||
all_day tinyint(1) NOT NULL default '0',
|
||||
free_busy tinyint(1) NOT NULL default '0',
|
||||
priority tinyint(1) NOT NULL default '1',
|
||||
priority tinyint(1) NOT NULL default '0',
|
||||
sensitivity tinyint(1) NOT NULL default '0',
|
||||
alarms varchar(255) default NULL,
|
||||
attendees text default NULL,
|
||||
|
|
|
@ -41,7 +41,7 @@ class kolab_calendar
|
|||
private $namespace;
|
||||
private $search_fields = array('title', 'description', 'location', '_attendees');
|
||||
private $sensitivity_map = array('public', 'private', 'confidential');
|
||||
private $priority_map = array('low', 'normal', 'high');
|
||||
private $priority_map = array('low' => 9, 'normal' => 5, 'high' => 1);
|
||||
private $role_map = array('REQ-PARTICIPANT' => 'required', 'OPT-PARTICIPANT' => 'optional', 'CHAIR' => 'resource');
|
||||
private $status_map = array('NEEDS-ACTION' => 'none', 'TENTATIVE' => 'tentative', 'CONFIRMED' => 'accepted', 'ACCEPTED' => 'accepted', 'DECLINED' => 'declined');
|
||||
private $month_map = array('', 'january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december');
|
||||
|
@ -154,8 +154,7 @@ class kolab_calendar
|
|||
public function get_color()
|
||||
{
|
||||
// color is defined in folder METADATA
|
||||
// FIXME: Kolab_Folder::getKolabAttribute() only reads value.shared; value.priv should be considered first
|
||||
if ($color = $this->storage->_folder->getKolabAttribute('color')) {
|
||||
if ($color = $this->storage->_folder->getKolabAttribute('color', HORDE_ANNOT_READ_PRIVATE_SHARED)) {
|
||||
return $color;
|
||||
}
|
||||
|
||||
|
@ -552,7 +551,6 @@ class kolab_calendar
|
|||
}
|
||||
|
||||
$sensitivity_map = array_flip($this->sensitivity_map);
|
||||
$priority_map = array_flip($this->priority_map);
|
||||
$status_map = array_flip($this->status_map);
|
||||
$role_map = array_flip($this->role_map);
|
||||
|
||||
|
@ -608,7 +606,7 @@ class kolab_calendar
|
|||
'attendees' => $attendees,
|
||||
'_attendees' => $_attendees,
|
||||
'free_busy' => $rec['show-time-as'],
|
||||
'priority' => isset($priority_map[$rec['priority']]) ? $priority_map[$rec['priority']] : 1,
|
||||
'priority' => is_numeric($rec['priority']) ? intval($rec['priority']) : (isset($this->priority_map[$rec['priority']]) ? $this->priority_map[$rec['priority']] : 0),
|
||||
'sensitivity' => $sensitivity_map[$rec['sensitivity']],
|
||||
'changed' => $rec['last-modification-date'],
|
||||
'calendar' => $this->id,
|
||||
|
@ -635,7 +633,7 @@ class kolab_calendar
|
|||
'end-date' => $event['end'],
|
||||
'sensitivity' =>$this->sensitivity_map[$event['sensitivity']],
|
||||
'show-time-as' => $event['free_busy'],
|
||||
'priority' => isset($priority_map[$event['priority']]) ? $priority_map[$event['priority']] : 1,
|
||||
'priority' => $event['priority'],
|
||||
);
|
||||
|
||||
//handle alarms
|
||||
|
|
|
@ -99,7 +99,7 @@ class calendar_ical
|
|||
'end' => $ve->getAttribute('DTEND'),
|
||||
// set defaults
|
||||
'free_busy' => 'busy',
|
||||
'priority' => 1,
|
||||
'priority' => 0,
|
||||
);
|
||||
|
||||
// check for all-day dates
|
||||
|
@ -155,8 +155,7 @@ class calendar_ical
|
|||
|
||||
case 'PRIORITY':
|
||||
if (is_numeric($attr['value'])) {
|
||||
$event['priority'] = $attr['value'] <= 4 ? 2 /* high */ :
|
||||
($attr['value'] == 5 ? 1 /* normal */ : 0 /* low */);
|
||||
$event['priority'] = $attr['value'];
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -303,8 +302,8 @@ class calendar_ical
|
|||
|
||||
$vevent .= "TRANSP:" . ($event['free_busy'] == 'free' ? 'TRANSPARENT' : 'OPAQUE') . self::EOL;
|
||||
|
||||
if ($event['priority'] != 1) {
|
||||
$vevent .= "PRIORITY:" . ($event['priority'] == 2 ? '1' : '9') . self::EOL;
|
||||
if ($event['priority']) {
|
||||
$vevent .= "PRIORITY:" . $event['priority'] . self::EOL;
|
||||
}
|
||||
|
||||
if ($event['cancelled'])
|
||||
|
|
|
@ -288,9 +288,16 @@ class calendar_ui
|
|||
{
|
||||
$attrib['name'] = 'priority';
|
||||
$select = new html_select($attrib);
|
||||
$select->add($this->cal->gettext('normal'), '1');
|
||||
$select->add($this->cal->gettext('low'), '0');
|
||||
$select->add($this->cal->gettext('high'), '2');
|
||||
$select->add('---', '0');
|
||||
$select->add('1 '.$this->cal->gettext('highest'), '1');
|
||||
$select->add('2 '.$this->cal->gettext('high'), '2');
|
||||
$select->add('3 ', '3');
|
||||
$select->add('4 ', '4');
|
||||
$select->add('5 '.$this->cal->gettext('normal'), '5');
|
||||
$select->add('6 ', '6');
|
||||
$select->add('7 ', '7');
|
||||
$select->add('8 '.$this->cal->gettext('low'), '8');
|
||||
$select->add('9 '.$this->cal->gettext('lowest'), '9');
|
||||
return $select->show(null);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue