add stats to tags relation and use them to display tags

git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@21 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
mensonge 2008-01-22 16:16:06 +00:00
parent b3b802434f
commit 2aed4f1f9f
12 changed files with 607 additions and 222 deletions

34
admin.php Normal file
View file

@ -0,0 +1,34 @@
<?php
/***************************************************************************
Copyright (C) 2006 - 2007 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
***************************************************************************/
// Uncomment the following lines to execute the admin script. Don't forget to re-comment them after using.
/*
require_once('header.inc.php');
$tagstatservice = & ServiceFactory :: getServiceInstance('TagStatService');
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
// Update the stats
$tagstatservice->updateAllStat();
echo "Admin script executed: OK!";
*/
?>

View file

@ -75,6 +75,9 @@ if (isset($userid)) {
$tplVars['cat_url'] = createURL('tags', '%2$s'); $tplVars['cat_url'] = createURL('tags', '%2$s');
} }
$tplVars['sidebar_blocks'] = array('linked');
$tplVars['userid'] = $userid;
$tplVars['subtitle'] = $pagetitle; $tplVars['subtitle'] = $pagetitle;
$templateservice->loadTemplate('tags.tpl', $tplVars); $templateservice->loadTemplate('tags.tpl', $tplVars);

View file

@ -8,8 +8,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Scuttle\n" "Project-Id-Version: Scuttle\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-01-14 11:58+0100\n" "POT-Creation-Date: 2008-01-22 16:54+0100\n"
"PO-Revision-Date: 2008-01-14 11:31+0100\n" "PO-Revision-Date: 2008-01-22 16:55+0100\n"
"Last-Translator: BenjaminHKB <benjamin.huynh-kim-bang@loria.fr>\n" "Last-Translator: BenjaminHKB <benjamin.huynh-kim-bang@loria.fr>\n"
"Language-Team: fr-FR <toony.sf@chezouam.net>\n" "Language-Team: fr-FR <toony.sf@chezouam.net>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -19,7 +19,8 @@ msgstr ""
"X-Poedit-Country: FRANCE\n" "X-Poedit-Country: FRANCE\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../../../about.php:25 ../../../templates/toolbar.inc.php:23 #: ../../../about.php:25
#: ../../../templates/toolbar.inc.php:23
msgid "About" msgid "About"
msgstr "À propos" msgstr "À propos"
@ -27,7 +28,8 @@ msgstr "À propos"
msgid "You are not allowed to delete this bookmark" msgid "You are not allowed to delete this bookmark"
msgstr "Vous ne pouvez pas supprimer ce signet." msgstr "Vous ne pouvez pas supprimer ce signet."
#: ../../../ajaxDelete.php:34 ../../../edit.php:78 #: ../../../ajaxDelete.php:34
#: ../../../edit.php:78
msgid "Failed to delete bookmark" msgid "Failed to delete bookmark"
msgstr "Erreur dans la suppression du signet" msgstr "Erreur dans la suppression du signet"
@ -35,31 +37,36 @@ msgstr "Erreur dans la suppression du signet"
msgid "All Tags" msgid "All Tags"
msgstr "Tous les tags" msgstr "Tous les tags"
#: ../../../alltags.php:57 ../../../bookmarks.php:72 #: ../../../alltags.php:57
#: ../../../populartags.php:58 ../../../profile.php:44 ../../../rss.php:62 #: ../../../bookmarks.php:72
#: ../../../search.php:87 ../../../watch.php:34 ../../../watchlist.php:61 #: ../../../populartags.php:58
#: ../../../profile.php:44
#: ../../../rss.php:62
#: ../../../search.php:87
#: ../../../watch.php:34
#: ../../../watchlist.php:61
#, php-format #, php-format
msgid "User with username %s was not found" msgid "User with username %s was not found"
msgstr "L'utilisateur %s n'a pas été trouvé." msgstr "L'utilisateur %s n'a pas été trouvé."
#: ../../../bookmarks.php:95 ../../../edit.php:44 #: ../../../bookmarks.php:95
#: ../../../edit.php:44
msgid "Your bookmark must have a title and an address" msgid "Your bookmark must have a title and an address"
msgstr "Votre signet doit avoir un titre et une adresse." msgstr "Votre signet doit avoir un titre et une adresse."
#: ../../../bookmarks.php:115 ../../../edit.php:58 #: ../../../bookmarks.php:115
#: ../../../edit.php:58
msgid "Bookmark saved" msgid "Bookmark saved"
msgstr "Signet enregistré." msgstr "Signet enregistré."
#: ../../../bookmarks.php:123 ../../../import.php:99 #: ../../../bookmarks.php:123
#: ../../../import.php:99
#: ../../../importNetscape.php:74 #: ../../../importNetscape.php:74
msgid "" msgid "There was an error saving your bookmark. Please try again or contact the administrator."
"There was an error saving your bookmark. Please try again or contact the " msgstr "Il y a eu une erreur en enregistrant ce signet. Veuillez rééssayer ou contacter votre administrateur."
"administrator."
msgstr ""
"Il y a eu une erreur en enregistrant ce signet. Veuillez rééssayer ou "
"contacter votre administrateur."
#: ../../../bookmarks.php:161 ../../../templates/toolbar.inc.php:14 #: ../../../bookmarks.php:161
#: ../../../templates/toolbar.inc.php:14
msgid "Add a Bookmark" msgid "Add a Bookmark"
msgstr "Ajouter un signet" msgstr "Ajouter un signet"
@ -92,7 +99,8 @@ msgstr "Vous n'êtes pas autorisé à éditer ce signet."
msgid "Error while saving your bookmark" msgid "Error while saving your bookmark"
msgstr "Erreur pendant l'enregistrement de votre signet." msgstr "Erreur pendant l'enregistrement de votre signet."
#: ../../../edit.php:88 ../../../templates/editprofile.tpl.php:49 #: ../../../edit.php:88
#: ../../../templates/editprofile.tpl.php:49
msgid "Save Changes" msgid "Save Changes"
msgstr "Enregister les modifications" msgstr "Enregister les modifications"
@ -108,7 +116,8 @@ msgstr "Erreur SQL"
msgid "Line" msgid "Line"
msgstr "Ligne" msgstr "Ligne"
#: ../../../functions.inc.php:115 ../../../templates/importDelicious.tpl.php:8 #: ../../../functions.inc.php:115
#: ../../../templates/importDelicious.tpl.php:8
#: ../../../templates/importNetscape.tpl.php:9 #: ../../../templates/importNetscape.tpl.php:9
msgid "File" msgid "File"
msgstr "Fichier" msgstr "Fichier"
@ -168,11 +177,13 @@ msgstr "Erreur XML: %s à la ligne %d"
msgid "Import Bookmarks from del.icio.us" msgid "Import Bookmarks from del.icio.us"
msgstr "Importer les signet depuis del.icio.us" msgstr "Importer les signet depuis del.icio.us"
#: ../../../import.php:86 ../../../importNetscape.php:64 #: ../../../import.php:86
#: ../../../importNetscape.php:64
msgid "You have already submitted this bookmark." msgid "You have already submitted this bookmark."
msgstr "Vous avez déjà enregistré ce signet." msgstr "Vous avez déjà enregistré ce signet."
#: ../../../import.php:97 ../../../importNetscape.php:72 #: ../../../import.php:97
#: ../../../importNetscape.php:72
#, fuzzy #, fuzzy
msgid "Bookmark imported." msgid "Bookmark imported."
msgstr "Signets importés." msgstr "Signets importés."
@ -199,18 +210,21 @@ msgstr "Conservez, partagez et taggez vos liens favoris"
msgid "Recent Bookmarks" msgid "Recent Bookmarks"
msgstr "Signets récents" msgstr "Signets récents"
#: ../../../jsScuttle.php:22 ../../../templates/tag2tagadd.tpl.php:9 #: ../../../jsScuttle.php:22
#: ../../../templates/tag2tagadd.tpl.php:9
#: ../../../templates/tag2tagdelete.tpl.php:8 #: ../../../templates/tag2tagdelete.tpl.php:8
#: ../../../templates/tagdelete.tpl.php:6 #: ../../../templates/tagdelete.tpl.php:6
msgid "Are you sure?" msgid "Are you sure?"
msgstr "Etes-vous sûr ?" msgstr "Etes-vous sûr ?"
#: ../../../jsScuttle.php:22 ../../../templates/tag2tagdelete.tpl.php:10 #: ../../../jsScuttle.php:22
#: ../../../templates/tag2tagdelete.tpl.php:10
#: ../../../templates/tagdelete.tpl.php:8 #: ../../../templates/tagdelete.tpl.php:8
msgid "Yes" msgid "Yes"
msgstr "Oui" msgstr "Oui"
#: ../../../jsScuttle.php:22 ../../../templates/tag2tagdelete.tpl.php:11 #: ../../../jsScuttle.php:22
#: ../../../templates/tag2tagdelete.tpl.php:11
#: ../../../templates/tagdelete.tpl.php:9 #: ../../../templates/tagdelete.tpl.php:9
msgid "No" msgid "No"
msgstr "Non" msgstr "Non"
@ -225,11 +239,10 @@ msgstr "Non Disponible"
#: ../../../login.php:38 #: ../../../login.php:38
msgid "The details you have entered are incorrect. Please try again." msgid "The details you have entered are incorrect. Please try again."
msgstr "" msgstr "Les informations que vous avez entrées sont incorrectes. Veuillez recommencer."
"Les informations que vous avez entrées sont incorrectes. Veuillez "
"recommencer."
#: ../../../login.php:48 ../../../templates/login.tpl.php:26 #: ../../../login.php:48
#: ../../../templates/login.tpl.php:26
#: ../../../templates/toolbar.inc.php:24 #: ../../../templates/toolbar.inc.php:24
msgid "Log In" msgid "Log In"
msgstr "Se connecter" msgstr "Se connecter"
@ -239,11 +252,8 @@ msgid "You must enter your username."
msgstr "Vous devez entrer votre nom d'utilisateur." msgstr "Vous devez entrer votre nom d'utilisateur."
#: ../../../password.php:35 #: ../../../password.php:35
msgid "" msgid "You must enter your <abbr title=\"electronic mail\">e-mail</abbr> address."
"You must enter your <abbr title=\"electronic mail\">e-mail</abbr> address." msgstr "Vous <em>devez</em> saisir une <abbr title=\"adresse électronique\">E-mail</abbr>."
msgstr ""
"Vous <em>devez</em> saisir une <abbr title=\"adresse électronique\">E-mail</"
"abbr>."
#: ../../../password.php:42 #: ../../../password.php:42
msgid "No matches found for that username." msgid "No matches found for that username."
@ -251,31 +261,20 @@ msgstr "Rien de trouvé pour ce nom d'utilisateur."
#: ../../../password.php:45 #: ../../../password.php:45
#, fuzzy #, fuzzy
msgid "" msgid "No matches found for that combination of username and <abbr title=\"electronic mail\">e-mail</abbr> address."
"No matches found for that combination of username and <abbr title=" msgstr "Nous n'avons rien trouvé pour cette combinaison de nom d'utilisateur et d'<abbr title=\"adresse mail\">e-mail</abbr>."
"\"electronic mail\">e-mail</abbr> address."
msgstr ""
"Nous n'avons rien trouvé pour cette combinaison de nom d'utilisateur et "
"d'<abbr title=\"adresse mail\">e-mail</abbr>."
#: ../../../password.php:53 #: ../../../password.php:53
msgid "" msgid "There was an error while generating your new password. Please try again."
"There was an error while generating your new password. Please try again." msgstr "Il y a eu une erreur en enregistrant ce signet. Veuillez rééssayer ou contacter votre administrateur."
msgstr ""
"Il y a eu une erreur en enregistrant ce signet. Veuillez rééssayer ou "
"contacter votre administrateur."
#: ../../../password.php:57 #: ../../../password.php:57
msgid "Your new password is:" msgid "Your new password is:"
msgstr "Votre nouveau mot de passe est:" msgstr "Votre nouveau mot de passe est:"
#: ../../../password.php:57 #: ../../../password.php:57
msgid "" msgid "To keep your bookmarks secure, you should change this password in your profile the next time you log in."
"To keep your bookmarks secure, you should change this password in your " msgstr "Pour garder vos signets sûrs, vous devriez changer ce mot de passe dans votre profil lors de votre prochaine authentification."
"profile the next time you log in."
msgstr ""
"Pour garder vos signets sûrs, vous devriez changer ce mot de passe dans "
"votre profil lors de votre prochaine authentification."
#: ../../../password.php:60 #: ../../../password.php:60
#, php-format #, php-format
@ -291,14 +290,16 @@ msgstr "Nouveau mot de passe généré et envoyé à l'adresse %s"
msgid "Forgotten Password" msgid "Forgotten Password"
msgstr "Mot de passe oublié" msgstr "Mot de passe oublié"
#: ../../../populartags.php:49 ../../../templates/dynamictags.inc.php:101 #: ../../../populartags.php:49
#: ../../../templates/dynamictags.inc.php:101
#: ../../../templates/sidebar.block.common.php:9 #: ../../../templates/sidebar.block.common.php:9
#: ../../../templates/sidebar.block.popular.php:15 #: ../../../templates/sidebar.block.popular.php:15
#: ../../../templates/sidebar.block.recent.php:25 #: ../../../templates/sidebar.block.recent.php:25
msgid "Popular Tags" msgid "Popular Tags"
msgstr "Tags populaires" msgstr "Tags populaires"
#: ../../../profile.php:52 ../../../watchlist.php:116 #: ../../../profile.php:52
#: ../../../watchlist.php:116
msgid "Username was not specified" msgid "Username was not specified"
msgstr "Le nom d'utilisateur n'a pas été spécifié." msgstr "Le nom d'utilisateur n'a pas été spécifié."
@ -306,7 +307,8 @@ msgstr "Le nom d'utilisateur n'a pas été spécifié."
msgid "My Profile" msgid "My Profile"
msgstr "Mon Profil" msgstr "Mon Profil"
#: ../../../profile.php:60 ../../../templates/toolbar.inc.php:13 #: ../../../profile.php:60
#: ../../../templates/toolbar.inc.php:13
msgid "Profile" msgid "Profile"
msgstr "Profil" msgstr "Profil"
@ -324,8 +326,7 @@ msgstr "Adresse de courrier électronique invalide."
#: ../../../profile.php:90 #: ../../../profile.php:90
msgid "An error occurred while saving your changes." msgid "An error occurred while saving your changes."
msgstr "" msgstr "Une erreur s'est produite pendant l'enregistrement de vos modifications."
"Une erreur s'est produite pendant l'enregistrement de vos modifications."
#: ../../../profile.php:92 #: ../../../profile.php:92
msgid "Changes saved." msgid "Changes saved."
@ -333,9 +334,7 @@ msgstr "Modifications enregistrées."
#: ../../../register.php:33 #: ../../../register.php:33
msgid "You <em>must</em> enter a username, password and e-mail address." msgid "You <em>must</em> enter a username, password and e-mail address."
msgstr "" msgstr "Vous <em>devez</em> saisir un nom d'utilisateur, un mot de passe, un nom et un <abbr title=\"adresse électronique\">e-mail</abbr>"
"Vous <em>devez</em> saisir un nom d'utilisateur, un mot de passe, un nom et "
"un <abbr title=\"adresse électronique\">e-mail</abbr>"
#: ../../../register.php:37 #: ../../../register.php:37
msgid "This username has been reserved, please make another choice." msgid "This username has been reserved, please make another choice."
@ -361,7 +360,8 @@ msgstr "Votre inscription a bien été prise en compte !"
msgid "Registration failed. Please try again." msgid "Registration failed. Please try again."
msgstr "Enregistrement raté. Veuillez rééssayer." msgstr "Enregistrement raté. Veuillez rééssayer."
#: ../../../register.php:66 ../../../templates/register.tpl.php:41 #: ../../../register.php:66
#: ../../../templates/register.tpl.php:41
#: ../../../templates/toolbar.inc.php:25 #: ../../../templates/toolbar.inc.php:25
msgid "Register" msgid "Register"
msgstr "S'enregistrer" msgstr "S'enregistrer"
@ -371,7 +371,8 @@ msgstr "S'enregistrer"
msgid "Recent bookmarks posted to %s" msgid "Recent bookmarks posted to %s"
msgstr "Signets ajoutés récemment à %s" msgstr "Signets ajoutés récemment à %s"
#: ../../../search.inc.php:13 ../../../search.inc.php:41 #: ../../../search.inc.php:13
#: ../../../search.inc.php:41
msgid "Search" msgid "Search"
msgstr "Chercher" msgstr "Chercher"
@ -395,15 +396,17 @@ msgstr "tous les signets"
msgid "for" msgid "for"
msgstr "pour" msgstr "pour"
#: ../../../search.php:58 ../../../search.php:104 #: ../../../search.php:58
#: ../../../search.php:104
msgid "Search Bookmarks" msgid "Search Bookmarks"
msgstr "Recherche de signets" msgstr "Recherche de signets"
#: ../../../search.php:64 #: ../../../search.php:64
msgid "Search Results" msgid "Search Results"
msgstr "Résulats de recherche" msgstr "Résultats de recherche"
#: ../../../tag2tagadd.php:31 ../../../tag2tagdelete.php:31 #: ../../../tag2tagadd.php:31
#: ../../../tag2tagdelete.php:31
msgid "Permission denied." msgid "Permission denied."
msgstr "Permission non accordée." msgstr "Permission non accordée."
@ -452,21 +455,22 @@ msgstr "Tag renommé"
msgid "Failed to rename the tag" msgid "Failed to rename the tag"
msgstr "Erreur dans la suppression du tag" msgstr "Erreur dans la suppression du tag"
#: ../../../tagrename.php:57 ../../../templates/sidebar.block.tagactions.php:9 #: ../../../tagrename.php:57
#: ../../../templates/sidebar.block.tagactions.php:9
msgid "Rename Tag" msgid "Rename Tag"
msgid_plural "Rename Tags" msgid_plural "Rename Tags"
msgstr[0] "Renommer le tag" msgstr[0] "Renommer le tag"
msgstr[1] "TRenommer les tags" msgstr[1] "TRenommer les tags"
#: ../../../tags.php:38 ../../../templates/editbookmark.tpl.php:44 #: ../../../tags.php:38
#: ../../../templates/editbookmark.tpl.php:44
#: ../../../templates/toolbar.inc.php:11 #: ../../../templates/toolbar.inc.php:11
msgid "Tags" msgid "Tags"
msgstr "Tags" msgstr "Tags"
#: ../../../users.php:33 #: ../../../users.php:33
#, fuzzy
msgid "Users" msgid "Users"
msgstr "Nom d'utilisateur" msgstr "Utilisateurs"
#: ../../../watch.php:46 #: ../../../watch.php:46
msgid "User removed from your watchlist" msgid "User removed from your watchlist"
@ -481,42 +485,28 @@ msgstr "Utilisateur ajouté à la liste des consultés."
msgid "My Watchlist" msgid "My Watchlist"
msgstr "Liste des signets vus" msgstr "Liste des signets vus"
#: ../../../watchlist.php:105 ../../../templates/toolbar.inc.php:12 #: ../../../watchlist.php:105
#: ../../../templates/toolbar.inc.php:12
#, fuzzy #, fuzzy
msgid "Watchlist" msgid "Watchlist"
msgstr "Liste des signets vus" msgstr "Liste des signets vus"
#: ../../../templates/about.tpl.php:6 #: ../../../templates/about.tpl.php:6
msgid "" msgid "<strong>Store</strong> all your favourite links in one place, accessible from anywhere."
"<strong>Store</strong> all your favourite links in one place, accessible " msgstr "<strong>Conservez</strong> tous vos signets au même endroit, accessibles de partout. "
"from anywhere."
msgstr ""
"<strong>Conservez</strong> tous vos signets au même endroit, accessibles de "
"partout. "
#: ../../../templates/about.tpl.php:7 #: ../../../templates/about.tpl.php:7
msgid "" msgid "<strong>Share</strong> your bookmarks with everyone, with friends on your watchlist or just keep them private."
"<strong>Share</strong> your bookmarks with everyone, with friends on your " msgstr "<strong>Partagez</strong> vos signets avec tout le monde, avec les utilisateurs autorisés ou gardez-les pour vous."
"watchlist or just keep them private."
msgstr ""
"<strong>Partagez</strong> vos signets avec tout le monde, avec les "
"utilisateurs autorisés ou gardez-les pour vous."
#: ../../../templates/about.tpl.php:8 #: ../../../templates/about.tpl.php:8
msgid "" msgid "<strong>Tag</strong> your bookmarks with as many labels as you want, instead of wrestling with folders."
"<strong>Tag</strong> your bookmarks with as many labels as you want, instead " msgstr "<strong>Taggez</strong> vos signets avec autant de labels que vous le souhaitez au lieu de les hiérarchiser avec des dossiers."
"of wrestling with folders."
msgstr ""
"<strong>Taggez</strong> vos signets avec autant de labels que vous le "
"souhaitez au lieu de les hiérarchiser avec des dossiers."
#: ../../../templates/about.tpl.php:9 #: ../../../templates/about.tpl.php:9
#, php-format #, php-format
msgid "" msgid "<strong><a href=\"register.php\">Register now</a></strong> to start using %s!"
"<strong><a href=\"register.php\">Register now</a></strong> to start using %s!" msgstr "<a href=\"register.php\">Enregistrez-vous maintenant</a> pour poster vos propres signets sur %s !"
msgstr ""
"<a href=\"register.php\">Enregistrez-vous maintenant</a> pour poster vos "
"propres signets !"
#: ../../../templates/about.tpl.php:12 #: ../../../templates/about.tpl.php:12
msgid "Geek Stuff" msgid "Geek Stuff"
@ -524,33 +514,16 @@ msgstr "Pour les Geeks"
#: ../../../templates/about.tpl.php:14 #: ../../../templates/about.tpl.php:14
#, php-format #, php-format
msgid "" msgid "%s is based on <a href=\"http://sourceforge.net/projects/scuttle/\">an open-source project</a> licensed under the <a href=\"http://www.gnu.org/copyleft/gpl.html\"><acronym title=\"GNU's Not Unix\">GNU</acronym> General Public License</a>. This means you can host it on your own web server for free, whether it is on the Internet, a private network or just your own computer."
"%s is based on <a href=\"http://sourceforge.net/projects/scuttle/\">an open-" msgstr "%s est basé sur <a href=\"http://sourceforge.net/projects/scuttle/\">un projet open-source</a>, sous la license <a href=\"http://www.gnu.org/copyleft/gpl.html\"><acronym title=\"GNU's Not Unix\">GNU</acronym> General Public License</a>. Vous pouvez donc héberger Scuttle sur votre propre serveur gratuitement, qu'il soit relié à Internet, dans un réseau privé ou juste sur votre ordinateur personnel."
"source project</a> licensed under the <a href=\"http://www.gnu.org/copyleft/"
"gpl.html\"><acronym title=\"GNU's Not Unix\">GNU</acronym> General Public "
"License</a>. This means you can host it on your own web server for free, "
"whether it is on the Internet, a private network or just your own computer."
msgstr ""
"%s est basé sur <a href=\"http://sourceforge.net/projects/scuttle/\">un "
"projet open-source</a>, sous la license <a href=\"http://www.gnu.org/"
"copyleft/gpl.html\"><acronym title=\"GNU's Not Unix\">GNU</acronym> General "
"Public License</a>. Vous pouvez donc héberger Scuttle sur votre propre "
"serveur gratuitement, qu'il soit relié à Internet, dans un réseau privé ou "
"juste sur votre ordinateur personnel."
#: ../../../templates/about.tpl.php:15 #: ../../../templates/about.tpl.php:15
#, php-format #, php-format
msgid "" msgid "%1$s supports most of the <a href=\"http://del.icio.us/doc/api\">del.icio.us <abbr title=\"Application Programming Interface\">API</abbr></a>. Almost all of the neat tools made for that system can be modified to work with %1$s instead. If you find a tool that won't let you change the API address, ask the creator to add this setting. You never know, they might just do it."
"%1$s supports most of the <a href=\"http://del.icio.us/doc/api\">del.icio.us " msgstr "%1$s supporte la plupart de l'<a href=\"http://del.icio.us/doc/api\">del.icio.us <abbr title=\"Application Programming Interface\">API</abbr></a>."
"<abbr title=\"Application Programming Interface\">API</abbr></a>. Almost all "
"of the neat tools made for that system can be modified to work with %1$s "
"instead. If you find a tool that won't let you change the API address, ask "
"the creator to add this setting. You never know, they might just do it."
msgstr ""
"%1$s supporte la plupart de l'<a href=\"http://del.icio.us/doc/api\">del."
"icio.us <abbr title=\"Application Programming Interface\">API</abbr></a>."
#: ../../../templates/bookmarks.tpl.php:17 ../../../templates/tags.tpl.php:7 #: ../../../templates/bookmarks.tpl.php:17
#: ../../../templates/tags.tpl.php:7
#: ../../../templates/users.tpl.php:8 #: ../../../templates/users.tpl.php:8
msgid "Sort by:" msgid "Sort by:"
msgstr "Classer par :" msgstr "Classer par :"
@ -657,11 +630,8 @@ msgid "Comma-separated"
msgstr "Séparés par des virgules" msgstr "Séparés par des virgules"
#: ../../../templates/editbookmark.tpl.php:50 #: ../../../templates/editbookmark.tpl.php:50
msgid "" msgid "Note: use \">\" to include one tag in another. e.g.: europe>france>paris"
"Note: use \">\" to include one tag in another. e.g.: europe>france>paris" msgstr "Note: utiliser \">\" pour inclure un tag dans un autre. ex: europe>france>paris"
msgstr ""
"Note: utiliser \">\" pour inclure un tag dans un autre. ex: "
"europe>france>paris"
#: ../../../templates/editbookmark.tpl.php:53 #: ../../../templates/editbookmark.tpl.php:53
#: ../../../templates/importDelicious.tpl.php:15 #: ../../../templates/importDelicious.tpl.php:15
@ -695,13 +665,8 @@ msgstr "Bookmarklet"
#: ../../../templates/editbookmark.tpl.php:98 #: ../../../templates/editbookmark.tpl.php:98
#, php-format #, php-format
msgid "" msgid "Drag one of the following bookmarklets to your browser's bookmarks and click it whenever you want to add the page you are on to %s"
"Drag one of the following bookmarklets to your browser's bookmarks and click " msgstr "Déplacez l'un des 'bookmarklet' suivants dans les marques-pages de votre navigateur et cliquez dessus chaque fois que vous souhaitez ajouter un signet pour la page courante dans %s "
"it whenever you want to add the page you are on to %s"
msgstr ""
"Déplacez l'un des 'bookmarklet' suivants dans les marques-pages de votre "
"navigateur et cliquez dessus chaque fois que vous souhaitez ajouter un "
"signet pour la page courante dans %s "
#: ../../../templates/editbookmark.tpl.php:110 #: ../../../templates/editbookmark.tpl.php:110
#, php-format #, php-format
@ -736,8 +701,10 @@ msgid "Account Details"
msgstr "Détail du compte" msgstr "Détail du compte"
#: ../../../templates/editprofile.tpl.php:11 #: ../../../templates/editprofile.tpl.php:11
#: ../../../templates/login.tpl.php:15 ../../../templates/password.tpl.php:10 #: ../../../templates/login.tpl.php:15
#: ../../../templates/profile.tpl.php:7 ../../../templates/register.tpl.php:16 #: ../../../templates/password.tpl.php:10
#: ../../../templates/profile.tpl.php:7
#: ../../../templates/register.tpl.php:16
msgid "Username" msgid "Username"
msgstr "Nom d'utilisateur" msgstr "Nom d'utilisateur"
@ -797,28 +764,16 @@ msgid "Instructions"
msgstr "Instructions" msgstr "Instructions"
#: ../../../templates/importDelicious.tpl.php:33 #: ../../../templates/importDelicious.tpl.php:33
msgid "" msgid "Log in to the <a href=\"http://del.icio.us/api/posts/all\">export page at del.icio.us</a>"
"Log in to the <a href=\"http://del.icio.us/api/posts/all\">export page at " msgstr "Se connecter à la <a href=\"http://del.icio.us/api/posts/all\">page d'export de del.icio.us</a>"
"del.icio.us</a>"
msgstr ""
"Se connecter à la <a href=\"http://del.icio.us/api/posts/all\">page d'export "
"de del.icio.us</a>"
#: ../../../templates/importDelicious.tpl.php:34 #: ../../../templates/importDelicious.tpl.php:34
msgid "" msgid "Save the resulting <abbr title=\"Extensible Markup Language\">XML</abbr> file to your computer"
"Save the resulting <abbr title=\"Extensible Markup Language\">XML</abbr> " msgstr "Enregistrer le fichier <abbr title=\"Extensible Markup Language\">XML</abbr> résultant sur votre ordinateur"
"file to your computer"
msgstr ""
"Enregistrer le fichier <abbr title=\"Extensible Markup Language\">XML</abbr> "
"résultant sur votre ordinateur"
#: ../../../templates/importDelicious.tpl.php:35 #: ../../../templates/importDelicious.tpl.php:35
msgid "" msgid "Click <kbd>Browse...</kbd> to find this file on your computer. The maximum size the file can be is 1MB"
"Click <kbd>Browse...</kbd> to find this file on your computer. The maximum " msgstr "Cliquez sur <kbd>Parcourir...</kbd> pour trouver le fichier sur votre ordinateur. La taille maximale du fichier ne peut excèder 1Mo"
"size the file can be is 1MB"
msgstr ""
"Cliquez sur <kbd>Parcourir...</kbd> pour trouver le fichier sur votre "
"ordinateur. La taille maximale du fichier ne peut excèder 1Mo"
#: ../../../templates/importDelicious.tpl.php:36 #: ../../../templates/importDelicious.tpl.php:36
#: ../../../templates/importNetscape.tpl.php:43 #: ../../../templates/importNetscape.tpl.php:43
@ -827,48 +782,31 @@ msgstr "Selectionnez la vision par défaut à appliquer à vos signets importés
#: ../../../templates/importDelicious.tpl.php:37 #: ../../../templates/importDelicious.tpl.php:37
#: ../../../templates/importNetscape.tpl.php:44 #: ../../../templates/importNetscape.tpl.php:44
msgid "" msgid "Click <kbd>Import</kbd> to start importing the bookmarks; it may take a minute"
"Click <kbd>Import</kbd> to start importing the bookmarks; it may take a " msgstr "Cliquez sur <kbd>Importer</kbd> pour débuter l'import des signets; cette opération peut prendre quelques minutes"
"minute"
msgstr ""
"Cliquez sur <kbd>Importer</kbd> pour débuter l'import des signets; cette "
"opération peut prendre quelques minutes"
#: ../../../templates/importNetscape.tpl.php:35 #: ../../../templates/importNetscape.tpl.php:35
msgid "Export your bookmarks from your browser to a file" msgid "Export your bookmarks from your browser to a file"
msgstr "Exporter vos signets dans un fichier depuis votre navigateur" msgstr "Exporter vos signets dans un fichier depuis votre navigateur"
#: ../../../templates/importNetscape.tpl.php:37 #: ../../../templates/importNetscape.tpl.php:37
msgid "" msgid "Internet Explorer: <kbd>File &gt; Import and Export... &gt; Export Favorites"
"Internet Explorer: <kbd>File &gt; Import and Export... &gt; Export Favorites" msgstr "Internet Explorer: <kbd>Ficher &gt; Importer et Exporter... &gt; Exporter les favoris"
msgstr ""
"Internet Explorer: <kbd>Ficher &gt; Importer et Exporter... &gt; Exporter "
"les favoris"
#: ../../../templates/importNetscape.tpl.php:38 #: ../../../templates/importNetscape.tpl.php:38
msgid "" msgid "Mozilla Firefox: <kbd>Bookmarks &gt; Manage Bookmarks... &gt; File &gt; Export..."
"Mozilla Firefox: <kbd>Bookmarks &gt; Manage Bookmarks... &gt; File &gt; " msgstr "Mozilla Firefox: <kbd>Marques-pages &gt; Gérer les marques-pages... &gt; Fichier &gt; Exporter..."
"Export..."
msgstr ""
"Mozilla Firefox: <kbd>Marques-pages &gt; Gérer les marques-pages... &gt; "
"Fichier &gt; Exporter..."
#: ../../../templates/importNetscape.tpl.php:39 #: ../../../templates/importNetscape.tpl.php:39
msgid "" msgid "Netscape: <kbd>Bookmarks &gt; Manage Bookmarks... &gt; Tools &gt; Export..."
"Netscape: <kbd>Bookmarks &gt; Manage Bookmarks... &gt; Tools &gt; Export..." msgstr "Netscape: <kbd>Marques-pages &gt; Gérer les marques-pages... &gt; Outils &gt; Exporter..."
msgstr ""
"Netscape: <kbd>Marques-pages &gt; Gérer les marques-pages... &gt; Outils "
"&gt; Exporter..."
#: ../../../templates/importNetscape.tpl.php:42 #: ../../../templates/importNetscape.tpl.php:42
msgid "" msgid "Click <kbd>Browse...</kbd> to find the saved bookmark file on your computer. The maximum size the file can be is 1MB"
"Click <kbd>Browse...</kbd> to find the saved bookmark file on your computer. " msgstr "Cliquez sur <kbd>Parcourir...</kbd> pour trouver le fichier sur votre ordinateur. La taille maximale du fichier ne peut excèder 1Mo"
"The maximum size the file can be is 1MB"
msgstr ""
"Cliquez sur <kbd>Parcourir...</kbd> pour trouver le fichier sur votre "
"ordinateur. La taille maximale du fichier ne peut excèder 1Mo"
#: ../../../templates/login.tpl.php:20 ../../../templates/register.tpl.php:21 #: ../../../templates/login.tpl.php:20
#: ../../../templates/register.tpl.php:21
msgid "Password" msgid "Password"
msgstr "Mot de passe" msgstr "Mot de passe"
@ -882,14 +820,8 @@ msgstr "Avez-vous oublié votre mot de passe ?"
#: ../../../templates/password.tpl.php:5 #: ../../../templates/password.tpl.php:5
#, php-format #, php-format
msgid "" msgid "If you have forgotten your password, %s can generate a new one. Enter the username and e-mail address of your account into the form below and we will e-mail your new password to you."
"If you have forgotten your password, %s can generate a new one. Enter the " msgstr "Si vous avez oublié votre mot de passe, %s peut en générer un nouveau. Entrez le nom d'utilisateur et l'adresse email de votre compte dans le formulaire ci-dessous et nous vous enverrons un nouveau mot de passe."
"username and e-mail address of your account into the form below and we will "
"e-mail your new password to you."
msgstr ""
"Si vous avez oublié votre mot de passe, %s peut en générer un nouveau. "
"Entrez le nom d'utilisateur et l'adresse email de votre compte dans le "
"formulaire ci-dessous et nous vous enverrons un nouveau mot de passe."
#: ../../../templates/password.tpl.php:19 #: ../../../templates/password.tpl.php:19
msgid "Generate Password" msgid "Generate Password"
@ -912,21 +844,21 @@ msgstr "Consultés"
#: ../../../templates/register.tpl.php:11 #: ../../../templates/register.tpl.php:11
#, php-format #, php-format
msgid "" msgid "Sign up here to create a free %s account. All the information requested below is required"
"Sign up here to create a free %s account. All the information requested " msgstr "Enregistrez-vous ici pour créer un compte gratuit %s. Toutes les informations requises ci-dessous sont nécessaires."
"below is required"
msgstr ""
"Enregistrez-vous ici pour créer un compte gratuit %s. Toutes les "
"informations requises ci-dessous sont nécessaires."
#: ../../../templates/register.tpl.php:33 #: ../../../templates/register.tpl.php:33
msgid "Antispam question" msgid "Antispam question"
msgstr "Question antispam" msgstr "Question antispam"
#: ../../../templates/sidebar.block.linked.php:63 #: ../../../templates/sidebar.block.linked.php:72
msgid "Linked Tags" msgid "Linked Tags"
msgstr "Tags structurés" msgstr "Tags structurés"
#: ../../../templates/sidebar.block.linked.php:75
msgid "plus"
msgstr "plus"
#: ../../../templates/sidebar.block.recent.php:15 #: ../../../templates/sidebar.block.recent.php:15
msgid "Recent Tags" msgid "Recent Tags"
msgstr "Tags récents" msgstr "Tags récents"
@ -954,14 +886,12 @@ msgid "Add to Watchlist"
msgstr "Ajouter à la liste des consultés" msgstr "Ajouter à la liste des consultés"
#: ../../../templates/tag2tagadd.tpl.php:7 #: ../../../templates/tag2tagadd.tpl.php:7
#, fuzzy
msgid "Create new link:" msgid "Create new link:"
msgstr "Créer un nouveau lien" msgstr "Créer un nouveau lien"
#: ../../../templates/tag2tagadd.tpl.php:11 #: ../../../templates/tag2tagadd.tpl.php:11
#, fuzzy
msgid "Create" msgid "Create"
msgstr "Privée" msgstr "Créer"
#: ../../../templates/tag2tagadd.tpl.php:12 #: ../../../templates/tag2tagadd.tpl.php:12
#: ../../../templates/tagrename.tpl.php:25 #: ../../../templates/tagrename.tpl.php:25
@ -977,16 +907,17 @@ msgid "New"
msgstr "Nouvaeu" msgstr "Nouvaeu"
#: ../../../templates/tagrename.tpl.php:24 #: ../../../templates/tagrename.tpl.php:24
#, fuzzy
msgid "Rename" msgid "Rename"
msgstr "Nom d'utilisateur" msgstr "Renommer"
#: ../../../templates/tags.tpl.php:8 ../../../templates/users.tpl.php:9 #: ../../../templates/tags.tpl.php:8
#: ../../../templates/users.tpl.php:9
#, fuzzy #, fuzzy
msgid "Alphabet" msgid "Alphabet"
msgstr "Alphabet" msgstr "Alphabet"
#: ../../../templates/tags.tpl.php:9 ../../../templates/users.tpl.php:10 #: ../../../templates/tags.tpl.php:9
#: ../../../templates/users.tpl.php:10
msgid "Popularity" msgid "Popularity"
msgstr "Popularité" msgstr "Popularité"
@ -1010,17 +941,16 @@ msgstr "Créé en "
msgid "bookmarks" msgid "bookmarks"
msgstr "signets" msgstr "signets"
#~ msgid "edit"
#~ msgstr "éditer"
#~ msgid "Failed to delete the bookmark" #~ msgid "Failed to delete the bookmark"
#~ msgstr "Erreur dans la suppression du signet" #~ msgstr "Erreur dans la suppression du signet"
#~ msgid "User with username %s not was not found" #~ msgid "User with username %s not was not found"
#~ msgstr "L'utilisateur %s n'a pas été trouvé." #~ msgstr "L'utilisateur %s n'a pas été trouvé."
#~ msgid "%s Bookmarks" #~ msgid "%s Bookmarks"
#~ msgstr "Signets de %s" #~ msgstr "Signets de %s"
#~ msgid "<abbr title=\"Electronic mail\">E-mail</abbr>" #~ msgid "<abbr title=\"Electronic mail\">E-mail</abbr>"
#~ msgstr "<abbr title=\"Adresse électronique\">E-mail</abbr>" #~ msgstr "<abbr title=\"Adresse électronique\">E-mail</abbr>"
#~ msgid "No bookmarks found" #~ msgid "No bookmarks found"
#~ msgstr "Pas de signets trouvés" #~ msgstr "Pas de signets trouvés"

View file

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-01-14 11:58+0100\n" "POT-Creation-Date: 2008-01-22 16:54+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -853,10 +853,14 @@ msgstr ""
msgid "Antispam question" msgid "Antispam question"
msgstr "" msgstr ""
#: ../../../templates/sidebar.block.linked.php:63 #: ../../../templates/sidebar.block.linked.php:72
msgid "Linked Tags" msgid "Linked Tags"
msgstr "" msgstr ""
#: ../../../templates/sidebar.block.linked.php:75
msgid "plus"
msgstr ""
#: ../../../templates/sidebar.block.recent.php:15 #: ../../../templates/sidebar.block.recent.php:15
msgid "Recent Tags" msgid "Recent Tags"
msgstr "" msgstr ""

View file

@ -76,6 +76,8 @@ if (isset($userid)) {
$tplVars['cat_url'] = createURL('tags', '%2$s'); $tplVars['cat_url'] = createURL('tags', '%2$s');
} }
$tplVars['sidebar_blocks'] = array('linked');
$tplVars['subtitle'] = $pagetitle; $tplVars['subtitle'] = $pagetitle;
$templateservice->loadTemplate('tags.tpl', $tplVars); $templateservice->loadTemplate('tags.tpl', $tplVars);

View file

@ -28,17 +28,35 @@ class Tag2TagService {
return false; return false;
} }
$this->db->sql_transaction('commit'); $this->db->sql_transaction('commit');
// Update stats
$tsts =& ServiceFactory::getServiceInstance('TagStatService');
$tsts->updateStat($tag1, $relationType, $uId);
return true; return true;
} }
function getLinkedTags($tag1, $relationType, $uId = -1) { // Return the target linked tags. If inverseRelation is true, return the source linked tags.
function getLinkedTags($tag, $relationType, $uId = null, $inverseRelation = false) {
// Set up the SQL query. // Set up the SQL query.
$query = "SELECT DISTINCT tag2 as 'tag' FROM `". $this->getTableName() ."`"; if($inverseRelation) {
$query.= " WHERE tag1 = '" .$tag1 ."'"; $queriedTag = "tag1";
$givenTag = "tag2";
} else {
$queriedTag = "tag2";
$givenTag = "tag1";
}
$query = "SELECT DISTINCT ". $queriedTag ." as 'tag'";
$query.= " FROM `". $this->getTableName() ."`";
$query.= " WHERE 1=1";
if($tag !=null) {
$query.= " AND ". $givenTag ." = '". $tag ."'";
}
if($relationType) { if($relationType) {
$query.= " AND relationType = '". $relationType ."'"; $query.= " AND relationType = '". $relationType ."'";
} }
if($uId>0) { if($uId != null) {
$query.= " AND uId = '".$uId."'"; $query.= " AND uId = '".$uId."'";
} }
@ -88,9 +106,14 @@ class Tag2TagService {
return $output; return $output;
} }
function getOrphewTags($relationType, $uId = 0) { function getOrphewTags($relationType, $uId = 0, $limit = null, $orderBy = null) {
$query = "SELECT DISTINCT tag1 as tag FROM `". $this->getTableName() ."`"; $query = "SELECT DISTINCT tts.tag1 as tag";
$query.= " WHERE tag1 <> ALL"; $query.= " FROM `". $this->getTableName() ."` tts";
if($orderBy != null) {
$tsts =& ServiceFactory::getServiceInstance('TagStatService');
$query.= ", ".$tsts->getTableName() ." tsts";
}
$query.= " WHERE tts.tag1 <> ALL";
$query.= " (SELECT DISTINCT tag2 FROM `". $this->getTableName() ."`"; $query.= " (SELECT DISTINCT tag2 FROM `". $this->getTableName() ."`";
$query.= " WHERE relationType = '".$relationType."'"; $query.= " WHERE relationType = '".$relationType."'";
if($uId > 0) { if($uId > 0) {
@ -98,12 +121,41 @@ class Tag2TagService {
} }
$query.= ")"; $query.= ")";
if($uId > 0) { if($uId > 0) {
$query.= " AND uId = '".$uId."'"; $query.= " AND tts.uId = '".$uId."'";
} }
//die($query); switch($orderBy) {
case "nb":
$query.= " AND tts.tag1 = tsts.tag1";
$query.= " AND tsts.relationType = '".$relationType."'";
if($uId > 0) {
$query.= " AND tsts.uId = ".$uId;
}
$query.= " ORDER BY tsts.nb DESC";
break;
case "depth": // by nb of descendants
$query.= " AND tts.tag1 = tsts.tag1";
$query.= " AND tsts.relationType = '".$relationType."'";
if($uId > 0) {
$query.= " AND tsts.uId = ".$uId;
}
$query.= " ORDER BY tsts.depth DESC";
break;
case "nbupdate":
$query.= " AND tts.tag1 = tsts.tag1";
$query.= " AND tsts.relationType = '".$relationType."'";
if($uId > 0) {
$query.= " AND tsts.uId = ".$uId;
}
$query.= " ORDER BY tsts.nbupdate DESC";
break;
}
if (! ($dbresult =& $this->db->sql_query_limit($query, $limit)) ){ if($limit != null) {
$query.= " LIMIT 0,".$limit;
}
if (! ($dbresult =& $this->db->sql_query($query)) ){
message_die(GENERAL_ERROR, 'Could not get linked tags', '', __LINE__, __FILE__, $query, $this->db); message_die(GENERAL_ERROR, 'Could not get linked tags', '', __LINE__, __FILE__, $query, $this->db);
return false; return false;
} }
@ -117,7 +169,7 @@ class Tag2TagService {
$query.= " AND relationType = '". $relationType ."'"; $query.= " AND relationType = '". $relationType ."'";
$query.= " AND uId = '".$uId."'"; $query.= " AND uId = '".$uId."'";
return $this->db->sql_numrows($dbresult) > 0; return $this->db->sql_numrows($this->db->sql_query($query)) > 0;
} }
function removeLinkedTags($tag1, $tag2, $relationType, $uId) { function removeLinkedTags($tag1, $tag2, $relationType, $uId) {
@ -132,12 +184,19 @@ class Tag2TagService {
return false; return false;
} }
// Update stats
$tsts =& ServiceFactory::getServiceInstance('TagStatService');
$tsts->updateStat($tag1, $relationType, $uId);
return true; return true;
} }
function deleteAll() { function deleteAll() {
$query = 'TRUNCATE TABLE `'. $this->getTableName() .'`'; $query = 'TRUNCATE TABLE `'. $this->getTableName() .'`';
$this->db->sql_query($query); $this->db->sql_query($query);
$tsts =& ServiceFactory::getServiceInstance('TagStatService');
$tsts->deleteAll();
} }
// Properties // Properties

181
services/tagstatservice.php Normal file
View file

@ -0,0 +1,181 @@
<?php
class TagStatService {
var $db;
var $tablename;
function &getInstance(&$db) {
static $instance;
if (!isset($instance))
$instance =& new TagStatService($db);
return $instance;
}
function TagStatService(&$db) {
$this->db =& $db;
$this->tablename = $GLOBALS['tableprefix'] .'tagsstats';
}
function getNbChildren($tag1, $relationType, $uId) {
$tts =& ServiceFactory::getServiceInstance('Tag2TagService');
$query = "SELECT tag1, relationType, uId FROM `". $tts->getTableName() ."`";
$query.= " WHERE tag1 = '" .$tag1 ."'";
$query.= " AND relationType = '". $relationType ."'";
$query.= " AND uId = '".$uId."'";
return $this->db->sql_numrows($this->db->sql_query($query));
}
function getNbDescendants($tag1, $relationType, $uId) {
$query = "SELECT nb FROM `". $this->getTableName() ."`";
$query.= " WHERE tag1 = '" .$tag1 ."'";
$query.= " AND relationType = '". $relationType ."'";
$query.= " AND uId = '".$uId."'";
$dbresults =& $this->db->sql_query($query);
$row = $this->db->sql_fetchrow($dbresults);
if($row['nb'] == null) {
return 0;
} else {
return (int) $row['nb'];
}
}
function getMaxDepth($tag1, $relationType, $uId) {
$query = "SELECT depth FROM `". $this->getTableName() ."`";
$query.= " WHERE tag1 = '" .$tag1 ."'";
$query.= " AND relationType = '". $relationType ."'";
$query.= " AND uId = '".$uId."'";
$dbresults =& $this->db->sql_query($query);
$row = $this->db->sql_fetchrow($dbresults);
if($row['depth'] == null) {
return 0;
} else {
return (int) $row['depth'];
};
}
function getNbUpdate($tag1, $relationType, $uId) {
$query = "SELECT nbupdate FROM `". $this->getTableName() ."`";
$query.= " WHERE tag1 = '" .$tag1 ."'";
$query.= " AND relationType = '". $relationType ."'";
$query.= " AND uId = '".$uId."'";
$dbresults =& $this->db->sql_query($query);
$row = $this->db->sql_fetchrow($dbresults);
if($row['nbupdate'] == null) {
return 0;
} else {
return (int) $row['nbupdate'];
}
}
function existStat($tag1, $relationType, $uId) {
$query = "SELECT tag1, relationType, uId FROM `". $this->getTableName() ."`";
$query.= " WHERE tag1 = '" .$tag1 ."'";
$query.= " AND relationType = '". $relationType ."'";
$query.= " AND uId = '".$uId."'";
return $this->db->sql_numrows($this->db->sql_query($query))>0;
}
function createStat($tag1, $relationType, $uId) {
$query = "INSERT INTO `". $this->getTableName() ."`";
$query.= "(tag1, relationType, uId)";
$query.= " VALUES ('".$tag1."','".$relationType."','".$uId."')";
$this->db->sql_query($query);
}
function updateStat($tag1, $relationType, $uId=null, $stoplist=array()) {
if(in_array($tag1, $stoplist)) {
return false;
}
$tts =& ServiceFactory::getServiceInstance('Tag2TagService');
$linkedTags = $tts->getLinkedTags($tag1, $relationType, $uId);
$nbDescendants = 0;
$maxDepth = 0;
foreach($linkedTags as $linkedTag) {
$nbDescendants+= 1 + $this->getNbDescendants($linkedTag, $relationType, $uId);
$maxDepth = max($maxDepth, 1 + $this->getMaxDepth($linkedTag, $relationType, $uId));
}
$this->setNbDescendants($tag1, $relationType, $uId, $nbDescendants);
$this->setMaxDepth($tag1, $relationType, $uId, $maxDepth);
$this->increaseNbUpdate($tag1, $relationType, $uId);
// propagation to the precedent tags
$linkedTags = $tts->getLinkedTags($tag1, $relationType, $uId, true);
$stoplist[] = $tag1;
foreach($linkedTags as $linkedTag) {
$this->updateStat($linkedTag, $relationType, $uId, $stoplist);
}
}
function updateAllStat() {
$tts =& ServiceFactory::getServiceInstance('Tag2TagService');
$query = "SELECT tag1, uId FROM `". $tts->getTableName() ."`";
$query.= " WHERE relationType = '>'";
//die($query);
if (! ($dbresult =& $this->db->sql_query($query)) ){
message_die(GENERAL_ERROR, 'Could not update stats', '', __LINE__, __FILE__, $query, $this->db);
return false;
}
$rowset = $this->db->sql_fetchrowset($dbresult);
foreach($rowset as $row) {
$this->updateStat($row['tag1'], '>', $row['uId']);
}
}
function setNbDescendants($tag1, $relationType, $uId, $nb) {
if(!$this->existStat($tag1, $relationType, $uId)) {
$this->createStat($tag1, $relationType, $uId);
}
$query = "UPDATE `". $this->getTableName() ."`";
$query.= " SET nb = ". $nb;
$query.= " WHERE tag1 = '" .$tag1 ."'";
$query.= " AND relationType = '". $relationType ."'";
$query.= " AND uId = '".$uId."'";
$this->db->sql_query($query);
}
function setMaxDepth($tag1, $relationType, $uId, $depth) {
if(!$this->existStat($tag1, $relationType, $uId)) {
$this->createStat($tag1, $relationType, $uId);
}
$query = "UPDATE `". $this->getTableName() ."`";
$query.= " SET depth = ". $depth;
$query.= " WHERE tag1 = '" .$tag1 ."'";
$query.= " AND relationType = '". $relationType ."'";
$query.= " AND uId = '".$uId."'";
$this->db->sql_query($query);
}
function increaseNbUpdate($tag1, $relationType, $uId) {
if(!$this->existStat($tag1, $relationType, $uId)) {
$this->createStat($tag1, $relationType, $uId);
}
$query = "UPDATE `". $this->getTableName() ."`";
$query.= " SET nbupdate = nbupdate + 1";
$query.= " WHERE tag1 = '" .$tag1 ."'";
$query.= " AND relationType = '". $relationType ."'";
$query.= " AND uId = '".$uId."'";
//die($query);
$this->db->sql_query($query);
}
function deleteAll() {
$query = 'TRUNCATE TABLE `'. $this->getTableName() .'`';
$this->db->sql_query($query);
}
// Properties
function getTableName() { return $this->tablename; }
function setTableName($value) { $this->tablename = $value; }
}
?>

View file

@ -82,3 +82,21 @@ CREATE TABLE `sc_tags2tags` (
PRIMARY KEY (`ttId`), PRIMARY KEY (`ttId`),
UNIQUE KEY `sc_tags2tags_tag1_tag2_uId` (`tag1`,`tag2`,`relationType`,`uId`) UNIQUE KEY `sc_tags2tags_tag1_tag2_uId` (`tag1`,`tag2`,`relationType`,`uId`)
); );
-- --------------------------------------------------------
--
-- Table structure for table `sc_tagsstats`
--
CREATE TABLE `sc_tagsstats` (
`tstId` int(11) NOT NULL auto_increment,
`tag1` varchar(32) NOT NULL default '',
`relationType` varchar(32) NOT NULL default '',
`uId` int(11) NOT NULL default '0',
`nb` int(11) NOT NULL default '0',
`depth` int(11) NOT NULL default '0',
`nbupdate` int(11) NOT NULL default '0',
PRIMARY KEY (`tstId`),
UNIQUE KEY `sc_tagsstats_tag1_type_uId` (`tag1`,`relationType`,`uId`)
);

View file

@ -4,11 +4,14 @@ $userservice =& ServiceFactory::getServiceInstance('UserService');
function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode =false, $precedentTag =null, $level=0, $stopList=array()) { function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode =false, $precedentTag =null, $level=0, $stopList=array()) {
$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService'); $tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
$tagstatservice =& ServiceFactory::getServiceInstance('TagStatService');
$output = ''; $output = '';
$output.= '<tr>'; $output.= '<tr>';
$output.= '<td></td>'; $output.= '<td></td>';
$output.= '<td>'. str_repeat('&nbsp;', $level*2) .'<a href="'. sprintf($cat_url, filter($user, 'url'), filter($tag, 'url')) .'" rel="tag">'. filter($tag) .'</a>'; $output.= '<td>'. str_repeat('&nbsp;', $level*2) .'<a href="'. sprintf($cat_url, filter($user, 'url'), filter($tag, 'url')) .'" rel="tag">'. filter($tag) .'</a>';
//$output.= ' - '. $tagstatservice->getMaxDepth($tag, $linkType, $uId);
if($editingMode) { if($editingMode) {
$output.= ' ('; $output.= ' (';
$output.= '<a href="'.createURL('tag2tagadd', $tag).'">add</a>'; $output.= '<a href="'.createURL('tag2tagadd', $tag).'">add</a>';
@ -22,7 +25,7 @@ function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode
$output.= '</tr>'; $output.= '</tr>';
if(!in_array($tag, $stopList)) { if(!in_array($tag, $stopList)) {
$linkedTags = $tag2tagservice->getLinkedTags($tag, '>', $userid, $level); $linkedTags = $tag2tagservice->getLinkedTags($tag, '>', $userid);
$precedentTag = $tag; $precedentTag = $tag;
$stopList[] = $tag; $stopList[] = $tag;
$level = $level + 1; $level = $level + 1;
@ -33,7 +36,6 @@ function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode
return $output; return $output;
} }
$logged_on_userid = $userservice->getCurrentUserId(); $logged_on_userid = $userservice->getCurrentUserId();
if ($logged_on_userid === false) { if ($logged_on_userid === false) {
$logged_on_userid = NULL; $logged_on_userid = NULL;
@ -43,7 +45,12 @@ $explodedTags = array();
if ($currenttag) { if ($currenttag) {
$explodedTags = explode('+', $currenttag); $explodedTags = explode('+', $currenttag);
} else { } else {
$orphewTags = $tag2tagservice->getOrphewTags('>', $userid); if($userid != null) {
$orphewTags = $tag2tagservice->getOrphewTags('>', $userid);
} else {
$orphewTags = $tag2tagservice->getOrphewTags('>', $userid, 4, "nb");
}
foreach($orphewTags as $orphewTag) { foreach($orphewTags as $orphewTag) {
$explodedTags[] = $orphewTag['tag']; $explodedTags[] = $orphewTag['tag'];
} }
@ -60,7 +67,17 @@ if(count($explodedTags) > 0) {
if ($displayLinkedZone) { if ($displayLinkedZone) {
?> ?>
<h2><?php echo T_('Linked Tags'); ?></h2> <h2>
<?php
echo T_('Linked Tags').' ';
//if($userid != null) {
$cUser = $userservice->getUser($userid);
echo '<a href="'.createURL('alltags', $cUser['username']).'">('.T_('plus').')</a>';
//}
?>
</h2>
<div id="linked"> <div id="linked">
<table> <table>
<?php <?php

View file

@ -23,5 +23,6 @@ echo $contents ."\n";
<?php <?php
} }
$this->includeTemplate('sidebar.tpl');
$this->includeTemplate($GLOBALS['bottom_include']); $this->includeTemplate($GLOBALS['bottom_include']);
?> ?>

View file

@ -26,6 +26,8 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
$this->ts->deleteAll(); $this->ts->deleteAll();
$this->tts =& ServiceFactory::getServiceInstance('Tag2TagService'); $this->tts =& ServiceFactory::getServiceInstance('Tag2TagService');
$this->tts->deleteAll(); $this->tts->deleteAll();
$this->tsts =& ServiceFactory::getServiceInstance('TagStatService');
$this->tsts->deleteAll();
} }
public function testManipulateTag2TagRelations() public function testManipulateTag2TagRelations()
@ -58,9 +60,11 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
$this->assertSame('a', $orphewTags[0]['tag']); $this->assertSame('a', $orphewTags[0]['tag']);
$this->assertSame('f', $orphewTags[1]['tag']); $this->assertSame('f', $orphewTags[1]['tag']);
$orphewTags = $tts->getOrphewTags('>'); $orphewTags = $tts->getOrphewTags('>');
$this->assertEquals(2, sizeof($orphewTags)); $this->assertEquals(1, sizeof($orphewTags));
$this->assertSame('f', $orphewTags[0]['tag']); $this->assertSame('f', $orphewTags[0]['tag']);
$linkedTags = $tts->getLinkedTags('a', '>');
$this->assertSame(array('b', 'c', 'd'), $linkedTags);
$linkedTags = $tts->getLinkedTags('a', '>', 1); $linkedTags = $tts->getLinkedTags('a', '>', 1);
$this->assertSame(array('b', 'c'), $linkedTags); $this->assertSame(array('b', 'c'), $linkedTags);
$tts->removeLinkedTags('a', 'b', '>', 1); $tts->removeLinkedTags('a', 'b', '>', 1);
@ -69,8 +73,48 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
$tts->removeLinkedTags('a', 'c', '>', 1); $tts->removeLinkedTags('a', 'c', '>', 1);
$linkedTags = $tts->getLinkedTags('a', '>', 1); $linkedTags = $tts->getLinkedTags('a', '>', 1);
$this->assertEquals(0, sizeof($linkedTags)); $this->assertEquals(0, sizeof($linkedTags));
$linkedTags = $tts->getLinkedTags('a', '>'); }
$this->assertSame(array('b', 'c', 'd'), $linkedTags);
/* Test function that select the best tags to display? */
public function testViewTag2TagRelations()
{
$tts = $this->tts;
$tts->addLinkedTags('a', 'b', '>', 1);
$tts->addLinkedTags('c', 'd', '>', 1);
$tts->addLinkedTags('d', 'e', '>', 1);
$tts->addLinkedTags('f', 'g', '>', 1);
$tts->addLinkedTags('f', 'h', '>', 1);
$tts->addLinkedTags('f', 'i', '>', 1);
$orphewTags = $tts->getOrphewTags('>', 1);
$this->assertEquals(3, sizeof($orphewTags));
$this->assertSame('a', $orphewTags[0]['tag']);
$this->assertSame('c', $orphewTags[1]['tag']);
$this->assertSame('f', $orphewTags[2]['tag']);
// with limit
$orphewTags = $tts->getOrphewTags('>', 1, 2);
$this->assertEquals(2, sizeof($orphewTags));
$this->assertSame('a', $orphewTags[0]['tag']);
$this->assertSame('c', $orphewTags[1]['tag']);
// with sorting
$orphewTags = $tts->getOrphewTags('>', 1, 2, 'nb'); // nb descendants
$this->assertEquals(2, sizeof($orphewTags));
$this->assertSame('f', $orphewTags[0]['tag']);
$this->assertSame('c', $orphewTags[1]['tag']);
$orphewTags = $tts->getOrphewTags('>', 1, 1, 'depth');
$this->assertEquals(1, sizeof($orphewTags));
$this->assertSame('c', $orphewTags[0]['tag']);
$orphewTags = $tts->getOrphewTags('>', 1, null, 'nbupdate');
$this->assertEquals(3, sizeof($orphewTags));
$this->assertSame('f', $orphewTags[0]['tag']);
$this->assertSame('c', $orphewTags[1]['tag']);
$this->assertSame('a', $orphewTags[2]['tag']);
} }
public function testAddLinkedTagsThroughBookmarking() public function testAddLinkedTagsThroughBookmarking()
@ -97,6 +141,7 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
$this->assertEquals(1, sizeof($linkedTags)); $this->assertEquals(1, sizeof($linkedTags));
$this->assertSame('c', $linkedTags[0]['tag']); $this->assertSame('c', $linkedTags[0]['tag']);
$this->assertTrue($tts->existsLinkedTags('d', 'e', '>', 1)); $this->assertTrue($tts->existsLinkedTags('d', 'e', '>', 1));
$this->assertFalse($tts->existsLinkedTags('e', 'd', '>', 1));
} }
public function testSearchThroughLinkedTags() public function testSearchThroughLinkedTags()
@ -140,5 +185,96 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase
} }
public function testStatsBetweenTags()
{
$tsts = $this->tsts;
$tts = $this->tts;
// basic functions
$this->assertFalse($tsts->existStat('a', '>', 10));
$tsts->setNbDescendants('a', '>', 10, 2);
$this->assertSame(2, $tsts->getNbDescendants('a', '>', 10));
$tsts->setMaxDepth('a', '>', 10, 3);
$this->assertSame(3, $tsts->getMaxDepth('a', '>', 10));
$this->assertTrue($tsts->existStat('a', '>', 10));
$this->assertFalse($tsts->existStat('a', '>', 20));
$tsts->increaseNbUpdate('a', '>', 10);
$this->assertSame(1, $tsts->getNbUpdate('a', '>', 10));
$tsts->deleteAll();
// no structure
$nbC = $tsts->getNbChildren('a', '>', 1);
$nbD = $tsts->getNbDescendants('a', '>', 1);
$maxDepth = $tsts->getMaxDepth('a', '>', 1);
$this->assertSame(0, $nbC);
$this->assertSame(0, $nbD);
$this->assertSame(0, $maxDepth);
// simple case
$tts->addLinkedTags('b', 'c', '>', 1);
$tts->addLinkedTags('a', 'd', '>', 1);
$tts->addLinkedTags('a', 'b', '>', 1);
$tts->addLinkedTags('b', 'e', '>', 1);
$this->assertSame(3, $tsts->getNbUpdate('a', '>', '1'));
$this->assertSame(2, $tsts->getNbUpdate('b', '>', '1'));
$this->assertSame(0, $tsts->getNbUpdate('c', '>', '1'));
$this->assertSame(0, $tsts->getNbUpdate('d', '>', '1'));
$this->assertSame(0, $tsts->getNbUpdate('e', '>', '1'));
$nbC = $tsts->getNbChildren('a', '>', 1);
$nbD = $tsts->getNbDescendants('a', '>', 1);
$maxDepth = $tsts->getMaxDepth('a', '>', 1);
$this->assertSame(2, $nbC);
$this->assertSame(4, $nbD);
$this->assertSame(2, $maxDepth);
$nbC = $tsts->getNbChildren('b', '>', 1);
$nbD = $tsts->getNbDescendants('b', '>', 1);
$maxDepth = $tsts->getMaxDepth('b', '>', 1);
$this->assertSame(2, $nbC);
$this->assertSame(2, $nbD);
$this->assertSame(1, $maxDepth);
$nbC = $tsts->getNbChildren('c', '>', 1);
$nbD = $tsts->getNbDescendants('c', '>', 1);
$maxDepth = $tsts->getMaxDepth('c', '>', 1);
$this->assertSame(0, $nbC);
$this->assertSame(0, $nbD);
$this->assertSame(0, $maxDepth);
$nbC = $tsts->getNbChildren('d', '>', 1);
$nbD = $tsts->getNbDescendants('d', '>', 1);
$maxDepth = $tsts->getMaxDepth('d', '>', 1);
$this->assertSame(0, $nbC);
$this->assertSame(0, $nbD);
$this->assertSame(0, $maxDepth);
// deletion
$tts->removeLinkedTags('b', 'e', '>', 1);
$nbC = $tsts->getNbChildren('b', '>', 1);
$nbD = $tsts->getNbDescendants('b', '>', 1);
$maxDepth = $tsts->getMaxDepth('b', '>', 1);
$this->assertSame(1, $nbC);
$this->assertSame(1, $nbD);
$this->assertSame(1, $maxDepth);
$nbC = $tsts->getNbChildren('a', '>', 1);
$nbD = $tsts->getNbDescendants('a', '>', 1);
$maxDepth = $tsts->getMaxDepth('a', '>', 1);
$this->assertSame(2, $nbC);
$this->assertSame(3, $nbD);
$this->assertSame(2, $maxDepth);
// advanced case with fore loop
//$tts->addLinkedTags('d', 'c', '>', 1);
// advanced case with back loop
//$tts->addLinkedTags('e', 'a', '>', 1);
}
} }
?> ?>