← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1980: Cleaning Code: GOI Reports form, work in progress

 

------------------------------------------------------------
revno: 1980
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2010-10-31 13:31:14 +0530
message:
  Cleaning Code: GOI Reports form, work in progress
modified:
  local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/form.vm
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserFormAction.java
  local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/javascript/reports.js
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/upwardReportAnalysisFront.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/form.vm'
--- local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/form.vm	2010-10-20 06:14:25 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/form.vm	2010-10-31 08:01:14 +0000
@@ -3,8 +3,6 @@
 
 <script>
     var rowCount = 0;
-
-
 </script>
 
 <form id="LineListDataEntryForm" action="saveValueAction.action" method="post" onsubmit="return calMaxRecords()">
@@ -16,118 +14,115 @@
         <th width="40%">DataElement</th>
         <th width="20%">Entry</th>
     </tr>
-#set( $dataValueMapKeys = $dataelementMap.keySet() )
-#foreach( $dataValueMapKey in $dataValueMapKeys )
-    #set( $dataElementName = $dataelementMap.get( $dataValueMapKey ) )
-    #set( $dataValue = $dataValueMap.get( $dataValueMapKey ) )
-	<tr>
-	    <td align="center">$count1</td>
-	    <td>$dataElementName</td>
-	    <td align="center"><input type="text" id="$dataValueMapKey" name="$dataValueMapKey" value="$!dataValue.value" />
-        #if( $sactionedPostdataelement == $dataValueMapKey)
-            <input type="button" value="Add" onclick="return addLLNewRow( '$dataValueMapKey' )">
-            
-        #end
-        </td>
-	<tr>
-    
-	#set( $count1 = $count1 + 1 )
-#end
+	#set( $dataValueMapKeys = $dataelementMap.keySet() )
+	#foreach( $dataValueMapKey in $dataValueMapKeys )
+		#set( $dataElementName = $dataelementMap.get( $dataValueMapKey ) )
+		#set( $dataValue = $dataValueMap.get( $dataValueMapKey ) )
+		<tr>
+			<td align="center">$count1</td>
+			<td>$dataElementName</td>
+			<td align="center"><input type="text" id="$dataValueMapKey" name="$dataValueMapKey" value="$!dataValue.value" />
+			#if( $sactionedPostdataelement == $dataValueMapKey)
+				<input type="button" value="Add" onclick="return addLLNewRow( '$dataValueMapKey' )">
+			#end
+			</td>
+		<tr>		
+		#set( $count1 = $count1 + 1 )
+	#end
 </table>
 
 <table id="tblGrid" width="100%">
+
     <tr>
         <th width="20">Sr.No.</th>
         #foreach( $lineListElement in $lineListElements )
-	    <th>$lineListElement.name</th>
+			<th>$lineListElement.name</th>
         #end
         <th width="20">Delete</th>
     </tr>
 
-#set($maxRecord = 0)
-#set($recordNumberList = "")
-#set($calInfo = "")
-#set($srno = 0)
-#if($llDataValuesList.size()!=0)
-
-    #foreach($llDataValue in $llDataValuesList)
-        #set($srno = $srno + 1)
-        #set($recordNumber = $llDataValue.recordNumber)
-        #set($recordNumberList = $recordNumberList + $recordNumber +":")
-        #set($llElementValuesMap = $llDataValue.lineListValues)
-
-        <tr>
-            <td><label id="sr.no">$srno</label></td>
-            #foreach( $lineListElement in $lineListElements )
-                #set($element = $lineListElement.shortName+':'+$recordNumber)
-                #set($getDate = 'getDate:'+$element)
-                #if($lineListElement.PresentationType == 'text')
-                    <td>
-                        <input type="text" name="$element" id = "$element" style="width:10em" onchange="return valueChanged($recordNumber,'$lineListElement.shortName')" value=$!llElementValuesMap.get($element)>
-                    </td>
-                #elseif($lineListElement.PresentationType == 'combobox')
-                    <td>
-                        <select name="$element" id="$element" onchange="return valueChanged($recordNumber,'$lineListElement.shortName')">
-                        <option name="SelectOption" value="" selected>--Select--</option>
-                            #set($lineListOptions = $llElementOptionsMap.get($lineListElement.shortName))
-                            #foreach( $lineListOption in $lineListOptions )
-                                <option name="$lineListOption.name" value="$lineListOption.name" #if($lineListOption.name == $llElementValuesMap.get($element)) selected #end>$lineListOption.name</option>
-                            #end
-                        </select>
-                    </td>
-                #elseif($lineListElement.PresentationType == 'calender')
-                    <td>
-		              <input type="text" id="$element" name="$element" style="width:10em" value="$!llElementValuesMap.get($element)" onchange="return valueChanged($recordNumber,'$lineListElement.shortName')">
-		              <img src="../images/calendar_icon.gif" width="16" height="16" id="$getDate" style="cursor: pointer;" title="$i18n.getString("date_selector")" onmouseover="this.style.background='orange';" onmouseout="this.style.background='green'" alt="Date">
-                    </td>
-                    <script type="text/javascript">
-        Calendar.setup({
-            inputField     :    "$element",      // id of the input field
-            ifFormat       :    "$i18n.getString("format.date.label")",       // format of the input field
-            button         :    "$getDate"   // trigger for the calendar (button ID)
-        });
-  	</script>
-                #end
-            #end
-            <td>
-                <a href="javascript:removeLLRecord( '$recordNumber' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
-            </td>
-            <td>
-                <input type="hidden" name="recordNumber:$recordNumber" id="recordNumber:$recordNumber" value="$recordNumber" style="width:10px;">
-            </td>
-            <td>
-                <input type="hidden" name="changedValue:$recordNumber" id="changedValue:$recordNumber">
-            </td>
-        </tr>
-        #set($maxRecord = $maxRecord + 1)
-    #end
-#end
+	#set($maxRecord = 0)
+	#set($recordNumberList = "")
+	#set($calInfo = "")
+	#set($srno = 0)
+	
+	#if($llDataValuesList.size()!=0)
+
+		#foreach($llDataValue in $llDataValuesList)
+			#set($srno = $srno + 1)
+			#set($recordNumber = $llDataValue.recordNumber)
+			#set($recordNumberList = $recordNumberList + $recordNumber +":")
+			#set($llElementValuesMap = $llDataValue.lineListValues)
+	
+			<tr>
+				<td><label id="sr.no">$srno</label></td>
+				#set( $colCount = 0 )
+				#foreach( $lineListElement in $lineListElements )
+					#set($element = $lineListElement.shortName+':'+$recordNumber)
+					#set($getDate = 'getDate:'+$element)
+					#if($lineListElement.PresentationType == 'text')
+						<td>
+							<input type="text" name="$element" id = "$element" style="width:10em" onchange="return valueChanged($recordNumber,'$lineListElement.shortName')" value=$!llElementValuesMap.get($element)>
+						</td>
+					#elseif($lineListElement.PresentationType == 'combobox')
+						<td>
+							<select name="$element" id="$element" onchange="return valueChanged($recordNumber,'$lineListElement.shortName')">
+							<option name="SelectOption" value="" selected>--Select--</option>
+								#set($lineListOptions = $llElementOptionsMap.get($lineListElement.shortName))
+								#foreach( $lineListOption in $lineListOptions )
+									<option name="$lineListOption.name" value="$lineListOption.name" #if($lineListOption.name == $llElementValuesMap.get($element)) selected #end>$lineListOption.name</option>
+								#end
+							</select>
+						</td>
+					#elseif($lineListElement.PresentationType == 'calender')
+						<td>
+						  <input type="text" id="$element" name="$element" style="width:10em" value="$!llElementValuesMap.get($element)" onchange="return valueChanged($recordNumber,'$lineListElement.shortName')">
+						  <img src="../images/calendar_icon.gif" width="16" height="16" id="$getDate" style="cursor: pointer;" title="$i18n.getString("date_selector")" onmouseover="this.style.background='orange';" onmouseout="this.style.background='green'" alt="Date">
+						</td>
+						<script type="text/javascript">
+							Calendar.setup({
+								inputField     :    "$element",      // id of the input field
+								ifFormat       :    "$i18n.getString("format.date.label")",       // format of the input field
+								button         :    "$getDate"   // trigger for the calendar (button ID)
+							});
+						</script>
+					#end
+				#end
+				<td>
+					<a href="javascript:removeLLRecord( '$recordNumber' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
+				</td>
+				<td>
+					<input type="hidden" name="recordNumber:$recordNumber" id="recordNumber:$recordNumber" value="$recordNumber" style="width:10px;">
+				</td>
+				<td>
+					<input type="hidden" name="changedValue:$recordNumber" id="changedValue:$recordNumber">
+				</td>
+			</tr>
+			#set($maxRecord = $maxRecord + 1)
+		#end
+	#end
 
 </table>
 
-<br/>
-<br/>
-<br>
+<br/><br/><br/>
+
 <table>
     <tr>
-
-    <td>
-        <center><input type="submit" value="Save"> 
-        <input type="hidden" id="reportedDate" name="reportedDate">
-    </td>
-    <td>
-        <input type="text" name="recordsFromDb" id="recordsFromDb" value="$maxRecord">recordsFromDb
-        <input type="hidden" name="delRecordNo" id="delRecordNo" >
-    </td>
-    <td>
-        <input type="text" name="totalRecords" id="totalRecords">totalRecords
-    </td>
-    <td>
-        <input type="hidden" name="recordNumbersList" id="recordNumbersList" value="$recordNumberList">
-    </td>
-
-</tr>
-
+		<td>
+			<center><input type="submit" value="Save"> 
+			<input type="hidden" id="reportedDate" name="reportedDate">
+		</td>
+		<td>
+			<input type="text" name="recordsFromDb" id="recordsFromDb" value="$maxRecord">recordsFromDb
+			<input type="hidden" name="delRecordNo" id="delRecordNo" >
+		</td>
+		<td>
+			<input type="text" name="totalRecords" id="totalRecords">totalRecords
+		</td>
+		<td>
+			<input type="hidden" name="recordNumbersList" id="recordNumbersList" value="$recordNumberList">
+		</td>
+	</tr>
 </table>
 
 <script type="text/javascript">
@@ -143,7 +138,6 @@
 
         var i =0;
         #foreach( $recordNo in $recordNumbers )
-
             recordNos[$i] = $recordNo;
             i++;
         #end
@@ -154,37 +148,33 @@
             #if($lineListElement.PresentationType == 'combobox')
                jsllElementPtype['$lineListElement.shortName'] = 'combobox';
                 #set($lineListOptions = $llElementOptionsMap.get($lineListElement.shortName))
-
-                    #foreach( $lineListOption in $lineListOptions )
-                        jsllOptions[$counter] = '$encoder.jsEscape( $lineListOption.name, "'" )';
-                        #set($counter = $counter + 1)
-                    #end
+				#foreach( $lineListOption in $lineListOptions )
+					jsllOptions[$counter] = '$encoder.jsEscape( $lineListOption.name, "'" )';
+					#set($counter = $counter + 1)
+				#end
             #elseif($lineListElement.PresentationType == 'text')
                jsllElementPtype['$lineListElement.shortName'] = 'text';
             #elseif($lineListElement.PresentationType == 'calender')
                jsllElementPtype['$lineListElement.shortName'] = 'calender';
-
             #end
             jsllElementOptions['$lineListElement.shortName'] = jsllOptions;
-
         #end
 
         function addLLNewRow(element)
         {
             rowCount = document.getElementById(element).value;
-            
 
-                if(rowCount>0)
-                {
-                    if(lastRow>0)
-                       var count = lastRow;
-                    else
-                        var count = $srno;
-                    for(var c = count; c < rowCount; c++)
-                    {
-                        addLLBNewRow();
-                    }
-                }
+			if(rowCount>0)
+			{
+				if(lastRow>0)
+				   var count = lastRow;
+				else
+					var count = $srno;
+				for(var c = count; c < rowCount; c++)
+				{
+					addLLBNewRow();
+				}
+			}
 
         }
 
@@ -192,7 +182,8 @@
         {
             document.getElementById('reportedDate').value = document.getElementById('reportingDate').value;
         }
-        function calMaxRecords()
+        
+		function calMaxRecords()
         {
             document.getElementById('totalRecords').value = lastRow;
 
@@ -203,7 +194,6 @@
 
         function valueChanged( recordNumber , element )
         {
-
             var flag = 0;
             var tempStr = element + ":"+recordNumber ;
             var resVal = document.getElementById(tempStr).value;
@@ -211,14 +201,13 @@
             {
                 document.getElementById(tempStr).focus();
                 alert(element + " cannot be null, Please enter some value");
-
             }
             else
             {
                 var tempVal = document.getElementById('changedValue:'+recordNumber).value;
 
                 var temparray = tempVal.split(" ");
-                for(var k=0;k<temparray.length;k++)
+                for(var k=0; k < temparray.length; k++)
                 {
                     if (element==temparray[k])
                     {
@@ -227,11 +216,12 @@
                     }
                 }
 
-                if(flag==0)
+                if( flag == 0 )
+				{
                     document.getElementById('changedValue:'+recordNumber).value = tempVal + element + " ";
+				}
             }
             return true;
-
-    }
+		}
 
 </script>
\ No newline at end of file

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserFormAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserFormAction.java	2010-08-28 10:15:38 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserFormAction.java	2010-10-31 08:01:14 +0000
@@ -1,12 +1,8 @@
 package org.hisp.dhis.reports.upward.action;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.reports.ReportType;
@@ -20,6 +16,7 @@
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
+
     private PeriodService periodService;
 
     public void setPeriodService( PeriodService periodService )
@@ -27,52 +24,9 @@
         this.periodService = periodService;
     }
 
-    private OrganisationUnitService organisationUnitService;
-
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-
-    public OrganisationUnitService getOrganisationUnitService()
-    {
-        return organisationUnitService;
-    }
-
-    /*
-     * private ReportService reportService;
-     * 
-     * public void setReportService( ReportService reportService ) {
-     * this.reportService = reportService; }
-     */
-    // -------------------------------------------------------------------------
-    // Constants
-    // -------------------------------------------------------------------------
-    private final int ALL = 0;
-
-    public int getALL()
-    {
-        return ALL;
-    }
-
-    // private String raFolderName;
-
     // -------------------------------------------------------------------------
     // Properties
     // -------------------------------------------------------------------------
-    private Collection<OrganisationUnit> organisationUnits;
-
-    public Collection<OrganisationUnit> getOrganisationUnits()
-    {
-        return organisationUnits;
-    }
-
-    private Collection<Period> periods = new ArrayList<Period>();
-
-    public Collection<Period> getPeriods()
-    {
-        return periods;
-    }
 
     private Collection<PeriodType> periodTypes;
 
@@ -94,25 +48,22 @@
     public String execute()
         throws Exception
     {
-        // raFolderName = reportService.getRAFolderName();
-
         reportTypeName = ReportType.RT_GOI;
 
-        /* Period Info */
         periodTypes = periodService.getAllPeriodTypes();
 
-        Iterator<PeriodType> alldeIterator = periodTypes.iterator();
-        while ( alldeIterator.hasNext() )
+        // Filtering Periodtypes other than Monthly, Quarterly and Yearly
+        Iterator<PeriodType> periodTypeIterator = periodTypes.iterator();
+        while ( periodTypeIterator.hasNext() )
         {
-            PeriodType type = alldeIterator.next();
+            PeriodType type = periodTypeIterator.next();
             if ( type.getName().equalsIgnoreCase( "Monthly" ) || type.getName().equalsIgnoreCase( "quarterly" )
                 || type.getName().equalsIgnoreCase( "yearly" ) )
             {
-                periods.addAll( periodService.getPeriodsByPeriodType( type ) );
             }
             else
             {
-                alldeIterator.remove();
+                periodTypeIterator.remove();
             }
         }
 

=== modified file 'local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml	2010-09-18 13:07:13 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml	2010-10-31 08:01:14 +0000
@@ -8,13 +8,8 @@
 	<bean id="org.hisp.dhis.reports.action.ReportsHomePageAction"
 		class="org.hisp.dhis.reports.action.ReportsHomePageAction"
 		scope="prototype">
-		<!-- added report service 20/08/2010-->
 		<property name="reportService" ref="org.hisp.dhis.reports.ReportService">
 		</property>
-		<!--	<property name="reportService">
-		<ref bean="org.hisp.dhis.reports.util.ReportService"/>
-		</property>-->
-		
 	</bean>
 	<!-- Reports Management start 07/08/2010 Global-->
 	<bean id="org.hisp.dhis.reports.reportmanagement.action.ReportsListAction"
@@ -430,25 +425,13 @@
 		
 	</bean>
 	
-	<!-- Upward Reports -->
+	<!-- Upward Reports/ GOI Reports -->
 	<bean
 		id="org.hisp.dhis.reports.upward.action.GenerateUpwardReportAnalyserFormAction"
 		class="org.hisp.dhis.reports.upward.action.GenerateUpwardReportAnalyserFormAction"
 		scope="prototype">
 		
-		<property name="periodService">
-			<ref bean="org.hisp.dhis.period.PeriodService"/>
-		</property>
-		<property name="organisationUnitService">
-			<ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
-		</property>
-		<!-- added report service 24/08/2010-->
-		<!--    <property name="reportService" ref="org.hisp.dhis.reports.ReportService">
-		</property>
-		<property name="reportService">
-		<ref bean="org.hisp.dhis.reports.util.ReportService"/>
-		</property>-->
-		
+		<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
 	</bean>
 	
 	<bean
@@ -463,15 +446,8 @@
 		<property name="organisationUnitService">
 			<ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
 		</property>
-		
-		<!-- added report service 24/08/2010-->
 		<property name="reportService" ref="org.hisp.dhis.reports.ReportService">
 		</property>
-		
-		<!--	<property name="reportService">
-		<ref bean="org.hisp.dhis.reports.util.ReportService"/>
-		</property>-->
-		
 	</bean>
 	
 	<!-- DataSet Lock Reports -->

=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/javascript/reports.js'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/javascript/reports.js	2010-09-15 08:50:45 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/javascript/reports.js	2010-10-31 08:01:14 +0000
@@ -165,13 +165,12 @@
     }    
 }// getDataElementsReceived end
 
-//---------------------------------------------------------------
+//------------------------------------------------------------------------------
 // Get Periods 
-//---------------------------------------------------------------
+//------------------------------------------------------------------------------
 
 function getPeriods()
 {
-    //document.reportForm.generate.disabled=false;
     var periodTypeList = document.getElementById( "periodTypeId" );
     var periodTypeId = periodTypeList.options[ periodTypeList.selectedIndex ].value;
     var availablePeriods = document.getElementById( "availablePeriods" );
@@ -179,18 +178,6 @@
   
     if ( periodTypeId != "NA" )
     {
-        /* //var url = "getPeriods.action?id=" + periodTypeId;
-    
-        var request = new Request();
-        request.setResponseTypeXML( 'period' );
-        request.setCallbackSuccess( getPeriodsReceived );
-        //request.send( url );
-
-        var requestString = "getPeriods.action";
-        var params = "id=" + periodTypeId;
-        request.sendAsPost( params );
-        request.send( requestString ); */
-		
 		$.post("getPeriods.action",
 		{
 			id : periodTypeId
@@ -207,14 +194,11 @@
         getReports( ouId, reportTypeName );
     }
     else
-    {
-    
+    {    
         document.reportForm.generate.disabled=true;
         clearList( availablePeriods );
         clearList( reportsList );
-
     }
-  
 }
 
 function getPeriodsForCumulative()
@@ -338,39 +322,24 @@
 function getPeriodsReceived( xmlObject )
 {	
     var availablePeriods = document.getElementById( "availablePeriods" );
-    var selectedPeriods = document.getElementById( "selectedPeriods" );
 	
     clearList( availablePeriods );
 	
     var periods = xmlObject.getElementsByTagName( "period" );
-    //document.reportForm.generate.disabled=false;
-    if(periods.length <= 0)
+    if( periods.length <= 0 )
+    {
         document.reportForm.generate.disabled=true;
-	
+    }
     for ( var i = 0; i < periods.length; i++)
     {
         var id = periods[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
-        //var startDate = periods[ i ].getElementsByTagName( "startDate" )[0].firstChild.nodeValue;
-        //var endDate = periods[ i ].getElementsByTagName( "endDate" )[0].firstChild.nodeValue;
         var periodName = periods[ i ].getElementsByTagName( "periodname" )[0].firstChild.nodeValue;
 		
-        if ( listContains( selectedPeriods, id ) == false )
-        {
-            /* var option = document.createElement( "option" );
-            option.value = id;
-            option.text = periodName;
-            availablePeriods.add( option, null ); */
-			
-			$("#availablePeriods").append("<option value='"+ id +"'>" + periodName + "</option>");
-        }
-    }
-	
-    // If the list of available periods is empty, an empty placeholder will be added
-//    addOptionPlaceHolder( availablePeriods );
+		$("#availablePeriods").append("<option value='"+ id +"'>" + periodName + "</option>");
+    }	
 }
 
 
-
 // -----------------------------------------------------------------------------
 // Date Validation
 // -----------------------------------------------------------------------------

=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/upwardReportAnalysisFront.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/upwardReportAnalysisFront.vm	2010-08-28 10:15:38 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/upwardReportAnalysisFront.vm	2010-10-31 08:01:14 +0000
@@ -1,118 +1,89 @@
 
 <script>
-		            //Global Variables
-		            
-					var reportModels = new HashTable();
-					var reportFileNames = new HashTable();
-
-		            // OrganisationUnit ids and its Names
-			            ##var orgUnits = new HashTable();
-			            ##foreach($orgUnit in $organisationUnits)
-			            ##    var orgUnitId = ""+$orgUnit.getId();
-			            ##    orgUnits.put(orgUnitId,"$orgUnit.getShortName()");
-			            ##end
-			            
-			            // OrganisationUnit ids and its Level
-			            ##var orgUnitLevels = new HashTable();
-			            ##foreach($orgUnit in $organisationUnits)
-			            ##    var orgUnitId = ""+$orgUnit.getId();
-			            ##    orgUnitLevels.put(orgUnitId,"$organisationUnitService.getLevelOfOrganisationUnit( $orgUnit )");
-			            ##end
-			            
-			            function formValidations()
-			            {			            
-			                var reportListIndex = document.reportForm.reportList.selectedIndex;
-			                var periodIndex = document.reportForm.availablePeriods.selectedIndex;
-			                var orgunitIdValue = document.reportForm.ouIDTB.value;
-			             //   var periodTypeIndex = document.reportFrom.periodTypeId.selectedIndex;
-			                
-			                	                
-			                //if(document.reportForm.periodTypeId.options[])
-			                
-			                if(document.reportForm.availablePeriods.options[periodIndex].text == null || document.reportForm.availablePeriods.options[periodIndex].text== "") 
-			                {
-			                	//document.reportForm.generate.disabled=true;
-			                	alert("Please Select Period");
-			                	return false;
-			                }			            
-			                else if(orgunitIdValue == null || orgunitIdValue=="" || orgunitIdValue==" ") {alert("Please Select OrganisationUnit"); return false;}
-			                
-			                else if(reportListIndex < 0 || document.reportForm.reportList.options[reportListIndex].text == null) {alert("Please Select Report"); return false;}
-			                
-							//document.reportForm.reportModelTB.value = reportModels.get(document.reportForm.reportList.options[reportListIndex].value);
-							//document.reportForm.reportFileNameTB.value = reportFileNames.get(document.reportForm.reportList.options[reportListIndex].value);
-							return true;
-			            }			
-			        </script>
-
-
-	        <h1>Government of India Reports Analyser</h1>
-	        <hr />	
-	        <br />
-	        <form id="reportForm" name="reportForm" action="generateUpwardReport.action" method="post" onsubmit="return formValidations()" target="_blank">        
-            <table align="center" style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="730" border=0>		                
-		                <tr>
-                    			<td class="NormalB">
-                    			    PeriodType : <br />
-                    			    <select id="periodTypeId" name="periodTypeId" style="width:200px" onchange="getPeriods()">
-                            				<option value="NA">[ Select PeriodType ]</option>
-                            				#foreach ( $type in $periodTypes )
-                                					<option value="$type.name">$type.name</option>
-                            				#end
-                        			</select>
-								</td>
-                      <td class="NormalB">                            
-                        OrganisationUnit : <br />
-                        <input type="text" name="ouNameTB" id="ouNameTB" size="20" disabled>         
-                      </td>
-       			
-                			</tr>
-                <tr>
-                    <td>&nbsp;</td>
-                    <td>&nbsp;</td>
-                </tr>
-                <tr>
-                    <td>&nbsp;</td>
-                    <td>&nbsp;</td>
-                </tr>			
-                <tr>
-          	          <td class="NormalB">
-          	              Periods : <br />
-                        <select id="availablePeriods" name="availablePeriods" style="width:200px">
-                            <option value="EMPTY_PLACEHOLDER_VALUE"></option>
-                        </select>
-			                        <select multiple id="selectedPeriods" name="selectedPeriods" style="display:none; width:200px; height:0px">				
-                            <option value="EMPTY_PLACEHOLDER_VALUE"></option>
-			                        </select>
-          	          </td>
-                                <td class="NormalB">
-                                    Reports :<br />
-                                    <select id="reportList" name="reportList" style="width:200px"></select>
-                                </td>
-                </tr>
-                <tr>
-                    <td>&nbsp;</td>
-                    <td>&nbsp;</td>
-                </tr>
-                <tr>
-                    <td>&nbsp;</td>
-                    <td>&nbsp;</td>
-                </tr>
-	                <tr>
-          	          <td>&nbsp;</td>
-          	          <td>
-						  <input type="checkbox" id="aggCB" name="aggCB" checked> Aggregated Data
-						  <br><br>	  							
-          	              <input type="submit" id= "generate" name="generate" value="Generate Report" disabled="disabled">
-						  <input type="hidden" name="autogen" id="autogen" value="0" >
-          	              <input type="hidden" name="ouIDTB" id="ouIDTB">
-<!--          	              <input type="hidden" name="ouLevelTB" id="ouLevelTB">
-          	              <input type="hidden" name="reportModelTB" id="reportModelTB">
-						  <input type="hidden" name="reportFileNameTB" id="reportFileNameTB">
-						  <input type="hidden" name="reportListFileNameTB" id="reportListFileNameTB" value="goiReportsList.xml">-->
-						  <input type="hidden" name="reportTypeNameTB" id="reportTypeNameTB" value="$reportTypeName">
-                    	</td>
-                </tr>
-            	</table>
-        </form>
-	  
\ No newline at end of file
+	function formValidations()
+	{
+		var reportList = document.getElementById("reportList");
+		var reportListIndex = reportList.selectedIndex;
+		var periodList = document.getElementById("availablePeriods");
+		var periodIndex = periodList.selectedIndex;
+		var ouIdTb = document.getElementById("ouIDTB");
+		var orgunitIdValue = ouIdTb.value;
+		
+		if( periodList.options[periodIndex].text == null || periodList.options[periodIndex].text == "" ) 
+		{
+			alert("Please Select Period");
+			return false;
+		}			            
+		else if( orgunitIdValue == null || orgunitIdValue == "" || orgunitIdValue == " " ) 
+		{
+			alert("Please Select OrganisationUnit"); 
+			return false;
+		}		
+		else if( reportListIndex < 0 || document.reportForm.reportList.options[reportListIndex].text == null ) 
+		{
+			alert("Please Select Report"); 
+			return false;
+		}
+		
+		return true;
+	}			
+</script>
+
+<h1>Government of India Reports Analyser</h1>
+<hr /><br />
+<form id="reportForm" name="reportForm" action="generateUpwardReport.action" method="post" onsubmit="return formValidations()" target="_blank">        
+	<table align="center" style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="730" border=0>		                
+		<tr>
+			<td class="NormalB">
+				1. PeriodType : <br />
+				<select id="periodTypeId" name="periodTypeId" style="width:200px" onchange="getPeriods()">
+					<option value="NA">[ Select PeriodType ]</option>
+					#foreach ( $type in $periodTypes )
+						<option value="$type.name">$type.name</option>
+					#end
+				</select>
+			</td>
+			<td class="NormalB">                            
+				3. OrganisationUnit : <br />
+				<input type="text" name="ouNameTB" id="ouNameTB" style="width:200px" disabled>         
+			</td>		
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>			
+		<tr>
+			<td class="NormalB">
+				2. Periods : <br />
+				<select id="availablePeriods" name="availablePeriods" style="width:200px"></select>
+			</td>
+			<td class="NormalB">
+				4. Reports :<br />
+				<select id="reportList" name="reportList" style="width:200px"></select>
+			</td>
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td>
+				<input type="checkbox" id="aggCB" name="aggCB" checked> Aggregated Data
+				<br><br>	  							
+				<input type="submit" id= "generate" name="generate" value="Generate Report" disabled="disabled">
+				<input type="hidden" name="autogen" id="autogen" value="0" >
+				<input type="hidden" name="ouIDTB" id="ouIDTB">
+				<input type="hidden" name="reportTypeNameTB" id="reportTypeNameTB" value="$reportTypeName">
+			</td>
+		</tr>
+	</table>
+</form>	  
\ No newline at end of file