← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3490: Fixed bug <772699> Web pivot lacks orgunit validation.

 

------------------------------------------------------------
revno: 3490
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-04-29 13:08:08 +0700
message:
  Fixed bug <772699> Web pivot lacks orgunit validation.
modified:
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/pivot.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewPivotTableForm.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 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/pivot.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/pivot.js	2011-03-15 23:26:14 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/pivot.js	2011-04-29 06:08:08 +0000
@@ -42,57 +42,64 @@
  */
 function getData()
 {
-  clearGlobalVariables();
-  
-  var dataType = $( "#dataType" ).val();
-  var indicatorGroupId = $( "#indicatorGroup" ).val();
-  var dataElementGroupId = $( "#dataElementGroup" ).val();
-  var startDate = $( "#startDate" ).val();
-  var endDate = $( "#endDate" ).val();
-  var periodTypeName = $( "#periodType" ).val();
-  
-  document.getElementById( "dataLabel" ).innerHTML = i18n_start_date + ": " + startDate + 
-    ", " + i18n_end_date + ": " + endDate + ", " + i18n_period_type + ": " + periodTypeName;
-  
-  var url = "getPivotTable.action";
-  
-  var groupId = dataType == DATA_TYPE_INDICATOR ? indicatorGroupId : dataElementGroupId;
-  
-  currentDataType = dataType;
-  
-  hideDivs();
-  
-  showLoader();
-  
-  $.getJSON(
-    url,
-    {
-      "dataType": dataType,
-      "groupId": groupId,
-      "periodTypeName": periodTypeName, 
-      "startDate": startDate, 
-      "endDate": endDate, 
-      "organisationUnitId": organisationUnitId 
-    },
-    function( json ) 
-    {
-      var pivot = json.pivotTable;
-      
-      indicators = pivot.indicators;
-      periods = pivot.periods;
-      orgunits = pivot.organisationUnits;
-      
-      sizes["indicator"] = pivot.sizeIndicators;
-      sizes["period"] = pivot.sizePeriods;
-      sizes["orgunit"] = pivot.sizeOrganisationUnits;
-      
-      data = pivot.indicatorValues[0];
-      
-      hideLoader();
-      
-      generateTable();
-    }
-  );
+  if ( organisationUnitId == -1 )
+  {
+	setHeaderDelayMessage( i18n_selected_organisation_unit );
+  }
+  else
+  {
+	  clearGlobalVariables();
+	  
+	  var dataType = $( "#dataType" ).val();
+	  var indicatorGroupId = $( "#indicatorGroup" ).val();
+	  var dataElementGroupId = $( "#dataElementGroup" ).val();
+	  var startDate = $( "#startDate" ).val();
+	  var endDate = $( "#endDate" ).val();
+	  var periodTypeName = $( "#periodType" ).val();
+	  
+	  document.getElementById( "dataLabel" ).innerHTML = i18n_start_date + ": " + startDate + 
+		", " + i18n_end_date + ": " + endDate + ", " + i18n_period_type + ": " + periodTypeName;
+	  
+	  var url = "getPivotTable.action";
+	  
+	  var groupId = dataType == DATA_TYPE_INDICATOR ? indicatorGroupId : dataElementGroupId;
+	  
+	  currentDataType = dataType;
+	  
+	  hideDivs();
+	  
+	  showLoader();
+	  
+	  $.getJSON(
+		url,
+		{
+		  "dataType": dataType,
+		  "groupId": groupId,
+		  "periodTypeName": periodTypeName, 
+		  "startDate": startDate, 
+		  "endDate": endDate, 
+		  "organisationUnitId": organisationUnitId 
+		},
+		function( json ) 
+		{
+		  var pivot = json.pivotTable;
+		  
+		  indicators = pivot.indicators;
+		  periods = pivot.periods;
+		  orgunits = pivot.organisationUnits;
+		  
+		  sizes["indicator"] = pivot.sizeIndicators;
+		  sizes["period"] = pivot.sizePeriods;
+		  sizes["orgunit"] = pivot.sizeOrganisationUnits;
+		  
+		  data = pivot.indicatorValues[0];
+		  
+		  hideLoader();
+		  
+		  generateTable();
+		}
+	  );
+  }
 }
 
 /**

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewPivotTableForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewPivotTableForm.vm	2011-03-28 20:09:32 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewPivotTableForm.vm	2011-04-29 06:08:08 +0000
@@ -16,6 +16,7 @@
 	var i18n_end_date = '$encoder.jsEscape( $i18n.getString( "end_date" ) , "'")';
 	var i18n_period_type = '$encoder.jsEscape( $i18n.getString( "period_type" ) , "'")';
 	var i18n_organisation_unit_level = '$encoder.jsEscape( $i18n.getString( "organisation_unit_level" ) , "'")';
+	var i18n_selected_organisation_unit = '$encoder.jsEscape( $i18n.getString( "please_select_org_unit" ) , "'")';
 </script>
 
 <style type="text/css">