From 3c685aa352587b752af61c6e80b1645ca3830316 Mon Sep 17 00:00:00 2001 From: mensonge Date: Thu, 20 Nov 2008 13:42:03 +0000 Subject: [PATCH] New feature: Dynamic tree of tags using Dojo toolkit (used by a menu2 sidebar box) [Config file modified: ] git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@165 b3834d28-1941-0410-a4f8-b48e95affb8f --- ajax/getlinkedtags.php | 63 +++++++++++++++++++++++++++++++ config.inc.php.example | 1 + scuttle.css | 17 ++++++++- templates/sidebar.block.menu2.php | 62 ++++++++++++++++++++++++++++++ templates/top.inc.php | 9 +++-- 5 files changed, 147 insertions(+), 5 deletions(-) create mode 100644 ajax/getlinkedtags.php create mode 100644 templates/sidebar.block.menu2.php diff --git a/ajax/getlinkedtags.php b/ajax/getlinkedtags.php new file mode 100644 index 0000000..fa8f2d0 --- /dev/null +++ b/ajax/getlinkedtags.php @@ -0,0 +1,63 @@ +isLoggedOn()) { + $loggedon = true; + $currentUser = $userservice->getCurrentUser(); + $currentUserID = $userservice->getCurrentUserId(); +} + +function displayTag($tag, $uId) { + $tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService'); + $output = '{ id:'.rand().', name:\''.$tag.'\''; + + $linkedTags = $tag2tagservice->getLinkedTags($tag, '>', $uId); + if(count($linkedTags) > 0) { + $output.= ', children: ['; + foreach($linkedTags as $linkedTag) { + $output.= displayTag($linkedTag, $uId); + } + $output.= "]"; + } + + $output.= '},'; + return $output; +} + +?> + +{ label: 'name', identifier: 'id', items: [ + +] } diff --git a/config.inc.php.example b/config.inc.php.example index 9966286..47e314e 100644 --- a/config.inc.php.example +++ b/config.inc.php.example @@ -79,6 +79,7 @@ $thumbnailsKey = ''; #then artviper.net send you a UserId and a secretKey $enableCommonTagDescription = true; # enableCommonTagDescription {true, false} $menuTag = 'menu'; # name of the tag whose subtags will appear into the menu box $maxSizeMenuBlock = 7; # maximum number of items (tags) appearing into menu box +$menu2Tags = array('example', 'of', 'menu', 'tags'); # list of tags used by menu2 sidebar box (void list = hidden menu2 box) ### Other ### $sizeSearchHistory = 10; # number of users' searches that are saved {1..10[Default]..-1[Unlimited]} diff --git a/scuttle.css b/scuttle.css index f148a68..7295987 100644 --- a/scuttle.css +++ b/scuttle.css @@ -243,7 +243,7 @@ div#sidebar a { div#sidebar a:hover { color: #773; } -div#sidebar div { +div#sidebar>div { background: #FFF url('bg_sidebar.png') bottom repeat-x; border: 1px solid #CC8; color: #555; @@ -282,6 +282,10 @@ div#sidebar ul li { margin: 0.5em 0; } +div#related { + padding: 0.5em; +} + /* TAGS */ p.commondescription { @@ -312,6 +316,17 @@ p.tags span.selected { background: #CEC; } +.treeTag { + color: #999955; +} +.treeTag:hover { + cursor: pointer; + text-decoration: underline; +} +.treeTag.selected { + background: #CEC; +} + /* PROFILE */ table.profile th { diff --git a/templates/sidebar.block.menu2.php b/templates/sidebar.block.menu2.php new file mode 100644 index 0000000..9b660fa --- /dev/null +++ b/templates/sidebar.block.menu2.php @@ -0,0 +1,62 @@ +getCurrentUserId(); +if ($logged_on_userid === false) { + $logged_on_userid = NULL; +} + +if(!isset($user)) { + $cat_url = createURL('tags', '%2$s'); +} + +$menu2Tags = $GLOBALS['menu2Tags']; +if (sizeOf($menu2Tags) > 0) { + ?> + +

'.T_('Menu Tags').' ';?>

+ + +'; + echo '
'; + echo ''; + echo ''; + echo '
'; +} +?> getUser($userid); ?> 0): ?> + +

+→

+ +

+→

+ +

+→

+ + + diff --git a/templates/top.inc.php b/templates/top.inc.php index dca9036..88a949a 100644 --- a/templates/top.inc.php +++ b/templates/top.inc.php @@ -23,7 +23,7 @@ if(isset($rsschannels)) { src="jsScuttle.php"> + href="http://ajax.googleapis.com/ajax/libs/dojo/1.2/dijit/themes/nihilo/nihilo.css"> - - + +