From 3f9a5210f18c5d4418c3c2d8788f9babf1a231c4 Mon Sep 17 00:00:00 2001 From: mensonge Date: Tue, 17 Feb 2009 13:15:06 +0000 Subject: Interface fix: option to allow admins to see easily tags from other admins when adding/editing a bookmark. [Config file modified: ] git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@289 b3834d28-1941-0410-a4f8-b48e95affb8f --- ajax/getadmintags.php | 44 +++++++++++++++++++++++++++++++++++ config.inc.php.example | 1 + services/bookmark2tagservice.php | 19 +++++++++++++++ templates/editbookmark.tpl.php | 2 +- templates/sidebar.block.watchlist.php | 4 ---- upgrade.txt | 1 + 6 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 ajax/getadmintags.php diff --git a/ajax/getadmintags.php b/ajax/getadmintags.php new file mode 100644 index 0000000..e3d8025 --- /dev/null +++ b/ajax/getadmintags.php @@ -0,0 +1,44 @@ + + +{identifier:"tag", +items: [ +getAdminTags(1000, $userservice->getCurrentUserId()); + foreach($listTags as $t) { + echo "{tag: \"".$t['tag']."\"},"; + } +?> +]} + + + + diff --git a/config.inc.php.example b/config.inc.php.example index 1857250..bbe6db4 100644 --- a/config.inc.php.example +++ b/config.inc.php.example @@ -31,6 +31,7 @@ $tableprefix = 'sc_'; # table prefix used for this installation. Do not use '-' $adminemail = 'admin@example.org'; # Contact address for the site administrator. Used as the FROM address in password retrieval e-mails. $admin_users = array(''); # admin users = array('adminnickname', 'user1nick', 'user2nick'); $adminsCanModifyBookmarksFromOtherUsers = true; # 'true' if admin users can edit or delete bookmarks belonging to other users. Else 'false'. +$adminsAreAdvisedTagsFromOtherAdmins = false; # 'true' if tags from other admins are proposed to each admin (in add/edit a bookmark page). Else 'false'. $reservedusers = array('all', 'watchlist'); # array of usernames that cannot be registered # Antispam $antispamQuestion = 'name of this application (no Caps)'; # antispamQuestion: A question to avoid spam diff --git a/services/bookmark2tagservice.php b/services/bookmark2tagservice.php index 257db15..86cb88a 100644 --- a/services/bookmark2tagservice.php +++ b/services/bookmark2tagservice.php @@ -326,7 +326,20 @@ class Bookmark2TagService { $this->db->sql_freeresult($dbresult); return $output; } + + 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); + } + + // ask for their tags + return $this->getPopularTags($admins, $limit, $logged_on_user, $days); + } + // $users can be {NULL, an id, an array of id} function &getPopularTags($user = NULL, $limit = 30, $logged_on_user = NULL, $days = NULL) { // Only count the tags that are visible to the current user. if (($user != $logged_on_user) || is_null($user) || ($user === false)) @@ -342,6 +355,12 @@ class Bookmark2TagService { $query = 'SELECT T.tag, COUNT(T.bId) AS bCount FROM '. $this->getTableName() .' AS T, '. $GLOBALS['tableprefix'] .'bookmarks AS B WHERE '; if (is_null($user) || ($user === false)) { $query .= 'B.bId = T.bId AND B.bStatus = 0'; + } elseif(is_array($user)) { + $query .= ' (1 = 0'; //tricks + foreach($user as $u) { + $query .= ' OR B.uId = '. $this->db->sql_escape($u) .' AND B.bId = T.bId'; + } + $query .= ' )'; } else { $query .= 'B.uId = '. $this->db->sql_escape($user) .' AND B.bId = T.bId'. $privacy; } diff --git a/templates/editbookmark.tpl.php b/templates/editbookmark.tpl.php index 8031aad..92357d1 100644 --- a/templates/editbookmark.tpl.php +++ b/templates/editbookmark.tpl.php @@ -68,7 +68,7 @@ $this->includeTemplate("dojo.inc"); - + diff --git a/templates/sidebar.block.watchlist.php b/templates/sidebar.block.watchlist.php index 5b476ea..686550b 100644 --- a/templates/sidebar.block.watchlist.php +++ b/templates/sidebar.block.watchlist.php @@ -36,10 +36,6 @@ foreach($watching as $watchuser) { - - -
  • -
  • diff --git a/upgrade.txt b/upgrade.txt index 8c9b751..fdaac0d 100644 --- a/upgrade.txt +++ b/upgrade.txt @@ -9,6 +9,7 @@ Message: this version modifies the database to UTF-8 charset. The idea is to con #NOTHING TO CHANGE IN DB - Upgrade your current configuration file (config.inc.php) with respect to config.inc.php.example $adminsCanModifyBookmarksFromOtherUsers = true; # 'true' if admin users can edit or delete bookmarks belonging to other users. Else 'false'. +$adminsAreAdvisedTagsFromOtherAdmins = false; # 'true' if tags from other admins are proposed to each admin (in add/edit a bookmark page). Else 'false'. === From version 0.91 to 0.92 === -- cgit v1.2.3-54-g00ecf