Subversion Repository Public Repository

Nextrek

@ 859
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
function openNode(clicked, level) {
	var node = clicked.parent().parent();
	function ajaxResOpenNode(data) {
		var nodes = data.nodes;

		for (var i = 0; i<nodes.length; i++) {
			/*var htmlToAppend = '<div id="container-id-'+nodes[i].id+'">';
			htmlToAppend += '<div id="node-id-'+nodes[i].id+'" ';
			htmlToAppend += 'node-id="'+nodes[i].id+'" ';
			htmlToAppend += 'level="'+nodes[i].level+'" ';
			htmlToAppend += 'cat="'+node.attr("cat")+'" ';
			htmlToAppend += 'leaf="'+((nodes[i].is_leaf) ? 1 : 0)+'" ';
			htmlToAppend += 'class="level-node-'+nodes[i].level+' ';
			htmlToAppend += 'cat-node-'+node.attr("cat")+'">';
			htmlToAppend += "<div class='node-container'>"+nodes[i].ramodescrizione+"</div></div></div>";*/

			var htmlToAppend = '<li id="node-id-'+nodes[i].id+'" ';
			htmlToAppend += 'node-id="'+nodes[i].id+'" ';
			htmlToAppend += 'level="'+nodes[i].level+'" ';
			htmlToAppend += 'cat="'+node.attr("cat")+'" ';
			htmlToAppend += 'leaf="'+((nodes[i].is_leaf) ? 1 : 0)+'" ';
			htmlToAppend += 'class="level-node-'+nodes[i].level+' ';
			htmlToAppend += (i==nodes.length-1) ? 'last-node ' : "";
			htmlToAppend += 'cat-node-'+node.attr("cat")+'">';

			if (level==3 || level==4) {
				htmlToAppend +=  "<div class='node-container child-node'><div class='light-close-button close-button'></div><div class='node-text'>"+nodes[i].ramodescrizione+"</div></div>";
			} else if (level>4) {
				htmlToAppend +=  "<div class='node-container child-node'><div class='dark-close-button close-button'></div><div class='node-text'>"+nodes[i].ramodescrizione+"</div></div>";
			} else {
				htmlToAppend +=  "<div class='node-container child-node'><div class='light-close-button close-button'></div><div class='node-text'>"+nodes[i].ramodescrizione+"</div></div>";
			}

			htmlToAppend += (!nodes[i].is_leaf) ? "<ul id='list-id-"+nodes[i].id+"' class='level-list-"+(level+1)+"' style='display:none;'></ul></li>" : "";

			//node.parent().append(htmlToAppend);
			$("#list-id-"+node.attr("node-id")).append(htmlToAppend);

		}

		$("#list-id-"+node.attr("node-id")).show();
		node.find(".close-button").show();
		$("#list-id-"+node.attr("node-id")+" .close-button").hide();

		/*node.parent().find(".level-node-"+level+"[leaf='0'] > .node-container .node-text").click(function() {
			openNode($(this), level+1);
		});*/

		node.parent().find("#list-id-"+node.attr("node-id")+" .level-node-"+level+"[leaf='0'] > .node-container .node-text").click(function() {
			openNode($(this), level+1);
		});

		node.parent().find()

		$("#list-id-"+node.attr("node-id")+" .close-button").click(function() {
			$(this).parent().parent().find("ul").hide();
			$(this).hide();
			/*$(this).parent().find(".node-text").click(function() {
				openNode($(this), level+1);;
			});*/
		})
	}

	if ($("#list-id-"+node.attr("node-id")+" > li").length>0) { //nodi giĆ  presenti
		$("#list-id-"+node.attr("node-id")).show();
		node.find(".close-button").show();
		$("#list-id-"+node.attr("node-id")+" .close-button").hide();
	} else {
		$.ajax({
			url: "./ajax/treeLoader.php",
			data: {
				filename: "jobsact",
				idpadre: node.attr("node-id")
			},
			dataType: "JSON",
			type: "GET",
			success: function(data) {
				ajaxResOpenNode(data);
			},
			error: function() {
				alert("Errore nel caricamento dei nodi figli");
			}
		});
	}

	//clicked.unbind("click");

}

function loadTree(data) {
	var nodes = data.nodes;

	for (var i = 0; i<nodes.length; i++) {
		/*var htmlToAppend = '<div id="container-id-'+nodes[i].id+'">';
		htmlToAppend += '<div id="node-id-'+nodes[i].id+'" ';
		htmlToAppend += 'node-id="'+nodes[i].id+'" ';
		htmlToAppend += 'level="'+nodes[i].level+'" ';
		htmlToAppend += 'cat="'+(i+1)+'" ';
		htmlToAppend += 'leaf="'+((nodes[i].is_leaf) ? 1 : 0)+'" ';
		htmlToAppend += 'class="level-node-1 cat-node-'+(i+1)+'">';
		htmlToAppend += nodes[i].ramodescrizione+"</div></div>";*/

		var htmlToAppend = '<li id="node-id-'+nodes[i].id+'" ';
		htmlToAppend += 'node-id="'+nodes[i].id+'" ';
		htmlToAppend += 'level="'+nodes[i].level+'" ';
		htmlToAppend += 'cat="'+(i+1)+'" ';
		htmlToAppend += 'leaf="'+((nodes[i].is_leaf) ? 1 : 0)+'" ';
		htmlToAppend += 'class="level-node-1 cat-node-'+(i+1)+'">';
		htmlToAppend += "<div class='cat-icon'></div>";
		htmlToAppend +=  "<div class='node-container'><div class='node-text'>"+nodes[i].ramodescrizione+"</div></div>"+"</li>";
		htmlToAppend += (!nodes[i].is_leaf) ? "<ul id='list-id-"+nodes[i].id+"' class='level-list-2' style='display:none;'></ul>" : "";

		$("#treeContainer").append(htmlToAppend);
	}

	$("#treeContainer .level-node-1 .node-container .node-text").click(function() {
		openNode($(this), 2);
	});

	$("#treeContainer .level-node-1 .node-container .node-text").trigger("click"); //apertura nodi primo livello
	
	$("p.gen-comandi a.gen-espandi").click(function(){
		if (!window.blockExpandCollapse){
			window.blockExpandCollapse = true;
			window.setTimeout(function(){
				window.setTimeout(function(){
					window.setTimeout(function(){
						window.blockExpandCollapse = false;
						$("#treeContainer .level-node-5 .node-container .node-text").trigger("click");
					}, 5000);
					$("#treeContainer .level-node-4 .node-container .node-text").trigger("click");
				}, 3000);
				$("#treeContainer .level-node-3 .node-container .node-text").trigger("click");
			},1500);
			$("#treeContainer .level-node-2 .node-container .node-text").trigger("click");
		}
	});
	
	$("p.gen-comandi a.gen-collassa").click(function(){
		if (!window.blockExpandCollapse){
			if ($("#treeContainer .level-node-2  > div.node-container .light-close-button") && $("#treeContainer .level-node-2  > div.node-container .light-close-button").length>0){
				if ($($("#treeContainer .level-node-2  > div.node-container .light-close-button")) && $($("#treeContainer .level-node-2  > div.node-container .light-close-button")).length>0){
					$($("#treeContainer .level-node-2  > div.node-container .light-close-button")).trigger("click");
				}
			}
		}
	});
	
	$(".button-itinerary").click(function(e){
		window.open("./itinerary.php?title=Jobs Act");
	})
	
}

Commits for Nextrek/legal-map/js/tree.js

Diff revisions: vs.
Revision Author Commited Message
824 Diff Diff MOliva picture MOliva Wed 21 Oct, 2015 22:16:09 +0000
823 Diff Diff MOliva picture MOliva Wed 21 Oct, 2015 20:36:52 +0000
822 Diff Diff MOliva picture MOliva Wed 21 Oct, 2015 20:30:41 +0000
821 Diff Diff MOliva picture MOliva Wed 21 Oct, 2015 20:17:09 +0000
815 Diff Diff MOliva picture MOliva Wed 21 Oct, 2015 15:19:58 +0000
814 Diff Diff MOliva picture MOliva Wed 21 Oct, 2015 15:19:03 +0000
810 Diff Diff MOliva picture MOliva Wed 21 Oct, 2015 14:56:09 +0000
809 Diff Diff MOliva picture MOliva Wed 21 Oct, 2015 14:00:40 +0000
771 Diff Diff FSallustio picture FSallustio Tue 22 Sep, 2015 15:51:05 +0000
756 FSallustio picture FSallustio Thu 17 Sep, 2015 10:36:24 +0000