-
Notifications
You must be signed in to change notification settings - Fork 0
/
org_tree.html
326 lines (232 loc) · 9.65 KB
/
org_tree.html
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
<?php
session_start();
if( !isset($_SESSION['auth']) ) {
header("Location: login.html");
}
else {
$auth=$_SESSION['auth'];
if ($auth!="bpty" && $auth!="exec" && $auth!="admin")
{
header("Location: login.html");
}
else{
?>
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/org.css">
<body>
<script src="js/d3.v3.min.js"></script>
<script src="js/jquery-2.1.0.min.js"></script>
<script src="js/underscore-min.js"></script>
<script src="js/underscore.nest.min.js"></script>
<script src="bootstrap/dist/js/bootstrap.min.js"></script>
<script src="js/bootstrap-multiselect.js"></script>
<script src="js/underscore-min.js"></script>
<script src="js/underscore.nest.min.js"></script>
<script src="js/flippant.min.js"></script>
<script src="js/moment.min.js"></script>
<script src="js/daterangepicker.js"></script>
<script src="js/jquery.sidr.min.js"></script>
<script src="js/d3_util.js"></script>
<script src="js/kanban_config.js"></script>
<script src="js/kanban_util.js"></script>
<script src="js/org_util.js"></script>
<script src="js/org_tree.js"></script>
<link rel="stylesheet" type="text/css" href="bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap-multiselect.css">
<link href="css/font-awesome-4.0.3/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/jquery.sidr.light.css">
<div class="btn-group-xs">
<button id="kanban_menu" type="button" class="btn btn-primary btn-xs">org menu</button>
</div>
<script>
$(document).ready(function() {
$('#kanban_menu').sidr({speed:300,displace:true});
});
</script>
<!-- Hidden <FORM> to submit the SVG data to the server, which will convert it to SVG/PDF/PNG downloadable file.
The form is populated and submitted by the JavaScript below. -->
<!-- production transcoder (tomcat6): http://www.kathan.at/transcode/-->
<!-- dev transcoder(jetty on ubuntu): http://localhost:8080/transcode/-->
<form id="svgform" method="post" action="http://tomcat.ea.bwinparty.corp/transcode/">
<!--<form id="svgform" method="post" action="localhost:8080/transcode/">-->
<input type="hidden" id="format" name="format" value="">
<input type="hidden" id="data" name="data" value="">
<input type="hidden" id="context" name="context" value="">
<input type="hidden" id="svg_width" name="svg_width" value="">
<input type="hidden" id="svg_height" name="svg_height" value="">
<input type="hidden" id="png_scale" name="png_scale" value="">
</form>
<script>
checkServices();
render();
/*
Utility function: populates the <FORM> with the SVG data
and the requested output format, and submits the form.
*/
function submit_download_form(output_format)
{
//dirty hack for the CSS declaration
// last css is for bootstrap => exclude !
var declaration ="";
for (var i=0;i<1;i++){
console.log("***"+i);
declaration = declaration+"<?xml-stylesheet href=\""+document.styleSheets[i].href+"\" type=\"text/css\"?>";
}
//declaration = declaration+"<?xml-stylesheet href=\""+document.styleSheets[i].href+"\" type=\"text/css\"?>";
console.log("***declaration"+declaration);
// Get the d3js SVG element
var svg = document.getElementsByTagName("svg")[0];
// Extract the data as SVG text string
var svg_xml = (new XMLSerializer).serializeToString(svg);
var clean = svg_xml;//.replace(" ", "");
var form = document.getElementById("svgform");
//console.log(declaration+svg_xml);
form.action=TRANSCODE_URL;
form["format"].value = output_format;
form["data"].value = declaration+clean ;
form["context"].value = CONTEXT ;
form["svg_width"].value = WIDTH ;
form["svg_height"].value = HEIGHT ;
//high res scale
form["png_scale"].value = 3 ;
console.log("*going to submit");
form.submit();
}
</script>
<div id="sidr" style="margin-left:10px;margin-top:10px">
<!-- ########### The Export Section ####### -->
<div>
<button class="btn btn-primary btn-xs" id="save_as_svg" value="">
Save as SVG</button>
<button class="btn btn-primary btn-xs" id="save_as_pdf" value="">
Save as PDF</button>
<button class="btn btn-primary btn-xs" id="save_as_png" value="">
Save as PNG</button>
<div style="width:250px" class="input-group input-group-sm">
<input id="input_transcode_url" type="text" class="form-control input-sm">
<span class="input-group-btn">
<button id="b99" class="btn btn-default input-sm" type="button">URL</button>
</span>
</div><!-- /input-group -->
</div>
<div class="control-zoom">
<a class="control-zoom-in" href="#" title="Zoom in"></a>
<a class="control-zoom-out" href="#" title="Zoom out"></a>
</div>
<div style="width:300px" class="input-group input-group-sm">
<input id="input_root" type="text" class="form-control input-sm">
<span class="input-group-btn">
<button id="b0" class="btn btn-default input-sm" type="button">root node (Full Name)</button>
</span>
</div><!-- /input-group -->
<div style="width:120px" class="input-group input-group-sm">
<input id="input_depth" type="text" class="form-control input-sm">
<span class="input-group-btn">
<button id="b1" class="btn btn-default input-sm" type="button">depth level</button>
</span>
</div><!-- /input-group -->
<div style="width:120px" class="input-group input-group-sm">
<input id="input_depthwidth" type="text" class="form-control input-sm">
<span class="input-group-btn">
<button id="b2" class="btn btn-default input-sm" type="button">depth width</button>
</span>
</div><!-- /input-group -->
<div style="width:120px" class="input-group input-group-sm">
<input id="b3" type="checkbox" class="form-control input-sm"> <span style="font-size:8px">show leaf nodes</span>
</div><!-- /input-group -->
<div class="btn-group-xs">
<span style="font-size:8px">PI data snapshot</span> <select id="pi_date" class="multiselect" >
<option value="org" selected>2014 JUNE</option>
<option value="org2014april">2014 APRIL</option>
<option value="org2013april">2013 APRIL</option>
<option value="org2012april">2012 APRIL</option>
<option value="org2011april">2011 APRIL</option>
</select>
</div>
<br/>
<div class="btn-group-xs">
<span style="font-size:8px">hierarchy tape</span> <select id="hierarchy" class="multiselect" >
<option value="bp" selected>business process supervisor</option>
<option value="hr">HR line supervisor</option>
</select>
</div>
<br/>
<div class="btn-group-xs">
<span style="font-size:8px">role type</span> <select id="roletype" class="multiselect" >
<option value="position" selected>position</option>
<option value="jobTitle">corporate job title</option>
<option value="job">job title</option>
<option value="function">function</option>
</select>
</div>
</div>
<script>
// Attached actions to the buttons
$(document).ready(function() {
$('#pi_date').multiselect({
buttonClass: 'btn-primary btn-sm',
onChange: function(element,checked){
console.log("element: "+_val+" checked: "+checked);
var _val = $(element).val()
ORG_DATA = _val;
d3.select("svg").remove();
render();
}
});
});
$(document).ready(function() {
$('#hierarchy').multiselect({
buttonClass: 'btn-primary btn-sm',
onChange: function(element,checked){
console.log("element: "+_val+" checked: "+checked);
var _val = $(element).val()
HIERARCHY_TYPE = _val;
d3.select("svg").remove();
render();
}
});
});
$(document).ready(function() {
$('#roletype').multiselect({
buttonClass: 'btn-primary btn-sm',
onChange: function(element,checked){
console.log("element: "+_val+" checked: "+checked);
var _val = $(element).val()
ROLE_TYPE = _val;
d3.select("svg").remove();
render();
}
});
});
initHandlers();
function switchVisibility(button,ref){
d3.select(button).on("click", function(){
var dep = d3.select(ref);
if (dep.style("visibility") =="visible") dep.style("visibility","hidden");
else dep.style("visibility","visible");
});
}
function initHandlers(){
console.log("button handling..");
$("#show_svg_code").click(function() { show_svg_code(); });
$("#save_as_svg").click(function() { submit_download_form("svg"); });
$("#save_as_pdf").click(function() { submit_download_form("pdf"); });
$("#save_as_png").click(function() { submit_download_form("png"); });
document.getElementById("input_transcode_url").value = TRANSCODE_URL;
$("#b99").click(function() { TRANSCODE_URL = document.getElementById("input_transcode_url").value });
document.getElementById("input_root").value=ROOT_NAME;
$("#b0").click(function() { ROOT_NAME = document.getElementById("input_root").value; d3.select("svg").remove();render();});
document.getElementById("input_depthwidth").value=DEPTH_WIDTH;
$("#b2").click(function() { DEPTH_WIDTH = document.getElementById("input_depthwidth").value; d3.select("svg").remove();render();});
document.getElementById("input_depth").value=MAX_DEPTH;
$("#b1").click(function() { MAX_DEPTH = document.getElementById("input_depth").value; d3.select("svg").remove();render();});
$("#b3").click(function() { console.log("* checkbox !");LEAF_NODES = document.getElementById("b3").checked; d3.select("svg").remove();render();});
}
</script>
<?php
}
}
?>
</body>
</html>