← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6289: Improved js validaton for completeness and org unit report

 

------------------------------------------------------------
revno: 6289
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-03-18 23:44:02 +0100
message:
  Improved js validaton for completeness and org unit report
modified:
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataCompleteness.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/orgUnitDistribution.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataCompletenessForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewOrgUnitDistribution.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/dataCompleteness.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataCompleteness.js	2011-06-23 14:38:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataCompleteness.js	2012-03-18 22:44:02 +0000
@@ -1,9 +1,3 @@
-var isOrganisationUnit = false;
-
-function organisationUnitSelected( units )
-{
-    isOrganisationUnit = units && units.length > 0;
-}
 
 function getPeriods( periodTypeList, availableList, selectedList, timespan )
 {
@@ -38,7 +32,7 @@
 
 function completenessIsValid( periodId )
 {
-    if ( !isOrganisationUnit )
+    if ( !selectionTreeSelection.isSelected() )
     {
         setHeaderDelayMessage( i18n_please_select_org_unit );
         return false;

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/orgUnitDistribution.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/orgUnitDistribution.js	2011-06-23 14:38:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/orgUnitDistribution.js	2012-03-18 22:44:02 +0000
@@ -1,18 +1,6 @@
-var selectedOrganisationUnit = null;
 
 var distributionDivs = [ "chartDiv", "tableDiv", "loaderDiv" ];
 
-function organisationUnitSelected( units )
-{
-    if ( units && units[0] )
-    {
-        selectedOrganisationUnit = units[0];
-    } else
-    {
-        selectedOrganisationUnit = null;
-    }
-}
-
 function displayOrgUnitDistribution()
 {
     if ( inputInvalid() )
@@ -61,17 +49,17 @@
 {
     var groupSetId = $( "#groupSetId" ).val();
 
+    if ( !selectionTreeSelection.isSelected() )
+    {
+        setHeaderDelayMessage( i18n_select_org_unit );
+        return true;
+    }
+
     if ( groupSetId == null || groupSetId == 0 )
     {
         setHeaderDelayMessage( i18n_select_group_set );
         return true;
     }
 
-    if ( selectedOrganisationUnit == null || selectedOrganisationUnit == "" )
-    {
-        setHeaderDelayMessage( i18n_select_org_unit );
-        return true;
-    }
-
     return false;
 }

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataCompletenessForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataCompletenessForm.vm	2012-03-06 03:17:52 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataCompletenessForm.vm	2012-03-18 22:44:02 +0000
@@ -1,6 +1,5 @@
 <script type="text/javascript">
 	jQuery(document).ready(function() {
-		selectionTreeSelection.setListenerFunction( organisationUnitSelected );
 		selectionTreeSelection.setMultipleSelectionAllowed( false );
 		selectionTree.clearSelectedOrganisationUnits();
 		selectionTree.buildSelectionTree();

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewOrgUnitDistribution.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewOrgUnitDistribution.vm	2011-09-03 18:23:12 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewOrgUnitDistribution.vm	2012-03-18 22:44:02 +0000
@@ -1,7 +1,6 @@
 <script type="text/javascript">
 	jQuery(document).ready(function() {
 		selectionTreeSelection.setMultipleSelectionAllowed( false );
-		selectionTreeSelection.setListenerFunction( organisationUnitSelected );
 		selectionTree.clearSelectedOrganisationUnits();
 		selectionTree.buildSelectionTree();
 	});