summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-03-30 19:20:26 +0200
committerChristian Weiske <cweiske@cweiske.de>2011-03-30 19:20:26 +0200
commit28c8cdaf5836690b2d393e0735bab62c59aaa7b7 (patch)
tree8cd139b96b223c2bf1159c433ccf88019f685ca6 /data
parentc7c702f54428a1c3569e90a6a58f879d575571cb (diff)
downloadsemanticscuttle-28c8cdaf5836690b2d393e0735bab62c59aaa7b7.tar.gz
semanticscuttle-28c8cdaf5836690b2d393e0735bab62c59aaa7b7.tar.bz2
make dynamictags (tagcloud) work again
Diffstat (limited to 'data')
-rw-r--r--data/templates/dynamictags.inc.php63
-rw-r--r--data/templates/editbookmark.tpl.php2
2 files changed, 37 insertions, 28 deletions
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(\'<div class="collapsible">\');';
- echo 'document.write(\'<h3>'. $title .'<\/h3>\');';
- echo 'document.write(\'<p id="popularTags" class="tags">\');';
+function writeTagsProposition($tagsCloud, $title)
+{
+ static $id = 0;
+ ++$id;
+
+ echo <<<JS
+ $('.edit-tagclouds')
+ .append(
+'<div class="collapsible" id="edit-tagcloud-$id">'
++ ' <h3>$title</h3>'
++ ' <p class="popularTags tags"></p>'
++ '</div>');
+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 .= '<span title="'. $row['bCount'] .' '. $entries .'" style="font-size:'. $row['size'] .'" onclick="addTag(this)">'. filter($row['tag']) .'<\/span> ';
+ $taglist .= '<span'
+ . ' title="'. $row['bCount'] . ' ' . $entries . '"'
+ . ' style="font-size:' . $row['size'] . '"'
+ . ' onclick="addTag(this)">'
+ . filter($row['tag'])
+ . '</span> ';
}
-
- 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(', ');
+<?php
+if ($userPopularTagsCount > 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();
}
-
-<?php
-if( $userPopularTagsCount > 0) {
- writeTagsProposition($userPopularTagsCloud, T_('Popular Tags'));
-}
-if( $allPopularTagsCount > 0) {
- writeTagsProposition($allPopularTagsCloud, T_('Popular Tags From All Users'));
-}
-
-
-?>
//]]>
</script>
-
+<div class="edit-tagclouds"></div>
<?php
}
?>
diff --git a/data/templates/editbookmark.tpl.php b/data/templates/editbookmark.tpl.php
index 1783692..25938e8 100644
--- a/data/templates/editbookmark.tpl.php
+++ b/data/templates/editbookmark.tpl.php
@@ -194,7 +194,7 @@ jQuery(document).ready(function() {
<?php
// Dynamic tag selection
- //FIXME$this->includeTemplate('dynamictags.inc');
+$this->includeTemplate('dynamictags.inc');
// Bookmarklets and import links
if (empty($_REQUEST['popup']) && (!isset($showdelete) || !$showdelete)) {