diff options
-rw-r--r-- | admin.php | 34 | ||||
-rw-r--r-- | alltags.php | 3 | ||||
-rw-r--r-- | locales/fr_FR/LC_MESSAGES/messages.mo | bin | 17152 -> 17339 bytes | |||
-rw-r--r-- | locales/fr_FR/LC_MESSAGES/messages.po | 332 | ||||
-rw-r--r-- | locales/messages.po | 8 | ||||
-rw-r--r-- | populartags.php | 2 | ||||
-rw-r--r-- | services/tag2tagservice.php | 81 | ||||
-rw-r--r-- | services/tagstatservice.php | 181 | ||||
-rw-r--r-- | tables.sql | 18 | ||||
-rw-r--r-- | templates/sidebar.block.linked.php | 25 | ||||
-rw-r--r-- | templates/tags.tpl.php | 3 | ||||
-rw-r--r-- | tests/tag2TagTest.php | 142 |
12 files changed, 607 insertions, 222 deletions
diff --git a/admin.php b/admin.php new file mode 100644 index 0000000..81dde3c --- /dev/null +++ b/admin.php @@ -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!"; +*/ +?> diff --git a/alltags.php b/alltags.php index b784414..3805a3d 100644 --- a/alltags.php +++ b/alltags.php @@ -75,6 +75,9 @@ if (isset($userid)) { $tplVars['cat_url'] = createURL('tags', '%2$s'); } +$tplVars['sidebar_blocks'] = array('linked'); +$tplVars['userid'] = $userid; + $tplVars['subtitle'] = $pagetitle; $templateservice->loadTemplate('tags.tpl', $tplVars); diff --git a/locales/fr_FR/LC_MESSAGES/messages.mo b/locales/fr_FR/LC_MESSAGES/messages.mo Binary files differindex c2d6b80..c068266 100644 --- a/locales/fr_FR/LC_MESSAGES/messages.mo +++ b/locales/fr_FR/LC_MESSAGES/messages.mo diff --git a/locales/fr_FR/LC_MESSAGES/messages.po b/locales/fr_FR/LC_MESSAGES/messages.po index c3c1691..5b1e1d5 100644 --- a/locales/fr_FR/LC_MESSAGES/messages.po +++ b/locales/fr_FR/LC_MESSAGES/messages.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: Scuttle\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-01-14 11:58+0100\n" -"PO-Revision-Date: 2008-01-14 11:31+0100\n" +"POT-Creation-Date: 2008-01-22 16:54+0100\n" +"PO-Revision-Date: 2008-01-22 16:55+0100\n" "Last-Translator: BenjaminHKB <benjamin.huynh-kim-bang@loria.fr>\n" "Language-Team: fr-FR <toony.sf@chezouam.net>\n" "MIME-Version: 1.0\n" @@ -19,7 +19,8 @@ msgstr "" "X-Poedit-Country: FRANCE\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" msgstr "À propos" @@ -27,7 +28,8 @@ msgstr "À propos" msgid "You are not allowed to delete this bookmark" 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" msgstr "Erreur dans la suppression du signet" @@ -35,31 +37,36 @@ msgstr "Erreur dans la suppression du signet" msgid "All Tags" msgstr "Tous les tags" -#: ../../../alltags.php:57 ../../../bookmarks.php:72 -#: ../../../populartags.php:58 ../../../profile.php:44 ../../../rss.php:62 -#: ../../../search.php:87 ../../../watch.php:34 ../../../watchlist.php:61 +#: ../../../alltags.php:57 +#: ../../../bookmarks.php:72 +#: ../../../populartags.php:58 +#: ../../../profile.php:44 +#: ../../../rss.php:62 +#: ../../../search.php:87 +#: ../../../watch.php:34 +#: ../../../watchlist.php:61 #, php-format msgid "User with username %s was not found" 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" 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" msgstr "Signet enregistré." -#: ../../../bookmarks.php:123 ../../../import.php:99 +#: ../../../bookmarks.php:123 +#: ../../../import.php:99 #: ../../../importNetscape.php:74 -msgid "" -"There was an error saving your bookmark. Please try again or contact the " -"administrator." -msgstr "" -"Il y a eu une erreur en enregistrant ce signet. Veuillez rééssayer ou " -"contacter votre administrateur." +msgid "There was an error saving your bookmark. Please try again or contact the 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" msgstr "Ajouter un signet" @@ -92,7 +99,8 @@ msgstr "Vous n'êtes pas autorisé à éditer ce signet." msgid "Error while saving your bookmark" 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" msgstr "Enregister les modifications" @@ -108,7 +116,8 @@ msgstr "Erreur SQL" msgid "Line" 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 msgid "File" msgstr "Fichier" @@ -168,11 +177,13 @@ msgstr "Erreur XML: %s à la ligne %d" msgid "Import Bookmarks from 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." msgstr "Vous avez déjà enregistré ce signet." -#: ../../../import.php:97 ../../../importNetscape.php:72 +#: ../../../import.php:97 +#: ../../../importNetscape.php:72 #, fuzzy msgid "Bookmark imported." msgstr "Signets importés." @@ -199,18 +210,21 @@ msgstr "Conservez, partagez et taggez vos liens favoris" msgid "Recent Bookmarks" 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/tagdelete.tpl.php:6 msgid "Are you sure?" 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 msgid "Yes" msgstr "Oui" -#: ../../../jsScuttle.php:22 ../../../templates/tag2tagdelete.tpl.php:11 +#: ../../../jsScuttle.php:22 +#: ../../../templates/tag2tagdelete.tpl.php:11 #: ../../../templates/tagdelete.tpl.php:9 msgid "No" msgstr "Non" @@ -225,11 +239,10 @@ msgstr "Non Disponible" #: ../../../login.php:38 msgid "The details you have entered are incorrect. Please try again." -msgstr "" -"Les informations que vous avez entrées sont incorrectes. Veuillez " -"recommencer." +msgstr "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 msgid "Log In" msgstr "Se connecter" @@ -239,11 +252,8 @@ msgid "You must enter your username." msgstr "Vous devez entrer votre nom d'utilisateur." #: ../../../password.php:35 -msgid "" -"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>." +msgid "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>." #: ../../../password.php:42 msgid "No matches found for that username." @@ -251,31 +261,20 @@ msgstr "Rien de trouvé pour ce nom d'utilisateur." #: ../../../password.php:45 #, fuzzy -msgid "" -"No matches found for that combination of username and <abbr title=" -"\"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>." +msgid "No matches found for that combination of username and <abbr title=\"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 -msgid "" -"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." +msgid "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." #: ../../../password.php:57 msgid "Your new password is:" msgstr "Votre nouveau mot de passe est:" #: ../../../password.php:57 -msgid "" -"To keep your bookmarks secure, you should change this password in your " -"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." +msgid "To keep your bookmarks secure, you should change this password in your 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 #, php-format @@ -291,14 +290,16 @@ msgstr "Nouveau mot de passe généré et envoyé à l'adresse %s" msgid "Forgotten Password" 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.popular.php:15 #: ../../../templates/sidebar.block.recent.php:25 msgid "Popular Tags" msgstr "Tags populaires" -#: ../../../profile.php:52 ../../../watchlist.php:116 +#: ../../../profile.php:52 +#: ../../../watchlist.php:116 msgid "Username was not specified" 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" msgstr "Mon Profil" -#: ../../../profile.php:60 ../../../templates/toolbar.inc.php:13 +#: ../../../profile.php:60 +#: ../../../templates/toolbar.inc.php:13 msgid "Profile" msgstr "Profil" @@ -324,8 +326,7 @@ msgstr "Adresse de courrier électronique invalide." #: ../../../profile.php:90 msgid "An error occurred while saving your changes." -msgstr "" -"Une erreur s'est produite pendant l'enregistrement de vos modifications." +msgstr "Une erreur s'est produite pendant l'enregistrement de vos modifications." #: ../../../profile.php:92 msgid "Changes saved." @@ -333,9 +334,7 @@ msgstr "Modifications enregistrées." #: ../../../register.php:33 msgid "You <em>must</em> enter a username, password and e-mail address." -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>" +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>" #: ../../../register.php:37 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." 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 msgid "Register" msgstr "S'enregistrer" @@ -371,7 +371,8 @@ msgstr "S'enregistrer" msgid "Recent bookmarks posted to %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" msgstr "Chercher" @@ -395,15 +396,17 @@ msgstr "tous les signets" msgid "for" msgstr "pour" -#: ../../../search.php:58 ../../../search.php:104 +#: ../../../search.php:58 +#: ../../../search.php:104 msgid "Search Bookmarks" msgstr "Recherche de signets" #: ../../../search.php:64 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." msgstr "Permission non accordée." @@ -452,21 +455,22 @@ msgstr "Tag renommé" msgid "Failed to rename the 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_plural "Rename Tags" msgstr[0] "Renommer le tag" 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 msgid "Tags" msgstr "Tags" #: ../../../users.php:33 -#, fuzzy msgid "Users" -msgstr "Nom d'utilisateur" +msgstr "Utilisateurs" #: ../../../watch.php:46 msgid "User removed from your watchlist" @@ -481,42 +485,28 @@ msgstr "Utilisateur ajouté à la liste des consultés." msgid "My Watchlist" msgstr "Liste des signets vus" -#: ../../../watchlist.php:105 ../../../templates/toolbar.inc.php:12 +#: ../../../watchlist.php:105 +#: ../../../templates/toolbar.inc.php:12 #, fuzzy msgid "Watchlist" msgstr "Liste des signets vus" #: ../../../templates/about.tpl.php:6 -msgid "" -"<strong>Store</strong> all your favourite links in one place, accessible " -"from anywhere." -msgstr "" -"<strong>Conservez</strong> tous vos signets au même endroit, accessibles de " -"partout. " +msgid "<strong>Store</strong> all your favourite links in one place, accessible from anywhere." +msgstr "<strong>Conservez</strong> tous vos signets au même endroit, accessibles de partout. " #: ../../../templates/about.tpl.php:7 -msgid "" -"<strong>Share</strong> your bookmarks with everyone, with friends on your " -"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." +msgid "<strong>Share</strong> your bookmarks with everyone, with friends on your 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 -msgid "" -"<strong>Tag</strong> your bookmarks with as many labels as you want, instead " -"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." +msgid "<strong>Tag</strong> your bookmarks with as many labels as you want, instead 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 #, php-format -msgid "" -"<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 !" +msgid "<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 !" #: ../../../templates/about.tpl.php:12 msgid "Geek Stuff" @@ -524,33 +514,16 @@ msgstr "Pour les Geeks" #: ../../../templates/about.tpl.php:14 #, php-format -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." -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." +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." +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 #, php-format -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." -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>." +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." +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 msgid "Sort by:" msgstr "Classer par :" @@ -657,11 +630,8 @@ msgid "Comma-separated" msgstr "Séparés par des virgules" #: ../../../templates/editbookmark.tpl.php:50 -msgid "" -"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" +msgid "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" #: ../../../templates/editbookmark.tpl.php:53 #: ../../../templates/importDelicious.tpl.php:15 @@ -695,13 +665,8 @@ msgstr "Bookmarklet" #: ../../../templates/editbookmark.tpl.php:98 #, php-format -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" -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 " +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" +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 #, php-format @@ -736,8 +701,10 @@ msgid "Account Details" msgstr "Détail du compte" #: ../../../templates/editprofile.tpl.php:11 -#: ../../../templates/login.tpl.php:15 ../../../templates/password.tpl.php:10 -#: ../../../templates/profile.tpl.php:7 ../../../templates/register.tpl.php:16 +#: ../../../templates/login.tpl.php:15 +#: ../../../templates/password.tpl.php:10 +#: ../../../templates/profile.tpl.php:7 +#: ../../../templates/register.tpl.php:16 msgid "Username" msgstr "Nom d'utilisateur" @@ -797,28 +764,16 @@ msgid "Instructions" msgstr "Instructions" #: ../../../templates/importDelicious.tpl.php:33 -msgid "" -"Log in to the <a href=\"http://del.icio.us/api/posts/all\">export page at " -"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>" +msgid "Log in to the <a href=\"http://del.icio.us/api/posts/all\">export page at 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 -msgid "" -"Save the resulting <abbr title=\"Extensible Markup Language\">XML</abbr> " -"file to your computer" -msgstr "" -"Enregistrer le fichier <abbr title=\"Extensible Markup Language\">XML</abbr> " -"résultant sur votre ordinateur" +msgid "Save the resulting <abbr title=\"Extensible Markup Language\">XML</abbr> 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 -msgid "" -"Click <kbd>Browse...</kbd> to find this file on your computer. 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" +msgid "Click <kbd>Browse...</kbd> to find this file on your computer. 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/importDelicious.tpl.php:36 #: ../../../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/importNetscape.tpl.php:44 -msgid "" -"Click <kbd>Import</kbd> to start importing the bookmarks; it may take a " -"minute" -msgstr "" -"Cliquez sur <kbd>Importer</kbd> pour débuter l'import des signets; cette " -"opération peut prendre quelques minutes" +msgid "Click <kbd>Import</kbd> to start importing the bookmarks; it may take a 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 msgid "Export your bookmarks from your browser to a file" msgstr "Exporter vos signets dans un fichier depuis votre navigateur" #: ../../../templates/importNetscape.tpl.php:37 -msgid "" -"Internet Explorer: <kbd>File > Import and Export... > Export Favorites" -msgstr "" -"Internet Explorer: <kbd>Ficher > Importer et Exporter... > Exporter " -"les favoris" +msgid "Internet Explorer: <kbd>File > Import and Export... > Export Favorites" +msgstr "Internet Explorer: <kbd>Ficher > Importer et Exporter... > Exporter les favoris" #: ../../../templates/importNetscape.tpl.php:38 -msgid "" -"Mozilla Firefox: <kbd>Bookmarks > Manage Bookmarks... > File > " -"Export..." -msgstr "" -"Mozilla Firefox: <kbd>Marques-pages > Gérer les marques-pages... > " -"Fichier > Exporter..." +msgid "Mozilla Firefox: <kbd>Bookmarks > Manage Bookmarks... > File > Export..." +msgstr "Mozilla Firefox: <kbd>Marques-pages > Gérer les marques-pages... > Fichier > Exporter..." #: ../../../templates/importNetscape.tpl.php:39 -msgid "" -"Netscape: <kbd>Bookmarks > Manage Bookmarks... > Tools > Export..." -msgstr "" -"Netscape: <kbd>Marques-pages > Gérer les marques-pages... > Outils " -"> Exporter..." +msgid "Netscape: <kbd>Bookmarks > Manage Bookmarks... > Tools > Export..." +msgstr "Netscape: <kbd>Marques-pages > Gérer les marques-pages... > Outils > Exporter..." #: ../../../templates/importNetscape.tpl.php:42 -msgid "" -"Click <kbd>Browse...</kbd> to find the saved bookmark file on your computer. " -"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" +msgid "Click <kbd>Browse...</kbd> to find the saved bookmark file on your computer. 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" msgstr "Mot de passe" @@ -882,14 +820,8 @@ msgstr "Avez-vous oublié votre mot de passe ?" #: ../../../templates/password.tpl.php:5 #, php-format -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." -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." +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." +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 msgid "Generate Password" @@ -912,21 +844,21 @@ msgstr "Consultés" #: ../../../templates/register.tpl.php:11 #, php-format -msgid "" -"Sign up here to create a free %s account. All the information requested " -"below is required" -msgstr "" -"Enregistrez-vous ici pour créer un compte gratuit %s. Toutes les " -"informations requises ci-dessous sont nécessaires." +msgid "Sign up here to create a free %s account. All the information requested 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 msgid "Antispam question" msgstr "Question antispam" -#: ../../../templates/sidebar.block.linked.php:63 +#: ../../../templates/sidebar.block.linked.php:72 msgid "Linked Tags" msgstr "Tags structurés" +#: ../../../templates/sidebar.block.linked.php:75 +msgid "plus" +msgstr "plus" + #: ../../../templates/sidebar.block.recent.php:15 msgid "Recent Tags" msgstr "Tags récents" @@ -954,14 +886,12 @@ msgid "Add to Watchlist" msgstr "Ajouter à la liste des consultés" #: ../../../templates/tag2tagadd.tpl.php:7 -#, fuzzy msgid "Create new link:" msgstr "Créer un nouveau lien" #: ../../../templates/tag2tagadd.tpl.php:11 -#, fuzzy msgid "Create" -msgstr "Privée" +msgstr "Créer" #: ../../../templates/tag2tagadd.tpl.php:12 #: ../../../templates/tagrename.tpl.php:25 @@ -977,16 +907,17 @@ msgid "New" msgstr "Nouvaeu" #: ../../../templates/tagrename.tpl.php:24 -#, fuzzy 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 msgid "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" msgstr "Popularité" @@ -1010,17 +941,16 @@ msgstr "Créé en " msgid "bookmarks" msgstr "signets" +#~ msgid "edit" +#~ msgstr "éditer" #~ msgid "Failed to delete the bookmark" #~ msgstr "Erreur dans la suppression du signet" - #~ msgid "User with username %s not was not found" #~ msgstr "L'utilisateur %s n'a pas été trouvé." - #~ msgid "%s Bookmarks" #~ msgstr "Signets de %s" - #~ msgid "<abbr title=\"Electronic mail\">E-mail</abbr>" #~ msgstr "<abbr title=\"Adresse électronique\">E-mail</abbr>" - #~ msgid "No bookmarks found" #~ msgstr "Pas de signets trouvés" + diff --git a/locales/messages.po b/locales/messages.po index f32110b..a5301eb 100644 --- a/locales/messages.po +++ b/locales/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\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" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -853,10 +853,14 @@ msgstr "" msgid "Antispam question" msgstr "" -#: ../../../templates/sidebar.block.linked.php:63 +#: ../../../templates/sidebar.block.linked.php:72 msgid "Linked Tags" msgstr "" +#: ../../../templates/sidebar.block.linked.php:75 +msgid "plus" +msgstr "" + #: ../../../templates/sidebar.block.recent.php:15 msgid "Recent Tags" msgstr "" diff --git a/populartags.php b/populartags.php index daef205..6bed82d 100644 --- a/populartags.php +++ b/populartags.php @@ -76,6 +76,8 @@ if (isset($userid)) { $tplVars['cat_url'] = createURL('tags', '%2$s'); } +$tplVars['sidebar_blocks'] = array('linked'); + $tplVars['subtitle'] = $pagetitle; $templateservice->loadTemplate('tags.tpl', $tplVars); diff --git a/services/tag2tagservice.php b/services/tag2tagservice.php index 7ceb8da..14d57b3 100644 --- a/services/tag2tagservice.php +++ b/services/tag2tagservice.php @@ -28,17 +28,35 @@ class Tag2TagService { return false; } $this->db->sql_transaction('commit'); + + // Update stats + $tsts =& ServiceFactory::getServiceInstance('TagStatService'); + $tsts->updateStat($tag1, $relationType, $uId); + 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. - $query = "SELECT DISTINCT tag2 as 'tag' FROM `". $this->getTableName() ."`"; - $query.= " WHERE tag1 = '" .$tag1 ."'"; + if($inverseRelation) { + $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) { $query.= " AND relationType = '". $relationType ."'"; } - if($uId>0) { + if($uId != null) { $query.= " AND uId = '".$uId."'"; } @@ -88,9 +106,14 @@ class Tag2TagService { return $output; } - function getOrphewTags($relationType, $uId = 0) { - $query = "SELECT DISTINCT tag1 as tag FROM `". $this->getTableName() ."`"; - $query.= " WHERE tag1 <> ALL"; + function getOrphewTags($relationType, $uId = 0, $limit = null, $orderBy = null) { + $query = "SELECT DISTINCT tts.tag1 as tag"; + $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.= " WHERE relationType = '".$relationType."'"; if($uId > 0) { @@ -98,12 +121,41 @@ class Tag2TagService { } $query.= ")"; 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); return false; } @@ -117,7 +169,7 @@ class Tag2TagService { $query.= " AND relationType = '". $relationType ."'"; $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) { @@ -132,12 +184,19 @@ class Tag2TagService { return false; } + // Update stats + $tsts =& ServiceFactory::getServiceInstance('TagStatService'); + $tsts->updateStat($tag1, $relationType, $uId); + return true; } function deleteAll() { $query = 'TRUNCATE TABLE `'. $this->getTableName() .'`'; $this->db->sql_query($query); + + $tsts =& ServiceFactory::getServiceInstance('TagStatService'); + $tsts->deleteAll(); } // Properties diff --git a/services/tagstatservice.php b/services/tagstatservice.php new file mode 100644 index 0000000..fa416f4 --- /dev/null +++ b/services/tagstatservice.php @@ -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; } +} +?> @@ -82,3 +82,21 @@ CREATE TABLE `sc_tags2tags` ( PRIMARY KEY (`ttId`), 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`) +); diff --git a/templates/sidebar.block.linked.php b/templates/sidebar.block.linked.php index 5a891ea..7bbde81 100644 --- a/templates/sidebar.block.linked.php +++ b/templates/sidebar.block.linked.php @@ -4,11 +4,14 @@ $userservice =& ServiceFactory::getServiceInstance('UserService'); function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode =false, $precedentTag =null, $level=0, $stopList=array()) { $tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService'); + $tagstatservice =& ServiceFactory::getServiceInstance('TagStatService'); $output = ''; $output.= '<tr>'; $output.= '<td></td>'; $output.= '<td>'. str_repeat(' ', $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) { $output.= ' ('; $output.= '<a href="'.createURL('tag2tagadd', $tag).'">add</a>'; @@ -22,7 +25,7 @@ function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode $output.= '</tr>'; if(!in_array($tag, $stopList)) { - $linkedTags = $tag2tagservice->getLinkedTags($tag, '>', $userid, $level); + $linkedTags = $tag2tagservice->getLinkedTags($tag, '>', $userid); $precedentTag = $tag; $stopList[] = $tag; $level = $level + 1; @@ -33,7 +36,6 @@ function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode return $output; } - $logged_on_userid = $userservice->getCurrentUserId(); if ($logged_on_userid === false) { $logged_on_userid = NULL; @@ -43,7 +45,12 @@ $explodedTags = array(); if ($currenttag) { $explodedTags = explode('+', $currenttag); } else { - $orphewTags = $tag2tagservice->getOrphewTags('>', $userid); + if($userid != null) { + $orphewTags = $tag2tagservice->getOrphewTags('>', $userid); + } else { + $orphewTags = $tag2tagservice->getOrphewTags('>', $userid, 4, "nb"); + } + foreach($orphewTags as $orphewTag) { $explodedTags[] = $orphewTag['tag']; } @@ -60,7 +67,17 @@ if(count($explodedTags) > 0) { 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"> <table> <?php diff --git a/templates/tags.tpl.php b/templates/tags.tpl.php index 7266170..d5de176 100644 --- a/templates/tags.tpl.php +++ b/templates/tags.tpl.php @@ -23,5 +23,6 @@ echo $contents ."\n"; <?php } +$this->includeTemplate('sidebar.tpl'); $this->includeTemplate($GLOBALS['bottom_include']); -?>
\ No newline at end of file +?> diff --git a/tests/tag2TagTest.php b/tests/tag2TagTest.php index 3a8466f..7b84ac6 100644 --- a/tests/tag2TagTest.php +++ b/tests/tag2TagTest.php @@ -26,6 +26,8 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase $this->ts->deleteAll(); $this->tts =& ServiceFactory::getServiceInstance('Tag2TagService'); $this->tts->deleteAll(); + $this->tsts =& ServiceFactory::getServiceInstance('TagStatService'); + $this->tsts->deleteAll(); } public function testManipulateTag2TagRelations() @@ -58,9 +60,11 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase $this->assertSame('a', $orphewTags[0]['tag']); $this->assertSame('f', $orphewTags[1]['tag']); $orphewTags = $tts->getOrphewTags('>'); - $this->assertEquals(2, sizeof($orphewTags)); + $this->assertEquals(1, sizeof($orphewTags)); $this->assertSame('f', $orphewTags[0]['tag']); + $linkedTags = $tts->getLinkedTags('a', '>'); + $this->assertSame(array('b', 'c', 'd'), $linkedTags); $linkedTags = $tts->getLinkedTags('a', '>', 1); $this->assertSame(array('b', 'c'), $linkedTags); $tts->removeLinkedTags('a', 'b', '>', 1); @@ -69,8 +73,48 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase $tts->removeLinkedTags('a', 'c', '>', 1); $linkedTags = $tts->getLinkedTags('a', '>', 1); $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() @@ -97,6 +141,7 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase $this->assertEquals(1, sizeof($linkedTags)); $this->assertSame('c', $linkedTags[0]['tag']); $this->assertTrue($tts->existsLinkedTags('d', 'e', '>', 1)); + $this->assertFalse($tts->existsLinkedTags('e', 'd', '>', 1)); } 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); + } } ?> |