← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2065: Added drilldown on orgunits to aggregated validation

 

------------------------------------------------------------
revno: 2065
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Mon 2010-09-06 06:37:19 +0200
message:
  Added drilldown on orgunits to aggregated validation
modified:
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/RunValidationAction.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/runValidation.js
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/runValidationForm.vm
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.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-validationrule/src/main/java/org/hisp/dhis/validationrule/action/RunValidationAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/RunValidationAction.java	2010-09-04 06:30:08 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/RunValidationAction.java	2010-09-06 04:37:19 +0000
@@ -27,6 +27,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -41,7 +43,6 @@
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.oust.manager.SelectionTreeManager;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.util.SessionUtils;
@@ -52,8 +53,6 @@
 
 import com.opensymphony.xwork2.ActionSupport;
 
-import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
-
 /**
  * @author Margrethe Store
  * @author Lars Helge Overland
@@ -84,13 +83,6 @@
         this.format = format;
     }
 
-    private SelectionTreeManager selectionTreeManager;
-
-    public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
-    {
-        this.selectionTreeManager = selectionTreeManager;
-    }
-
     private OrganisationUnitService organisationUnitService;
 
     public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
@@ -116,6 +108,13 @@
     // Input/output
     // -------------------------------------------------------------------------
 
+    private Integer organisationUnitId;
+    
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
+
     private String startDate;
 
     public String getStartDate()
@@ -186,8 +185,8 @@
 
     public String execute()
     {
-        OrganisationUnit unit = selectionTreeManager.getReloadedSelectedOrganisationUnit();
-
+        OrganisationUnit unit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+        
         if ( aggregate ) // Aggregate data source
         {
             List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>( unit.getChildren() );

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml	2010-09-01 10:30:03 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml	2010-09-06 04:37:19 +0000
@@ -215,9 +215,6 @@
     <property name="validationRuleService">
       <ref bean="org.hisp.dhis.validation.ValidationRuleService"/>
     </property>
-    <property name="selectionTreeManager">
-      <ref bean="org.hisp.dhis.oust.manager.SelectionTreeManager"/>
-    </property>
     <property name="organisationUnitService">
       <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
     </property>

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/runValidation.js'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/runValidation.js	2010-09-04 06:30:08 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/runValidation.js	2010-09-06 04:37:19 +0000
@@ -1,4 +1,16 @@
 
+var startDate;
+var endDate;
+var validationRuleGroupId;
+var aggregate;
+var doDataMart;
+var organisationUnitId;
+
+function organisationUnitSelected( ids )
+{
+	organisationUnitId = ids[0];
+}
+
 function validateRunValidation()
 {
 	var request = new Request();
@@ -20,11 +32,18 @@
     {
     	setWaitMessage( "Analysing data, please wait..." );
     	
-        var url = 'runValidationAction.action?startDate=' + getFieldValue( 'startDate' ) +
-        	'&endDate=' + getFieldValue( 'endDate' ) + 
-        	'&validationRuleGroupId=' + $( '#validationRuleGroupId' ).val() +
-        	'&aggregate=' + getListValue( 'aggregate' ) +
-        	'&doDataMart=' + getListValue( 'doDataMart' );
+    	startDate = getFieldValue( 'startDate' );
+    	endDate = getFieldValue( 'endDate' );
+    	validationRuleGroupId = $( '#validationRuleGroupId' ).val();
+    	aggregate = $( '#aggregate' ).val();
+    	doDataMart = $( '#doDataMart' ).val();
+    	
+        var url = 'runValidationAction.action?organisationUnitId=' + organisationUnitId +
+        	'&startDate=' + startDate  +
+        	'&endDate=' + endDate + 
+        	'&validationRuleGroupId=' + validationRuleGroupId +
+        	'&aggregate=' + aggregate +
+        	'&doDataMart=' + doDataMart;
         	
 		$.get( url, function( data ) {
 			$( "div#analysisInput" ).hide();
@@ -43,6 +62,21 @@
     }
 }
 
+function drillDownValidation( orgUnitId )
+{
+    var url = 'runValidationAction.action?organisationUnitId=' + orgUnitId +
+    	'&startDate=' + startDate  +
+    	'&endDate=' + endDate + 
+    	'&validationRuleGroupId=' + validationRuleGroupId +
+    	'&aggregate=' + aggregate +
+    	'&doDataMart=' + doDataMart;
+        	
+		$.get( url, function( data ) {
+			$( "div#analysisResult" ).html( data );
+			pageInit();
+		} );
+}
+
 function viewValidationResultDetails( validationRuleId, sourceId, periodId )
 {
 	var url = "viewValidationResultDetails.action?validationRuleId=" + validationRuleId +

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/runValidationForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/runValidationForm.vm	2010-09-01 10:30:03 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/runValidationForm.vm	2010-09-06 04:37:19 +0000
@@ -74,9 +74,10 @@
 <span id="message"></span>
 
 <script type="text/javascript">
-	selectionTreeSelection.setMultipleSelectionAllowed( false );
 	selectionTree.clearSelectedOrganisationUnits();
 	selectionTree.buildSelectionTree();
+	selectionTreeSelection.setMultipleSelectionAllowed( false );
+	selectionTreeSelection.setListenerFunction( organisationUnitSelected );
 	
 	 jQuery(document).ready(function(){
 		datePickerInRange( 'startDate' , 'endDate' );	

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.vm	2010-09-04 06:30:08 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.vm	2010-09-06 04:37:19 +0000
@@ -63,7 +63,7 @@
 	<tbody>
 		#foreach( $result in $validationResults )
 		<tr id="tr${result.id}">
-		  <td>$!result.source.name</td>
+		  <td#if( $aggregate ) style="cursor:pointer" onclick="drillDownValidation( '$!result.source.id' )"#end>$!result.source.name</td>
 		  <td>$!format.formatPeriod( $result.period )</td>
 		  <td>$!result.validationRule.leftSide.description</td>
 		  <td>$!result.leftsideValue</td>