aboutsummaryrefslogtreecommitdiff
path: root/data/templates/default/sidebar.block.linked.php
blob: d3a25a55c240f1c2e3acc257780507b0ee232624 (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
64
65
66
<?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) ? str_replace('+', ',', $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"></div>
 <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
                parentparam = "";
                if (node == -1 ) {
                    node = <?php echo json_encode($currenttag); ?>;
                    parentparam = "&parent=true";
                } else if (node.attr('rel')) {
                    node = node.attr('rel');
                } else {
                    return;
                }

                return "<?php echo ROOT ?>ajax/getlinkedtags.php?tag=" + node
                    + parentparam;
            }
        }
    },
    plugins : [ "themes", "json_data"]
});
//]]>
 </script>
</div>