From 1ed53ed3419f7d49bdb216c0e5f823ce3fd4145e Mon Sep 17 00:00:00 2001 From: mensonge Date: Wed, 12 Mar 2008 16:53:00 +0000 Subject: Interface design: improve navigation between tags (clickable >) git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@71 b3834d28-1941-0410-a4f8-b48e95affb8f --- tag2tagedit.php | 63 ++++++++++++++++++++++++++++++++ templates/sidebar.block.linked.php | 17 +++++---- templates/tag2tagedit.tpl.php | 73 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 147 insertions(+), 6 deletions(-) create mode 100644 tag2tagedit.php create mode 100644 templates/tag2tagedit.tpl.php diff --git a/tag2tagedit.php b/tag2tagedit.php new file mode 100644 index 0000000..67dc115 --- /dev/null +++ b/tag2tagedit.php @@ -0,0 +1,63 @@ +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 = '> '; + } + $output = ''; $output.= ''; $output.= ''; $output.= ''; $output.= $level == 1?'':''; - $output.= str_repeat(' ', $level*2) .''; + $output.= str_repeat(' ', $level*2) .$link.''; $output.= $level == 1?'':''; //$output.= ' - '. $tagstatservice->getMaxDepth($tag, $linkType, $uId); @@ -35,15 +40,15 @@ function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode $output.= ', etc'; } - if($editingMode) { + /*if($editingMode) { $output.= ' ('; - $output.= 'add'; - if($precedentTag != null) { + $output.= '+'; + if(1) { $output.= ' - '; - $output.= 'del'; + $output.= '-'; } $output.= ')'; - } + }*/ $output.= ''; $output.= ''; 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 @@ +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']); +?> -- cgit v1.2.3-54-g00ecf