From 0b82d4468406803d048d1aa7d2082055c2d88c91 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sat, 31 Jan 2009 09:52:56 -0500 Subject: [PATCH] More work on tagging. Better dom ids for the tagging nodes, pass the resource id to the autocompleter so we can (eventually) filter out existing tags on the item when presenting autocompletion choices. --- kronolith/js/tagactions.js | 10 +++++----- kronolith/lib/Imple/TagActions.php | 2 +- kronolith/lib/Imple/TagAutoCompleter.php | 9 +++++++-- kronolith/templates/panel.inc | 16 ++++++++-------- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/kronolith/js/tagactions.js b/kronolith/js/tagactions.js index 6c5cb4c90..84c85bccc 100755 --- a/kronolith/js/tagactions.js +++ b/kronolith/js/tagactions.js @@ -20,7 +20,7 @@ function removeTag(resource, type, tagid, endpoint) { var params = new Object(); params.imple = "TagActions/action=remove/resource=" + resource + "/type=" + type + "/tags=" + tagid; - new Ajax.Updater({success:'tags-' + resource}, + new Ajax.Updater({success:'tags_' + resource}, endpoint, { method: 'post', @@ -30,9 +30,9 @@ function removeTag(resource, type, tagid, endpoint) return true; } -function toggleNewTags(domid) +function toggleTags(domid) { - $('tag-show-' + domid).toggle(); - $('tag-hide-' + domid).toggle(); - $('newtags-' + domid).toggle(); + $('tag-show_' + domid).toggle(); + $('tag-hide_' + domid).toggle(); + $('tagnode_' + domid).toggle(); } \ No newline at end of file diff --git a/kronolith/lib/Imple/TagActions.php b/kronolith/lib/Imple/TagActions.php index ea58180d0..619a49a20 100644 --- a/kronolith/lib/Imple/TagActions.php +++ b/kronolith/lib/Imple/TagActions.php @@ -104,7 +104,7 @@ class Kronolith_Imple_TagActions extends Kronolith_Imple } foreach ($tags as $tag_id => $tag) { - $html .= '
  • ' . $tag . ($hasEdit ? '' . Horde::img('delete-small.png', _("Remove Tag"), '', $GLOBALS['registry']->getImageDir('horde')) . '' : '') . '
  • '; + $html .= '
  • ' . $tag . ($hasEdit ? '' . Horde::img('delete-small.png', _("Remove Tag"), '', $GLOBALS['registry']->getImageDir('horde')) . '' : '') . '
  • '; } return $html; diff --git a/kronolith/lib/Imple/TagAutoCompleter.php b/kronolith/lib/Imple/TagAutoCompleter.php index 24fa07d0d..09e572ce7 100644 --- a/kronolith/lib/Imple/TagAutoCompleter.php +++ b/kronolith/lib/Imple/TagAutoCompleter.php @@ -21,9 +21,11 @@ class Kronolith_Imple_TagAutoCompleter extends Kronolith_Imple */ public function __construct($params) { - if (empty($params['triggerId'])) { - $params['triggerId'] = $this->_randomid(); + + if (!count($params)) { + return; } + $params['triggerId'] = $params['triggerId'] . '_' . $params['id']; if (empty($params['resultsId'])) { $params['resultsId'] = $params['triggerId'] . '_results'; } @@ -84,6 +86,9 @@ class Kronolith_Imple_TagAutoCompleter extends Kronolith_Imple { $tagger = new Kronolith_Tagger(); $tags = $tagger->listTags($search); + + + return array_values($tags); } diff --git a/kronolith/templates/panel.inc b/kronolith/templates/panel.inc index f5ff4c579..c410548e7 100644 --- a/kronolith/templates/panel.inc +++ b/kronolith/templates/panel.inc @@ -46,10 +46,10 @@ $tagger = new Kronolith_Tagger();
  • getTags($id, 'calendar'); ?> - ">+ -
    - -- 2.11.0