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
This commit is contained in:
parent
e8e5209d51
commit
484de2408f
65
bookmarkcommondescriptionedit.php
Normal file
65
bookmarkcommondescriptionedit.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?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');
|
||||
$bookmarkservice = & ServiceFactory :: getServiceInstance('BookmarkService');
|
||||
$tagservice = & ServiceFactory :: getServiceInstance('TagService');
|
||||
$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
|
||||
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
||||
$cdservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService');
|
||||
|
||||
list ($url, $hash) = explode('/', $_SERVER['PATH_INFO']);
|
||||
$template = 'bookmarkcommondescriptionedit.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($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);
|
||||
?>
|
@ -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');
|
||||
?>
|
||||
|
Binary file not shown.
@ -8,8 +8,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Scuttle\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2008-02-05 14:06+0100\n"
|
||||
"PO-Revision-Date: 2008-02-05 14:09+0100\n"
|
||||
"POT-Creation-Date: 2008-02-13 18:09+0100\n"
|
||||
"PO-Revision-Date: 2008-02-13 18:22+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,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 <a href=\"http://sourceforge.net/projects/scuttle/\">un
|
||||
msgid "%1$s supports most of the <a href=\"http://del.icio.us/doc/api\">del.icio.us <abbr title=\"Application Programming Interface\">API</abbr></a>. Almost all of the neat tools made for that system can be modified to work with %1$s instead. If you find a tool that won't let you change the API address, ask the creator to add this setting. You never know, they might just do it."
|
||||
msgstr "%1$s supporte la plupart de l'<a href=\"http://del.icio.us/doc/api\">del.icio.us <abbr title=\"Application Programming Interface\">API</abbr></a>."
|
||||
|
||||
#: ../../../templates/bookmarks.tpl.php:17
|
||||
#: ../../../templates/tags.tpl.php:7
|
||||
#: ../../../templates/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"
|
||||
|
@ -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 <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\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 ""
|
||||
|
||||
|
@ -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%;*/
|
||||
|
139
services/commondescriptionservice.php
Normal file
139
services/commondescriptionservice.php
Normal file
@ -0,0 +1,139 @@
|
||||
<?php
|
||||
class CommonDescriptionService {
|
||||
var $db;
|
||||
var $tablename;
|
||||
|
||||
function &getInstance(&$db) {
|
||||
static $instance;
|
||||
if (!isset($instance))
|
||||
$instance =& new CommonDescriptionService($db);
|
||||
return $instance;
|
||||
}
|
||||
|
||||
function CommonDescriptionService(&$db) {
|
||||
$this->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; }
|
||||
}
|
||||
?>
|
19
tables.sql
19
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`)
|
||||
);
|
||||
|
62
tagcommondescriptionedit.php
Normal file
62
tagcommondescriptionedit.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?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');
|
||||
$cdservice = & ServiceFactory :: getServiceInstance('CommonDescriptionService');
|
||||
|
||||
list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']);
|
||||
$template = 'tagcommondescriptionedit.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 &&
|
||||
$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);
|
||||
?>
|
55
templates/bookmarkcommondescriptionedit.tpl.php
Normal file
55
templates/bookmarkcommondescriptionedit.tpl.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
$this->includeTemplate($GLOBALS['top_include']);
|
||||
$userservice = & ServiceFactory :: getServiceInstance('UserService');
|
||||
list ($url, $hash) = explode('/', $_SERVER['PATH_INFO']);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
window.onload = function() {
|
||||
document.getElementById("title").focus();
|
||||
}
|
||||
</script>
|
||||
|
||||
<form action="<?php echo $formaction; ?>" method="post">
|
||||
<table>
|
||||
<tr>
|
||||
<th align="left"><?php echo T_('Title'); ?></th>
|
||||
<td><input type="text" id="title" name="title" size="75" maxlength="255" value="<?php echo $description['cdTitle']; ?>" onkeypress="this.style.backgroundImage = 'none';" /></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left"><?php echo T_('Description'); ?></th>
|
||||
<td><textarea name="description" cols="75" rows="10"><?php echo $description['cdDescription']; ?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<?php
|
||||
if(strlen($description['cdDatetime'])>0) {
|
||||
echo T_('Last modification: ').$description['cdDatetime'].', ';
|
||||
$lastUser = $userservice->getUser($description['uId']);
|
||||
echo $lastUser['username'];
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td></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="hash" value="<?php echo $hash; ?>" /></div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
$this->includeTemplate($GLOBALS['bottom_include']);
|
||||
?>
|
@ -1,14 +1,44 @@
|
||||
<?php
|
||||
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
||||
$bookmarkservice =& ServiceFactory::getServiceInstance('BookmarkService');
|
||||
$cdservice =& ServiceFactory::getServiceInstance('CommonDescriptionService');
|
||||
|
||||
$logged_on_userid = $userservice->getCurrentUserId();
|
||||
$this->includeTemplate($GLOBALS['top_include']);
|
||||
|
||||
include('search.inc.php');
|
||||
if (count($bookmarks) > 0) {
|
||||
?>
|
||||
|
||||
<?php
|
||||
if((isset($currenttag) && $GLOBALS['enableCommonTagDescription'])
|
||||
|| (isset($hash) && $GLOBALS['enableCommonBookmarkDescription'])):?>
|
||||
<p class="commondescription">
|
||||
|
||||
<?php
|
||||
if(isset($currenttag) && $cdservice->getLastTagDescription($currenttag)) {
|
||||
$description = $cdservice->getLastTagDescription($currenttag);
|
||||
echo filter($description['cdDescription']);
|
||||
} elseif(isset($hash) && $cdservice->getLastBookmarkDescription($hash)) {
|
||||
$description = $cdservice->getLastBookmarkDescription($hash);
|
||||
echo filter($description['cdTitle']). "<br/>";
|
||||
echo filter($description['cdDescription']). "<br/>";
|
||||
}
|
||||
|
||||
if($logged_on_userid>0) {
|
||||
if(isset($currenttag)) {
|
||||
echo ' (<a href="'. createURL('tagcommondescriptionedit', $currenttag).'">';
|
||||
echo T_('edit common description').'</a>)';
|
||||
} elseif(isset($hash)) {
|
||||
echo ' (<a href="'.createURL('bookmarkcommondescriptionedit', $hash).'">';
|
||||
echo T_('edit common description').'</a>)';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<?php endif ?>
|
||||
|
||||
|
||||
<?php if (count($bookmarks) > 0) { ?>
|
||||
<script type="text/javascript">
|
||||
window.onload = playerLoad;
|
||||
</script>
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
$userservice =& ServiceFactory::getServiceInstance('UserService');
|
||||
$tagservice =& ServiceFactory::getServiceInstance('TagService');
|
||||
|
||||
if ($userservice->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);
|
||||
?>
|
||||
|
||||
<h2><?php echo T_('Actions'); ?></h2>
|
||||
@ -18,10 +21,13 @@ if ($userservice->isLoggedOn()) {
|
||||
<?php if (count($tags) == 1): ?>
|
||||
<li><a href="<?php echo $deletelink; ?>"><?php echo T_('Delete Tag') ?></a></li>
|
||||
<?php endif; ?>
|
||||
<?php if ($GLOBALS['enableCommonTagDescription']): ?>
|
||||
<li><a href="<?php echo $commondesclink; ?>"><?php echo T_('Edit Tag Common Description') ?></a></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
48
templates/tagcommondescriptionedit.tpl.php
Normal file
48
templates/tagcommondescriptionedit.tpl.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?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['cdDescription']; ?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<?php
|
||||
if(strlen($description['cdDatetime'])>0) {
|
||||
echo T_('Last modification: ').$description['cdDatetime'].', ';
|
||||
$lastUser = $userservice->getUser($description['uId']);
|
||||
echo $lastUser['username'];
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td></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']);
|
||||
?>
|
@ -1,5 +1,8 @@
|
||||
<?php
|
||||
$this->includeTemplate($GLOBALS['top_include']);
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ($tags && count($tags) > 0) {
|
||||
?>
|
||||
|
||||
|
7
tests/LAUNCH_TESTS
Normal file
7
tests/LAUNCH_TESTS
Normal file
@ -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
|
96
tests/commonDescriptionTest.php
Normal file
96
tests/commonDescriptionTest.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?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 CommonDescriptionTest tests/commonDescriptionTest.php
|
||||
*/
|
||||
|
||||
class CommonDescriptionTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $us;
|
||||
protected $bs;
|
||||
protected $ts;
|
||||
protected $tts;
|
||||
protected $tsts;
|
||||
protected $cds;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $tableprefix;
|
||||
require_once('./header.inc.php');
|
||||
|
||||
$this->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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue
Block a user