From 0c81abaa3e6319fb729f6924c8d8ffb7393a5072 Mon Sep 17 00:00:00 2001 From: mensonge Date: Fri, 20 Feb 2009 09:33:59 +0000 Subject: Interface fix: menu2 just displays linked tags from admins git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@292 b3834d28-1941-0410-a4f8-b48e95affb8f --- ajax/getadminlinkedtags.php | 64 +++++++++++++++++++++++++++++++++++++++ services/bookmark2tagservice.php | 7 ++--- services/tag2tagservice.php | 18 ++++++++++- services/userservice.php | 10 ++++++ templates/sidebar.block.menu2.php | 8 ++--- 5 files changed, 97 insertions(+), 10 deletions(-) create mode 100644 ajax/getadminlinkedtags.php diff --git a/ajax/getadminlinkedtags.php b/ajax/getadminlinkedtags.php new file mode 100644 index 0000000..75aae9a --- /dev/null +++ b/ajax/getadminlinkedtags.php @@ -0,0 +1,64 @@ +getAdminLinkedTags($tag, '>'); + if(count($linkedTags) > 0) { + $output.= ', children: ['; + foreach($linkedTags as $linkedTag) { + $output.= displayTag($linkedTag, $uId); + } + $output = substr($output, 0, -1); // remove final comma avoiding IE6 Dojo bug + $output.= "]"; + } + + $output.= '},'; + return $output; +} + +?> + +{ label: 'name', identifier: 'id', items: [ + +] } diff --git a/services/bookmark2tagservice.php b/services/bookmark2tagservice.php index 99c97af..918fb5b 100644 --- a/services/bookmark2tagservice.php +++ b/services/bookmark2tagservice.php @@ -330,13 +330,10 @@ class Bookmark2TagService { function &getAdminTags($limit = 30, $logged_on_user = NULL, $days = NULL) { // look for admin ids $userservice = & ServiceFactory :: getServiceInstance('UserService'); - $admins = array(); - foreach($GLOBALS['admin_users'] as $adminName) { - $admins[] = $userservice->getIdFromUser($adminName); - } + $adminIds = $userservice->getAdminIds(); // ask for their tags - return $this->getPopularTags($admins, $limit, $logged_on_user, $days); + return $this->getPopularTags($adminIds, $limit, $logged_on_user, $days); } function &getContactTags($user, $limit = 30, $logged_on_user = NULL, $days = NULL) { diff --git a/services/tag2tagservice.php b/services/tag2tagservice.php index 1547daf..6069880 100644 --- a/services/tag2tagservice.php +++ b/services/tag2tagservice.php @@ -43,6 +43,16 @@ class Tag2TagService { return true; } + // Return linked tags just for admin users + function getAdminLinkedTags($tag, $relationType, $inverseRelation = false, $stopList = array()) { + // look for admin ids + $userservice = & ServiceFactory :: getServiceInstance('UserService'); + $adminIds = $userservice->getAdminIds(); + + //ask for their linked tags + return $this->getLinkedTags($tag, $relationType, $adminIds, $inverseRelation, $stopList); + } + // Return the target linked tags. If inverseRelation is true, return the source linked tags. function getLinkedTags($tag, $relationType, $uId = null, $inverseRelation = false, $stopList = array()) { // Set up the SQL query. @@ -63,7 +73,13 @@ class Tag2TagService { if($relationType) { $query.= " AND relationType = '". $relationType ."'"; } - if($uId != null) { + if(is_array($uId)) { + $query.= " AND ( 1=0 "; //tricks always false + foreach($uId as $u) { + $query.= " OR uId = '".$u."'"; + } + $query.= " ) "; + } elseif($uId != null) { $query.= " AND uId = '".$uId."'"; } //die($query); diff --git a/services/userservice.php b/services/userservice.php index a4ed3ac..d0eb96a 100644 --- a/services/userservice.php +++ b/services/userservice.php @@ -429,6 +429,16 @@ class UserService { } $this->db->sql_freeresult($dbresult); return $rows; + } + + // Returns an array with admin uIds + function getAdminIds() { + $admins = array(); + foreach($GLOBALS['admin_users'] as $adminName) { + if($this->getIdFromUser($adminName) != NULL) + $admins[] = $this->getIdFromUser($adminName); + } + return $admins; } function deleteUser($uId) { diff --git a/templates/sidebar.block.menu2.php b/templates/sidebar.block.menu2.php index eee150e..543ac79 100644 --- a/templates/sidebar.block.menu2.php +++ b/templates/sidebar.block.menu2.php @@ -29,15 +29,15 @@ if (sizeOf($menu2Tags) > 0) { '; + echo '
'; echo '
'; echo ''; - echo ''; + //echo ''; echo '
'; } ?> -- cgit v1.2.3