From 532197c2645fa56c6869526754045f704d6c6cb1 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sun, 7 Jun 2009 16:44:11 -0400 Subject: [PATCH] Don't call the show API to get links for timeObjects. Pass them directly in the timeObjects data array. This saves an extra API call for each object and also allows us to not set a link if one is not desired. --- folks/lib/api.php | 3 ++- kronolith/lib/Event.php | 4 ++-- kronolith/lib/Event/Horde.php | 1 + kronolith/taggertest.php | 11 +++++++++++ 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 kronolith/taggertest.php diff --git a/folks/lib/api.php b/folks/lib/api.php index 93a0db6ee..5c6516f05 100644 --- a/folks/lib/api.php +++ b/folks/lib/api.php @@ -388,7 +388,8 @@ function _folks_listTimeObjects($categories, $start, $end) 'id' => $friend, 'start' => date('Y-m-d\TH:i:s', $born), 'end' => date('Y-m-d\TH:i:s', $born + 1), - 'params' => array('user' => $friend)); + 'params' => array('user' => $friend), + 'link' => Folks::getUrlFor('user', $friend, true)); } return $objects; diff --git a/kronolith/lib/Event.php b/kronolith/lib/Event.php index 7c1d69dc5..955724810 100644 --- a/kronolith/lib/Event.php +++ b/kronolith/lib/Event.php @@ -2106,8 +2106,8 @@ abstract class Kronolith_Event $link = ''; $event_title = $this->getTitle(); - if (isset($this->external)) { - $link = $registry->link($this->external . '/show', $this->external_params); + if (isset($this->external) && !empty($this->external_link)) { + $link = $this->external_link; $link = Horde::linkTooltip(Horde::url($link), '', 'event-tentative', '', '', String::wrap($this->description)); } elseif (isset($this->eventID) && $this->hasPermission(PERMS_READ)) { $link = Horde::linkTooltip($this->getViewUrl(array('datetime' => $datetime->strftime('%Y%m%d%H%M%S'), 'url' => $from_url), $full), diff --git a/kronolith/lib/Event/Horde.php b/kronolith/lib/Event/Horde.php index fd3f08531..a1ba6be3d 100644 --- a/kronolith/lib/Event/Horde.php +++ b/kronolith/lib/Event/Horde.php @@ -46,6 +46,7 @@ class Kronolith_Event_Horde extends Kronolith_Event $this->external = $this->_api; $this->external_params = $event['params']; $this->external_icon = !empty($event['icon']) ? $event['icon'] : null; + $this->external_link = !empty($event['link']) ? $event['link'] : null; $this->title = $event['title']; $this->description = isset($event['description']) ? $event['description'] : ''; $this->start = $eventStart; diff --git a/kronolith/taggertest.php b/kronolith/taggertest.php new file mode 100644 index 000000000..251726020 --- /dev/null +++ b/kronolith/taggertest.php @@ -0,0 +1,11 @@ + 'tags')); +?> + + \ No newline at end of file -- 2.11.0