← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2210: bugs fixed in dashboard

 

------------------------------------------------------------
revno: 2210
committer: dev ratan <dev-hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-09-23 16:10:37 +0530
message:
  bugs fixed in dashboard
modified:
  local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ta.js
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/tabularAnalysisFront.vm
  local/in/dhis-web-reports-national/src/main/resources/struts.xml
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/action/ValidateSurveyAction.java


--
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/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java'
--- local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java	2010-09-08 12:56:29 +0000
+++ local/in/dhis-web-dashboard/src/main/java/org/hisp/dhis/dashboard/ta/action/GenerateTabularAnalysisResultAction.java	2010-09-23 10:40:37 +0000
@@ -283,10 +283,10 @@
         String monthOrder[] = { "04", "05", "06", "07", "08", "09","10", "11", "12", "01", "02", "03" };
         int monthDays[] = { 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31 };
         
-        int startRow = 1;
+        int startRow = 0;
         @SuppressWarnings("unused")
         int startCol = 0;
-        int headerRow = 1;
+        int headerRow = 0;
         int headerCol = 0;
         
         String raFolderName = configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER ).getValue();
@@ -299,7 +299,7 @@
         
         /* Orgunit Info */
 
-        if ( ouSelCB != null )
+        if ( ouRadio.equalsIgnoreCase("orgUnitSelectedRadio"))
         {
             for ( String ouStr : orgUnitListCB )
             {
@@ -343,7 +343,7 @@
                 }
             }
         }
-        System.out.println("selectedoulebel = "+organisationUnitService.getLevelOfOrganisationUnit( selOrgUnit ));
+       // System.out.println("selectedoulebel = "+organisationUnitService.getLevelOfOrganisationUnit( selOrgUnit ));
         int minOULevel = 1;
         int maxOuLevel = 1;
         if( selOUList != null && selOUList.size() > 0 )
@@ -362,10 +362,10 @@
         else if(orgUnitLevelCB != null && ouRadio.equalsIgnoreCase("orgUnitGroupRadio") ) minOULevel = organisationUnitService.getLevelOfOrganisationUnit( selOrgUnit );
         else maxOuLevel = minOULevel;
 
-        System.out.println("maxlevelou = "+maxOuLevel + " minoulevel = "+minOULevel);
+       // System.out.println("maxlevelou = "+maxOuLevel + " minoulevel = "+minOULevel);
         int c1 = headerCol+1;
         
-        if( ouSelCB != null )
+        if( ouRadio.equalsIgnoreCase("orgUnitSelectedRadio" ))
         {
             sheet0.mergeCells( c1, headerRow, c1, headerRow+1 );
             sheet0.addCell( new Label( c1, headerRow, "Facility", getCellFormat1() ) );
@@ -373,10 +373,10 @@
         }
         else
         {
-            for(int i = minOULevel; i <= maxOuLevel; i++ )
+            for(int i = minOULevel; i <= maxOuLevel-1; i++ )
             {           
                 sheet0.mergeCells( c1, headerRow, c1, headerRow+1 );
-                sheet0.addCell( new Label( c1, headerRow, "Level"+i, getCellFormat1() ) );
+                sheet0.addCell( new Label( c1, headerRow, "Level"+(i+1), getCellFormat1() ) );
                 c1++;
             }
         }
@@ -507,9 +507,9 @@
             
             //sheet0.mergeCells( colCount, headerRow+1+rowCount, colCount, headerRow+1+rowCount+ouChildCountMap.get( ou ));
             
-            if( ouSelCB != null )
+            if( ouRadio.equalsIgnoreCase("orgUnitSelectedRadio"))
             {
-                sheet0.addCell( new Label( headerCol+1, headerRow+1+rowCount, ou.getName(), getCellFormat2() ) );
+                sheet0.addCell( new Label( 1, 2, ou.getName(), getCellFormat2() ) );
             }
             else
             {
@@ -518,12 +518,12 @@
                 {
                     if( i == colCount )
                     {
-                        sheet0.addCell( new Label( colCount, headerRow+1+rowCount, ou.getName(), getCellFormat2() ) );
+                        sheet0.addCell( new Label( colCount-1, headerRow+1+rowCount, ou.getName(), getCellFormat2() ) );
                     }
                     else
                     {
                         parentOu = parentOu.getParent();
-                        sheet0.addCell( new Label( i, headerRow+1+rowCount, parentOu.getName(), getCellFormat2() ) );
+                        sheet0.addCell( new Label( i, headerRow+rowCount, parentOu.getName(), getCellFormat2() ) );
                     } 
                 }
             }

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ta.js'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ta.js	2010-09-08 08:13:41 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/ta.js	2010-09-23 10:40:37 +0000
@@ -1,3 +1,29 @@
+
+
+function ouradioSelection( evt )
+{
+	//var ouSelCBId = document.getElementById( "ouSelCB" );
+	//if( ouSelCBId.checked )
+	//{
+	//	return;
+	//}
+	
+	var excelItems = byId('ouRadio');
+	
+	if(excelItems.checked && excelItems.getAttribute('value') == "orgUnitGroupRadio")
+	{
+		getOrgUnitGroups();
+	}
+	else if(excelItems.checked && excelItems.getAttribute('value') == "orgUnitSelectedRadio")
+	{
+		ouSelCBChange();
+	}
+	else
+	{
+		ouLevelSelected();
+	}
+}
+
 function getOrgUnitGroups()
 {
 	var ouLevelId = document.getElementById( "orgUnitLevelCB" );
@@ -15,31 +41,14 @@
 	}
 }
 
-function ouradioSelection( evt )
-{
-	var ouSelCBId = document.getElementById( "ouSelCB" );
-	if( ouSelCBId.checked )
-	{
-		return;
-	}
-
-	
-	var excelItems = byId('ouRadio');
-	if(excelItems.checked && excelItems.getAttribute('value') == "orgUnitGroupRadio"){
-		getOrgUnitGroups();
-	}else
-	{
-		ouSelCBChange();
-	}
-}
 
 function ouSelCBChange()
 {
-    var ouSelCBId = document.getElementById( "ouSelCB" );
+    //var ouSelCBId = document.getElementById( "ouSelCB" );
     var ouListCDId = document.getElementById( "orgUnitListCB" );
     var ouLevelId = document.getElementById( "orgUnitLevelCB" );
 	
-    if( ouSelCBId.checked )
+    //if( ouSelCBId.checked )
     {
         $('#orgUnitListCB').removeAttr('disabled');
 		
@@ -47,6 +56,7 @@
          $("#orgUnitLevelCB").attr("disabled", "disabled");
         $('#ViewReport').removeAttr('disabled');
     }
+    /*
     else
     {
 	$('#orgUnitLevelCB').removeAttr('disabled');
@@ -54,13 +64,30 @@
         $("#orgUnitListCB").attr("disabled", "disabled");
         
     }
-	
-    if( selOrgUnitId != null && selOrgUnitId != "NONE" && selOrgUnitId != "")
-    {
-        getOUDeatilsForTA( selOrgUnitId );
-    }
-	
-}
+	*/
+    if( selOrgUnitId != null && selOrgUnitId != "NONE" && selOrgUnitId != "")
+    {
+        getOUDeatilsForTA( selOrgUnitId );
+    }
+    
+	
+}
+
+function ouLevelSelected()
+{
+    var ouListCDId = document.getElementById( "orgUnitListCB" );
+    var ouLevelId = document.getElementById( "orgUnitLevelCB" );
+
+	$('#orgUnitLevelCB').removeAttr('disabled');
+    clearList( ouListCDId );
+    $("#orgUnitListCB").attr("disabled", "disabled");
+
+    if( selOrgUnitId != null && selOrgUnitId != "NONE" && selOrgUnitId != "")
+    {
+        getOUDeatilsForTA( selOrgUnitId );
+    }
+}
+
 
 function aggPeriodCBChange()
 {
@@ -318,6 +345,7 @@
 //addOptionPlaceHolder( availableIndicators );
 }
 
+
 function getPeriods()
 {
     var periodTypeList = document.getElementById( "periodTypeLB" );
@@ -413,6 +441,7 @@
 
 function getOUDeatilsForTA( orgUnitIds )
 {
+	
     /* //var url = "getOrgUnitDetails.action?orgUnitId=" + orgUnitIds+"&type=ta";
 	
     var request = new Request();
@@ -438,9 +467,10 @@
 
 function getOUDetailsForTARecevied(xmlObject)
 {
-    var ouSelCBId = document.getElementById( "ouSelCB" );
+   // var ouSelCBId = document.getElementById( "ouSelCB" );
     var ouListCDId = document.getElementById( "orgUnitListCB" );
     var ouLevelId = document.getElementById( "orgUnitLevelCB" );
+    var ouRadioVal = $( "input[name='ouRadio']:checked" ).val();
 		
     var orgUnits = xmlObject.getElementsByTagName("orgunit");
 
@@ -450,24 +480,34 @@
         var orgUnitName = orgUnits[ i ].getElementsByTagName("name")[0].firstChild.nodeValue;
         var ouLevel = orgUnits[ i ].getElementsByTagName("level")[0].firstChild.nodeValue;
         var maxOULevel = orgUnits[ i ].getElementsByTagName("maxoulevel")[0].firstChild.nodeValue;
-
-        if( ouSelCBId.checked )
+         
+        
+        if( ouRadioVal == "orgUnitSelectedRadio"  )
         {
             ouListCDId.disabled = false;
-            
+            clearList( ouLevelId );
             document.getElementById( "ViewReport" ).disabled = false;
     		
             clearList( ouLevelId );
             ouLevelId.disabled = true;
-    		
+            
+            var flag = 0;
             for(var i=0; i < ouListCDId.options.length; i++)
             {
-                if( id == ouListCDId.options[i].value ) return;
-            }
-        	
-            ouListCDId.options[ouListCDId.options.length] = new Option(orgUnitName, id, false, false);
+                if( id == ouListCDId.options[i].value ) 
+                {
+                	flag = 1;
+                	break;
+                }
+            }
+            
+            
+            if( flag == 0 )
+            {
+            	ouListCDId.options[ouListCDId.options.length] = new Option(orgUnitName, id, false, false);
+            }
         }
-        else
+        else 
         {
             clearList( ouListCDId );
     		
@@ -475,13 +515,12 @@
             var selouRadioButton = $( "input[name='ouRadio']:checked" ).val();
             if( selouRadioButton == "orgUnitGroupRadio" )
             {
-		getOrgUnitGroups();
+            	getOrgUnitGroups();
             }
             else
             {
                 getorgUnitLevels( ouLevel, maxOULevel );
-            }
-            
+            }            
         }
     }    		
 }
@@ -531,7 +570,6 @@
 
 function formValidations()
 {
-		
     var selectedServices = document.getElementById("selectedServices");
     var orgUnitListCB = document.getElementById("orgUnitListCB");
     var orgUnitLevelCB = document.getElementById("orgUnitLevelCB");
@@ -541,37 +579,62 @@
     var aggPeriodCB = document.getElementById("aggPeriodCB");
     var periodTypeList = document.getElementById( "periodTypeLB" );
     var periodTypeId = periodTypeList.options[ periodTypeList.selectedIndex ].value;
-	
-    if( selectedServices.options.length <= 0 ) {
-        alert("Please select DataElement/Indicator(s)");return false;
+    var ouRadioVal = $( "input[name='ouRadio']:checked" ).val();
+  
+    
+    if( selectedServices.options.length <= 0 ) 
+    {
+        alert("Please select DataElement/Indicator(s)");
+        return false;
     }
 	
     if( periodTypeId == yearlyPeriodTypeName )
     {
-        if( yearLB.selectedIndex < 0 ) {
-            alert("Please select Year(s)");return false;
+        if( yearLB.selectedIndex < 0 ) 
+        {
+            alert("Please select Year(s)");
+            return false;
         }
     }
     else
     {
-        if( yearLB.selectedIndex < 0 ) {
-            alert("Please select Year(s)");return false;
+        if( yearLB.selectedIndex < 0 ) 
+        {
+            alert("Please select Year(s)");
+            return false;
         }
-        if( periodLB.selectedIndex < 0 ) {
-            alert("Please select Period(s)");return false;
+        if( periodLB.selectedIndex < 0 ) 
+        {
+            alert("Please select Period(s)");
+            return false;
         }
     }
 	
-    if( ouSelCB.checked)
-    {
-        if(orgUnitListCB.options.length <=0 ) {
-            alert( "Please select OrgUnit(s)" );return false;
-        }
-    }
-    else if( orgUnitLevelCB.selectedIndex < 0 ) {
-        alert( "Please select OrgUnitLevel" );return false;
-    }
-		
+    if( ouRadioVal == "orgUnitSelectedRadio" )
+    {
+        if( orgUnitListCB.selectedIndex < 0 ) 
+        {
+            alert( "Please select OrgUnit(s)" );
+            return false;
+        }
+    }
+    else if( ouRadioVal == "orgUnitGroupRadio" ) 
+    { 
+    	if( orgUnitLevelCB.selectedIndex < 0 ) 
+    	{
+            alert( "Please select OrgUnitGroup" );
+            return false;
+        }
+    }
+    else if( ouRadioVal == "orgUnitLevelRadio" )
+    {
+	   if(orgUnitLevelCB.selectedIndex < 0  ) 
+	   {
+           alert( "Please select OrgUnitLevel" );
+           return false;
+       }
+    }
+	   
     orgUnitListCB.disabled = false;
     for(k = 0; k < selectedServices.options.length; k++)
     {

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/tabularAnalysisFront.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/tabularAnalysisFront.vm	2010-09-04 13:07:00 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/tabularAnalysisFront.vm	2010-09-23 10:40:37 +0000
@@ -141,7 +141,7 @@
 				<table>
 					<tr>
 						<td class="NormalB">
-							<input type="checkbox" id="ouSelCB" name="ouSelCB" onchange="ouSelCBChange()" value="ON" > Selected<br />
+							<input type="radio" id="ouRadio" name="ouRadio" value="orgUnitSelectedRadio" onclick="ouradioSelection(event)" > Selected<br />
 							$i18n.getString( "ga_orgunit" )<br>    			                    	
 							<select name="orgUnitListCB" id="orgUnitListCB" multiple size="7" style="width: 175px;" ondblclick="remOUFunction()" disabled >
 							</select>						
@@ -149,7 +149,7 @@
 						<td class="NormalB">&nbsp;</td>
 						<td class="NormalB">
 
-                            <input type="radio" id="ouRadio" name="ouRadio" value="orgUnitGroupRadio"    onclick="ouradioSelection(event)"> OrgUnitGroups
+                            <input type="radio" id="ouRadio" name="ouRadio" value="orgUnitGroupRadio"  onclick="ouradioSelection(event)"> OrgUnitGroups
                             <br>
                             <input type="radio" id="ouRadio" name="ouRadio" value="orgUnitLevelRadio" onclick="ouradioSelection(event)" checked> OrgUnit Levels
 							<br>

=== modified file 'local/in/dhis-web-reports-national/src/main/resources/struts.xml'
--- local/in/dhis-web-reports-national/src/main/resources/struts.xml	2010-09-13 10:03:14 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/struts.xml	2010-09-23 10:40:37 +0000
@@ -1156,7 +1156,7 @@
                 <param name="contentType">application/vnd.ms-excel</param>
                 <param name="inputName">inputStream</param>
                 <param name="contentDisposition">filename="${fileName}"</param>
-                <param name="bufferSize">1024</param>
+                <param name="bufferSize">1024</param> 
             </result>
         </action>
 		
@@ -1181,6 +1181,7 @@
             </result>
         </action>
 		
+		
 	
 		
 	</package>

=== modified file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/action/ValidateSurveyAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/action/ValidateSurveyAction.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/action/ValidateSurveyAction.java	2010-09-23 10:40:37 +0000
@@ -77,6 +77,7 @@
 
     private I18n i18n;
 
+    
     public void setI18n( I18n i18n )
     {
         this.i18n = i18n;