From 0cf29f9591b1e49fcd65234201a34de9ce119475 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Fri, 23 Oct 2009 18:58:05 +0200 Subject: [PATCH] Fix opening holiday events. Prepare to view tasks. --- kronolith/js/kronolith.js | 28 ++++++++++++++++++++++------ kronolith/lib/Event.php | 1 + kronolith/lib/Event/Horde.php | 18 ++++++++++++++---- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index 9e37a59d4..d3e24c1b2 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -329,6 +329,10 @@ KronolithCore = { this._addHistory(fullloc); break; + case 'task': + this._addHistory(fullloc); + break; + case 'options': //this.highlightSidebar('appoptions'); this._addHistory(loc); @@ -999,12 +1003,16 @@ KronolithCore = { event.value.nodeId = 'kronolithEvent' + view + event.value.calendar + date + event.key; _createElement = function(event) { - return new Element('DIV', { + var el = new Element('DIV', { 'id': event.value.nodeId, - 'calendar': event.value.calendar, - 'eventid' : event.key, + 'calendar': event.value.calendar.replace(/:/, '^'), + 'eventid' : event.key.replace(/:/, '^'), 'class': 'kronolithEvent' }); + if (!Object.isUndefined(event.value.aj)) { + el.writeAttribute('ajax', event.value.aj); + } + return el; }; switch (view) { @@ -1880,12 +1888,16 @@ KronolithCore = { case 'kronolithNavWeek': case 'kronolithNavMonth': case 'kronolithNavYear': - case 'kronolithNavTasks': case 'kronolithNavAgenda': this.go(id.substring(12).toLowerCase() + ':' + this.date.dateString()); e.stop(); return; + case 'kronolithNavTasks': + this.go('tasks'); + e.stop(); + return; + case 'kronolithMinicalDate': this.go('month:' + orig.readAttribute('date')); e.stop(); @@ -2030,7 +2042,11 @@ KronolithCore = { } if (elt.hasClassName('kronolithEvent')) { - this.go('event:' + elt.readAttribute('calendar') + ':' + elt.readAttribute('eventid')); + if (elt.hasAttribute('ajax')) { + this.go(elt.readAttribute('ajax')); + } else { + this.go('event:' + elt.readAttribute('calendar') + ':' + elt.readAttribute('eventid')); + } e.stop(); return; } else if (elt.hasClassName('kronolithWeekDay')) { @@ -2129,7 +2145,7 @@ KronolithCore = { this.doAction('ListTopTags', {}, this._topTags); if (id) { RedBox.loading(); - this.doAction('GetEvent', { 'cal': calendar, 'id': id }, this._editEvent.bind(this)); + this.doAction('GetEvent', { 'cal': calendar.replace(/\^/, ':'), 'id': id.replace(/\^/, ':') }, this._editEvent.bind(this)); } else { var d = date ? this.parseDate(date) : new Date(); $('kronolithEventId').value = ''; diff --git a/kronolith/lib/Event.php b/kronolith/lib/Event.php index eebf2fb2c..a0b55e99f 100644 --- a/kronolith/lib/Event.php +++ b/kronolith/lib/Event.php @@ -1083,6 +1083,7 @@ abstract class Kronolith_Event * - r: recurrence type (Horde_Date_Recurrence::RECUR_* constant) * - ic: icon * - ln: link + * - aj: ajax link * - id: event id * - ty: calendar type (driver) * - l: location diff --git a/kronolith/lib/Event/Horde.php b/kronolith/lib/Event/Horde.php index f9fc87d94..354efcf82 100644 --- a/kronolith/lib/Event/Horde.php +++ b/kronolith/lib/Event/Horde.php @@ -22,7 +22,14 @@ class Kronolith_Event_Horde extends Kronolith_Event * * @var string */ - private $_api; + protected $_api; + + /** + * The link to this event in the ajax interface. + * + * @var string + */ + public $ajax_link; /** * Constructor. @@ -47,6 +54,7 @@ class Kronolith_Event_Horde extends Kronolith_Event $this->external_params = $event['params']; $this->external_icon = !empty($event['icon']) ? $event['icon'] : null; $this->external_link = !empty($event['link']) ? $event['link'] : null; + $this->ajax_link = !empty($event['ajax_link']) ? $event['ajax_link'] : null; $this->title = $event['title']; $this->description = isset($event['description']) ? $event['description'] : ''; $this->start = $eventStart; @@ -85,9 +93,11 @@ class Kronolith_Event_Horde extends Kronolith_Event { $json = parent::toJson($allDay, $full, $time_format); $json->ic = $this->external_icon; - // @TODO: What is expected for external calendar links? This is currently - // broken in the UI. - //$json->ln = $this->getLink(); + if ($this->ajax_link) { + $json->aj = $this->ajax_link; + } else { + $json->ln = $this->getLink(); + } return $json; } -- 2.11.0