From 28c8cdaf5836690b2d393e0735bab62c59aaa7b7 Mon Sep 17 00:00:00 2001
From: Christian Weiske
Date: Wed, 30 Mar 2011 19:20:26 +0200
Subject: make dynamictags (tagcloud) work again
---
data/templates/dynamictags.inc.php | 63 ++++++++++++++++++++++----------------
1 file changed, 36 insertions(+), 27 deletions(-)
(limited to 'data/templates/dynamictags.inc.php')
diff --git a/data/templates/dynamictags.inc.php b/data/templates/dynamictags.inc.php
index 62f5071..8cf07c1 100644
--- a/data/templates/dynamictags.inc.php
+++ b/data/templates/dynamictags.inc.php
@@ -36,22 +36,34 @@ $allPopularTagsCount = count($allPopularTags);
// function printing the cloud
-function writeTagsProposition($tagsCloud, $title) {
- echo 'document.write(\'
\');';
- echo 'document.write(\'
'. $title .'<\/h3>\');';
- echo 'document.write(\'
\');';
+function writeTagsProposition($tagsCloud, $title)
+{
+ static $id = 0;
+ ++$id;
+
+ echo <<'
++ ' $title
'
++ ' '
++ '
');
+JS;
$taglist = '';
- foreach(array_keys($tagsCloud) as $key) {
- $row =& $tagsCloud[$key];
+ foreach (array_keys($tagsCloud) as $key) {
+ $row = $tagsCloud[$key];
$entries = T_ngettext('bookmark', 'bookmarks', $row['bCount']);
- $taglist .= ''. filter($row['tag']) .'<\/span> ';
+ $taglist .= ''
+ . filter($row['tag'])
+ . ' ';
}
-
- echo 'document.write(\''. $taglist .'\');';
- echo 'document.write(\'<\/p>\');';
- echo 'document.write(\'<\/div>\');';
-
+ echo '$(\'#edit-tagcloud-' . $id . ' p\').append('
+ . json_encode($taglist)
+ . ");\n";
}
@@ -88,10 +100,18 @@ function addonload(addition) {
}
jQuery(function($) {
- var taglist = document.getElementById('tags');
- var tags = taglist.value.split(', ');
+ 0) {
+ writeTagsProposition($userPopularTagsCloud, T_('Popular Tags'));
+}
+if ($allPopularTagsCount > 0) {
+ writeTagsProposition($allPopularTagsCloud, T_('Popular Tags From All Users'));
+}
+?>
+ var taglist = $('#tags');
+ var tags = taglist.val().split(', ');
- var populartags = document.getElementById('popularTags').getElementsByTagName('span');
+ var populartags = $('.edit-tagclouds span');
for (var i = 0; i < populartags.length; i++) {
if (tags.contains(populartags[i].innerHTML)) {
@@ -120,20 +140,9 @@ function addTag(ele) {
document.getElementById('tags').focus();
}
-
- 0) {
- writeTagsProposition($userPopularTagsCloud, T_('Popular Tags'));
-}
-if( $allPopularTagsCount > 0) {
- writeTagsProposition($allPopularTagsCloud, T_('Popular Tags From All Users'));
-}
-
-
-?>
//]]>
-
+
--
cgit v1.2.3-54-g00ecf