~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to local/in/dhis-web-ga/GAnalysisScreen.jsp

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
 
 
3
 
 
4
<%@ page contentType="text/html ; charset=UTF-8"%>
 
5
 
 
6
<%@ page import="java.sql.*,java.util.*" %>
 
7
<%@ page session="true"%>
 
8
 
 
9
 
 
10
<jsp:useBean id="GenerateHomePage" scope="session" class="org.hisp.gtool.action.GenerateHomePage" />
 
11
<jsp:useBean id="AudioAction" scope="session" class="org.hisp.gtool.action.AudioAction" />
 
12
 
 
13
 
 
14
<%
 
15
 
 
16
// To Play Audio
 
17
String muteOpt = (String) session.getAttribute("muteOpt");
 
18
if(muteOpt != null && muteOpt.equals("OFF"))
 
19
{
 
20
        AudioAction.stopAudio();
 
21
        AudioAction.playAudio("t2.wav");
 
22
}       
 
23
 
 
24
 
 
25
Hashtable htForIGMembers = GenerateHomePage.getIndicatorGroups();
 
26
//Enumeration keysForigMembers = htForIGMembers.keys();
 
27
Vector keysForigMembers = new Vector(htForIGMembers.keySet());
 
28
Collections.sort(keysForigMembers);
 
29
Iterator keysForigMembersIter = keysForigMembers.iterator();
 
30
 
 
31
        
 
32
Hashtable htForDEGMembers = GenerateHomePage.getDEGroups();
 
33
//Enumeration keysFordegMembers = htForDEGMembers.keys();
 
34
Vector keysFordegMembers = new Vector(htForDEGMembers.keySet());
 
35
Collections.sort(keysFordegMembers);
 
36
Iterator keysFordegMembersIter = keysFordegMembers.iterator();
 
37
 
 
38
 
 
39
String monthNames[]={"","Jan-","Feb-","Mar-","Apr-","May-","Jun-","Jul-","Aug-","Sep-","Oct-","Nov-","Dec-"};
 
40
%>
 
41
 
 
42
<html>
 
43
        <head>
 
44
                <title>Graphical Analyser</title>
 
45
                <link rel="stylesheet" type="text/css" href="css/StylesForTags.css" />
 
46
                <style fprolloverstyle>                 
 
47
                                A:hover {background-color: silver;}
 
48
                </style>                
 
49
                <script>
 
50
                        var ouName=""; 
 
51
                        var indName="";
 
52
                        var sDateIndex=0;
 
53
                        var eDateIndex=0;
 
54
                        var category="";
 
55
                        var categoryName="";
 
56
                        
 
57
                        var sDate="";
 
58
                        var eDate="";
 
59
                        
 
60
                        var igMembers = new Array(); // Indicator Groups and its Corresponding Indicators
 
61
                        var countForIGMembers1 = 0;
 
62
                        var countForIGMembers2 = 0;
 
63
                        
 
64
                        var selriRadioButton="indicatorsRadio";
 
65
 
 
66
                        // Indicator Group Members
 
67
                        <%
 
68
                //      keysForigMembers = htForIGMembers.keys();
 
69
                        
 
70
//                      Vector keysForigMembers = new Vector(htForIGMembers.keySet());
 
71
//                      Collections.sort(keysForigMembers);
 
72
                        keysForigMembersIter = keysForigMembers.iterator();
 
73
                        
 
74
                        while(keysForigMembersIter.hasNext())
 
75
                        {
 
76
                                String igName = (String) keysForigMembersIter.next();
 
77
                                List liForIGMembers = (ArrayList) htForIGMembers.get(igName);
 
78
                                Iterator itForIGMembers = liForIGMembers.iterator();
 
79
                                %>
 
80
                                igMembers[countForIGMembers1] = new Array();
 
81
                                countForIGMembers2 = 0;
 
82
                                <%
 
83
                                while(itForIGMembers.hasNext())
 
84
                                {               
 
85
                                        String iName = (String) itForIGMembers.next();
 
86
                                        %>
 
87
                                        igMembers[countForIGMembers1][countForIGMembers2++]= '<%=iName%>';
 
88
                                        <%
 
89
                                } // inner while loop
 
90
                                %>
 
91
                                countForIGMembers1++;
 
92
                                <%
 
93
                        } // outer while loop   
 
94
                        %>
 
95
                        
 
96
                        
 
97
                        var degMembers = new Array(); // DEGroups and its Dataelemets
 
98
                        var countForDEGMembers1 = 0;
 
99
                        var countForDEGMembers2 = 0;
 
100
 
 
101
                        // DEGroup Members
 
102
                        <%
 
103
                        keysFordegMembersIter = keysFordegMembers.iterator();
 
104
                        while(keysFordegMembersIter.hasNext())
 
105
                        {
 
106
                                String degName = (String) keysFordegMembersIter.next();
 
107
                                List liForDEGMembers = (ArrayList) htForDEGMembers.get(degName);
 
108
                                Iterator itForDEGMembers = liForDEGMembers.iterator();
 
109
                                %>
 
110
                                degMembers[countForDEGMembers1] = new Array();
 
111
                                countForDEGMembers2 = 0;
 
112
                                <%
 
113
                                while(itForDEGMembers.hasNext())
 
114
                                {               
 
115
                                        String deName = (String) itForDEGMembers.next();
 
116
                                        %>
 
117
                                        degMembers[countForDEGMembers1][countForDEGMembers2++]= '<%=deName%>';
 
118
                                        <%
 
119
                                } // inner while loop
 
120
                                %>
 
121
                                countForDEGMembers1++;
 
122
                                <%
 
123
                        } // outer while loop   
 
124
                        %>
 
125
                        
 
126
                        
 
127
                        
 
128
                        var igNames = new Array(); // IndicatorGroup Names
 
129
                        var countForIGNames = 0;
 
130
 
 
131
                        // IndicatorGroup Names                 
 
132
                        <%
 
133
                                //keysForigMembers = htForIGMembers.keys();
 
134
                                keysForigMembersIter = keysForigMembers.iterator();
 
135
                                while(keysForigMembersIter.hasNext())
 
136
                                {
 
137
                                        String igName = (String) keysForigMembersIter.next(); 
 
138
                                        %>
 
139
                                        igNames[countForIGNames++]= '<%=igName%>';
 
140
                                        <%                                      
 
141
                                } // while loop         
 
142
                        %>
 
143
 
 
144
 
 
145
 
 
146
                        var degNames = new Array(); // DataElementGroup Names
 
147
                        var countForDEGNames = 0;
 
148
                        
 
149
                        // DEGroup Names                        
 
150
                        <%
 
151
                                //keysFordegMembers = htForDEGMembers.keys();
 
152
                                keysFordegMembersIter = keysFordegMembers.iterator();
 
153
                                while(keysFordegMembersIter.hasNext())
 
154
                                {
 
155
                                        String degName = (String) keysFordegMembersIter.next(); 
 
156
                                        %>
 
157
                                        degNames[countForDEGNames++]= '<%=degName%>';
 
158
                                        <%                                      
 
159
                                } // while loop         
 
160
                        %>
 
161
                        
 
162
                        
 
163
                        
 
164
                        function riradioSelection(evt)
 
165
                        {
 
166
                                selriRadioButton = evt.target.value;
 
167
                                var iGroupsCBLength = document.ChartGenerationForm.iGroupsCB.options.length;
 
168
                        var k = 0;
 
169
                        // For loop to clear the Indicator/DE Group ListBox
 
170
                        for(k=0;k<iGroupsCBLength;k++)
 
171
                {
 
172
                        document.ChartGenerationForm.iGroupsCB.options[0] = null;            
 
173
                } // for loop end
 
174
                
 
175
                // For Loop to clear the Indicators /Data Elements ListBox
 
176
                var iListCBLength = document.ChartGenerationForm.iListCB.options.length;
 
177
                        for(k=0;k<iListCBLength;k++)
 
178
                {
 
179
                        document.ChartGenerationForm.iListCB.options[0] = null;              
 
180
                } // for loop end                         
 
181
                                          
 
182
                                var ideGroupIndex = 0;                          
 
183
                                if(selriRadioButton == "dataElementsRadio")
 
184
                                 {                               
 
185
                                        for(k=0;k<degNames.length;k++)
 
186
                                        {
 
187
                                         document.ChartGenerationForm.iGroupsCB.options[k] = new Option(degNames[k],degNames[k],false,false);                            
 
188
                                        }// for loop end
 
189
                                        
 
190
                                        for(k=0;k<degMembers[ideGroupIndex].length;k++)
 
191
                                        {
 
192
                                         document.ChartGenerationForm.iListCB.options[k] = new Option(degMembers[ideGroupIndex][k],degMembers[ideGroupIndex][k],false,false);                            
 
193
                                        }// for loop end
 
194
                                        
 
195
                                  }// if block end
 
196
                                 else
 
197
                                 {
 
198
                                        for(k=0;k<igNames.length;k++)
 
199
                                        {
 
200
                                         document.ChartGenerationForm.iGroupsCB.options[k] = new Option(igNames[k],igNames[k],false,false);                              
 
201
                                        }// for loop end        
 
202
                                        
 
203
                                        
 
204
                                        for(k=0;k<igMembers[ideGroupIndex].length;k++)
 
205
                                        {
 
206
                                        document.ChartGenerationForm.iListCB.options[k] = new Option(igMembers[ideGroupIndex][k],igMembers[ideGroupIndex][k],false,false);                               
 
207
                                        }// for loop end                         
 
208
                                 }// else end                           
 
209
                        }// function riradioSelection end
 
210
                        
 
211
                        
 
212
                        function onloadFunction()
 
213
                        {
 
214
                                var iGroupsCBLength = document.ChartGenerationForm.iGroupsCB.options.length;
 
215
                        var k = 0;
 
216
                        for(k=0;k<iGroupsCBLength;k++)
 
217
                {
 
218
                        document.ChartGenerationForm.iGroupsCB.options[0] = null;            
 
219
                } // for loop end                         
 
220
                                for(k=0;k<igNames.length;k++)
 
221
                                {
 
222
                                        document.ChartGenerationForm.iGroupsCB.options[k] = new Option(igNames[k],igNames[k],false,false);                               
 
223
                                }// for loop end                                 
 
224
                                                                
 
225
                                                                
 
226
                                var iListCBLength = document.ChartGenerationForm.iListCB.options.length;
 
227
                        for(k=0;k<iListCBLength;k++)
 
228
                {
 
229
                        document.ChartGenerationForm.iListCB.options[0] = null;              
 
230
                } // for loop end                         
 
231
                                var iGroupIndex = 0;
 
232
                                for(k=0;k<igMembers[iGroupIndex].length;k++)
 
233
                                {
 
234
                                 document.ChartGenerationForm.iListCB.options[k] = new Option(igMembers[iGroupIndex][k],igMembers[iGroupIndex][k],false,false);                          
 
235
                                }
 
236
                        } // onloadFuntion end
 
237
                        
 
238
 
 
239
                        function iGroupsCBChange()
 
240
                        {
 
241
                                var iListCBLength = document.ChartGenerationForm.iListCB.options.length;
 
242
                        var k = 0;
 
243
                        for(k=0;k<iListCBLength;k++)
 
244
                {
 
245
                        document.ChartGenerationForm.iListCB.options[0] = null;              
 
246
                } // for loop end                         
 
247
                                var iGroupIndex = document.ChartGenerationForm.iGroupsCB.selectedIndex;
 
248
                                
 
249
                                if(selriRadioButton == "dataElementsRadio")
 
250
                                 {                               
 
251
                                        for(k=0;k<degMembers[iGroupIndex].length;k++)
 
252
                                        {
 
253
                                         document.ChartGenerationForm.iListCB.options[k] = new Option(degMembers[iGroupIndex][k],degMembers[iGroupIndex][k],false,false);                                
 
254
                                        }// for loop end
 
255
                                  }// if block end
 
256
                                 else
 
257
                                 {
 
258
                                        for(k=0;k<igMembers[iGroupIndex].length;k++)
 
259
                                        {
 
260
                                         document.ChartGenerationForm.iListCB.options[k] = new Option(igMembers[iGroupIndex][k],igMembers[iGroupIndex][k],false,false);                          
 
261
                                        }// for loop end                                 
 
262
                                 }// else end   
 
263
                        }// function iGroupsCBChange end
 
264
                        
 
265
                        
 
266
                        function formValidations()
 
267
                        {
 
268
                                ouName   = document.ChartGenerationForm.ouNameTB.value;
 
269
                                indName  = document.ChartGenerationForm.iListCB.selectedIndex;
 
270
                                sDateIndex    = document.ChartGenerationForm.sDateLB.selectedIndex;
 
271
                                eDateIndex    = document.ChartGenerationForm.eDateLB.selectedIndex;
 
272
                                category = document.ChartGenerationForm.categoryLB.selectedIndex;
 
273
                        
 
274
                                sDate = document.ChartGenerationForm.sDateLB.options[sDateIndex].value;
 
275
                                eDate = document.ChartGenerationForm.eDateLB.options[eDateIndex].value;
 
276
                                categoryName = document.ChartGenerationForm.categoryLB.options[category].text;
 
277
 
 
278
 
 
279
                                if(ouName=="" || ouName==null) {alert("Please Select OrganisationUnit");return false;}
 
280
                                else if(indName < 0) {alert("Please Select Indicator(s)");return false;}
 
281
                                else if(sDateIndex < 0) {alert("Please Select Starting Period");return false;}
 
282
                                else if(eDateIndex < 0) {alert("Please Select Ending Period");return false;}
 
283
                                else if(category < 0) {alert("Please Select Category");return false;}
 
284
                                else if(sDate > eDate) {alert("Starting Date is Greater");return false;}
 
285
 
 
286
                                var sWidth = 850;
 
287
                                var sHeight = 650;
 
288
                                var LeftPosition=(screen.width)?(screen.width-sWidth)/2:100;
 
289
                                var TopPosition=(screen.height)?(screen.height-sHeight)/2:100;
 
290
 
 
291
                                window.open('','chartWindow1','width=' + sWidth + ', height=' + sHeight + ', ' + 'left=' + LeftPosition + ', top=' + TopPosition + ', ' + 'location=no, menubar=no, ' +  'status=no, toolbar=no, scrollbars=yes, resizable=yes');
 
292
 
 
293
                                return true;
 
294
                        } // formValidations Function End
 
295
                 
 
296
                 function summaryReportFunction()
 
297
                 {
 
298
                        if(formValidations())
 
299
                                {                       
 
300
                                        var urlValuesForSR = ouName+"@@"+sDate+"@@"+eDate;
 
301
                                        
 
302
                                        var sWidth = 850;
 
303
                                        var sHeight = 650;
 
304
                                        var LeftPosition=(screen.width)?(screen.width-sWidth)/2:100;
 
305
                                        var TopPosition=(screen.height)?(screen.height-sHeight)/2:100;
 
306
 
 
307
                                        // window.open("summaryReportFW.jsp?Action="+urlValuesForSR,'chartWindow1','width=' + sWidth + ', height=' + sHeight + ', ' + 'left=' + LeftPosition + ', top=' + TopPosition + ', ' + 'location=no, menubar=no, ' +  'status=no, toolbar=no, scrollbars=no, resizable=no');
 
308
                                                                                
 
309
                                        if(categoryName=="Period") window.open("summaryReportPW.jsp?Action="+urlValuesForSR,'chartWindow1','width=' + sWidth + ', height=' + sHeight + ', ' + 'left=' + LeftPosition + ', top=' + TopPosition + ', ' + 'location=no, menubar=no, ' +  'status=no, toolbar=no, scrollbars=yes, resizable=yes');
 
310
                                        else if(categoryName=="Facility") window.open("summaryReportFW.jsp?Action="+urlValuesForSR,'chartWindow1','width=' + sWidth + ', height=' + sHeight + ', ' + 'left=' + LeftPosition + ', top=' + TopPosition + ', ' + 'location=no, menubar=no, ' +  'status=no, toolbar=no, scrollbars=yes, resizable=yes');
 
311
                                }                                                       
 
312
                }// summaryReportFunction end   
 
313
        </script>
 
314
        </head>
 
315
        <body onload="onloadFunction()" >
 
316
        <form id="ChartGenerationForm" name="ChartGenerationForm" action="tempForViewChart.jsp" method="post" onsubmit="return formValidations()" target="chartWindow1">        
 
317
                 <table style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="100%" height="100%"  border=0 valign="top">
 
318
                <tr>
 
319
                        <td width="64%" class="NormalB" valign="top" style="padding-left: 0; padding-top: 0">
 
320
                                <table cellpadding="15" cellspacing="2" border=0 bordercolor="#800000" width="100%" style="background-image: url('images/Ind_Box1.png'); background-repeat: no-repeat;">                                        
 
321
                                        <tr><td class="NormalB">
 
322
                                                <input type="radio" id="riRadio" name="riRadio" value="dataElementsRadio"    onclick="riradioSelection(event)"> DataElements
 
323
                                                        &nbsp;&nbsp;&nbsp;
 
324
                                                <input type="radio" id="riRadio" name="riRadio" value="indicatorsRadio" onclick="riradioSelection(event)" checked> Indicators
 
325
                                        </td></tr>                                      
 
326
                                        <tr><td class="NormalB">
 
327
                                                        Indicator/DataElement Group : <br><select name="iGroupsCB" id="iGroupsCB" onchange="iGroupsCBChange()" style="width: 400">
 
328
                                                                                                                                                <%
 
329
                                                                                                                                                /*
 
330
                                                                                                                                                keysForigMembers = htForIGMembers.keys();
 
331
                                                                                                                                                while(keysForigMembers.hasMoreElements())
 
332
                                                                                                                                                {
 
333
                                                                                                                                                        String igName = (String) keysForigMembers.nextElement(); %>
 
334
                                                                                                                                                        <option><%=igName%></option>
 
335
                                                                                                                                                <%} // while loop       
 
336
                                                                                                                                                */      
 
337
                                                                                                                                                %>                                                                                                                                      
 
338
                                                                                                                                          </select>
 
339
                                                </td></tr>                                                                                                                                        
 
340
                                                <tr><td class="NormalB" >                                                                                                                                                                                                                                                                                                                                                                         
 
341
                                                                                                                                         Indicator/DataElement List : <br><select name="iListCB" id="iListCB" multiple size="15" style="width: 400">
 
342
                                                                                                                                         <%
 
343
                                                                                                                                                /*
 
344
                                                                                                                                                List liForIName = GenerateHomePage.getIndicatorName();
 
345
                                                                                                                                                Iterator iForIName = liForIName.iterator();
 
346
                                                                                                                                                while(iForIName.hasNext())
 
347
                                                                                                                                                        {
 
348
                                                                                                                                                                String iname = (String) iForIName.next();%>
 
349
                                                                                                                                                                <option><%=iname%></option>
 
350
                                                                                                                                                        <%}// while loop end                                                                    
 
351
                                                                                                                                                */      
 
352
                                                                                                                                        %>                                      
 
353
                                                                                                                                        </select>
 
354
                                                </td></tr>
 
355
                                                <tr><td>&nbsp;<br></br><br/></td></tr>
 
356
                                </table>                
 
357
                        </td>                                                                                   
 
358
                        <td width="31%" class="NormalB" style="padding-left: 0; padding-top: 0" valign="top">
 
359
                                        <table border=0 width="100%" cellpadding="25" style="background-image: url('images/Period_Box1.png'); background-repeat: no-repeat; ">                                          
 
360
                                                <tr><td class="NormalB" width="100%">
 
361
                                                        From : <br><select id="sDateLB" name="sDateLB">
 
362
                                                                                                <%
 
363
                                                                                                        List liForSDate = GenerateHomePage.getStartDate();
 
364
                                                                                                        Iterator iForSDate = liForSDate.iterator();
 
365
                                                                                                        while(iForSDate.hasNext())
 
366
                                                                                                        {
 
367
                                                                                                                String sdate = (String) iForSDate.next();
 
368
                                                                                                                String partsOfTempForSDate[] = sdate.split("-");
 
369
                                                                                                                String tempForSDate = monthNames[Integer.parseInt(partsOfTempForSDate[1])]+partsOfTempForSDate[0];%>
 
370
                                                                                                                <option value="<%=sdate%>"><%=tempForSDate%></option>
 
371
                                                                                                        <%}// while loop end                                                                    
 
372
                                                                                                        %>                                                                              
 
373
                                                                                                </select>
 
374
                                                                                                
 
375
                                                                                                <br><br>
 
376
                                                                                                
 
377
                                                                                                To : <br><select id="eDateLB" name="eDateLB">
 
378
                                                                                <%
 
379
                                                                                        List liForEDate = GenerateHomePage.getEndDate();
 
380
                                                                                        Iterator iForEDate = liForEDate.iterator();
 
381
                                                                                        while(iForEDate.hasNext())
 
382
                                                                                        {
 
383
                                                                                                String edate = (String) iForEDate.next();
 
384
                                                                                                String partsOfTempForEDate[] = edate.split("-");
 
385
                                                                                                String tempForEDate = monthNames[Integer.parseInt(partsOfTempForEDate[1])]+partsOfTempForEDate[0];%>
 
386
                                                                                                <option value="<%=edate%>"><%=tempForEDate%></option>
 
387
                                                                                        <%}// while loop end                                                                    
 
388
                                                                                %>
 
389
                                                                        </select>
 
390
                                                                        <br/><br/><br/>
 
391
                                                                </td></tr>                                                              
 
392
                                                        </table>                                                        
 
393
                                                        <table width="100%" cellpadding="15" border=0 bordercolor="#800000" style="background-image: url('images/Submit_Box1.png'); background-repeat: no-repeat; " >
 
394
                                                        <tr><td class="NormalB">                
 
395
                                                                        OrganisationUnit  : <br><input type="text" name="ouNameTB" id="ouNameTB" size="20">                                                                                                                             
 
396
                                                                        <br/><br/><br/>
 
397
                                                                        View by : <br><select id="categoryLB" name="categoryLB">
 
398
                                                                                                <option>Period</option>
 
399
                                                                                                <option>Facility</option>
 
400
                                                                                                
 
401
                                                                                        </select>
 
402
                                                                        <br/><br/><br/>                                                                                 
 
403
                                                                        <input type="submit" name="ViewChart" value="ViewChart" style="width: 120; height: 25; font-family:Arial; font-weight:bold; color:#800080">
 
404
                                                                        <br/><br/><br/>
 
405
                                                                        <input type="button" name="ViewSummary" value="ViewSummary" style="width: 120; height: 25; font-family:Arial; font-weight:bold; color:#800080" onclick="javascript:summaryReportFunction()">
 
406
                                                                        <input type="hidden" name="ouIDTB" id="ouIDTB">
 
407
                                                                        <br></br><br/><br/><br/><br/>
 
408
                                                                </td></tr>
 
409
                                                        </table>                                                                
 
410
                                        </td>
 
411
                                        <td width="5%" valign="center" class="NormalB" style="background-image: url('images/SideTitle1.png'); background-repeat: no-repeat; "></td>
 
412
                                </tr>
 
413
                        </table>
 
414
                        </form> 
 
415
        </body>
 
416
</html>
 
 
b'\\ No newline at end of file'