Don't call the show API to get links for timeObjects. Pass them directly
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 7 Jun 2009 20:44:11 +0000 (16:44 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 7 Jun 2009 20:44:11 +0000 (16:44 -0400)
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
kronolith/lib/Event.php
kronolith/lib/Event/Horde.php
kronolith/taggertest.php [new file with mode: 0644]

index 93a0db6..5c6516f 100644 (file)
@@ -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;
index 7c1d69d..9557248 100644 (file)
@@ -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),
index fd3f085..a1ba6be 100644 (file)
@@ -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 (file)
index 0000000..2517260
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+@define('KRONOLITH_BASE', dirname(__FILE__));
+include_once KRONOLITH_BASE . '/lib/base.php';
+include KRONOLITH_TEMPLATES . '/common-header.inc';
+include KRONOLITH_TEMPLATES . '/menu.inc';
+
+Kronolith_Imple::factory('TagAutoCompleter',
+     array('triggerId' => 'tags'));
+?>
+
+<input id="tags" name="tags" />
\ No newline at end of file