From: Michael J. Rubinsky Date: Sat, 6 Jun 2009 22:07:35 +0000 (-0400) Subject: Add support for listTimeObjects API to return an 'icon' member. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=49cc8ab6485715f9fccf92c2e4c0d286b893d169;p=horde.git Add support for listTimeObjects API to return an 'icon' member. listTimeObjects 'icon' member is expected to be a fully qualified URL to an image src. --- diff --git a/kronolith/js/src/kronolith.js b/kronolith/js/src/kronolith.js index 24e046466..8fb0b3390 100644 --- a/kronolith/js/src/kronolith.js +++ b/kronolith/js/src/kronolith.js @@ -1151,6 +1151,10 @@ KronolithCore = { _setEventText: function(div, event) { + if (event.icn) { + div.insert(new Element('IMG', { 'src': event.icn })); + } + div.insert(event.t); if (event.a) { div.insert(' ') diff --git a/kronolith/lib/Event.php b/kronolith/lib/Event.php index 324aaafa7..7c1d69dc5 100644 --- a/kronolith/lib/Event.php +++ b/kronolith/lib/Event.php @@ -2175,7 +2175,9 @@ abstract class Kronolith_Event Horde::url($registry->getImageDir(), true, -1)); } - if (!empty($status)) { + if (!empty($this->external) && !empty($this->external_icon)) { + $link = $status . Horde::img($this->external_icon, '', '', '') . ' ' . $link; + } else if (!empty($status)) { $link .= ' ' . $status; } diff --git a/kronolith/lib/Event/Horde.php b/kronolith/lib/Event/Horde.php index 2a603e5e3..fd3f08531 100644 --- a/kronolith/lib/Event/Horde.php +++ b/kronolith/lib/Event/Horde.php @@ -45,6 +45,7 @@ class Kronolith_Event_Horde extends Kronolith_Event $this->eventID = '_' . $this->_api . $event['id']; $this->external = $this->_api; $this->external_params = $event['params']; + $this->external_icon = !empty($event['icon']) ? $event['icon'] : null; $this->title = $event['title']; $this->description = isset($event['description']) ? $event['description'] : ''; $this->start = $eventStart; @@ -53,6 +54,7 @@ class Kronolith_Event_Horde extends Kronolith_Event if (isset($event['recurrence'])) { $recurrence = new Horde_Date_Recurrence($eventStart); + $recurrence->setRecurType($event['recurrence']['type']); if (isset($event['recurrence']['end'])) { $recurrence->setRecurEnd($event['recurrence']['end']); @@ -78,4 +80,14 @@ class Kronolith_Event_Horde extends Kronolith_Event $this->stored = true; } + public function toJson($allDay = null, $full = false, $time_format = 'H:i') + { + $json = parent::toJson($allDay, $full, $time_format); + $json->icn = $this->external_icon; + // @TODO: What is expected for external calendar links? This is currently + // broken in the UI. + //$json->link = $this->getLink(); + return $json; + } + }