From 73e20c2ff50d197105f3efbc8940c498de4d2f47 Mon Sep 17 00:00:00 2001 From: mensonge Date: Tue, 5 Feb 2008 13:30:33 +0000 Subject: [PATCH] fix interface: make easier the management of tag links git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@33 b3834d28-1941-0410-a4f8-b48e95affb8f --- locales/fr_FR/LC_MESSAGES/messages.mo | Bin 17580 -> 17836 bytes locales/fr_FR/LC_MESSAGES/messages.po | 58 ++++++++++++++++++-------- locales/messages.po | 54 +++++++++++++++++------- services/tag2tagservice.php | 17 +++++++- tag2tagadd.php | 16 ++++--- tag2tagdelete.php | 7 +++- templates/sidebar.block.linked.php | 32 +++++++------- templates/tag2tagadd.tpl.php | 29 ++++++++++++- templates/tag2tagdelete.tpl.php | 31 +++++++++++++- tests/tag2TagTest.php | 2 + 10 files changed, 185 insertions(+), 61 deletions(-) diff --git a/locales/fr_FR/LC_MESSAGES/messages.mo b/locales/fr_FR/LC_MESSAGES/messages.mo index 17bc6b02a0b36fc6fb9e5f6407c36cd2bfa3f7ba..46db404aa4c1a60dc572640649a665639c28d720 100644 GIT binary patch delta 4502 zcmYM%3vg7`0mkvONj49VK!Ah<2rQ3~fCR$BC@~=q9_0}s3L?<(NXRBxNH&m%5U4DX zKtTx5ri$7^6<;7wkcB8IS|mEuf!4Mt6R88W;!MG5%V5D_rgZxM_MWt7^6l@OyL<0F z_dG6oWV`Fg4p-o6?}+COrGpG46C;g@av4+jfQ}kd*~^$Uw0)RB`_FO4tfqY%`_f*~ z$C%l;4*mEMK7|wbvI2LY8^6Pzcn@{ynD~$ZlRzbw1H+sHW;}8)lZ#PUg#4L>d_<$) zx)zgYZ$kb4WgLx%aV&NseKgVZx(D{h7)(RmZ#<@$fHC=0x^tky{-6#S1oI5)hs{`z ztyqrH{fwD|HK-^00M&utV+3BqM7)l=&VBoR1P67!cw`XFaO}qY%_J&1aVqMBnWzgF zA%A8$AKkDK)zN0_9!#PA3w##Oq0XPiuxKg^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}mci6EUv3WYVK&R-t! zvD=>?l^^VXxL3Bzf3$a#+kaoekHP*W{l5(9n&HV9ku`KgLrHSKkxqG3N_s|mdiSEz zYH!-qs?r73^Gm%8tFk-?YpN<|c?$9-9<1?Xms6fyx}ZFFPE~oi|8R0{h(CHrmfK&J W>38{)hBb%yzZ!MO?Qa=\n" +"POT-Creation-Date: 2008-02-05 14:06+0100\n" +"PO-Revision-Date: 2008-02-05 14:09+0100\n" +"Last-Translator: BenjaminHKB \n" "Language-Team: fr-FR \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" @@ -212,20 +212,20 @@ msgid "Recent Bookmarks" msgstr "Signets récents" #: ../../../jsScuttle.php:22 -#: ../../../templates/tag2tagadd.tpl.php:9 -#: ../../../templates/tag2tagdelete.tpl.php:8 +#: ../../../templates/tag2tagadd.tpl.php:12 +#: ../../../templates/tag2tagdelete.tpl.php:13 #: ../../../templates/tagdelete.tpl.php:6 msgid "Are you sure?" msgstr "Etes-vous sûr ?" #: ../../../jsScuttle.php:22 -#: ../../../templates/tag2tagdelete.tpl.php:10 +#: ../../../templates/tag2tagdelete.tpl.php:15 #: ../../../templates/tagdelete.tpl.php:8 msgid "Yes" msgstr "Oui" #: ../../../jsScuttle.php:22 -#: ../../../templates/tag2tagdelete.tpl.php:11 +#: ../../../templates/tag2tagdelete.tpl.php:16 #: ../../../templates/tagdelete.tpl.php:9 msgid "No" msgstr "Non" @@ -411,27 +411,27 @@ msgstr "Résultats de recherche" msgid "Permission denied." msgstr "Permission non accordée." -#: ../../../tag2tagadd.php:42 +#: ../../../tag2tagadd.php:44 msgid "Tag link created" msgstr "Lien entre tags créé." -#: ../../../tag2tagadd.php:45 +#: ../../../tag2tagadd.php:47 msgid "Failed to create the link" msgstr "Impossible de créer le lien" -#: ../../../tag2tagadd.php:54 +#: ../../../tag2tagadd.php:58 msgid "Add Tag Link" msgstr "Ajout d'un lien entre tags" -#: ../../../tag2tagdelete.php:40 +#: ../../../tag2tagdelete.php:43 msgid "Tag link deleted" msgstr "Effacement d'un lien entre tags" -#: ../../../tag2tagdelete.php:43 +#: ../../../tag2tagdelete.php:46 msgid "Failed to delete the link" msgstr "Impossible d'effacer le lien" -#: ../../../tag2tagdelete.php:53 +#: ../../../tag2tagdelete.php:58 msgid "Delete Link Between Tags" msgstr "Effacer un lien entre tags" @@ -855,14 +855,26 @@ msgstr "Enregistrez-vous ici pour créer un compte gratuit %s. Toutes les inform msgid "Antispam question" msgstr "Question antispam" -#: ../../../templates/sidebar.block.linked.php:97 +#: ../../../templates/sidebar.block.linked.php:35 +msgid "Synonyms:" +msgstr "Synonymes :" + +#: ../../../templates/sidebar.block.linked.php:96 msgid "Linked Tags" msgstr "Tags structurés" -#: ../../../templates/sidebar.block.linked.php:100 +#: ../../../templates/sidebar.block.linked.php:99 msgid "plus" msgstr "plus" +#: ../../../templates/sidebar.block.linked.php:116 +msgid "Add new link" +msgstr "Créer un lien" + +#: ../../../templates/sidebar.block.linked.php:117 +msgid "Delete link" +msgstr "Supprimer un lien" + #: ../../../templates/sidebar.block.recent.php:15 msgid "Recent Tags" msgstr "Tags récents" @@ -889,19 +901,29 @@ msgstr "Enlever de la liste des consultés" msgid "Add to Watchlist" msgstr "Ajouter à la liste des consultés" -#: ../../../templates/tag2tagadd.tpl.php:7 +#: ../../../templates/tag2tagadd.tpl.php:6 msgid "Create new link:" msgstr "Créer un nouveau lien" -#: ../../../templates/tag2tagadd.tpl.php:11 +#: ../../../templates/tag2tagadd.tpl.php:14 msgid "Create" msgstr "Créer" -#: ../../../templates/tag2tagadd.tpl.php:12 +#: ../../../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:" +msgstr "Liens existants :" + +#: ../../../templates/tag2tagadd.tpl.php:44 +#: ../../../templates/tag2tagdelete.tpl.php:45 +msgid "No links" +msgstr "Pas de liens" + #: ../../../templates/tagrename.tpl.php:12 msgid "Old" msgstr "Ancien" diff --git a/locales/messages.po b/locales/messages.po index 5fc2607..5b25b7b 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-01 17:37+0100\n" +"POT-Creation-Date: 2008-02-05 14:06+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -193,18 +193,18 @@ msgstr "" msgid "Recent Bookmarks" msgstr "" -#: ../../../jsScuttle.php:22 ../../../templates/tag2tagadd.tpl.php:9 -#: ../../../templates/tag2tagdelete.tpl.php:8 +#: ../../../jsScuttle.php:22 ../../../templates/tag2tagadd.tpl.php:12 +#: ../../../templates/tag2tagdelete.tpl.php:13 #: ../../../templates/tagdelete.tpl.php:6 msgid "Are you sure?" msgstr "" -#: ../../../jsScuttle.php:22 ../../../templates/tag2tagdelete.tpl.php:10 +#: ../../../jsScuttle.php:22 ../../../templates/tag2tagdelete.tpl.php:15 #: ../../../templates/tagdelete.tpl.php:8 msgid "Yes" msgstr "" -#: ../../../jsScuttle.php:22 ../../../templates/tag2tagdelete.tpl.php:11 +#: ../../../jsScuttle.php:22 ../../../templates/tag2tagdelete.tpl.php:16 #: ../../../templates/tagdelete.tpl.php:9 msgid "No" msgstr "" @@ -387,27 +387,27 @@ msgstr "" msgid "Permission denied." msgstr "" -#: ../../../tag2tagadd.php:42 +#: ../../../tag2tagadd.php:44 msgid "Tag link created" msgstr "" -#: ../../../tag2tagadd.php:45 +#: ../../../tag2tagadd.php:47 msgid "Failed to create the link" msgstr "" -#: ../../../tag2tagadd.php:54 +#: ../../../tag2tagadd.php:58 msgid "Add Tag Link" msgstr "" -#: ../../../tag2tagdelete.php:40 +#: ../../../tag2tagdelete.php:43 msgid "Tag link deleted" msgstr "" -#: ../../../tag2tagdelete.php:43 +#: ../../../tag2tagdelete.php:46 msgid "Failed to delete the link" msgstr "" -#: ../../../tag2tagdelete.php:53 +#: ../../../tag2tagdelete.php:58 msgid "Delete Link Between Tags" msgstr "" @@ -858,14 +858,26 @@ msgstr "" msgid "Antispam question" msgstr "" -#: ../../../templates/sidebar.block.linked.php:97 +#: ../../../templates/sidebar.block.linked.php:35 +msgid "Synonyms:" +msgstr "" + +#: ../../../templates/sidebar.block.linked.php:96 msgid "Linked Tags" msgstr "" -#: ../../../templates/sidebar.block.linked.php:100 +#: ../../../templates/sidebar.block.linked.php:99 msgid "plus" msgstr "" +#: ../../../templates/sidebar.block.linked.php:116 +msgid "Add new link" +msgstr "" + +#: ../../../templates/sidebar.block.linked.php:117 +msgid "Delete link" +msgstr "" + #: ../../../templates/sidebar.block.recent.php:15 msgid "Recent Tags" msgstr "" @@ -891,19 +903,29 @@ msgstr "" msgid "Add to Watchlist" msgstr "" -#: ../../../templates/tag2tagadd.tpl.php:7 +#: ../../../templates/tag2tagadd.tpl.php:6 msgid "Create new link:" msgstr "" -#: ../../../templates/tag2tagadd.tpl.php:11 +#: ../../../templates/tag2tagadd.tpl.php:14 msgid "Create" msgstr "" -#: ../../../templates/tag2tagadd.tpl.php:12 +#: ../../../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:" +msgstr "" + +#: ../../../templates/tag2tagadd.tpl.php:44 +#: ../../../templates/tag2tagdelete.tpl.php:45 +msgid "No links" +msgstr "" + #: ../../../templates/tagrename.tpl.php:12 msgid "Old" msgstr "" diff --git a/services/tag2tagservice.php b/services/tag2tagservice.php index d37ab8b..1c6392e 100644 --- a/services/tag2tagservice.php +++ b/services/tag2tagservice.php @@ -16,7 +16,8 @@ class Tag2TagService { } function addLinkedTags($tag1, $tag2, $relationType, $uId) { - if($tag1 == $tag2) { + if($tag1 == $tag2 || strlen($tag1) == 0 || strlen($tag2) == 0 + || ($relationType != ">" && $relationType != "=")) { return false; } $values = array('tag1' => $tag1, 'tag2' => $tag2, 'relationType'=> $relationType, 'uId'=> $uId); @@ -196,7 +197,21 @@ class Tag2TagService { return $this->db->sql_numrows($this->db->sql_query($query)) > 0; } + function getLinks($uId) { + $query = "SELECT tag1, tag2, relationType, uId FROM `". $this->getTableName() ."`"; + $query.= " WHERE 1=1"; + if($uId > 0) { + $query.= " AND uId = '".$uId."'"; + } + + return $this->db->sql_fetchrowset($this->db->sql_query($query)); + } + function removeLinkedTags($tag1, $tag2, $relationType, $uId) { + if($tag1 == $tag2 || strlen($tag1) == 0 || strlen($tag2) == 0 + || ($relationType != ">" && $relationType != "=")) { + return false; + } $query = 'DELETE FROM '. $this->getTableName(); $query.= ' WHERE tag1 = "'. $tag1 .'"'; $query.= ' AND tag2 = "'. $tag2 .'"'; diff --git a/tag2tagadd.php b/tag2tagadd.php index 83af1d6..bc13b16 100644 --- a/tag2tagadd.php +++ b/tag2tagadd.php @@ -34,11 +34,13 @@ if($logged_on_user == null) { } -list ($url, $tag) = explode('/', $_SERVER['PATH_INFO']); +list ($url, $tag1) = explode('/', $_SERVER['PATH_INFO']); if ($_POST['confirm']) { - $newTag = $_POST['newTag']; - if ($tag2tagservice->addLinkedTags($tag, $newTag, '>', $userservice->getCurrentUserId())) { + $tag1 = $_POST['tag1']; + $linkType = $_POST['linkType']; + $tag2 = $_POST['tag2']; + if ($tag2tagservice->addLinkedTags($tag1, $tag2, $linkType, $userservice->getCurrentUserId())) { $tplVars['msg'] = T_('Tag link created'); header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')])); } else { @@ -50,9 +52,11 @@ if ($_POST['confirm']) { header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')] .'/'. $tags)); } -$tplVars['tag'] = $tag; -$tplVars['subtitle'] = T_('Add Tag Link') .': '. $tag; -$tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag; +$tplVars['links'] = $tag2tagservice->getLinks($userservice->getCurrentUserId()); + +$tplVars['tag1'] = $tag1; +$tplVars['subtitle'] = T_('Add Tag Link') .': '. $tag1; +$tplVars['formaction'] = $_SERVER['SCRIPT_NAME'] .'/'. $tag1; $tplVars['referrer'] = $_SERVER['HTTP_REFERER']; $templateservice->loadTemplate('tag2tagadd.tpl', $tplVars); ?> diff --git a/tag2tagdelete.php b/tag2tagdelete.php index f794456..7f1ac8f 100644 --- a/tag2tagdelete.php +++ b/tag2tagdelete.php @@ -36,7 +36,10 @@ if($logged_on_user == null) { list ($url, $tag1, $tag2) = explode('/', $_SERVER['PATH_INFO']); if ($_POST['confirm']) { - if ($tag2tagservice->removeLinkedTags($_POST['tag1'], $_POST['tag2'], '>', $userservice->getCurrentUserId())) { + $tag = $_POST['tag1']; + $linkType = $_POST['linkType']; + $newTag = $_POST['tag2']; + if ($tag2tagservice->removeLinkedTags($_POST['tag1'], $_POST['tag2'], $linkType, $userservice->getCurrentUserId())) { $tplVars['msg'] = T_('Tag link deleted'); header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')])); } else { @@ -48,6 +51,8 @@ if ($_POST['confirm']) { header('Location: '. createURL('bookmarks', $logged_on_user[$userservice->getFieldName('username')] .'/'. $tags)); } +$tplVars['links'] = $tag2tagservice->getLinks($userservice->getCurrentUserId()); + $tplVars['tag1'] = $tag1; $tplVars['tag2'] = $tag2; $tplVars['subtitle'] = T_('Delete Link Between Tags') .': '. $tag1.' > '.$tag2; diff --git a/templates/sidebar.block.linked.php b/templates/sidebar.block.linked.php index 401d0d7..1643272 100644 --- a/templates/sidebar.block.linked.php +++ b/templates/sidebar.block.linked.php @@ -23,8 +23,16 @@ function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode $synonymTags = $tag2tagservice->getAllLinkedTags($tag, '=', $uId); $synonymTags = is_array($synonymTags)?$synonymTags:array($synonymTags); sort($synonymTags); + $synonymList = ''; foreach($synonymTags as $synonymTag) { - $output.= ", ".$synonymTag; + //$output.= ", ".$synonymTag; + $synonymList.= $synonymTag.' '; + } + if(count($synonymTags)>0) { + $output.= ', '.$synonymTags[0]; + } + if(count($synonymTags)>1) { + $output.= ', etc'; } if($editingMode) { @@ -81,15 +89,6 @@ if ($currenttag) { } } -if(count($explodedTags) > 0) { - $displayLinkedZone = false; - foreach($explodedTags as $explodedTag) { - if($tag2tagservice->getLinkedTags($explodedTag, '>', $userid) || $tag2tagservice->getLinkedTags($explodedTag, '>', $userid, true) || $tag2tagservice->getLinkedTags($explodedTag, '=', $userid)) { - $displayLinkedZone = true; - break; - } - } - if ($displayLinkedZone) { ?>

@@ -111,6 +110,14 @@ if(count($explodedTags) > 0) { } else { $editingMode = false; } + + if($editingMode) { + echo ''; + echo ' () '; + echo ' ()'; + echo ''; + } + $stopList = array(); foreach($explodedTags as $explodedTag) { if(!in_array($explodedTag, $stopList)) { @@ -135,8 +142,3 @@ if(count($explodedTags) > 0) { ?> - - diff --git a/templates/tag2tagadd.tpl.php b/templates/tag2tagadd.tpl.php index 109eea7..cb86a37 100644 --- a/templates/tag2tagadd.tpl.php +++ b/templates/tag2tagadd.tpl.php @@ -3,9 +3,12 @@ $this->includeTemplate($GLOBALS['top_include']); ?>
-

-

>

+

+ + + +

@@ -19,5 +22,27 @@ $this->includeTemplate($GLOBALS['top_include']);

0) { +echo T_("Existing links:"); +foreach($links as $link) { + echo ''; + if($link['tag1'] == $tag1 || $link['tag1'] == $tag2) { + $textTag1 = ''.$tag1.''; + } else { + $textTag1 = $link['tag1']; + } + if($link['tag2'] == $tag1 || $link['tag2'] == $tag2) { + $textTag2 = ''.$tag2.''; + } else { + $textTag2 = $link['tag2']; + } + + echo $textTag1.' '.$link['relationType'].' '.$textTag2; + echo " "; +} +} else { + echo T_('No links'); +} + $this->includeTemplate($GLOBALS['bottom_include']); ?> diff --git a/templates/tag2tagdelete.tpl.php b/templates/tag2tagdelete.tpl.php index 9a276d1..2f0715b 100644 --- a/templates/tag2tagdelete.tpl.php +++ b/templates/tag2tagdelete.tpl.php @@ -3,8 +3,13 @@ $this->includeTemplate($GLOBALS['top_include']); ?>
- - + +

+ + + +

@@ -18,5 +23,27 @@ $this->includeTemplate($GLOBALS['top_include']);

0) { +echo T_("Existing links:"); +foreach($links as $link) { + echo ''; + if($link['tag1'] == $tag1 || $link['tag1'] == $tag2) { + $textTag1 = ''.$tag1.''; + } else { + $textTag1 = $link['tag1']; + } + if($link['tag2'] == $tag1 || $link['tag2'] == $tag2) { + $textTag2 = ''.$tag2.''; + } else { + $textTag2 = $link['tag2']; + } + + echo $textTag1.' '.$link['relationType'].' '.$textTag2; + echo " "; +} +} else { + echo T_('No links'); +} + $this->includeTemplate($GLOBALS['bottom_include']); ?> diff --git a/tests/tag2TagTest.php b/tests/tag2TagTest.php index 9a72eb8..4154c6f 100644 --- a/tests/tag2TagTest.php +++ b/tests/tag2TagTest.php @@ -44,6 +44,8 @@ class Tag2TagTest extends PHPUnit_Framework_TestCase // basic test + $links = $tts->getLinks(1); + $allLinkedTags = $tts->getAllLinkedTags('e', '>', 1, true); // as flat list $this->assertEquals(array(), $allLinkedTags);