diff options
| -rw-r--r-- | locales/fr_FR/LC_MESSAGES/messages.mo | bin | 19568 -> 19802 bytes | |||
| -rw-r--r-- | locales/fr_FR/LC_MESSAGES/messages.po | 129 | ||||
| -rw-r--r-- | locales/messages.po | 123 | ||||
| -rw-r--r-- | services/tagservice.php | 88 | ||||
| -rw-r--r-- | tagedit.php | 61 | ||||
| -rw-r--r-- | tagrename.php | 1 | ||||
| -rw-r--r-- | templates/bookmarks.tpl.php | 18 | ||||
| -rw-r--r-- | templates/sidebar.block.tagactions.php | 2 | ||||
| -rw-r--r-- | templates/tagedit.tpl.php | 35 | ||||
| -rw-r--r-- | tests/tagsTest.php | 76 | 
10 files changed, 421 insertions, 112 deletions
| diff --git a/locales/fr_FR/LC_MESSAGES/messages.mo b/locales/fr_FR/LC_MESSAGES/messages.moBinary files differ index fb6404f..6012d4c 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 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 <benjamin.huynh-kim-bang@loria.fr>\n"  "Language-Team: fr-FR <toony.sf@chezouam.net>\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 <a href=\"http://del.icio.us/doc/api\">del.icio  msgstr "%1$s supporte la plupart de l'<a href=\"http://del.icio.us/doc/api\"><abbr title=\"Application Programming Interface\">API</abbr> del.icio.us</a>."  #: ../../../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 <EMAIL@ADDRESS>\n"  "Language-Team: LANGUAGE <LL@li.org>\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 @@ +<?php +class TagService { +    var $db; +    var $tablename; + +    function &getInstance(&$db) { +        static $instance; +        if (!isset($instance)) +            $instance =& new TagService($db); +        return $instance; +    } + +    function TagService(&$db) { +        $this->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 @@ +<?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 +***************************************************************************/ + +require_once('header.inc.php'); +$tagservice       = & ServiceFactory :: getServiceInstance('TagService'); +$templateservice  = & ServiceFactory :: getServiceInstance('TemplateService'); +$userservice      = & ServiceFactory :: getServiceInstance('UserService'); + +list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']); +$template   = 'tagedit.tpl'; + +$logged_on_user = $userservice->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 @@  <?php  $userservice =& ServiceFactory::getServiceInstance('UserService');  $bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService'); +$tagservice =& ServiceFactory::getServiceInstance('TagService');  $cdservice =& ServiceFactory::getServiceInstance('CommonDescriptionService');  $logged_on_userid = $userservice->getCurrentUserId(); @@ -41,6 +42,19 @@ if($logged_on_userid>0) {  <?php endif ?> +<?php +$userObject = $userservice->getUserByUsername($user); +/* Private tag description */ +if(isset($currenttag) && strlen($user)>0 && $tagservice->getDescription($currenttag, $userObject['uId'])):?> +<p class="commondescription"> +<?php + +    $description = $tagservice->getDescription($currenttag, $userObject['uId']); +    echo nl2br(filter($description['tDescription'])); +?> +</p> +<?php endif ?> +  <?php if (count($bookmarks) > 0) { ?>  <script type="text/javascript">  window.onload = playerLoad; @@ -64,12 +78,12 @@ window.onload = playerLoad;  	if(isset($user)) {  	    echo ' - ';  	    echo '<a href="'. createURL('tags', $currenttag) .'">'; -	    echo T_('Bookmarks from other users for these tags').'</a>'; +	    echo T_('Bookmarks from other users for this tag').'</a>';  	    //echo T_(' for these tags');   	} else if($logged_on_userid>0){  	    echo ' - ';  	    echo '<a href="'. createURL('bookmarks', $currentUsername.'/'.$currenttag) .'">'; -	    echo T_('Only your bookmarks for these tags').'</a>'; +	    echo T_('Only your bookmarks for this tag').'</a>';  	    //echo T_(' for these tags');  	}      } diff --git a/templates/sidebar.block.tagactions.php b/templates/sidebar.block.tagactions.php index 43d4922..fd13d98 100644 --- a/templates/sidebar.block.tagactions.php +++ b/templates/sidebar.block.tagactions.php @@ -10,6 +10,7 @@ if ($userservice->isLoggedOn()) {          $renametext = T_ngettext('Rename Tag', 'Rename Tags', count($tags));          $renamelink = createURL('tagrename', $currenttag);          $deletelink = createURL('tagdelete', $currenttag); +        $tagdesclink = createURL('tagedit', $currenttag);          $commondesclink = createURL('tagcommondescriptionedit', $currenttag);          $addtag2taglinklink = createURL('tag2tagadd', $currenttag);  ?> @@ -21,6 +22,7 @@ if ($userservice->isLoggedOn()) {          <?php if (count($tags) == 1): ?>          <li><a href="<?php echo $deletelink; ?>"><?php echo T_('Delete Tag') ?></a></li>          <?php endif; ?> +        <li><a href="<?php echo $tagdesclink; ?>"><?php echo T_('Edit Tag Description') ?></a></li>          <?php if ($GLOBALS['enableCommonTagDescription']): ?>          <li><a href="<?php echo $commondesclink; ?>"><?php echo T_('Edit Tag Common Description') ?></a></li>  	<?php endif; ?> diff --git a/templates/tagedit.tpl.php b/templates/tagedit.tpl.php new file mode 100644 index 0000000..fbfe48c --- /dev/null +++ b/templates/tagedit.tpl.php @@ -0,0 +1,35 @@ +<?php +$this->includeTemplate($GLOBALS['top_include']); +$userservice      = & ServiceFactory :: getServiceInstance('UserService'); +?> +<script type="text/javascript"> +window.onload = function() { +    document.getElementById("description").focus(); +} +</script> +<form action="<?php echo $formaction; ?>" method="post"> +<table> +<tr> +    <th align="left"><?php echo T_('Description'); ?></th> +    <td><textarea name="description" cols="75" rows="10"><?php echo $description['tDescription']; ?></textarea></td> +</tr> +<tr> +    <td></td> +    <td> +    <input type="submit" name="confirm" value="<?php echo T_('Update'); ?>" /> +    <input type="submit" name="cancel" value="<?php echo T_('Cancel'); ?>" /> +    </td> +    <td></td> +</tr> +</table> +</p> + +<?php if (isset($referrer)): ?> +<div><input type="hidden" name="referrer" value="<?php echo $referrer; ?>" /></div> +<?php endif; ?> +<div><input type="hidden" name="tag" value="<?php echo $tag; ?>" /></div> +</form> + +<?php +$this->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 @@ +<?php +require_once 'PHPUnit/Framework.php'; + +/* +To launch this test, type the following line into a shell +at the root of the scuttlePlus directory : +     phpunit TagsTest tests/tagsTest.php +*/ + +class TagsTest extends PHPUnit_Framework_TestCase +{ +    protected $ts; +  +    protected function setUp() +    { +        global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix; +	require_once('./header.inc.php'); + +	$this->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);	 +	 +    } + +} +?> | 
