Visually emphasize pending/declined events from other user's calendars

This commit is contained in:
Thomas Bruederli 2015-01-21 17:05:16 +01:00
parent d9f69d35c7
commit 59b64ae7cd
4 changed files with 41 additions and 13 deletions

View file

@ -674,6 +674,11 @@ class kolab_calendar extends kolab_storage_folder_api
$record['calendar'] = $this->id;
$record['links'] = $this->get_links($record['uid']);
if ($this->get_namespace() == 'other') {
$record['className'] = 'fc-event-ns-other';
$record = kolab_driver::add_partstat_class($record, array('NEEDS-ACTION','DECLINED'), $this->get_owner());
}
return kolab_driver::to_rcube_event($record);
}

View file

@ -1421,6 +1421,30 @@ class kolab_driver extends calendar_driver
return $record;
}
/**
* Set CSS class according to the event's attendde partstat
*/
public static function add_partstat_class($event, $partstats, $user = null)
{
// set classes according to PARTSTAT
if (is_array($event['attendees'])) {
$user_emails = libcalendaring::get_instance()->get_user_emails($user);
$partstat = 'UNKNOWN';
foreach ($event['attendees'] as $attendee) {
if (in_array($attendee['email'], $user_emails)) {
$partstat = $attendee['status'];
break;
}
}
if (in_array($partstat, $partstats)) {
$event['className'] = trim($event['className'] . ' fc-invitation-' . strtolower($partstat));
}
}
return $event;
}
/**
* Provide a list of revisions for the given event
*

View file

@ -276,20 +276,10 @@ class kolab_invitation_calendar
private function _mod_event($event)
{
// set classes according to PARTSTAT
if (is_array($event['attendees'])) {
$user_emails = $this->cal->get_user_emails();
$partstat = 'UNKNOWN';
foreach ($event['attendees'] as $attendee) {
if (in_array($attendee['email'], $user_emails)) {
$partstat = $attendee['status'];
break;
}
}
$event = kolab_driver::add_partstat_class($event, $this->partstats);
if (in_array($partstat, $this->partstats)) {
$event['className'] = 'fc-invitation-' . strtolower($partstat);
$event['calendar'] = $this->id;
}
if (strpos($event['className'], 'fc-invitation-') !== false) {
$event['calendar'] = $this->id;
}
return $event;

View file

@ -1883,6 +1883,15 @@ a.dropdown-link:after {
border: 1px dashed #c00 !important;
}
.fc-event-vert.fc-event-ns-other.fc-invitation-declined,
.fc-event-hori.fc-event-ns-other.fc-invitation-declined {
opacity: 0.7;
}
.fc-event-ns-other.fc-invitation-declined .fc-event-title {
text-decoration: line-through;
}
.fc-event-vert.fc-invitation-tentative .fc-event-head,
.fc-event-vert.fc-invitation-declined .fc-event-head,
.fc-event-vert.fc-invitation-needs-action .fc-event-head {