summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-01-09 15:51:35 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-01-09 15:51:35 +0000
commitef9143907f1ea6600a6c66065f0e18ac42f3535b (patch)
tree37382b6d5b8df60670cd5efecbcfd388d68d06e8 /templates
parentb1c3fbad478b43080e7506243d3fb77465a599d4 (diff)
downloadsemanticscuttle-ef9143907f1ea6600a6c66065f0e18ac42f3535b.tar.gz
semanticscuttle-ef9143907f1ea6600a6c66065f0e18ac42f3535b.tar.bz2
Structured tags '>' for each user
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@3 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'templates')
-rw-r--r--templates/editbookmark.tpl.php6
-rw-r--r--templates/sidebar.block.linked.php78
-rw-r--r--templates/tag2tagadd.tpl.php23
-rw-r--r--templates/tag2tagdelete.tpl.php22
4 files changed, 128 insertions, 1 deletions
diff --git a/templates/editbookmark.tpl.php b/templates/editbookmark.tpl.php
index a590d81..f707668 100644
--- a/templates/editbookmark.tpl.php
+++ b/templates/editbookmark.tpl.php
@@ -46,6 +46,10 @@ window.onload = function() {
<td>&larr; <?php echo T_('Comma-separated'); ?></td>
</tr>
<tr>
+ <th></th>
+ <td align="right"><small><?php echo T_('Note: use ">" to include one tag in another. e.g.: europe>france>paris')?><small></td>
+</tr>
+<tr>
<th align="left"><?php echo T_('Privacy'); ?></th>
<td>
<select name="status">
@@ -117,4 +121,4 @@ document.write('<\/ul>');
<?php
}
$this->includeTemplate($GLOBALS['bottom_include']);
-?> \ No newline at end of file
+?>
diff --git a/templates/sidebar.block.linked.php b/templates/sidebar.block.linked.php
new file mode 100644
index 0000000..23bcb0c
--- /dev/null
+++ b/templates/sidebar.block.linked.php
@@ -0,0 +1,78 @@
+<?php
+$tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
+$userservice =& ServiceFactory::getServiceInstance('UserService');
+
+function displayLinkedTags($tag, $linkType, $uId, $cat_url, $user, $editingMode =false, $precedentTag =null, $level=0, $stopList=array()) {
+ $tag2tagservice =& ServiceFactory::getServiceInstance('Tag2TagService');
+
+ $output = '';
+ $output.= '<tr>';
+ $output.= '<td></td>';
+ $output.= '<td>'. str_repeat('&nbsp;', $level*2) .'<a href="'. sprintf($cat_url, filter($user, 'url'), filter($tag, 'url')) .'" rel="tag">'. filter($tag) .'</a>';
+ if($editingMode) {
+ $output.= ' (';
+ $output.= '<a href="'.createURL('tag2tagadd', $tag).'">add</a>';
+ if($precedentTag != null) {
+ $output.= ' - ';
+ $output.= '<a href="'.createURL('tag2tagdelete', $precedentTag.'/'.$tag).'">del</a>';
+ }
+ $output.= ')';
+ }
+ $output.= '</td>';
+ $output.= '</tr>';
+
+ if(!in_array($tag, $stopList)) {
+ $linkedTags = $tag2tagservice->getLinkedTags($tag, '>', $userid, $level);
+ $precedentTag = $tag;
+ $stopList[] = $tag;
+ $level = $level + 1;
+ foreach($linkedTags as $linkedTag) {
+ $output.= displayLinkedTags($linkedTag, $linkType, $uId, $cat_url, $user, $editingMode, $precedentTag, $level, $stopList);
+ }
+ }
+ return $output;
+}
+
+
+$logged_on_userid = $userservice->getCurrentUserId();
+if ($logged_on_userid === false) {
+ $logged_on_userid = NULL;
+}
+
+$explodedTags = array();
+if ($currenttag) {
+ $explodedTags = explode('+', $currenttag);
+} else {
+ $orphewTags = $tag2tagservice->getOrphewTags('>', $userid);
+ foreach($orphewTags as $orphewTag) {
+ $explodedTags[] = $orphewTag['tag'];
+ }
+}
+
+if(count($explodedTags) > 0) {
+ $displayLinkedZone = false;
+ foreach($explodedTags as $explodedTag) {
+ if($tag2tagservice->getLinkedTags($explodedTag, '>', $userid)) {
+ $displayLinkedZone = true;
+ break;
+ }
+ }
+ if ($displayLinkedZone) {
+?>
+
+<h2><?php echo T_('Linked Tags'); ?></h2>
+<div id="linked">
+ <table>
+ <?php
+ $editingMode = ($userid === $logged_on_userid);
+ foreach($explodedTags as $explodedTag) {
+ echo displayLinkedTags($explodedTag, '>', $userid, $cat_url, $user, $editingMode);
+ }
+ ?>
+ </table>
+</div>
+
+<?php
+ }
+}
+?>
diff --git a/templates/tag2tagadd.tpl.php b/templates/tag2tagadd.tpl.php
new file mode 100644
index 0000000..5b5ea58
--- /dev/null
+++ b/templates/tag2tagadd.tpl.php
@@ -0,0 +1,23 @@
+<?php
+$this->includeTemplate($GLOBALS['top_include']);
+?>
+
+<form action="<?= $formaction ?>" method="post">
+<input type="hidden" name="tag" value="<?php echo $tag ?>" />
+<p><?php echo T_('Create new link :')?></p>
+<p><?php echo $tag ?> > <input type="text" name="newTag" /></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>
+
+<?php
+$this->includeTemplate($GLOBALS['bottom_include']);
+?>
diff --git a/templates/tag2tagdelete.tpl.php b/templates/tag2tagdelete.tpl.php
new file mode 100644
index 0000000..9a276d1
--- /dev/null
+++ b/templates/tag2tagdelete.tpl.php
@@ -0,0 +1,22 @@
+<?php
+$this->includeTemplate($GLOBALS['top_include']);
+?>
+
+<form action="<?= $formaction ?>" method="post">
+<input type="hidden" name="tag1" value="<?php echo $tag1 ?>" />
+<input type="hidden" name="tag2" value="<?php echo $tag2 ?>" />
+<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>
+
+<?php
+$this->includeTemplate($GLOBALS['bottom_include']);
+?>