Highlight busy days in year view.
authorJan Schneider <jan@horde.org>
Fri, 5 Jun 2009 12:30:56 +0000 (14:30 +0200)
committerJan Schneider <jan@horde.org>
Fri, 5 Jun 2009 14:25:43 +0000 (16:25 +0200)
kronolith/js/src/kronolith.js
kronolith/lib/Event.php
kronolith/lib/Event/Sql.php
kronolith/lib/Kronolith.php
kronolith/themes/screen.css

index a546245..15b03fe 100644 (file)
@@ -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');
+                                    }
                                 }
                             }
                         }
index 2679c7e..324aaaf 100644 (file)
@@ -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;
index 9e9f55f..7edc9cd 100644 (file)
@@ -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'])));
index 2588297..40847fe 100644 (file)
@@ -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));
index 3e4f19e..46b0cdd 100644 (file)
@@ -1020,6 +1020,9 @@ div.kronolithView div.kronolithViewBody div.kronolithRow {
 .kronolithHasEvents {
     font-weight: bold;
 }
+.kronolithMinical .kronolithIsBusy {
+    background-color: #fff760;
+}
 
 /* Main view month */
 #kronolithViewMonthContainer {