]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
Interface fix: option to allow admins to see easily tags from other admins when addin...
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Tue, 17 Feb 2009 13:15:06 +0000 (13:15 +0000)
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Tue, 17 Feb 2009 13:15:06 +0000 (13:15 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@289 b3834d28-1941-0410-a4f8-b48e95affb8f

ajax/getadmintags.php [new file with mode: 0644]
config.inc.php.example
services/bookmark2tagservice.php
templates/editbookmark.tpl.php
templates/sidebar.block.watchlist.php
upgrade.txt

diff --git a/ajax/getadmintags.php b/ajax/getadmintags.php
new file mode 100644 (file)
index 0000000..e3d8025
--- /dev/null
@@ -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']."\"},";
+       }
+?>
+]}
+
+
+
+
index 18572500c47138e4658d34c7bf778c66f5623d72..bbe6db4e99a5156595f9f5bd11cc7228c5821655 100644 (file)
@@ -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
index 257db15a16f94beb4076ca396d03c4a7cc81baa1..86cb88ad064ed90321cf8c18265a01d9b9aad17d 100644 (file)
@@ -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;
                }
index 8031aad3b4c667057ac84a2eb1e00a133bcbdb4b..92357d115abf41bb84bb33216232663717f4cc1e 100644 (file)
@@ -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>
index 5b476ea1502d2d7d6290e22cb454d043fb51b06a..686550bd769a39a00ac626caa3dae3e85123d41c 100644 (file)
@@ -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>
index 8c9b751c6ebfb006d1589aea3bbd185ad0754592..fdaac0d21f45574e7758638f1aea87c311531132 100644 (file)
@@ -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 ===