2
// OrgUnit GroupSet Change Function
3
function orgUnitGroupSetCB()
5
var orgUnitGroupSetList = document.getElementById( 'orgUnitGroupSetListCB' );
6
var orgUnitList = document.getElementById( 'orgUnitListCB' );
7
if(document.getElementById( 'ougSetCB' ).checked)
9
orgUnitGroupSetList.disabled = false;
14
orgUnitGroupSetList.disabled = true;
16
clearList(orgUnitList);
19
// Removes slected orgunits from the Organisation List
20
function remOUFunction()
22
var index = document.ChartGenerationForm.orgUnitListCB.options.length;
24
for(i=index-1;i>=0;i--)
26
if(document.ChartGenerationForm.orgUnitListCB.options[i].selected)
27
document.ChartGenerationForm.orgUnitListCB.options[i] = null;
31
// DataElement and Its options Change Function
32
function deSelectionChangeFuntion(evt)
34
var availableDataElements = document.getElementById("availableDataElements");
35
var selectedDataElements = document.getElementById("selectedDataElements");
37
clearList(availableDataElements);
38
clearList(selectedDataElements);
43
// Category ListBox Change function
44
function categoryChangeFunction(evt)
46
selCategory = evt.target.value;
47
if(selCategory == "period")
49
document.ChartGenerationForm.facilityLB.disabled = true;
50
var index = document.ChartGenerationForm.orgUnitListCB.options.length;
53
document.ChartGenerationForm.orgUnitListCB.options[0] = null;
58
document.ChartGenerationForm.facilityLB.disabled = false;
60
}// categoryChangeFunction end
62
//Facility ListBox Change Function
63
function facilityChangeFunction(evt)
65
selFacility = evt.target.value;
66
if(selFacility == "children")
68
var index = document.ChartGenerationForm.orgUnitListCB.options.length;
71
document.ChartGenerationForm.orgUnitListCB.options[0] = null;
74
}// facilityChangeFunction end
76
// Indicator or Dataelement radio button changed function
77
function riradioSelection(evt)
79
selriRadioButton = evt.target.value;
80
if(selriRadioButton == "dataElementsRadio")
82
document.ChartGenerationForm.indicatorGroupId.disabled = true;
83
document.ChartGenerationForm.availableIndicators.disabled = true;
84
document.ChartGenerationForm.selectedIndicators.disabled = true;
86
document.ChartGenerationForm.dataElementGroupId.disabled = false;
87
document.ChartGenerationForm.availableDataElements.disabled = false;
88
document.ChartGenerationForm.selectedDataElements.disabled = false;
92
document.ChartGenerationForm.indicatorGroupId.disabled = false;
93
document.ChartGenerationForm.availableIndicators.disabled = false;
94
document.ChartGenerationForm.selectedIndicators.disabled = false;
96
document.ChartGenerationForm.dataElementGroupId.disabled = true;
97
document.ChartGenerationForm.availableDataElements.disabled = true;
98
document.ChartGenerationForm.selectedDataElements.disabled = true;
100
}// function riradioSelection end
102
// Selected Button (ie ViewSummary or ViewChart) Function
103
function selButtonFunction(selButton)
105
document.ChartGenerationForm.selectedButton.value = selButton;
106
}// selButtonFunction end
109
//Graphical Analysis Form Validations
110
function formValidations()
113
var selOUListLength = document.ChartGenerationForm.orgUnitListCB.options.length;
114
var selDEListSize = document.ChartGenerationForm.selectedDataElements.options.length;
115
var selIndListSize = document.ChartGenerationForm.selectedIndicators.options.length;
116
sDateIndex = document.ChartGenerationForm.sDateLB.selectedIndex;
117
eDateIndex = document.ChartGenerationForm.eDateLB.selectedIndex;
118
category = document.ChartGenerationForm.categoryLB.selectedIndex;
119
sDate = document.ChartGenerationForm.sDateLB.options[sDateIndex].text;
120
eDate = document.ChartGenerationForm.eDateLB.options[eDateIndex].text;
121
categoryName = document.ChartGenerationForm.categoryLB.options[category].text;
123
if(selOUListLength <= 0) {alert("Please Select OrganisationUnit");return false;}
124
else if(selriRadioButton == "dataElementsRadio" && selDEListSize <= 0) {alert("Please Select DataElement(s)");return false;}
125
else if(selriRadioButton == "indicatorsRadio" && selIndListSize <= 0) {alert("Please Select Indicator(s)");return false;}
126
else if(sDateIndex < 0) {alert("Please Select Starting Period");return false;}
127
else if(eDateIndex < 0) {alert("Please Select Ending Period");return false;}
128
else if(category < 0) {alert("Please Select Category");return false;}
129
else if(sDate > eDate) {alert("Starting Date is Greater");return false;}
132
if(selriRadioButton == "dataElementsRadio")
134
for(k=0;k<document.ChartGenerationForm.selectedDataElements.options.length;k++)
136
document.ChartGenerationForm.selectedDataElements.options[k].selected = true;
141
for(k=0;k<document.ChartGenerationForm.selectedIndicators.options.length;k++)
143
document.ChartGenerationForm.selectedIndicators.options[k].selected = true;
147
if(document.getElementById( 'ougSetCB' ).checked)
149
if(document.ChartGenerationForm.orgUnitListCB.selectedIndex <= -1)
150
{alert("Please Select OrganisationUnit");return false;}
154
for(k=0;k<selOUListLength;k++)
156
document.ChartGenerationForm.orgUnitListCB.options[k].selected = true;
162
var LeftPosition=(screen.width)?(screen.width-sWidth)/2:100;
163
var TopPosition=(screen.height)?(screen.height-sHeight)/2:100;
165
window.open('','chartWindow1','width=' + sWidth + ', height=' + sHeight + ', ' + 'left=' + LeftPosition + ', top=' + TopPosition + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=yes, resizable=yes');
167
} // formValidations Function End