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
This commit is contained in:
parent
0025ca22a2
commit
3f9a5210f1
6 changed files with 66 additions and 5 deletions
44
ajax/getadmintags.php
Normal file
44
ajax/getadmintags.php
Normal file
|
@ -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']."\"},";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
]}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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.
|
$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');
|
$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'.
|
$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
|
$reservedusers = array('all', 'watchlist'); # array of usernames that cannot be registered
|
||||||
# Antispam
|
# Antispam
|
||||||
$antispamQuestion = 'name of this application (no Caps)'; # antispamQuestion: A question to avoid spam
|
$antispamQuestion = 'name of this application (no Caps)'; # antispamQuestion: A question to avoid spam
|
||||||
|
|
|
@ -327,6 +327,19 @@ class Bookmark2TagService {
|
||||||
return $output;
|
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) {
|
function &getPopularTags($user = NULL, $limit = 30, $logged_on_user = NULL, $days = NULL) {
|
||||||
// Only count the tags that are visible to the current user.
|
// Only count the tags that are visible to the current user.
|
||||||
if (($user != $logged_on_user) || is_null($user) || ($user === false))
|
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 ';
|
$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)) {
|
if (is_null($user) || ($user === false)) {
|
||||||
$query .= 'B.bId = T.bId AND B.bStatus = 0';
|
$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 {
|
} else {
|
||||||
$query .= 'B.uId = '. $this->db->sql_escape($user) .' AND B.bId = T.bId'. $privacy;
|
$query .= 'B.uId = '. $this->db->sql_escape($user) .' AND B.bId = T.bId'. $privacy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ $this->includeTemplate("dojo.inc");
|
||||||
<tr>
|
<tr>
|
||||||
<th align="left"><?php echo T_('Tags'); ?></th>
|
<th align="left"><?php echo T_('Tags'); ?></th>
|
||||||
<td class="scuttletheme">
|
<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>
|
<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>← <?php echo T_('Comma-separated'); ?></td>
|
<td>← <?php echo T_('Comma-separated'); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -37,10 +37,6 @@ foreach($watching as $watchuser) {
|
||||||
</li>
|
</li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if(count($watching) == 0):?>
|
|
||||||
<li><?php echo T_("Nobody");?></li>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php foreach($watching as $watchuser): ?>
|
<?php foreach($watching as $watchuser): ?>
|
||||||
<li><a href="<?php echo createURL('bookmarks', $watchuser); ?>"><?php echo $watchuser; ?></a>
|
<li><a href="<?php echo createURL('bookmarks', $watchuser); ?>"><?php echo $watchuser; ?></a>
|
||||||
<?php if($userservice->isLoggedOn() && $currentUser->getUsername() == $user): ?>
|
<?php if($userservice->isLoggedOn() && $currentUser->getUsername() == $user): ?>
|
||||||
|
|
|
@ -9,6 +9,7 @@ Message: this version modifies the database to UTF-8 charset. The idea is to con
|
||||||
#NOTHING TO CHANGE IN DB
|
#NOTHING TO CHANGE IN DB
|
||||||
- Upgrade your current configuration file (config.inc.php) with respect to config.inc.php.example
|
- 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'.
|
$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 ===
|
=== From version 0.91 to 0.92 ===
|
||||||
|
|
Loading…
Reference in a new issue