From 17797c578194de504352ccb26a0b3fac05980fcb Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Tue, 9 Mar 2010 23:54:03 -0500 Subject: [PATCH] Actually retrieve and set the calendar tags. Still an issue with the very first time the calendar chunk loads due to the timing of the callbacks, but this gets calendar tags *mostly* working --- kronolith/js/kronolith.js | 3 +++ kronolith/lib/Ajax/Application.php | 8 +++++++- kronolith/lib/Kronolith.php | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index 5f5d06dbe..494ecbd4f 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -2210,6 +2210,7 @@ KronolithCore = { if (calendar && type == 'remote') { $('kronolithCalendarremoteUrl').setValue(calendar); } + $('kronolithCalendarinternalTags').autocompleter.init(); } else { info = Kronolith.conf.calendars[type][calendar]; @@ -2222,6 +2223,7 @@ KronolithCore = { $('kronolithCalendarinternalDescription').setValue(info.desc); $('kronolithCalendarinternalLinkImportExport').up('span').show(); $('kronolithCalendarinternalExport').href = Kronolith.conf.URI_CALENDAR_EXPORT + '=' + calendar; + $('kronolithCalendarinternalTags').autocompleter.init(Kronolith.conf.calendars.internal[calendar].tg); break; case 'tasklists': $('kronolithCalendartasklistsDescription').setValue(info.desc); @@ -2630,6 +2632,7 @@ KronolithCore = { if (r.response.perms) { cal.perms = r.response.perms; } + cal.tg = data.tags.split(','); this.getCalendarList(type, cal.owner).select('div').each(function(element) { if (element.retrieve('calendar') == data.calendar) { element diff --git a/kronolith/lib/Ajax/Application.php b/kronolith/lib/Ajax/Application.php index 987030a7f..18bccafcf 100644 --- a/kronolith/lib/Ajax/Application.php +++ b/kronolith/lib/Ajax/Application.php @@ -460,6 +460,7 @@ class Kronolith_Ajax_Application extends Horde_Ajax_Application_Base switch ($this->_vars->type) { case 'internal': + $tagger = Kronolith::getTagger(); $info = array(); foreach (array('name', 'color', 'description', 'tags') as $key) { $info[$key] = $this->_vars->$key; @@ -480,6 +481,7 @@ class Kronolith_Ajax_Application extends Horde_Ajax_Application_Base Kronolith::readPermsForm($calendar); $GLOBALS['notification']->push(sprintf(_("The calendar \"%s\" has been created."), $info['name']), 'horde.success'); $result->calendar = $calendar->getName(); + $tagger->tag($result->calendar, $this->_vars->tags, $calendar->get('owner'), 'calendar'); break; } @@ -498,6 +500,8 @@ class Kronolith_Ajax_Application extends Horde_Ajax_Application_Base return $result; } + $tagger->replaceTags($calendar->getName(), $this->_vars->tags, $calendar->get('owner'), 'calendar'); + Kronolith::readPermsForm($calendar); $result->perms = $calendar->getPermission()->data; if ($calendar->get('name') != $original_name) { @@ -643,6 +647,7 @@ class Kronolith_Ajax_Application extends Horde_Ajax_Application_Base return $result; } $calendar = $GLOBALS['all_calendars'][$this->_vars->cal]; + $tagger = Kronolith::getTagger(); $result->calendar = array( 'name' => (!$calendar->get('owner') ? '' : '[' . Horde_Auth::convertUsername($calendar->get('owner'), false) . '] ') . $calendar->get('name'), 'desc' => $calendar->get('desc'), @@ -651,7 +656,8 @@ class Kronolith_Ajax_Application extends Horde_Ajax_Application_Base 'bg' => Kronolith::backgroundColor($calendar), 'show' => false, 'perms' => $calendar->getPermission()->data, - 'edit' => $calendar->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)); + 'edit' => $calendar->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT), + 'tg' => array_values($tagger->getTags($calendar->getName(), 'calendar'))); return $result; } diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 21a99a369..5b3b35476 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -182,6 +182,8 @@ class Kronolith } } + $tagger = self::getTagger(); + /* Variables used in core javascript files. */ $code['conf'] = array( 'URI_AJAX' => (string)Horde::getServiceLink('ajax', 'kronolith'), @@ -257,7 +259,8 @@ class Kronolith 'bg' => self::backgroundColor($calendar), 'show' => in_array($id, $GLOBALS['display_calendars']), 'perms' => $calendar->getPermission()->data, - 'edit' => $calendar->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)); + 'edit' => $calendar->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT), + 'tg' => array_values($tagger->getTags($calendar->getName(), 'calendar'))); } } -- 2.11.0