From 3b79d6b9cc75eaf2b54f6d41843a313b13395c8d Mon Sep 17 00:00:00 2001 From: mensonge Date: Mon, 21 Apr 2008 15:43:00 +0000 Subject: [PATCH] New feature: private descriptions for tags git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@117 b3834d28-1941-0410-a4f8-b48e95affb8f --- locales/fr_FR/LC_MESSAGES/messages.mo | Bin 19568 -> 19802 bytes locales/fr_FR/LC_MESSAGES/messages.po | 129 ++++++++++++++----------- locales/messages.po | 123 ++++++++++++----------- services/tagservice.php | 88 +++++++++++++++++ tagedit.php | 61 ++++++++++++ tagrename.php | 1 + templates/bookmarks.tpl.php | 18 +++- templates/sidebar.block.tagactions.php | 2 + templates/tagedit.tpl.php | 35 +++++++ tests/tagsTest.php | 76 +++++++++++++++ 10 files changed, 421 insertions(+), 112 deletions(-) create mode 100644 services/tagservice.php create mode 100644 tagedit.php create mode 100644 templates/tagedit.tpl.php create mode 100644 tests/tagsTest.php diff --git a/locales/fr_FR/LC_MESSAGES/messages.mo b/locales/fr_FR/LC_MESSAGES/messages.mo index fb6404ff0132051d6db75c34bcd62355e1c9ec69..6012d4c249c9ed9aa7d57ed59faa2b0d2917b7e3 100644 GIT binary patch delta 5073 zcmYk;3v|s#0>|;mJ0v6$B9e%kAZa2HSlrfI7cFs8H0s9MUZUF-_2N3~M*2Seamw27@BSy}^nd*FnVEa<{O3P2|7riV+2`g~ zA9rc@kc>8%*X{Y@nW{oovG)^DJu_5s$#XQ+;XVw?^_ zQ8$W2b=(~Fy=>G2^tPW5w)JtS2b_+JaRX`~(Xq_GM$(Kz8_Y)CXfkT*W}pifA+u|C zApgt}{%C+#P&4%aUHBL^un0QU10`Yxwnv`9Ot9*vs&9#7{`CaqG{}pXj`y(@Mm062 z1$IXbtO&KKrl8ia6!p7hs2SLf8u(t+04q^@;Ua2a)u``3LhZ4jc;;VI9v1IxvUof~ zJsCAc)tHF)F#&^{Ih!aIRUd$w@)@Yzy#U+dD$K`Ys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--|^( zuzI2&s{G*LTYp_ywQZe=J8W6IT_=CS)&(nM{z8VS!g1Ec{1E38P3tLglIYm(;`{9% zNBKjd3(2(Yzt@7Yykb9GF_}PqM`DPMj-?*@2> Z_T1^`P3iT0P*ZDKeqn%jZNZV|{{z$d6hr_3 diff --git a/locales/fr_FR/LC_MESSAGES/messages.po b/locales/fr_FR/LC_MESSAGES/messages.po index 0207223..ba20222 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-04-18 09:06+0200\n" -"PO-Revision-Date: 2008-04-18 09:07+0100\n" +"POT-Creation-Date: 2008-04-21 17:36+0200\n" +"PO-Revision-Date: 2008-04-21 17:37+0100\n" "Last-Translator: BenjaminHKB \n" "Language-Team: fr-FR \n" "MIME-Version: 1.0\n" @@ -50,23 +50,24 @@ msgstr "Tous les tags" msgid "User with username %s was not found" msgstr "L'utilisateur %s n'a pas été trouvé." -#: ../../../bookmarkcommondescriptionedit.php:36 +#: ../../../bookmarkcommondescriptionedit.php:35 #: ../../../tag2tagadd.php:31 #: ../../../tag2tagdelete.php:31 #: ../../../tag2tagedit.php:31 #: ../../../tagcommondescriptionedit.php:35 +#: ../../../tagedit.php:34 msgid "Permission denied." msgstr "Permission non accordée." -#: ../../../bookmarkcommondescriptionedit.php:46 +#: ../../../bookmarkcommondescriptionedit.php:45 msgid "Bookmark common description updated" msgstr "Description commune du signet mise à jour." -#: ../../../bookmarkcommondescriptionedit.php:49 +#: ../../../bookmarkcommondescriptionedit.php:48 msgid "Failed to update the bookmark common description" msgstr "Erreur dans la mise à jour de la description du signet" -#: ../../../bookmarkcommondescriptionedit.php:58 +#: ../../../bookmarkcommondescriptionedit.php:57 msgid "Edit Bookmark Common Description" msgstr "Editer la description commune du signet" @@ -125,49 +126,49 @@ msgstr "Erreur pendant l'enregistrement de votre signet." msgid "Save Changes" msgstr "Enregistrer les modifications" -#: ../../../functions.inc.php:97 +#: ../../../functions.inc.php:108 msgid "message_die() was called multiple times." msgstr "message_die() was called multiple times. ?" -#: ../../../functions.inc.php:109 +#: ../../../functions.inc.php:120 msgid "SQL Error" msgstr "Erreur SQL" -#: ../../../functions.inc.php:115 +#: ../../../functions.inc.php:126 msgid "Line" msgstr "Ligne" -#: ../../../functions.inc.php:115 +#: ../../../functions.inc.php:126 #: ../../../templates/importDelicious.tpl.php:8 #: ../../../templates/importNetscape.tpl.php:9 msgid "File" msgstr "Fichier" -#: ../../../functions.inc.php:121 +#: ../../../functions.inc.php:132 msgid "Information" msgstr "Information" -#: ../../../functions.inc.php:126 +#: ../../../functions.inc.php:137 msgid "Critical Information" msgstr "Information critique." -#: ../../../functions.inc.php:131 +#: ../../../functions.inc.php:142 msgid "An error occured" msgstr "Une erreur s'est produite." -#: ../../../functions.inc.php:134 +#: ../../../functions.inc.php:145 msgid "General Error" msgstr "Erreur générale." -#: ../../../functions.inc.php:142 +#: ../../../functions.inc.php:153 msgid "An critical error occured" msgstr "Une erreur critique s'est produite." -#: ../../../functions.inc.php:145 +#: ../../../functions.inc.php:156 msgid "Critical Error" msgstr "Erreur critique." -#: ../../../functions.inc.php:154 +#: ../../../functions.inc.php:165 msgid "DEBUG MODE" msgstr "Mode de débogage." @@ -466,7 +467,7 @@ msgid "Failed to update the tag common description" msgstr "Impossible de mettre à jour la description commune du tag" #: ../../../tagcommondescriptionedit.php:55 -#: ../../../templates/sidebar.block.tagactions.php:26 +#: ../../../templates/sidebar.block.tagactions.php:27 msgid "Edit Tag Common Description" msgstr "Editer la description commune du tag" @@ -483,16 +484,29 @@ msgstr "Impossible d'effacer le tag" msgid "Delete Tag" msgstr "Supprimer le tag" -#: ../../../tagrename.php:49 +#: ../../../tagedit.php:44 +msgid "Tag description updated" +msgstr "Description du tag mise à jour" + +#: ../../../tagedit.php:47 +msgid "Failed to update the tag description" +msgstr "Impossible de mettre à jour la description du tag" + +#: ../../../tagedit.php:54 +#: ../../../templates/sidebar.block.tagactions.php:25 +msgid "Edit Tag Description" +msgstr "Editer la description du tag" + +#: ../../../tagrename.php:50 msgid "Tag renamed" msgstr "Tag renommé" -#: ../../../tagrename.php:53 +#: ../../../tagrename.php:54 msgid "Failed to rename the tag" msgstr "Erreur dans le renommage du tag" -#: ../../../tagrename.php:60 -#: ../../../templates/sidebar.block.tagactions.php:11 +#: ../../../tagrename.php:61 +#: ../../../templates/sidebar.block.tagactions.php:10 msgid "Rename Tag" msgid_plural "Rename Tags" msgstr[0] "Renommer le tag" @@ -566,7 +580,7 @@ msgid "%1$s supports most of the del.icio msgstr "%1$s supporte la plupart de l'API del.icio.us." #: ../../../templates/bookmarkcommondescriptionedit.tpl.php:15 -#: ../../../templates/bookmarks.tpl.php:53 +#: ../../../templates/bookmarks.tpl.php:67 #: ../../../templates/editbookmark.tpl.php:34 msgid "Title" msgstr "Titre" @@ -576,6 +590,7 @@ msgstr "Titre" #: ../../../templates/editprofile.tpl.php:46 #: ../../../templates/profile.tpl.php:28 #: ../../../templates/tagcommondescriptionedit.tpl.php:13 +#: ../../../templates/tagedit.tpl.php:13 msgid "Description" msgstr "Description" @@ -586,6 +601,7 @@ msgstr "Dernière modification :" #: ../../../templates/bookmarkcommondescriptionedit.tpl.php:39 #: ../../../templates/tagcommondescriptionedit.tpl.php:32 +#: ../../../templates/tagedit.tpl.php:19 msgid "Update" msgstr "Mettre à jour" @@ -593,93 +609,94 @@ msgstr "Mettre à jour" #: ../../../templates/tag2tagadd.tpl.php:24 #: ../../../templates/tag2tagedit.tpl.php:38 #: ../../../templates/tagcommondescriptionedit.tpl.php:33 +#: ../../../templates/tagedit.tpl.php:20 #: ../../../templates/tagrename.tpl.php:25 msgid "Cancel" msgstr "Annuler" -#: ../../../templates/bookmarks.tpl.php:33 -#: ../../../templates/bookmarks.tpl.php:36 +#: ../../../templates/bookmarks.tpl.php:34 +#: ../../../templates/bookmarks.tpl.php:37 msgid "edit common description" msgstr "éditer la description commune" -#: ../../../templates/bookmarks.tpl.php:50 +#: ../../../templates/bookmarks.tpl.php:64 msgid "bookmark(s)" msgstr "signet(s)" -#: ../../../templates/bookmarks.tpl.php:51 +#: ../../../templates/bookmarks.tpl.php:65 #: ../../../templates/tags.tpl.php:10 #: ../../../templates/users.tpl.php:8 msgid "Sort by:" msgstr "Classer par :" -#: ../../../templates/bookmarks.tpl.php:52 +#: ../../../templates/bookmarks.tpl.php:66 msgid "Date" msgstr "Date" -#: ../../../templates/bookmarks.tpl.php:57 +#: ../../../templates/bookmarks.tpl.php:71 msgid "URL" msgstr "URL" -#: ../../../templates/bookmarks.tpl.php:67 -msgid "Bookmarks from other users for these tags" -msgstr "Signets des autres utilisateurs pour ces tags" +#: ../../../templates/bookmarks.tpl.php:81 +msgid "Bookmarks from other users for this tag" +msgstr "Signets des autres utilisateurs pour ce tag" -#: ../../../templates/bookmarks.tpl.php:72 -msgid "Only your bookmarks for these tags" -msgstr "Uniquement vos signets pour ces tags" +#: ../../../templates/bookmarks.tpl.php:86 +msgid "Only your bookmarks for this tag" +msgstr "Uniquement vos signets pour ce tag" -#: ../../../templates/bookmarks.tpl.php:115 +#: ../../../templates/bookmarks.tpl.php:129 msgid "Edit" msgstr "Editer" -#: ../../../templates/bookmarks.tpl.php:115 +#: ../../../templates/bookmarks.tpl.php:129 msgid "Delete" msgstr "Supprimer" -#: ../../../templates/bookmarks.tpl.php:121 +#: ../../../templates/bookmarks.tpl.php:135 msgid "by" msgstr "par" -#: ../../../templates/bookmarks.tpl.php:133 +#: ../../../templates/bookmarks.tpl.php:147 #, fuzzy, php-format msgid " and %s1 other%s" msgstr " et les autres %s" -#: ../../../templates/bookmarks.tpl.php:136 +#: ../../../templates/bookmarks.tpl.php:150 #, fuzzy, php-format msgid " and %2$s%1$s others%3$s" msgstr " et les autres %s" -#: ../../../templates/bookmarks.tpl.php:145 +#: ../../../templates/bookmarks.tpl.php:159 msgid "Copy" msgstr "Copier" -#: ../../../templates/bookmarks.tpl.php:204 -#: ../../../templates/bookmarks.tpl.php:210 +#: ../../../templates/bookmarks.tpl.php:218 +#: ../../../templates/bookmarks.tpl.php:224 msgid "First" msgstr "Première" -#: ../../../templates/bookmarks.tpl.php:205 -#: ../../../templates/bookmarks.tpl.php:211 +#: ../../../templates/bookmarks.tpl.php:219 +#: ../../../templates/bookmarks.tpl.php:225 msgid "Previous" msgstr "Précédent" -#: ../../../templates/bookmarks.tpl.php:218 -#: ../../../templates/bookmarks.tpl.php:221 +#: ../../../templates/bookmarks.tpl.php:232 +#: ../../../templates/bookmarks.tpl.php:235 msgid "Next" msgstr "Suivant" -#: ../../../templates/bookmarks.tpl.php:219 -#: ../../../templates/bookmarks.tpl.php:222 +#: ../../../templates/bookmarks.tpl.php:233 +#: ../../../templates/bookmarks.tpl.php:236 msgid "Last" msgstr "Dernière" -#: ../../../templates/bookmarks.tpl.php:224 +#: ../../../templates/bookmarks.tpl.php:238 #, php-format msgid "Page %d of %d" msgstr "Page %d de %d" -#: ../../../templates/bookmarks.tpl.php:226 +#: ../../../templates/bookmarks.tpl.php:240 msgid "No bookmarks available" msgstr "Pas de signets disponibles." @@ -1005,23 +1022,23 @@ msgstr "Tags récents" msgid "Related Tags" msgstr "Tags en relation" -#: ../../../templates/sidebar.block.search.php:16 +#: ../../../templates/sidebar.block.search.php:15 msgid "Last Searches" msgstr "Dernières recherches" -#: ../../../templates/sidebar.block.search.php:25 +#: ../../../templates/sidebar.block.search.php:24 msgid "Number of bookmarks for this query" msgstr "Nombre de signets pour cette recherche" -#: ../../../templates/sidebar.block.tagactions.php:28 +#: ../../../templates/sidebar.block.tagactions.php:29 msgid "Create a link to another tag" msgstr "Créer un lien vers un autre tag" -#: ../../../templates/sidebar.block.users.php:14 +#: ../../../templates/sidebar.block.users.php:13 msgid "Last Users" msgstr "Derniers utilisateurs" -#: ../../../templates/sidebar.block.users.php:23 +#: ../../../templates/sidebar.block.users.php:22 #: ../../../templates/users.tpl.php:17 msgid "bookmarks" msgstr "signets" diff --git a/locales/messages.po b/locales/messages.po index 248d1e1..2dc98f1 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-04-18 09:06+0200\n" +"POT-Creation-Date: 2008-04-21 17:36+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -41,21 +41,21 @@ msgstr "" msgid "User with username %s was not found" msgstr "" -#: ../../../bookmarkcommondescriptionedit.php:36 ../../../tag2tagadd.php:31 +#: ../../../bookmarkcommondescriptionedit.php:35 ../../../tag2tagadd.php:31 #: ../../../tag2tagdelete.php:31 ../../../tag2tagedit.php:31 -#: ../../../tagcommondescriptionedit.php:35 +#: ../../../tagcommondescriptionedit.php:35 ../../../tagedit.php:34 msgid "Permission denied." msgstr "" -#: ../../../bookmarkcommondescriptionedit.php:46 +#: ../../../bookmarkcommondescriptionedit.php:45 msgid "Bookmark common description updated" msgstr "" -#: ../../../bookmarkcommondescriptionedit.php:49 +#: ../../../bookmarkcommondescriptionedit.php:48 msgid "Failed to update the bookmark common description" msgstr "" -#: ../../../bookmarkcommondescriptionedit.php:58 +#: ../../../bookmarkcommondescriptionedit.php:57 msgid "Edit Bookmark Common Description" msgstr "" @@ -111,48 +111,48 @@ msgstr "" msgid "Save Changes" msgstr "" -#: ../../../functions.inc.php:97 +#: ../../../functions.inc.php:108 msgid "message_die() was called multiple times." msgstr "" -#: ../../../functions.inc.php:109 +#: ../../../functions.inc.php:120 msgid "SQL Error" msgstr "" -#: ../../../functions.inc.php:115 +#: ../../../functions.inc.php:126 msgid "Line" msgstr "" -#: ../../../functions.inc.php:115 ../../../templates/importDelicious.tpl.php:8 +#: ../../../functions.inc.php:126 ../../../templates/importDelicious.tpl.php:8 #: ../../../templates/importNetscape.tpl.php:9 msgid "File" msgstr "" -#: ../../../functions.inc.php:121 +#: ../../../functions.inc.php:132 msgid "Information" msgstr "" -#: ../../../functions.inc.php:126 +#: ../../../functions.inc.php:137 msgid "Critical Information" msgstr "" -#: ../../../functions.inc.php:131 +#: ../../../functions.inc.php:142 msgid "An error occured" msgstr "" -#: ../../../functions.inc.php:134 +#: ../../../functions.inc.php:145 msgid "General Error" msgstr "" -#: ../../../functions.inc.php:142 +#: ../../../functions.inc.php:153 msgid "An critical error occured" msgstr "" -#: ../../../functions.inc.php:145 +#: ../../../functions.inc.php:156 msgid "Critical Error" msgstr "" -#: ../../../functions.inc.php:154 +#: ../../../functions.inc.php:165 msgid "DEBUG MODE" msgstr "" @@ -442,7 +442,7 @@ msgid "Failed to update the tag common description" msgstr "" #: ../../../tagcommondescriptionedit.php:55 -#: ../../../templates/sidebar.block.tagactions.php:26 +#: ../../../templates/sidebar.block.tagactions.php:27 msgid "Edit Tag Common Description" msgstr "" @@ -459,16 +459,28 @@ msgstr "" msgid "Delete Tag" msgstr "" -#: ../../../tagrename.php:49 +#: ../../../tagedit.php:44 +msgid "Tag description updated" +msgstr "" + +#: ../../../tagedit.php:47 +msgid "Failed to update the tag description" +msgstr "" + +#: ../../../tagedit.php:54 ../../../templates/sidebar.block.tagactions.php:25 +msgid "Edit Tag Description" +msgstr "" + +#: ../../../tagrename.php:50 msgid "Tag renamed" msgstr "" -#: ../../../tagrename.php:53 +#: ../../../tagrename.php:54 msgid "Failed to rename the tag" msgstr "" -#: ../../../tagrename.php:60 -#: ../../../templates/sidebar.block.tagactions.php:11 +#: ../../../tagrename.php:61 +#: ../../../templates/sidebar.block.tagactions.php:10 msgid "Rename Tag" msgid_plural "Rename Tags" msgstr[0] "" @@ -549,7 +561,7 @@ msgid "" msgstr "" #: ../../../templates/bookmarkcommondescriptionedit.tpl.php:15 -#: ../../../templates/bookmarks.tpl.php:53 +#: ../../../templates/bookmarks.tpl.php:67 #: ../../../templates/editbookmark.tpl.php:34 msgid "Title" msgstr "" @@ -559,6 +571,7 @@ msgstr "" #: ../../../templates/editprofile.tpl.php:46 #: ../../../templates/profile.tpl.php:28 #: ../../../templates/tagcommondescriptionedit.tpl.php:13 +#: ../../../templates/tagedit.tpl.php:13 msgid "Description" msgstr "" @@ -569,6 +582,7 @@ msgstr "" #: ../../../templates/bookmarkcommondescriptionedit.tpl.php:39 #: ../../../templates/tagcommondescriptionedit.tpl.php:32 +#: ../../../templates/tagedit.tpl.php:19 msgid "Update" msgstr "" @@ -576,92 +590,93 @@ msgstr "" #: ../../../templates/tag2tagadd.tpl.php:24 #: ../../../templates/tag2tagedit.tpl.php:38 #: ../../../templates/tagcommondescriptionedit.tpl.php:33 +#: ../../../templates/tagedit.tpl.php:20 #: ../../../templates/tagrename.tpl.php:25 msgid "Cancel" msgstr "" -#: ../../../templates/bookmarks.tpl.php:33 -#: ../../../templates/bookmarks.tpl.php:36 +#: ../../../templates/bookmarks.tpl.php:34 +#: ../../../templates/bookmarks.tpl.php:37 msgid "edit common description" msgstr "" -#: ../../../templates/bookmarks.tpl.php:50 +#: ../../../templates/bookmarks.tpl.php:64 msgid "bookmark(s)" msgstr "" -#: ../../../templates/bookmarks.tpl.php:51 ../../../templates/tags.tpl.php:10 +#: ../../../templates/bookmarks.tpl.php:65 ../../../templates/tags.tpl.php:10 #: ../../../templates/users.tpl.php:8 msgid "Sort by:" msgstr "" -#: ../../../templates/bookmarks.tpl.php:52 +#: ../../../templates/bookmarks.tpl.php:66 msgid "Date" msgstr "" -#: ../../../templates/bookmarks.tpl.php:57 +#: ../../../templates/bookmarks.tpl.php:71 msgid "URL" msgstr "" -#: ../../../templates/bookmarks.tpl.php:67 -msgid "Bookmarks from other users for these tags" +#: ../../../templates/bookmarks.tpl.php:81 +msgid "Bookmarks from other users for this tag" msgstr "" -#: ../../../templates/bookmarks.tpl.php:72 -msgid "Only your bookmarks for these tags" +#: ../../../templates/bookmarks.tpl.php:86 +msgid "Only your bookmarks for this tag" msgstr "" -#: ../../../templates/bookmarks.tpl.php:115 +#: ../../../templates/bookmarks.tpl.php:129 msgid "Edit" msgstr "" -#: ../../../templates/bookmarks.tpl.php:115 +#: ../../../templates/bookmarks.tpl.php:129 msgid "Delete" msgstr "" -#: ../../../templates/bookmarks.tpl.php:121 +#: ../../../templates/bookmarks.tpl.php:135 msgid "by" msgstr "" -#: ../../../templates/bookmarks.tpl.php:133 +#: ../../../templates/bookmarks.tpl.php:147 #, php-format msgid " and %s1 other%s" msgstr "" -#: ../../../templates/bookmarks.tpl.php:136 +#: ../../../templates/bookmarks.tpl.php:150 #, php-format msgid " and %2$s%1$s others%3$s" msgstr "" -#: ../../../templates/bookmarks.tpl.php:145 +#: ../../../templates/bookmarks.tpl.php:159 msgid "Copy" msgstr "" -#: ../../../templates/bookmarks.tpl.php:204 -#: ../../../templates/bookmarks.tpl.php:210 +#: ../../../templates/bookmarks.tpl.php:218 +#: ../../../templates/bookmarks.tpl.php:224 msgid "First" msgstr "" -#: ../../../templates/bookmarks.tpl.php:205 -#: ../../../templates/bookmarks.tpl.php:211 +#: ../../../templates/bookmarks.tpl.php:219 +#: ../../../templates/bookmarks.tpl.php:225 msgid "Previous" msgstr "" -#: ../../../templates/bookmarks.tpl.php:218 -#: ../../../templates/bookmarks.tpl.php:221 +#: ../../../templates/bookmarks.tpl.php:232 +#: ../../../templates/bookmarks.tpl.php:235 msgid "Next" msgstr "" -#: ../../../templates/bookmarks.tpl.php:219 -#: ../../../templates/bookmarks.tpl.php:222 +#: ../../../templates/bookmarks.tpl.php:233 +#: ../../../templates/bookmarks.tpl.php:236 msgid "Last" msgstr "" -#: ../../../templates/bookmarks.tpl.php:224 +#: ../../../templates/bookmarks.tpl.php:238 #, php-format msgid "Page %d of %d" msgstr "" -#: ../../../templates/bookmarks.tpl.php:226 +#: ../../../templates/bookmarks.tpl.php:240 msgid "No bookmarks available" msgstr "" @@ -1001,23 +1016,23 @@ msgstr "" msgid "Related Tags" msgstr "" -#: ../../../templates/sidebar.block.search.php:16 +#: ../../../templates/sidebar.block.search.php:15 msgid "Last Searches" msgstr "" -#: ../../../templates/sidebar.block.search.php:25 +#: ../../../templates/sidebar.block.search.php:24 msgid "Number of bookmarks for this query" msgstr "" -#: ../../../templates/sidebar.block.tagactions.php:28 +#: ../../../templates/sidebar.block.tagactions.php:29 msgid "Create a link to another tag" msgstr "" -#: ../../../templates/sidebar.block.users.php:14 +#: ../../../templates/sidebar.block.users.php:13 msgid "Last Users" msgstr "" -#: ../../../templates/sidebar.block.users.php:23 +#: ../../../templates/sidebar.block.users.php:22 #: ../../../templates/users.tpl.php:17 msgid "bookmarks" msgstr "" diff --git a/services/tagservice.php b/services/tagservice.php new file mode 100644 index 0000000..fbb7fa3 --- /dev/null +++ b/services/tagservice.php @@ -0,0 +1,88 @@ +db =& $db; + $this->tablename = $GLOBALS['tableprefix'] .'tags'; + } + + function getDescription($tag, $uId) { + $query = 'SELECT tag, uId, tDescription'; + $query.= ' FROM '.$this->getTableName(); + $query.= ' WHERE tag = "'.$tag.'"'; + $query.= ' AND uId = "'.$uId.'"'; + + if (!($dbresult = & $this->db->sql_query($query))) { + message_die(GENERAL_ERROR, 'Could not get tag description', '', __LINE__, __FILE__, $query, $this->db); + return false; + } + + if ($row =& $this->db->sql_fetchrow($dbresult)) { + return $row; + } else { + return array(); + } + } + + function getAllDescriptions($tag) { + $query = 'SELECT tag, uId, tDescription'; + $query.= ' FROM '.$this->getTableName(); + $query.= ' WHERE tag = "'.$tag.'"'; + + if (!($dbresult = & $this->db->sql_query($query))) { + message_die(GENERAL_ERROR, 'Could not get tag description', '', __LINE__, __FILE__, $query, $this->db); + return false; + } + + return $this->db->sql_fetchrowset($dbresult); + } + + function updateDescription($tag, $uId, $desc) { + if(count($this->getDescription($tag, $uId))>0) { + $query = 'UPDATE '.$this->getTableName(); + $query.= ' SET tDescription="'.$this->db->sql_escape($desc).'"'; + $query.= ' WHERE tag="'.$tag.'" AND uId="'.$uId.'"'; + } else { + $values = array('tag'=>$tag, 'uId'=>$uId, 'tDescription'=>$desc); + $query = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values); + } + + $this->db->sql_transaction('begin'); + if (!($dbresult = & $this->db->sql_query($query))) { + $this->db->sql_transaction('rollback'); + message_die(GENERAL_ERROR, 'Could not delete bookmarks', '', __LINE__, __FILE__, $query, $this->db); + return false; + } + $this->db->sql_transaction('commit'); + return true; + } + + function renameTag($uId, $oldName, $newName) { + $query = 'UPDATE `'. $this->getTableName() .'`'; + $query.= ' SET tag="'.$newName.'"'; + $query.= ' WHERE tag="'.$oldName.'"'; + $query.= ' AND uId="'.$uId.'"'; + $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; } +} +?> diff --git a/tagedit.php b/tagedit.php new file mode 100644 index 0000000..aca0607 --- /dev/null +++ b/tagedit.php @@ -0,0 +1,61 @@ +getCurrentUser(); + +//permissions +if($logged_on_user == null) { + $tplVars['error'] = T_('Permission denied.'); + $templateservice->loadTemplate('error.500.tpl', $tplVars); + exit(); +} + +if ($_POST['confirm']) { + + if ( strlen($tag)>0 && + $tagservice->updateDescription($tag, $logged_on_user['uId'], $_POST['description']) + ) { + $tplVars['msg'] = T_('Tag description updated'); + header('Location: '. $_POST['referrer']); + } else { + $tplVars['error'] = T_('Failed to update the tag description'); + $template = 'error.500.tpl'; + } +} elseif ($_POST['cancel']) { + $logged_on_user = $userservice->getCurrentUser(); + header('Location: '. $_POST['referrer']); +} else { + $tplVars['subtitle'] = T_('Edit Tag Description') .': '. $tag; + $tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag; + $tplVars['referrer'] = $_SERVER['HTTP_REFERER']; + $tplVars['tag'] = $tag; + $tplVars['description'] = $tagservice->getDescription($tag, $logged_on_user['uId']); +} +$templateservice->loadTemplate($template, $tplVars); +?> diff --git a/tagrename.php b/tagrename.php index 23cb00b..de0f77f 100644 --- a/tagrename.php +++ b/tagrename.php @@ -43,6 +43,7 @@ if ($_POST['confirm']) { if ( !is_null($old) && !is_null($new) && + $tagservice->renameTag($userservice->getCurrentUserId(), $old, $new) && $b2tservice->renameTag($userservice->getCurrentUserId(), $old, $new) && $tag2tagservice->renameTag($userservice->getCurrentUserId(), $old, $new) ) { diff --git a/templates/bookmarks.tpl.php b/templates/bookmarks.tpl.php index cc4743c..dfcf1c7 100644 --- a/templates/bookmarks.tpl.php +++ b/templates/bookmarks.tpl.php @@ -1,6 +1,7 @@ getCurrentUserId(); @@ -41,6 +42,19 @@ if($logged_on_userid>0) { +getUserByUsername($user); +/* Private tag description */ +if(isset($currenttag) && strlen($user)>0 && $tagservice->getDescription($currenttag, $userObject['uId'])):?> +

+getDescription($currenttag, $userObject['uId']); + echo nl2br(filter($description['tDescription'])); +?> +

+ + 0) { ?> +
+ + + + + + + + + + +
+ + +
+

+ + +
+ +
+
+ +includeTemplate($GLOBALS['bottom_include']); +?> diff --git a/tests/tagsTest.php b/tests/tagsTest.php new file mode 100644 index 0000000..d2ed569 --- /dev/null +++ b/tests/tagsTest.php @@ -0,0 +1,76 @@ +ts =& ServiceFactory::getServiceInstance('TagService'); + $this->ts->deleteAll(); + $this->us =& ServiceFactory::getServiceInstance('UserService'); + $this->bs =& ServiceFactory::getServiceInstance('BookmarkService'); + $this->bs->deleteAll(); + $this->b2ts =& ServiceFactory::getServiceInstance('Bookmark2TagService'); + $this->b2ts->deleteAll(); + $this->tts =& ServiceFactory::getServiceInstance('Tag2TagService'); + $this->tts->deleteAll(); + $this->tsts =& ServiceFactory::getServiceInstance('TagStatService'); + $this->tsts->deleteAll(); + } + + public function testTagDescriptions() + { + $ts = $this->ts; + + $desc = $ts->getAllDescriptions('tag1'); + $this->assertSame(array(), $desc); + + $desc = $ts->getDescription('tag1', 1); // user 1 + $this->assertSame(array(), $desc); + + $desc1 = "test description"; + $ts->updateDescription('tag1', 1, $desc1); // first desc + $desc = $ts->getDescription('tag1', 1); + $this->assertEquals(array('tag'=>'tag1', 'uId'=>1, 'tDescription'=>$desc1), $desc); + + $desc1 = "&é\"'(-è_çà)=´~#'#{{[\\\\[||`\^\^@^@}¹²¡×¿ ?./§µ%"; + $ts->updateDescription('tag1', 1, $desc1); // update desc + $desc = $ts->getDescription('tag1', 1); + $this->assertEquals(array('tag'=>'tag1', 'uId'=>1, 'tDescription'=>$desc1), $desc); + + $desc2 = "æâ€êþÿûîîôôöŀï'üð’‘ßä«≤»©»  ↓¿×÷¡¹²³"; + $ts->updateDescription('tag1', 2, $desc2); // user 2 + $desc = $ts->getDescription('tag1', 2); + $this->assertEquals(array('tag'=>'tag1', 'uId'=>2, 'tDescription'=>$desc2), $desc); + + $desc = $ts->getAllDescriptions('tag1'); + $this->assertEquals($desc, array(array('tag'=>'tag1', 'uId'=>1, 'tDescription'=>$desc1), array('tag'=>'tag1', 'uId'=>2, 'tDescription'=>$desc2))); + + } + + public function testRenameFunction() + { + $ts = $this->ts; + + $ts->updateDescription('tag1', 10, 'xxx'); + $ts->renameTag(10, 'tag1', 'tag2'); + $desc = $ts->getDescription('tag1', 10); + $this->assertSame(array(), $desc); + $desc = $ts->getDescription('tag2', 10); + $this->assertEquals(array('tag'=>'tag2', 'uId'=>10, 'tDescription'=>'xxx'), $desc); + + } + +} +?>