aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-03-12 16:53:00 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-03-12 16:53:00 +0000
commit1ed53ed3419f7d49bdb216c0e5f823ce3fd4145e (patch)
tree0afef004d3bf12e6bfb04bea57ddd771cb8d0265
parent0bc299ae6cf0139241bd25cef48a1849a1e8e03f (diff)
downloadsemanticscuttle-1ed53ed3419f7d49bdb216c0e5f823ce3fd4145e.tar.gz
semanticscuttle-1ed53ed3419f7d49bdb216c0e5f823ce3fd4145e.tar.bz2
Interface design: improve navigation between tags (clickable >)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@71 b3834d28-1941-0410-a4f8-b48e95affb8f
-rw-r--r--tag2tagedit.php63
-rw-r--r--templates/sidebar.block.linked.php17
-rw-r--r--templates/tag2tagedit.tpl.php73
3 files changed, 147 insertions, 6 deletions
diff --git a/tag2tagedit.php b/tag2tagedit.php
new file mode 100644
index 0000000..67dc115
--- /dev/null
+++ b/tag2tagedit.php
@@ -0,0 +1,63 @@
+<?php
+/***************************************************************************
+Copyright (C) 2006 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');
+$tag2tagservice = & ServiceFactory :: getServiceInstance('Tag2TagService');
+$templateservice = & ServiceFactory :: getServiceInstance('TemplateService');
+$userservice = & ServiceFactory :: getServiceInstance('UserService');
+
+$logged_on_user = $userservice->getCurrentUser();
+
+//permissions
+if($logged_on_user == null) {
+ $tplVars['error'] = T_('Permission denied.');
+ $templateservice->loadTemplate('error.500.tpl', $tplVars);
+ exit();
+}
+
+list ($url, $tag1, $tag2) = explode('/', $_SERVER['PATH_INFO']);
+
+if ($_POST['confirm']) {
+ $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 {
+ $tplVars['error'] = T_('Failed to delete the link');
+ $templateservice->loadTemplate('error.500.tpl', $tplVars);
+ exit();
+ }
+} elseif ($_POST['cancel']) {
+ 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_('Edit Link Between Tags') .': '. $tag1.' > '.$tag2;
+$tplVars['formaddaction'] = createUrl('tag2tagadd');
+$tplVars['formdeleteaction'] = createUrl('tag2tagdelete');
+$tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
+$templateservice->loadTemplate('tag2tagedit.tpl', $tplVars);
+?>
diff --git a/templates/sidebar.block.linked.php b/templates/sidebar.block.linked.php
index 74b58ae..c3adfdd 100644
--- a/templates/sidebar.block.linked.php
+++ b/templates/sidebar.block.linked.php
@@ -11,12 +11,17 @@ function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode
$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
$tagstatservice =& ServiceFactory::getServiceInstance('TagStatService');
+ // link '>'
+ if($level>1) {
+ $link = '<small><a href="'.createURL('tag2tagedit', $precedentTag.'/'.$tag).'" title="'._('Edit link').'">></a> </small>';
+ }
+
$output = '';
$output.= '<tr>';
$output.= '<td></td>';
$output.= '<td>';
$output.= $level == 1?'<b>':'';
- $output.= str_repeat('&nbsp;', $level*2) .'<a href="'. sprintf($cat_url, filter($user, 'url'), filter($tag, 'url')) .'" rel="tag">'. filter($tag) .'</a>';
+ $output.= str_repeat('&nbsp;', $level*2) .$link.'<a href="'. sprintf($cat_url, filter($user, 'url'), filter($tag, 'url')) .'" rel="tag">'. filter($tag) .'</a>';
$output.= $level == 1?'</b>':'';
//$output.= ' - '. $tagstatservice->getMaxDepth($tag, $linkType, $uId);
@@ -35,15 +40,15 @@ function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode
$output.= '<span title="'.T_('Synonyms:').' '.$synonymList.'">, etc</span>';
}
- if($editingMode) {
+ /*if($editingMode) {
$output.= ' (';
- $output.= '<a href="'.createURL('tag2tagadd', $tag).'">add</a>';
- if($precedentTag != null) {
+ $output.= '<a href="'.createURL('tag2tagadd', $tag).'" title="'._('Add a subtag').'">+</a>';
+ if(1) {
$output.= ' - ';
- $output.= '<a href="'.createURL('tag2tagdelete', $precedentTag.'/'.$tag).'">del</a>';
+ $output.= '<a href="'.createURL('tag2tagdelete', $tag).'">-</a>';
}
$output.= ')';
- }
+ }*/
$output.= '</td>';
$output.= '</tr>';
diff --git a/templates/tag2tagedit.tpl.php b/templates/tag2tagedit.tpl.php
new file mode 100644
index 0000000..4e5850b
--- /dev/null
+++ b/templates/tag2tagedit.tpl.php
@@ -0,0 +1,73 @@
+<?php
+$this->includeTemplate($GLOBALS['top_include']);
+?>
+
+<form action="<?= $formaddaction ?>" method="post">
+<p><?php echo T_('Create new link')?></p>
+<p>
+<input type="text" name="tag1" value="<?php echo $tag1 ?>"/>
+<input type="text" name="linkType" value=">" size="1" maxlength="1"/>
+<input type="text" name="tag2" />
+</p>
+<!--p><?php echo T_('Are you sure?'); ?></p-->
+<p>
+ <input type="submit" name="confirm" value="<?php echo T_('Create'); ?>" />
+ <input type="submit" name="cancel" value="<?php echo T_('Cancel'); ?>" />
+</p>
+
+<?php if (isset($referrer)): ?>
+<div><input type="hidden" name="referrer" value="<?php echo $referrer; ?>" /></div>
+<?php endif; ?>
+
+</form>
+
+<hr />
+
+<form action="<?= $formdeleteaction ?>" method="post">
+<p><?php echo T_('Delete the link')?></p>
+<!--input type="hidden" name="tag1" value="<?php echo $tag1 ?>" />
+<input type="hidden" name="tag2" value="<?php echo $tag2 ?>" /-->
+<p>
+<input type="text" name="tag1" value="<?php echo $tag1 ?>"/>
+<input type="text" name="linkType" value=">" size="1" maxlength="1"/>
+<input type="text" name="tag2" value="<?php echo $tag2 ?>"/>
+</p>
+<p><?php echo T_('Are you sure?'); ?></p>
+<p>
+ <input type="submit" name="confirm" value="<?php echo T_('Yes'); ?>" />
+ <input type="submit" name="cancel" value="<?php echo T_('No'); ?>" />
+</p>
+
+<?php if (isset($referrer)): ?>
+<div><input type="hidden" name="referrer" value="<?php echo $referrer; ?>" /></div>
+<?php endif; ?>
+
+</form>
+
+<hr />
+
+<?php
+if(count($links)>0) {
+echo T_("Existing links:");
+foreach($links as $link) {
+ echo '<span style="white-space:nowrap;margin-left:25px;">';
+ if($link['tag1'] == $tag1 || $link['tag1'] == $tag2) {
+ $textTag1 = '<b>'.$tag1.'</b>';
+ } else {
+ $textTag1 = $link['tag1'];
+ }
+ if($link['tag2'] == $tag1 || $link['tag2'] == $tag2) {
+ $textTag2 = '<b>'.$tag2.'</b>';
+ } else {
+ $textTag2 = $link['tag2'];
+ }
+
+ echo $textTag1.' '.$link['relationType'].' '.$textTag2;
+ echo "</span> ";
+}
+} else {
+ echo T_('No links');
+}
+
+$this->includeTemplate($GLOBALS['bottom_include']);
+?>