From 70746b142d825aa74b6d87f9bbf9f8a8fe2f92dc Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Fri, 5 Jun 2009 14:30:56 +0200 Subject: [PATCH] Highlight busy days in year view. --- kronolith/js/src/kronolith.js | 13 +++++++++++-- kronolith/lib/Event.php | 1 + kronolith/lib/Event/Sql.php | 2 +- kronolith/lib/Kronolith.php | 6 +++++- kronolith/themes/screen.css | 3 +++ 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/kronolith/js/src/kronolith.js b/kronolith/js/src/kronolith.js index a5462455c..15b03fe35 100644 --- a/kronolith/js/src/kronolith.js +++ b/kronolith/js/src/kronolith.js @@ -816,7 +816,7 @@ KronolithCore = { case 'year': var year = dates[0].getFullYear(), - month, day, dateString, monthLength, events, title; + month, day, dateString, monthLength, events, title, busy, td; this.ecache.each(function(types) { types.value.each(function(calendars) { for (month = 0; month < 12; month++) { @@ -826,6 +826,7 @@ KronolithCore = { events = calendars.value.get(dateString); if (events) { title = ''; + busy = false; events.each(function(event) { if (event.value.al) { title += Kronolith.text.allday; @@ -833,9 +834,17 @@ KronolithCore = { title += event.value.start.toString('t') + '-' + event.value.end.toString('t'); } title += ': ' + event.value.t; + if (event.value.x == Kronolith.conf.status.tentative || + event.value.x == Kronolith.conf.status.confirmed) { + busy = true; + } }); if (title) { - $('kronolithYearTable' + month).down('td[date=' + dateString + ']').writeAttribute('title', title).addClassName('kronolithHasEvents'); + td = $('kronolithYearTable' + month).down('td[date=' + dateString + ']'); + td.writeAttribute('title', title).addClassName('kronolithHasEvents'); + if (busy) { + td.addClassName('kronolithIsBusy'); + } } } } diff --git a/kronolith/lib/Event.php b/kronolith/lib/Event.php index 2679c7e9d..324aaafa7 100644 --- a/kronolith/lib/Event.php +++ b/kronolith/lib/Event.php @@ -1015,6 +1015,7 @@ abstract class Kronolith_Event $json->c = $this->getCalendar(); $json->s = $this->start->toJson(); $json->e = $this->end->toJson(); + $json->x = $this->status; $json->al = is_null($allDay) ? $this->isAllDay() : $allDay; $json->bg = $this->_backgroundColor; $json->fg = $this->_foregroundColor; diff --git a/kronolith/lib/Event/Sql.php b/kronolith/lib/Event/Sql.php index 9e9f55fc8..7edc9cd13 100644 --- a/kronolith/lib/Event/Sql.php +++ b/kronolith/lib/Event/Sql.php @@ -89,7 +89,7 @@ class Kronolith_Event_Sql extends Kronolith_Event $this->private = (bool)($SQLEvent['event_private']); } if (isset($SQLEvent['event_status'])) { - $this->status = $SQLEvent['event_status']; + $this->status = (int)$SQLEvent['event_status']; } if (isset($SQLEvent['event_attendees'])) { $this->attendees = array_change_key_case($driver->convertFromDriver(unserialize($SQLEvent['event_attendees']))); diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 2588297dc..40847fe4c 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -155,6 +155,10 @@ class Kronolith array('d', 'dd', 'ddd', 'dddd', 'MM', 'MMM', 'MMM', 'MMMM', 'yy', 'yyyy'), NLS::getLangInfo(D_FMT)), 'time_format' => $prefs->getValue('twentyFour') ? 'HH:mm' : 'hh:mm tt', + 'status' => array('tentative' => self::STATUS_TENTATIVE, + 'confirmed' => self::STATUS_CONFIRMED, + 'cancelled' => self::STATUS_CANCELLED, + 'free' => self::STATUS_FREE), // Turn debugging on? 'debug' => !empty($conf['js']['debug']), ); @@ -203,7 +207,7 @@ class Kronolith 'week' => str_replace('%d', '#{week}', _("Week %d")), 'agenda' => _("Agenda"), 'searching' => str_replace('%s', '#{term}', _("Events matching \"%s\"")), - 'allday' => _("All-day"), + 'allday' => _("All day"), ); for ($i = 1; $i <= 12; ++$i) { $code['text']['month'][$i - 1] = NLS::getLangInfo(constant('MON_' . $i)); diff --git a/kronolith/themes/screen.css b/kronolith/themes/screen.css index 3e4f19e89..46b0cdd80 100644 --- a/kronolith/themes/screen.css +++ b/kronolith/themes/screen.css @@ -1020,6 +1020,9 @@ div.kronolithView div.kronolithViewBody div.kronolithRow { .kronolithHasEvents { font-weight: bold; } +.kronolithMinical .kronolithIsBusy { + background-color: #fff760; +} /* Main view month */ #kronolithViewMonthContainer { -- 2.11.0