From 484de2408fc42d8f5a25af53df159b2baa42c334 Mon Sep 17 00:00:00 2001
From: mensonge
Date: Wed, 13 Feb 2008 17:34:18 +0000
Subject: [PATCH] new feature: collaborative description for tags and bookmarks
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@36 b3834d28-1941-0410-a4f8-b48e95affb8f
---
bookmarkcommondescriptionedit.php | 65 ++++++++
config.inc.php.example | 7 +
locales/fr_FR/LC_MESSAGES/messages.mo | Bin 17836 -> 18380 bytes
locales/fr_FR/LC_MESSAGES/messages.po | 143 ++++++++++++------
locales/messages.po | 136 +++++++++++------
scuttle.css | 7 +
services/commondescriptionservice.php | 139 +++++++++++++++++
tables.sql | 19 +++
tagcommondescriptionedit.php | 62 ++++++++
.../bookmarkcommondescriptionedit.tpl.php | 55 +++++++
templates/bookmarks.tpl.php | 32 +++-
templates/sidebar.block.tagactions.php | 8 +-
templates/tagcommondescriptionedit.tpl.php | 48 ++++++
templates/tags.tpl.php | 3 +
tests/LAUNCH_TESTS | 7 +
tests/commonDescriptionTest.php | 96 ++++++++++++
16 files changed, 731 insertions(+), 96 deletions(-)
create mode 100644 bookmarkcommondescriptionedit.php
create mode 100644 services/commondescriptionservice.php
create mode 100644 tagcommondescriptionedit.php
create mode 100644 templates/bookmarkcommondescriptionedit.tpl.php
create mode 100644 templates/tagcommondescriptionedit.tpl.php
create mode 100644 tests/LAUNCH_TESTS
create mode 100644 tests/commonDescriptionTest.php
diff --git a/bookmarkcommondescriptionedit.php b/bookmarkcommondescriptionedit.php
new file mode 100644
index 0000000..2abdf4f
--- /dev/null
+++ b/bookmarkcommondescriptionedit.php
@@ -0,0 +1,65 @@
+getCurrentUser();
+
+//permissions
+if($logged_on_user == null) {
+ $tplVars['error'] = T_('Permission denied.');
+ $templateservice->loadTemplate('error.500.tpl', $tplVars);
+ exit();
+}
+
+if ($_POST['confirm']) {
+
+ if (strlen($hash)>0 &&
+ $cdservice->addBookmarkDescription($_POST['hash'], stripslashes($_POST['title']), stripslashes($_POST['description']), $logged_on_user['uId'], time())
+ ) {
+ $tplVars['msg'] = T_('Bookmark common description updated');
+ header('Location: '. $_POST['referrer']);
+ } else {
+ $tplVars['error'] = T_('Failed to update the bookmark common description');
+ $template = 'error.500.tpl';
+ }
+} elseif ($_POST['cancel']) {
+ $logged_on_user = $userservice->getCurrentUser();
+ header('Location: '. $_POST['referrer']);
+} else {
+ $bkm = $bookmarkservice->getBookmarkByHash($hash);
+
+ $tplVars['subtitle'] = T_('Edit Bookmark Common Description') .': '. $bkm['bAddress'];
+ $tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $hash;
+ $tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
+ $tplVars['hash'] = $hash;
+ $tplVars['description'] = $cdservice->getLastBookmarkDescription($hash);
+}
+$templateservice->loadTemplate($template, $tplVars);
+?>
diff --git a/config.inc.php.example b/config.inc.php.example
index ce7bcde..4c76c9d 100644
--- a/config.inc.php.example
+++ b/config.inc.php.example
@@ -87,6 +87,10 @@ $dbname = 'scuttle';
#
# antispamQuestion: A question to avoid spam
# antispamAnswer: The answer to the question (users have to put exactly the same answer)
+#
+# enableCommonTagDescription : true or false
+# enableCommonBookmarkDescription : true or false
+#
######################################################################
$sitename = 'SemanticScuttle';
@@ -124,5 +128,8 @@ $reservedusers = array('all', 'watchlist');
$antispamQuestion = 'Put here the answer to 1 + 2 + 3';
$antispamAnswer = '6';
+$enableCommonTagDescription = true;
+$enableCommonBookmarkDescription = true;
+
include_once('debug.inc.php');
?>
diff --git a/locales/fr_FR/LC_MESSAGES/messages.mo b/locales/fr_FR/LC_MESSAGES/messages.mo
index 46db404aa4c1a60dc572640649a665639c28d720..5f0ff253d328b5fbab16c890ba94201371d701a5 100644
GIT binary patch
delta 4854
zcmaji33OD|0mkv0l~9&I!X6+4AwXC{Lf8x;0m2d+P_b$X(%_H`Ss)9^!~g+@04{`z
zQI>*I#8?8zT8E`9v0_-ndek0|R1VbI7QxdVREkAgYw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Nj`a=oFs{)5m8AY{H+PS(|h7Oq!X!0=92y-i7X>?$RH9y>JsN+KKx`qQ8`TN
zkdMd;(w2-O?a5>^f@G3~MCCJVS_KYDKXa*{5PrG\n"
"Language-Team: fr-FR \n"
"MIME-Version: 1.0\n"
@@ -50,6 +50,19 @@ msgstr "Tous les tags"
msgid "User with username %s was not found"
msgstr "L'utilisateur %s n'a pas été trouvé."
+#: ../../../bookmarkcommondescriptionedit.php:38
+msgid "Bookmark common description updated"
+msgstr "Description commune du signet mise à jour."
+
+#: ../../../bookmarkcommondescriptionedit.php:41
+#, fuzzy
+msgid "Failed to update the bookmark common description"
+msgstr "Erreur dans la suppression du signet"
+
+#: ../../../bookmarkcommondescriptionedit.php:50
+msgid "Edit Bookmark Common Description"
+msgstr "Editer la description commune du signet"
+
#: ../../../bookmarks.php:95
#: ../../../edit.php:44
msgid "Your bookmark must have a title and an address"
@@ -435,6 +448,20 @@ msgstr "Impossible d'effacer le lien"
msgid "Delete Link Between Tags"
msgstr "Effacer un lien entre tags"
+#: ../../../tagcommondescriptionedit.php:37
+msgid "Tag common description updated"
+msgstr "Editer la description commune du tag"
+
+#: ../../../tagcommondescriptionedit.php:40
+#, fuzzy
+msgid "Failed to update the tag common description"
+msgstr "Impossible d'effacer le tag"
+
+#: ../../../tagcommondescriptionedit.php:47
+#: ../../../templates/sidebar.block.tagactions.php:24
+msgid "Edit Tag Common Description"
+msgstr "Editer la description commune du tag"
+
#: ../../../tagdelete.php:31
msgid "Tag deleted"
msgstr "Tag effacé"
@@ -444,7 +471,7 @@ msgid "Failed to delete the tag"
msgstr "Impossible d'effacer le tag"
#: ../../../tagdelete.php:44
-#: ../../../templates/sidebar.block.tagactions.php:19
+#: ../../../templates/sidebar.block.tagactions.php:22
msgid "Delete Tag"
msgstr "Supprimer le tag"
@@ -457,7 +484,7 @@ msgid "Failed to rename the tag"
msgstr "Erreur dans la suppression du tag"
#: ../../../tagrename.php:57
-#: ../../../templates/sidebar.block.tagactions.php:9
+#: ../../../templates/sidebar.block.tagactions.php:11
msgid "Rename Tag"
msgid_plural "Rename Tags"
msgstr[0] "Renommer le tag"
@@ -523,77 +550,108 @@ msgstr "%s est basé sur un
msgid "%1$s supports most of the del.icio.us API. 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'del.icio.us API."
-#: ../../../templates/bookmarks.tpl.php:17
-#: ../../../templates/tags.tpl.php:7
-#: ../../../templates/users.tpl.php:8
-msgid "Sort by:"
-msgstr "Classer par :"
-
-#: ../../../templates/bookmarks.tpl.php:18
-msgid "Date"
-msgstr "Date"
-
-#: ../../../templates/bookmarks.tpl.php:19
+#: ../../../templates/bookmarkcommondescriptionedit.tpl.php:15
+#: ../../../templates/bookmarks.tpl.php:48
#: ../../../templates/editbookmark.tpl.php:34
msgid "Title"
msgstr "Titre"
-#: ../../../templates/bookmarks.tpl.php:23
+#: ../../../templates/bookmarkcommondescriptionedit.tpl.php:20
+#: ../../../templates/editbookmark.tpl.php:39
+#: ../../../templates/editprofile.tpl.php:44
+#: ../../../templates/profile.tpl.php:28
+#: ../../../templates/tagcommondescriptionedit.tpl.php:13
+msgid "Description"
+msgstr "Description"
+
+#: ../../../templates/bookmarkcommondescriptionedit.tpl.php:28
+#: ../../../templates/tagcommondescriptionedit.tpl.php:21
+msgid "Last modification: "
+msgstr "Dernière modification :"
+
+#: ../../../templates/bookmarkcommondescriptionedit.tpl.php:39
+#: ../../../templates/tagcommondescriptionedit.tpl.php:32
+msgid "Update"
+msgstr "Mettre à jour"
+
+#: ../../../templates/bookmarkcommondescriptionedit.tpl.php:40
+#: ../../../templates/tag2tagadd.tpl.php:15
+#: ../../../templates/tagcommondescriptionedit.tpl.php:33
+#: ../../../templates/tagrename.tpl.php:25
+msgid "Cancel"
+msgstr "Annuler"
+
+#: ../../../templates/bookmarks.tpl.php:29
+#: ../../../templates/bookmarks.tpl.php:32
+msgid "edit common description"
+msgstr "éditer la description commune"
+
+#: ../../../templates/bookmarks.tpl.php:46
+#: ../../../templates/tags.tpl.php:10
+#: ../../../templates/users.tpl.php:8
+msgid "Sort by:"
+msgstr "Classer par :"
+
+#: ../../../templates/bookmarks.tpl.php:47
+msgid "Date"
+msgstr "Date"
+
+#: ../../../templates/bookmarks.tpl.php:52
msgid "URL"
msgstr "URL"
-#: ../../../templates/bookmarks.tpl.php:60
+#: ../../../templates/bookmarks.tpl.php:89
msgid "Edit"
msgstr "Editer"
-#: ../../../templates/bookmarks.tpl.php:60
+#: ../../../templates/bookmarks.tpl.php:89
msgid "Delete"
msgstr "Supprimer"
-#: ../../../templates/bookmarks.tpl.php:66
+#: ../../../templates/bookmarks.tpl.php:95
msgid "by"
msgstr "par"
-#: ../../../templates/bookmarks.tpl.php:78
+#: ../../../templates/bookmarks.tpl.php:107
#, fuzzy, php-format
msgid " and %s1 other%s"
msgstr " et les autres %s"
-#: ../../../templates/bookmarks.tpl.php:81
+#: ../../../templates/bookmarks.tpl.php:110
#, fuzzy, php-format
msgid " and %2$s%1$s others%3$s"
msgstr " et les autres %s"
-#: ../../../templates/bookmarks.tpl.php:90
+#: ../../../templates/bookmarks.tpl.php:119
msgid "Copy"
msgstr "Copier"
-#: ../../../templates/bookmarks.tpl.php:137
-#: ../../../templates/bookmarks.tpl.php:143
+#: ../../../templates/bookmarks.tpl.php:166
+#: ../../../templates/bookmarks.tpl.php:172
msgid "First"
msgstr "Première"
-#: ../../../templates/bookmarks.tpl.php:138
-#: ../../../templates/bookmarks.tpl.php:144
+#: ../../../templates/bookmarks.tpl.php:167
+#: ../../../templates/bookmarks.tpl.php:173
msgid "Previous"
msgstr "Précédent"
-#: ../../../templates/bookmarks.tpl.php:151
-#: ../../../templates/bookmarks.tpl.php:154
+#: ../../../templates/bookmarks.tpl.php:180
+#: ../../../templates/bookmarks.tpl.php:183
msgid "Next"
msgstr "Suivant"
-#: ../../../templates/bookmarks.tpl.php:152
-#: ../../../templates/bookmarks.tpl.php:155
+#: ../../../templates/bookmarks.tpl.php:181
+#: ../../../templates/bookmarks.tpl.php:184
msgid "Last"
msgstr "Dernière"
-#: ../../../templates/bookmarks.tpl.php:157
+#: ../../../templates/bookmarks.tpl.php:186
#, php-format
msgid "Page %d of %d"
msgstr "Page %d de %d"
-#: ../../../templates/bookmarks.tpl.php:161
+#: ../../../templates/bookmarks.tpl.php:190
msgid "No bookmarks available"
msgstr "Pas de signets disponibles."
@@ -601,7 +659,7 @@ msgstr "Pas de signets disponibles."
#: ../../../templates/sidebar.block.common.php:15
#: ../../../templates/sidebar.block.popular.php:21
#: ../../../templates/sidebar.block.recent.php:20
-#: ../../../templates/tags.tpl.php:16
+#: ../../../templates/tags.tpl.php:19
msgid "bookmark"
msgid_plural "bookmarks"
msgstr[0] "signet"
@@ -619,12 +677,6 @@ msgstr "Adresse"
msgid "Required"
msgstr "Requis"
-#: ../../../templates/editbookmark.tpl.php:39
-#: ../../../templates/editprofile.tpl.php:44
-#: ../../../templates/profile.tpl.php:28
-msgid "Description"
-msgstr "Description"
-
#: ../../../templates/editbookmark.tpl.php:46
msgid "Comma-separated"
msgstr "Séparés par des virgules"
@@ -883,7 +935,7 @@ msgstr "Tags récents"
msgid "Related Tags"
msgstr "Tags en relation"
-#: ../../../templates/sidebar.block.tagactions.php:14
+#: ../../../templates/sidebar.block.tagactions.php:17
#: ../../../templates/sidebar.block.watchstatus.php:17
#, fuzzy
msgid "Actions"
@@ -909,11 +961,6 @@ msgstr "Créer un nouveau lien"
msgid "Create"
msgstr "Créer"
-#: ../../../templates/tag2tagadd.tpl.php:15
-#: ../../../templates/tagrename.tpl.php:25
-msgid "Cancel"
-msgstr "Annuler"
-
#: ../../../templates/tag2tagadd.tpl.php:26
#: ../../../templates/tag2tagdelete.tpl.php:27
msgid "Existing links:"
@@ -936,12 +983,12 @@ msgstr "Nouvaeu"
msgid "Rename"
msgstr "Renommer"
-#: ../../../templates/tags.tpl.php:8
+#: ../../../templates/tags.tpl.php:11
#: ../../../templates/users.tpl.php:9
msgid "Alphabet"
msgstr "Alphabet"
-#: ../../../templates/tags.tpl.php:9
+#: ../../../templates/tags.tpl.php:12
#: ../../../templates/users.tpl.php:10
msgid "Popularity"
msgstr "Popularité"
@@ -968,8 +1015,6 @@ 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"
diff --git a/locales/messages.po b/locales/messages.po
index 5b25b7b..fb8f8f5 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-02-05 14:06+0100\n"
+"POT-Creation-Date: 2008-02-13 18:09+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -41,6 +41,18 @@ msgstr ""
msgid "User with username %s was not found"
msgstr ""
+#: ../../../bookmarkcommondescriptionedit.php:38
+msgid "Bookmark common description updated"
+msgstr ""
+
+#: ../../../bookmarkcommondescriptionedit.php:41
+msgid "Failed to update the bookmark common description"
+msgstr ""
+
+#: ../../../bookmarkcommondescriptionedit.php:50
+msgid "Edit Bookmark Common Description"
+msgstr ""
+
#: ../../../bookmarks.php:95 ../../../edit.php:44
msgid "Your bookmark must have a title and an address"
msgstr ""
@@ -411,6 +423,19 @@ msgstr ""
msgid "Delete Link Between Tags"
msgstr ""
+#: ../../../tagcommondescriptionedit.php:37
+msgid "Tag common description updated"
+msgstr ""
+
+#: ../../../tagcommondescriptionedit.php:40
+msgid "Failed to update the tag common description"
+msgstr ""
+
+#: ../../../tagcommondescriptionedit.php:47
+#: ../../../templates/sidebar.block.tagactions.php:24
+msgid "Edit Tag Common Description"
+msgstr ""
+
#: ../../../tagdelete.php:31
msgid "Tag deleted"
msgstr ""
@@ -420,7 +445,7 @@ msgid "Failed to delete the tag"
msgstr ""
#: ../../../tagdelete.php:44
-#: ../../../templates/sidebar.block.tagactions.php:19
+#: ../../../templates/sidebar.block.tagactions.php:22
msgid "Delete Tag"
msgstr ""
@@ -432,7 +457,8 @@ msgstr ""
msgid "Failed to rename the tag"
msgstr ""
-#: ../../../tagrename.php:57 ../../../templates/sidebar.block.tagactions.php:9
+#: ../../../tagrename.php:57
+#: ../../../templates/sidebar.block.tagactions.php:11
msgid "Rename Tag"
msgid_plural "Rename Tags"
msgstr[0] ""
@@ -511,76 +537,107 @@ msgid ""
"the creator to add this setting. You never know, they might just do it."
msgstr ""
-#: ../../../templates/bookmarks.tpl.php:17 ../../../templates/tags.tpl.php:7
-#: ../../../templates/users.tpl.php:8
-msgid "Sort by:"
-msgstr ""
-
-#: ../../../templates/bookmarks.tpl.php:18
-msgid "Date"
-msgstr ""
-
-#: ../../../templates/bookmarks.tpl.php:19
+#: ../../../templates/bookmarkcommondescriptionedit.tpl.php:15
+#: ../../../templates/bookmarks.tpl.php:48
#: ../../../templates/editbookmark.tpl.php:34
msgid "Title"
msgstr ""
-#: ../../../templates/bookmarks.tpl.php:23
+#: ../../../templates/bookmarkcommondescriptionedit.tpl.php:20
+#: ../../../templates/editbookmark.tpl.php:39
+#: ../../../templates/editprofile.tpl.php:44
+#: ../../../templates/profile.tpl.php:28
+#: ../../../templates/tagcommondescriptionedit.tpl.php:13
+msgid "Description"
+msgstr ""
+
+#: ../../../templates/bookmarkcommondescriptionedit.tpl.php:28
+#: ../../../templates/tagcommondescriptionedit.tpl.php:21
+msgid "Last modification: "
+msgstr ""
+
+#: ../../../templates/bookmarkcommondescriptionedit.tpl.php:39
+#: ../../../templates/tagcommondescriptionedit.tpl.php:32
+msgid "Update"
+msgstr ""
+
+#: ../../../templates/bookmarkcommondescriptionedit.tpl.php:40
+#: ../../../templates/tag2tagadd.tpl.php:15
+#: ../../../templates/tagcommondescriptionedit.tpl.php:33
+#: ../../../templates/tagrename.tpl.php:25
+msgid "Cancel"
+msgstr ""
+
+#: ../../../templates/bookmarks.tpl.php:29
+#: ../../../templates/bookmarks.tpl.php:32
+msgid "edit common description"
+msgstr ""
+
+#: ../../../templates/bookmarks.tpl.php:46 ../../../templates/tags.tpl.php:10
+#: ../../../templates/users.tpl.php:8
+msgid "Sort by:"
+msgstr ""
+
+#: ../../../templates/bookmarks.tpl.php:47
+msgid "Date"
+msgstr ""
+
+#: ../../../templates/bookmarks.tpl.php:52
msgid "URL"
msgstr ""
-#: ../../../templates/bookmarks.tpl.php:60
+#: ../../../templates/bookmarks.tpl.php:89
msgid "Edit"
msgstr ""
-#: ../../../templates/bookmarks.tpl.php:60
+#: ../../../templates/bookmarks.tpl.php:89
msgid "Delete"
msgstr ""
-#: ../../../templates/bookmarks.tpl.php:66
+#: ../../../templates/bookmarks.tpl.php:95
msgid "by"
msgstr ""
-#: ../../../templates/bookmarks.tpl.php:78
+#: ../../../templates/bookmarks.tpl.php:107
#, php-format
msgid " and %s1 other%s"
msgstr ""
-#: ../../../templates/bookmarks.tpl.php:81
+#: ../../../templates/bookmarks.tpl.php:110
#, php-format
msgid " and %2$s%1$s others%3$s"
msgstr ""
-#: ../../../templates/bookmarks.tpl.php:90
+#: ../../../templates/bookmarks.tpl.php:119
msgid "Copy"
msgstr ""
-#: ../../../templates/bookmarks.tpl.php:137
-#: ../../../templates/bookmarks.tpl.php:143
+#: ../../../templates/bookmarks.tpl.php:166
+#: ../../../templates/bookmarks.tpl.php:172
msgid "First"
msgstr ""
-#: ../../../templates/bookmarks.tpl.php:138
-#: ../../../templates/bookmarks.tpl.php:144
+#: ../../../templates/bookmarks.tpl.php:167
+#: ../../../templates/bookmarks.tpl.php:173
msgid "Previous"
msgstr ""
-#: ../../../templates/bookmarks.tpl.php:151
-#: ../../../templates/bookmarks.tpl.php:154
+#: ../../../templates/bookmarks.tpl.php:180
+#: ../../../templates/bookmarks.tpl.php:183
msgid "Next"
msgstr ""
-#: ../../../templates/bookmarks.tpl.php:152
-#: ../../../templates/bookmarks.tpl.php:155
+#: ../../../templates/bookmarks.tpl.php:181
+#: ../../../templates/bookmarks.tpl.php:184
msgid "Last"
msgstr ""
-#: ../../../templates/bookmarks.tpl.php:157
+#: ../../../templates/bookmarks.tpl.php:186
#, php-format
msgid "Page %d of %d"
msgstr ""
-#: ../../../templates/bookmarks.tpl.php:161
+#: ../../../templates/bookmarks.tpl.php:190
msgid "No bookmarks available"
msgstr ""
@@ -588,7 +645,7 @@ msgstr ""
#: ../../../templates/sidebar.block.common.php:15
#: ../../../templates/sidebar.block.popular.php:21
#: ../../../templates/sidebar.block.recent.php:20
-#: ../../../templates/tags.tpl.php:16
+#: ../../../templates/tags.tpl.php:19
msgid "bookmark"
msgid_plural "bookmarks"
msgstr[0] ""
@@ -606,12 +663,6 @@ msgstr ""
msgid "Required"
msgstr ""
-#: ../../../templates/editbookmark.tpl.php:39
-#: ../../../templates/editprofile.tpl.php:44
-#: ../../../templates/profile.tpl.php:28
-msgid "Description"
-msgstr ""
-
#: ../../../templates/editbookmark.tpl.php:46
msgid "Comma-separated"
msgstr ""
@@ -886,7 +937,7 @@ msgstr ""
msgid "Related Tags"
msgstr ""
-#: ../../../templates/sidebar.block.tagactions.php:14
+#: ../../../templates/sidebar.block.tagactions.php:17
#: ../../../templates/sidebar.block.watchstatus.php:17
msgid "Actions"
msgstr ""
@@ -911,11 +962,6 @@ msgstr ""
msgid "Create"
msgstr ""
-#: ../../../templates/tag2tagadd.tpl.php:15
-#: ../../../templates/tagrename.tpl.php:25
-msgid "Cancel"
-msgstr ""
-
#: ../../../templates/tag2tagadd.tpl.php:26
#: ../../../templates/tag2tagdelete.tpl.php:27
msgid "Existing links:"
@@ -938,11 +984,11 @@ msgstr ""
msgid "Rename"
msgstr ""
-#: ../../../templates/tags.tpl.php:8 ../../../templates/users.tpl.php:9
+#: ../../../templates/tags.tpl.php:11 ../../../templates/users.tpl.php:9
msgid "Alphabet"
msgstr ""
-#: ../../../templates/tags.tpl.php:9 ../../../templates/users.tpl.php:10
+#: ../../../templates/tags.tpl.php:12 ../../../templates/users.tpl.php:10
msgid "Popularity"
msgstr ""
diff --git a/scuttle.css b/scuttle.css
index eb22bec..211e587 100644
--- a/scuttle.css
+++ b/scuttle.css
@@ -256,6 +256,13 @@ div#sidebar ul li {
/* TAGS */
+p.commondescription {
+ padding-left:5px;
+ color: #555;
+ font-weight: bold;
+ border-left: 1px solid #CC8;
+}
+
p.tags {
line-height: 2.25em;
/*margin: 2em 10%;*/
diff --git a/services/commondescriptionservice.php b/services/commondescriptionservice.php
new file mode 100644
index 0000000..7e34219
--- /dev/null
+++ b/services/commondescriptionservice.php
@@ -0,0 +1,139 @@
+db =& $db;
+ $this->tablename = $GLOBALS['tableprefix'] .'commondescription';
+ }
+
+ function addTagDescription($tag, $desc, $uId, $time) {
+ $datetime = gmdate('Y-m-d H:i:s', $time);
+ $values = array('tag'=>$tag, 'cdDescription'=>$desc, 'uId'=>$uId, 'cdDatetime'=>$datetime);
+ $sql = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values);
+
+ if (!($dbresult =& $this->db->sql_query($sql))) {
+ $this->db->sql_transaction('rollback');
+ message_die(GENERAL_ERROR, 'Could not add tag description', '', __LINE__, __FILE__, $sql, $this->db);
+ return false;
+ }
+
+ return true;
+ }
+
+ function getLastTagDescription($tag) {
+ $query = "SELECT *";
+ $query.= " FROM `". $this->getTableName() ."`";
+ $query.= " WHERE tag='".$tag."'";
+ $query.= " ORDER BY cdDatetime DESC";
+
+ if (!($dbresult = & $this->db->sql_query_limit($query, 1, 0))) {
+ 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 false;
+ }
+ }
+
+ function getAllTagsDescription($tag) {
+ $query = "SELECT *";
+ $query.= " FROM `". $this->getTableName() ."`";
+ $query.= " WHERE tag='".$tag."'";
+ $query.= " ORDER BY cdDatetime DESC";
+
+ if (!($dbresult = & $this->db->sql_query($query))) {
+ message_die(GENERAL_ERROR, 'Could not get tag descriptions', '', __LINE__, __FILE__, $query, $this->db);
+ return false;
+ }
+
+ return $this->db->sql_fetchrowset($dbresult);
+
+ }
+
+ function getDescriptionById($cdId) {
+ $query = "SELECT *";
+ $query.= " FROM `". $this->getTableName() ."`";
+ $query.= " WHERE cdId='".$cdId."'";
+
+ if (!($dbresult = & $this->db->sql_query($query))) {
+ message_die(GENERAL_ERROR, 'Could not get tag descriptions', '', __LINE__, __FILE__, $query, $this->db);
+ return false;
+ }
+
+ if ($row =& $this->db->sql_fetchrow($dbresult)) {
+ return $row;
+ } else {
+ return false;
+ }
+
+ }
+
+ function addBookmarkDescription($bHash, $title, $desc, $uId, $time) {
+ $datetime = gmdate('Y-m-d H:i:s', $time);
+ $values = array('bHash'=>$bHash, 'cdTitle'=>$title, 'cdDescription'=>$desc, 'uId'=>$uId, 'cdDatetime'=>$datetime);
+ $sql = 'INSERT INTO '. $this->getTableName() .' '. $this->db->sql_build_array('INSERT', $values);
+
+ if (!($dbresult =& $this->db->sql_query($sql))) {
+ $this->db->sql_transaction('rollback');
+ message_die(GENERAL_ERROR, 'Could not add bookmark description', '', __LINE__, __FILE__, $sql, $this->db);
+ return false;
+ }
+ return true;
+ }
+
+ function getLastBookmarkDescription($bHash) {
+ $query = "SELECT *";
+ $query.= " FROM `". $this->getTableName() ."`";
+ $query.= " WHERE bHash='".$bHash."'";
+ $query.= " ORDER BY cdDatetime DESC";
+
+ if (!($dbresult = & $this->db->sql_query_limit($query, 1, 0))) {
+ message_die(GENERAL_ERROR, 'Could not get bookmark description', '', __LINE__, __FILE__, $query, $this->db);
+ return false;
+ }
+
+ if ($row =& $this->db->sql_fetchrow($dbresult)) {
+ return $row;
+ } else {
+ return false;
+ }
+ }
+
+ function getAllBookmarksDescription($bHash) {
+ $query = "SELECT *";
+ $query.= " FROM `". $this->getTableName() ."`";
+ $query.= " WHERE bHash='".$bHash."'";
+ $query.= " ORDER BY cdDatetime DESC";
+
+ if (!($dbresult = & $this->db->sql_query($query))) {
+ message_die(GENERAL_ERROR, 'Could not get bookmark descriptions', '', __LINE__, __FILE__, $query, $this->db);
+ return false;
+ }
+
+ return $this->db->sql_fetchrowset($dbresult);
+
+ }
+
+
+ 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/tables.sql b/tables.sql
index 3dd7bab..5adb492 100644
--- a/tables.sql
+++ b/tables.sql
@@ -100,3 +100,22 @@ CREATE TABLE `sc_tagsstats` (
PRIMARY KEY (`tstId`),
UNIQUE KEY `sc_tagsstats_tag1_type_uId` (`tag1`,`relationType`,`uId`)
);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `sc_commondescription`
+--
+
+CREATE TABLE `sc_commondescription` (
+ `cdId` int(11) NOT NULL auto_increment,
+ `uId` int(11) NOT NULL default '0',
+ `tag` varchar(32) NOT NULL default '',
+ `bHash` varchar(32) NOT NULL default '',
+ `cdTitle` varchar(255) NOT NULL default '',
+ `cdDescription` varchar(2000) default NULL,
+ `cdDatetime` datetime NOT NULL default '0000-00-00 00:00:00',
+ PRIMARY KEY (`cdId`),
+ UNIQUE KEY `sc_commondescription_tag_datetime` (`tag`,`cdDatetime`),
+ UNIQUE KEY `sc_commondescription_bookmark_datetime` (`bHash`,`cdDatetime`)
+);
diff --git a/tagcommondescriptionedit.php b/tagcommondescriptionedit.php
new file mode 100644
index 0000000..bb167d8
--- /dev/null
+++ b/tagcommondescriptionedit.php
@@ -0,0 +1,62 @@
+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 &&
+ $cdservice->addTagDescription($tag, stripslashes($_POST['description']), $logged_on_user['uId'], time())
+ ) {
+ $tplVars['msg'] = T_('Tag common description updated');
+ header('Location: '. $_POST['referrer']);
+ } else {
+ $tplVars['error'] = T_('Failed to update the tag common description');
+ $template = 'error.500.tpl';
+ }
+} elseif ($_POST['cancel']) {
+ $logged_on_user = $userservice->getCurrentUser();
+ header('Location: '. $_POST['referrer']);
+} else {
+ $tplVars['subtitle'] = T_('Edit Tag Common Description') .': '. $tag;
+ $tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag;
+ $tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
+ $tplVars['tag'] = $tag;
+ $tplVars['description'] = $cdservice->getLastTagDescription($tag);
+}
+$templateservice->loadTemplate($template, $tplVars);
+?>
diff --git a/templates/bookmarkcommondescriptionedit.tpl.php b/templates/bookmarkcommondescriptionedit.tpl.php
new file mode 100644
index 0000000..c1723de
--- /dev/null
+++ b/templates/bookmarkcommondescriptionedit.tpl.php
@@ -0,0 +1,55 @@
+includeTemplate($GLOBALS['top_include']);
+$userservice = & ServiceFactory :: getServiceInstance('UserService');
+list ($url, $hash) = explode('/', $_SERVER['PATH_INFO']);
+?>
+
+
+
+
+
+
+
+
+
+
+includeTemplate($GLOBALS['bottom_include']);
+?>
diff --git a/templates/bookmarks.tpl.php b/templates/bookmarks.tpl.php
index 42015ef..13ee3a0 100644
--- a/templates/bookmarks.tpl.php
+++ b/templates/bookmarks.tpl.php
@@ -1,14 +1,44 @@
getCurrentUserId();
$this->includeTemplate($GLOBALS['top_include']);
include('search.inc.php');
-if (count($bookmarks) > 0) {
?>
+
+
+
+getLastTagDescription($currenttag)) {
+ $description = $cdservice->getLastTagDescription($currenttag);
+ echo filter($description['cdDescription']);
+} elseif(isset($hash) && $cdservice->getLastBookmarkDescription($hash)) {
+ $description = $cdservice->getLastBookmarkDescription($hash);
+ echo filter($description['cdTitle']). "
";
+ echo filter($description['cdDescription']). "
";
+}
+
+if($logged_on_userid>0) {
+ if(isset($currenttag)) {
+ echo ' (';
+ echo T_('edit common description').')';
+ } elseif(isset($hash)) {
+ echo ' (';
+ echo T_('edit common description').')';
+ }
+}
+?>
+
+
+
+
+ 0) { ?>
diff --git a/templates/sidebar.block.tagactions.php b/templates/sidebar.block.tagactions.php
index 836c40c..a19db0b 100644
--- a/templates/sidebar.block.tagactions.php
+++ b/templates/sidebar.block.tagactions.php
@@ -1,5 +1,7 @@
isLoggedOn()) {
$currentUser = $userservice->getCurrentUser();
$currentUsername = $currentUser[$userservice->getFieldName('username')];
@@ -9,6 +11,7 @@ if ($userservice->isLoggedOn()) {
$renametext = T_ngettext('Rename Tag', 'Rename Tags', count($tags));
$renamelink = createURL('tagrename', $currenttag);
$deletelink = createURL('tagdelete', $currenttag);
+ $commondesclink = createURL('tagcommondescriptionedit', $currenttag);
?>
@@ -18,10 +21,13 @@ if ($userservice->isLoggedOn()) {
+
+
+
\ No newline at end of file
+?>
diff --git a/templates/tagcommondescriptionedit.tpl.php b/templates/tagcommondescriptionedit.tpl.php
new file mode 100644
index 0000000..6e09374
--- /dev/null
+++ b/templates/tagcommondescriptionedit.tpl.php
@@ -0,0 +1,48 @@
+includeTemplate($GLOBALS['top_include']);
+$userservice = & ServiceFactory :: getServiceInstance('UserService');
+?>
+
+
+
+includeTemplate($GLOBALS['bottom_include']);
+?>
diff --git a/templates/tags.tpl.php b/templates/tags.tpl.php
index d5de176..d6259cc 100644
--- a/templates/tags.tpl.php
+++ b/templates/tags.tpl.php
@@ -1,5 +1,8 @@
includeTemplate($GLOBALS['top_include']);
+?>
+
+ 0) {
?>
diff --git a/tests/LAUNCH_TESTS b/tests/LAUNCH_TESTS
new file mode 100644
index 0000000..dc8bdf4
--- /dev/null
+++ b/tests/LAUNCH_TESTS
@@ -0,0 +1,7 @@
+You need PHPunit.
+
+Then
+
+To launch the tests, put in a console situated in the root of the SEMANTICSCUTTLE project (where is the SEMANTICSCUTTLE config file):
+
+phpunit BookmarksTest ./tests/bookmarksTest.php ; phpunit CommonDescriptionTest tests/commonDescriptionTest.php ; phpunit Tag2TagTest tests/tag2TagTest.php
diff --git a/tests/commonDescriptionTest.php b/tests/commonDescriptionTest.php
new file mode 100644
index 0000000..4de4d84
--- /dev/null
+++ b/tests/commonDescriptionTest.php
@@ -0,0 +1,96 @@
+us =& ServiceFactory::getServiceInstance('UserService');
+ $this->bs =& ServiceFactory::getServiceInstance('BookmarkService');
+ $this->bs->deleteAll();
+ $this->ts =& ServiceFactory::getServiceInstance('TagService');
+ $this->ts->deleteAll();
+ $this->tts =& ServiceFactory::getServiceInstance('Tag2TagService');
+ $this->tts->deleteAll();
+ $this->tsts =& ServiceFactory::getServiceInstance('TagStatService');
+ $this->tsts->deleteAll();
+ $this->cds =& ServiceFactory::getServiceInstance('CommonDescriptionService');
+ $this->cds->deleteAll();
+ }
+
+ public function testModifyDescription()
+ {
+ $cds = $this->cds;
+
+ $uId1 = 1;
+ $uId2 = 2;
+ $title1 = "title1";
+ $title2 = "title2";
+ $desc1 = "&é\"'(-è_çà)=´~#'#{{[\\\\[||`\^\^@^@}¹²¡×¿ ?./§µ%";
+ $desc2 = "æâ€êþÿûîîôôöŀï'üð’‘ßä«≤»©» ↓¿×÷¡¹²³";
+ $time1 = time();
+ $time2 = time()+200;
+
+ $tagDesc1 = array('cdId'=>1, 'tag'=>'taghouse', 'cdDescription'=>$desc1, 'uId'=>$uId1,'cdDatetime'=>$time1);
+ $tagDesc2 = array('cdId'=>2, 'tag'=>'taghouse', 'cdDescription'=>$desc2, 'uId'=>$uId2,'cdDatetime'=>$time2);
+
+ $cds->addTagDescription('taghouse', $desc1, $uId1, $time1);
+ $cds->addTagDescription('taghouse', $desc2, $uId2, $time2);
+
+ $desc = $cds->getLastTagDescription('taghouse');
+ $this->assertContains('taghouse', $desc);
+ $this->assertContains($desc2, $desc);
+ $this->assertContains(gmdate('Y-m-d H:i:s', $time2), $desc);
+
+ $desc = $cds->getAllTagsDescription('taghouse');
+ $this->assertContains($desc1, $desc[1]);
+ $this->assertContains(gmdate('Y-m-d H:i:s', $time1), $desc[1]);
+ $this->assertContains($desc2, $desc[0]);
+ $this->assertContains(gmdate('Y-m-d H:i:s', $time2), $desc[0]);
+
+ $desc = $cds->getDescriptionById(1);
+ $this->assertContains($desc1, $desc);
+
+ $bkDesc1 = array('cdId'=>3, 'bHash'=>'10', 'cdTitle'=>$title1, 'cdDescription'=>$desc1, 'uId'=>$uId1,'cdDatetime'=>$time1);
+ $bkDesc2 = array('cdId'=>4, 'bHash'=>'10', 'cdTitle'=>$title2, 'cdDescription'=>$desc2, 'uId'=>$uId2,'cdDatetime'=>$time2);
+
+ $cds->addBookmarkDescription(10, $title1, $desc1, $uId1, $time1);
+ $cds->addBookmarkDescription(10, $title2, $desc2, $uId2, $time2);
+
+ $desc = $cds->getLastBookmarkDescription(10);
+ $this->assertContains($title2, $desc);
+ $this->assertContains($desc2, $desc);
+ $this->assertContains(gmdate('Y-m-d H:i:s', $time2), $desc);
+
+ $desc = $cds->getAllBookmarksDescription(10);
+ $this->assertContains($title1, $desc[1]);
+ $this->assertContains($desc1, $desc[1]);
+ $this->assertContains(gmdate('Y-m-d H:i:s', $time1), $desc[1]);
+ $this->assertContains($title2, $desc[0]);
+ $this->assertContains($desc2, $desc[0]);
+ $this->assertContains(gmdate('Y-m-d H:i:s', $time2), $desc[0]);
+
+ $desc = $cds->getDescriptionById(3);
+ $this->assertContains($desc1, $desc);
+
+
+ }
+
+}
+?>