aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-02-17 13:15:06 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-02-17 13:15:06 +0000
commit3f9a5210f18c5d4418c3c2d8788f9babf1a231c4 (patch)
tree702a2832d83aac4c5df414a3315c937c5e4064ce
parent0025ca22a274865fa2a7a045323b3eb418705c4d (diff)
downloadsemanticscuttle-3f9a5210f18c5d4418c3c2d8788f9babf1a231c4.tar.gz
semanticscuttle-3f9a5210f18c5d4418c3c2d8788f9babf1a231c4.tar.bz2
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
-rw-r--r--ajax/getadmintags.php44
-rw-r--r--config.inc.php.example1
-rw-r--r--services/bookmark2tagservice.php19
-rw-r--r--templates/editbookmark.tpl.php2
-rw-r--r--templates/sidebar.block.watchlist.php4
-rw-r--r--upgrade.txt1
6 files changed, 66 insertions, 5 deletions
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 @@
+<?php
+/***************************************************************************
+Copyright (C) 2004 - 2006 Scuttle project
+http://sourceforge.net/projects/scuttle/
+http://scuttle.org/
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***************************************************************************/
+
+/* Return a json file with list of tags according to current user and sort by popularity*/
+
+require_once('../header.inc.php');
+
+/* Service creation: only useful services are created */
+$b2tservice =& ServiceFactory::getServiceInstance('Bookmark2TagService');
+$bookmarkservice =& ServiceFactory::getServiceInstance('TagService');
+
+?>
+
+{identifier:"tag",
+items: [
+<?php
+ $listTags = $b2tservice->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");
<tr>
<th align="left"><?php echo T_('Tags'); ?></th>
<td class="scuttletheme">
- <span dojoType="dojo.data.ItemFileReadStore" jsId="memberTagStore" url="<?php echo ROOT?>ajax/gettags.php"></span>
+ <span dojoType="dojo.data.ItemFileReadStore" jsId="memberTagStore" url="<?php echo ROOT?>ajax/<?php echo ($GLOBALS['adminsAreAdvisedTagsFromOtherAdmins'] && $currentUser->isAdmin())?'getadmintags':'gettags'?>.php"></span>
<input type="text" dojoType="js.MultiComboBox" id="tags" name="tags" size="75" value="<?php echo filter(implode(', ', $row['tags']), 'xml'); ?>" store="memberTagStore" delimiter="," searchAttr="tag" hasDownArrow="false" queryExpr="*${0}*" autoComplete="false" highlightMatch="all"/></td>
<td>&larr; <?php echo T_('Comma-separated'); ?></td>
</tr>
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) {
</form>
</li>
<?php endif; ?>
-
- <?php if(count($watching) == 0):?>
- <li><?php echo T_("Nobody");?></li>
- <?php endif; ?>
<?php foreach($watching as $watchuser): ?>
<li><a href="<?php echo createURL('bookmarks', $watchuser); ?>"><?php echo $watchuser; ?></a>
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 ===