-
Notifications
You must be signed in to change notification settings - Fork 4
/
bff_demo.php
393 lines (361 loc) · 14.9 KB
/
bff_demo.php
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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
<!DOCTYPE html>
<html>
<title>VHA Business Function Framework and Requirements</title>
<head>
<?php
include_once "vivian_tree_layout.css";
include_once "vivian_common.php";
?>
<!-- JQuery Buttons -->
<script>
$(function(){
$( "button" ).button().click(function(event){
event.preventDefault();
});
fileName = window.location.href.substring(window.location.href.lastIndexOf('/')+1)
$('a[href="'+fileName+'"]').parents("#navigation_buttons li").each(function (i) {
$(this).removeClass().addClass("active");
});
});
</script>
</head>
<body >
<div>
<div id="toolTip" class="tooltip" style="opacity:0;">
<div id="head" class="header"></div>
<div class="tooltipTail"></div>
</div>
<div id="dialog-modal">
<div id="accordion">
<h3><a href="#">Description</a></h3>
<div id="description"></div>
<h3 id="commentary_head" style="display:none"><a href="#">Commentary</a></h3>
<div id="commentary"></div>
<h3 id="requirements_head" style="display:none"><a href="#">Requirements</a></h3>
<div id="requirements"></div>
<h3 id="bdID_head" style="display:none"><a href="#">Business Need: ID</a></h3>
<div id="bnID"></div>
<h3 id="needBFF_head" style="display:none"><a href="#">Business Need: BFF Links</a></h3>
<div id="bnBFFLink"></div>
<h3 id="bnNSR_head" style="display:none"><a href="#">Business Need: New Service Request</a></h3>
<div id="bnNSR"></div>
<h3 id="bnDofUpdate_head" style="display:none"><a href="#">Business Need: Date of Update</a></h3>
<div id="bnDofUpdate"></div>
<h3 id="allReq" style="display:none"><a href="#">All Business Needs</a></h3>
<div id="nsNSR"><a target='_blank' onclick="window.location.href=FILES_URL+'/requirements/All-Requirement%20List.html'">All Needs</a></div>
</div>
</div>
<div id='pageDescription' class='hint' style="position:relative; top: -10px; left:20px; margin-right:200px;">
<p>
This tree graph represents the VHA Business Function Framework (BFF).
The BFF is a hierarchical construct that describes VHA business functions
or major service areas within each core mission Line of Business (LoB) and
serve as logical groupings of activities. Subfunctions represent the
logical groupings of sub-activities needed to fulfill each VHA business
function. Click on an item to bring a modal window with detailed
description and commentary.
See the legend for an explanation of the symbols and colors of the display.
The "collapsed" nodes can be expanded to show the "children" of that node.
</p>
<p><b>Note:</b> Not all Business Needs can be found connected to a BFF Entry.
To see the listing of all Business Needs, click
<a target='_blank' onclick="window.location.href=FILES_URL+'/requirements/All-Requirement%20List.html'">here</a></p>
<p>The current information is based on BFF version 2.12.</p>
</div>
<div id="buttons" style="position:relative; right:-20px">
<button onclick="_collapseAllNode()">Collapse All</button>
<button onclick="_resetAllNode()">Reset</button>
<input type="checkbox" id="showUpdates" onclick="renderWindow()"> Show new and updated requirements</input>
</div>
</br>
<div id="legend_placeholder" style="position:relative; left:20px;"></div>
<div id="treeview_placeholder"></div>
<script type="text/javascript">
<?php include_once "vivian_tree_layout_common.js" ?>
$("#accordion").accordion({heightStyle: 'content', collapsible: true}).hide();
var chart = d3.chart.treeview()
.height(2000)
.width(1880)
.textwidth(280);
var legendShapeChart = d3.chart.treeview()
.height(115)
.width(1300)
.margins({top:42, left:10, right:0, bottom:0})
.textwidth(110);
var shapeLegend = [{name: "Framework Grouping (Collapsed)", shape: "triangle-up","_children":[],"hasRequirements": false, "index":0, "depth": -10},
{name: "Framework Grouping (Expanded)", shape: "triangle-up", "depth": -10,"index":1},
{name: "Framework Grouping with Needs (Collapsed)", shape: "triangle-up","_children":[],"hasRequirements": true, "depth": -10,"index":2},
{name: "Framework Grouping with Needs (Expanded)", shape: "triangle-up","children":[],"hasRequirements": true, "depth": -10,"index":3},
{name: "Business Function", shape:"circle","hasRequirements": false, "depth": 20,"index":0},
{name: "Business Function with Needs (Collapsed)", shape:"circle","hasRequirements": true,"_children":[], "depth": 20,"index":1},
{name: "Business Function with Needs (Expanded)", shape:"circle","hasRequirements": true, "depth": 20,"index":2},
{name: "Business Need", shape:"cross", "isRequirement": true, "depth": 50,"index":0},
{name: "Business Need (Recently Updated)", shape:"cross", "isRequirement": true, "recentUpdate":"Update","depth": 50,"index":1},
{name: "Business Need (New)", shape:"cross", "isRequirement": true, "recentUpdate":"New Requirement","depth": 50,"index":2}
]
var vivianDataPath = FILES_URL;
var requirementsPath = vivianDataPath + "requirements/"
renderWindow();
function renderWindow() {
d3.json(vivianDataPath + "bff.json", function(BFFjson) {
d3.json(vivianDataPath + "requirements.json", function(reqjson) {
resetAllNode(BFFjson);
chart.on("node", "event", "mouseover", node_onMouseOver)
.on("node", "event","mouseout", node_onMouseOut)
.on("node", "event","click", node_onClick)
.on("text", "attr", "cursor", function(d) {
return d.description !== undefined && d.description ? "pointer" : "hand";
})
.on("text", "event", "click", text_onMouseClick)
.on("path", "attr", "r", function(d) { return 7 - d.depth/2; });
var combinedJSON = combineData(BFFjson,reqjson,"children")
if($("#showUpdates").is(":checked")) {
combinedJSON = removeNonRequirementNodes(combinedJSON,"children")
combinedJSON.children = combinedJSON.children.filter(function(object) {return object.filteredReq})
}
var test = d3.select("#treeview_placeholder").datum(combinedJSON).call(chart);
d3.select("#legend_placeholder").datum(null).call(legendShapeChart);
createShapeLegend();
});
});
}
var toolTip = d3.select(document.getElementById("toolTip"));
var header = d3.select(document.getElementById("head"));
/*
* Remove the nodes that do not contain any requirements
* Should only be run when filtering to show only the "recently updated" requirements
*/
function removeNonRequirementNodes(bffData, parameter) {
//Go through combined data
bffData[parameter].forEach( function(child) {
// If child object is requirement, parent object is set to be shown
if (child.isRequirement) {bffData.filteredReq=true}
// Check child's children for objects
if (child.children) {
child = removeNonRequirementNodes(child,"children")
child.children = child.children.filter(function(test) {return test.filteredReq || test.isRequirement})
}
if (child._children) {
child = removeNonRequirementNodes(child,"_children");
child._children = child._children.filter(function(test) {return test.filteredReq || test.isRequirement})
}
//If any "child of a child" is marked as having requirements, add the parent object as well
if (child.filteredReq) {bffData.filteredReq=true}
})
return bffData
}
function combineData(bffData, reqData,parameter) {
bffData[parameter].forEach(function(d) {
if(d3.keys(reqData).indexOf(d.name) != -1) {
var reqDataToShow = reqData[d.name]
d.hasRequirements = false;
if($("#showUpdates").is(":checked")) {
reqDataToShow = reqData[d.name].filter(function(d) {return d.recentUpdate != "None"})
}
if (reqDataToShow.length) {
d.hasRequirements = true;
if(d._children) {
d._children = d._children.concat(reqDataToShow)
}
else {
d.leafFunction= true
d._children = reqDataToShow
}
}
}
//compare objects to see if anything was added to the array
// i.e. requirements are found
if (d.children) { combineData(d, reqData,"children")}
if (d._children) {combineData(d, reqData,"_children")}
});
return bffData
}
function node_onClick(d) {
//Check for the overall number of nodes shown to make sure screen isn't crowded
var addNodes = 0;
var rmNodes = 0;
if(d._children) { addNodes = d._children.length;}
if(d.children) { rmNodes = d.children.length;}
var newNodeSum = d3.selectAll(".node")[0].length + addNodes - rmNodes
if (newNodeSum < 350) {
chart.onNodeClick(d)
}
else {
alert("Adding any more nodes may cause the shown information to overlap. Please close other opened nodes first")
}
};
function node_onMouseOver(d) {
if (d.number !== undefined){
header.text("" + d.number);
}
else if (d.isRequirement) {
header.html("Name: " + d.name + " </br></br> Type: " + d.type + "</br></br>Date of Update: " + d.dateUpdated);
}
else {
return;
}
$( document ).uitooltip('option', 'content', $("#toolTip").html())
}
function getRequirementsURL(d){
var requirementsUrl = requirementsPath + d.name.replace('/','_') + "-Req.html";
var outstring = "<a target='_blank' href='" + requirementsUrl + "'>Requirements for " + d.name + "</a>"
if (d.isRequirement) {
outstring="<ul>"
d.BFFlink.forEach(function(d) {
requirementsUrl = requirementsPath + d.replace('/','_') + "-Req.html";
outstring += "<li><a target='_blank' href='" + requirementsUrl + "'>Requirements for " + d + "</a></li>"
});
outstring += "</ul>"
}
return outstring
}
function node_onMouseOut(d) {
$( document ).uitooltip('option', 'content', "")
header.text("");
}
function generateNSRURL(d) {
returnURLS = '<ul>'
d.NSRLink.forEach(function(nsrEntry) {
nsrVal = nsrEntry.split(":")[0]
returnURLS += "<li><a target='_blank' href='" + requirementsPath + nsrVal + "-Req.html'>" + d.NSRLink + "</a></li>"
});
returnURLS += '</ul>'
return returnURLS
}
function getBusinessNeedURL(d) {
return "<a target='_blank' href='" + requirementsPath + "BFFReq-" + d.busNeedId + ".html'>" + d.busNeedId + "</a>"
}
function modalForBFFGroup(d) {
if (d.hasRequirements){
$('#requirements').show();
$('#requirements_head').show();
$('#requirements').html(getRequirementsURL(d));
}
else{
$('#requirements').html('');
$('#requirements_head').hide();
$('#requirements').hide();
}
}
function modalForBusinessNeed(d) {
if (d.isRequirement){
$('#busNeedLink').html(getBusinessNeedURL(d));
$('#needLink_head').show();
$('#busNeedLink').show();
$("#bnID").html(getBusinessNeedURL(d))
$("#bdID_head").show();
$("#bnID").show();
$("#bnBFFLink").html(getRequirementsURL(d))
$("#needBFF_head").show();
$("#bnBFFLink").show();
$("#bnNSR").html(generateNSRURL(d))
$("#bnNSR_head").show();
$("#bnNSR").show();
$("#bnDofUpdate_head").show();
$("#bnDofUpdate").html(d.dateUpdated);
$("#bnDofUpdate").show();
}
else {
$('#busNeedLink').html('');
$('#needLink_head').hide();
$('#busNeedLink').hide();
$("#bdID_head").hide();
$("#bnID").hide();
$("#needBFF_head").hide();
$("#bnBFFLink").hide();
$("#bnNSR_head").hide();
$("#bnNSR").hide();
$("#bnDofUpdate_head").hide();
$("#bnDofUpdate").html('');
$("#bnDofUpdate").hide();
}
}
function text_onMouseClick(d) {
if (d.description) {
var modalTitle = d.name;
if (d.number){modalTitle = "" + d.number + ": " + modalTitle }
var overlayDialogObj = {
autoOpen: true,
height: 'auto',
width: 700,
modal: true,
position: {my: "center center-50", of: window},
title:modalTitle,
open: function(){
$('#description').html(d.description);
if (d.commentary){
$('#commentary').html(d.commentary);
$('#commentary').show();
$('#commentary_head').show();
}
else{
$('#commentary').html('');
$('#commentary_head').hide();
$('#commentary').hide();
}
modalForBFFGroup(d);
modalForBusinessNeed(d);
if (d.hasRequirements || d.isRequirement) {
$("#allReq").show();
}
else{
$("#allReq").hide();
}
$('#accordion').accordion("option", "active", 0);
$('#accordion').accordion("refresh");
$('#accordion').accordion({heightStyle: 'content'}).show();
},
};
$('#dialog-modal').dialog(overlayDialogObj).show();
// var pkgUrl = package_link_url + d.name.replace(/ /g, '_') + ".html";
// var win = window.open(pkgUrl, '_black');
// win.focus();
}
d3.event.preventDefault();
d3.event.stopPropagation();
}
function node_onMouseOut(d) {
header.text("");
toolTip.style("opacity", "0");
}
function createShapeLegend() {
var shapeLegendDisplay = legendShapeChart.svg().selectAll("g.shapeLegend")
.data(shapeLegend)
.enter().append("svg:g")
.attr("class", "shapeLegend")
.attr("transform", function(d, i) { return "translate("+(d.index * 310) +","+ d.depth+")"; })
shapeLegendDisplay.append("path")
.attr("class", function(d) {return d.name;})
.attr("d", d3.svg.symbol().type(function(d) { return d.shape;}))
.style("fill", function(d) {
var color = "#1bb15c"
if (d.hasRequirements) { color = "#7C84DE"}
return d._children ? color : "#FFF";
})
.style("stroke", function(d) {
var color = "#1bb15c"
if (d.hasRequirements || d.isRequirement) { color = "#7C84DE"}
if (d.recentUpdate == "Update") {color = "#DC7A20"}
if (d.recentUpdate == "New Requirement") {color = "#B03A57 "}
return color
})
// "stroke": function(d) {chart.findNodeStroke(d)},
.attr("r", 3);
shapeLegendDisplay.append("svg:text")
.attr("class", function(d) {return d.name;})
.attr("x", 13)
.attr("dy", ".31em")
.text(function(d) {
return d.name;
});
var shapeLegendDisplay = legendShapeChart.svg();
shapeLegendDisplay.append("text")
.attr("x", 0)
.attr("y", -28 )
.attr("text-anchor", "left")
.style("font-size", "16px")
.text("Legend");
}
</script>
</body>
</html>