summaryrefslogtreecommitdiff
path: root/data/templates/sidebar.block.linked.php
blob: 517705ed624efb4ffbb936fba8437e1d76fe1f28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/*
 * Used in:
 * - populartags.php
 * - bookmarks.php
 * - alltags.php
 * - tags.php
 */
/* Service creation: only useful services are created */
$tag2tagservice =SemanticScuttle_Service_Factory::get('Tag2Tag');

require_once('sidebar.linkedtags.inc.php');

/* Manage input */
$user = isset($user)?$user:'';
$userid = isset($userid)?$userid:0;
$currenttag = isset($currenttag)?$currenttag:'';
//$summarizeLinkedTags = isset($summarizeLinkedTags)?$summarizeLinkedTags:false;

$logged_on_userid = $userservice->getCurrentUserId();
$editingMode = $logged_on_userid !== false;
?>
<h2><?php echo T_('Linked Tags'); ?></h2>
<div id="related">
<?php
if ($editingMode) {
	echo '<p style="margin-bottom: 13px;text-align:center;">';
	echo ' (<a href="'. createURL('tag2tagadd','') .'" rel="tag">'.T_('Add new link').'</a>) ';
	echo ' (<a href="'. createURL('tag2tagdelete','') .'" rel="tag">'.T_('Delete link').'</a>)';
	echo '</p>';
}
?>
 <div id="related-content" />
<script type="text/javascript"><![CDATA[
jQuery("#related-content")
.jstree({
    "themes" : {
        "theme": "default",
        "dots": false,
        "icons": true,
        "url": '<?php echo ROOT ?>js/themes/default/style.css'
    },
    "json_data" : {
        "ajax" : {
            "url": function(node) {
                //-1 is root
                parent = "";
                if (node == -1 ) {
                    node = <?php echo json_encode($currenttag); ?>;
                    parent = "&parent=true";
                } else if (node.attr('rel')) {
                    node = node.attr('rel');
                } else {
                    return;
                }
                return "<?php echo ROOT ?>ajax/getlinkedtags.php?tag=" + node + parent;
            }
        }
    },
    plugins : [ "themes", "json_data"]
});
]]></script>
</div>