← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4548: Validation rule result, added more information

 

------------------------------------------------------------
revno: 4548
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-09-08 19:31:21 +0200
message:
  Validation rule result, added more information
modified:
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java
  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/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/ExportValidationResultAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java	2011-01-26 10:01:53 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java	2011-09-08 17:31:21 +0000
@@ -35,6 +35,7 @@
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.system.grid.ListGrid;
 import org.hisp.dhis.util.SessionUtils;
@@ -56,6 +57,13 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
     private I18nFormat format;
 
     public void setFormat( I18nFormat format )
@@ -80,6 +88,13 @@
     {
         this.type = type;
     }
+    
+    private Integer organisationUnitId;
+
+    public void setOrganisationUnitId( Integer organisationUnitId )
+    {
+        this.organisationUnitId = organisationUnitId;
+    }
 
     // -------------------------------------------------------------------------
     // Output
@@ -112,10 +127,17 @@
         List<ValidationResult> results = (List<ValidationResult>) SessionUtils.
             getSessionVar( KEY_VALIDATIONRESULT );
         
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+        
         Grid grid = new ListGrid();
         
         grid.setTitle( i18n.getString( "data_quality_report" ) );
         
+        if ( organisationUnit != null )
+        {
+            grid.setSubtitle( organisationUnit.getName() );
+        }
+        
         grid.addHeader( new GridHeader( i18n.getString( "source" ), false, true ) );
         grid.addHeader( new GridHeader( i18n.getString( "period" ), false, true ) );
         grid.addHeader( new GridHeader( i18n.getString( "left_side_description" ), false, true ) );

=== 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	2011-05-05 21:15:45 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/RunValidationAction.java	2011-09-08 17:31:21 +0000
@@ -185,6 +185,13 @@
     {
         return maxExceeded;
     }
+    
+    private OrganisationUnit organisationUnit;
+
+    public OrganisationUnit getOrganisationUnit()
+    {
+        return organisationUnit;
+    }
 
     // -------------------------------------------------------------------------
     // Execute
@@ -192,11 +199,11 @@
 
     public String execute()
     {
-        OrganisationUnit unit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+        organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
         
         if ( aggregate ) // Aggregate data source
         {
-            List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>( unit.getChildren() );
+            List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>( organisationUnit.getChildren() );
 
             List<Period> periods = new ArrayList<Period>( periodService.namePeriods( 
                 periodService.getPeriodsBetweenDates( format.parseDate( startDate ), format.parseDate( endDate ) ), format ) );
@@ -234,7 +241,7 @@
         }
         else // Captured data source
         {
-            Collection<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnitWithChildren( unit.getId() );
+            Collection<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnitWithChildren( organisationUnit.getId() );
 
             if ( validationRuleGroupId == -1 )
             {

=== 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	2011-06-16 04:20:05 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml	2011-09-08 17:31:21 +0000
@@ -225,7 +225,9 @@
   </bean>
 
   <bean id="org.hisp.dhis.validationrule.action.ExportValidationResultAction" class="org.hisp.dhis.validationrule.action.ExportValidationResultAction"
-    scope="prototype" />
+    scope="prototype">
+	<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+  </bean>
   
   <!-- Data analysis -->
 

=== 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	2011-07-28 08:10:02 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/runValidation.js	2011-09-08 17:31:21 +0000
@@ -133,5 +133,8 @@
 
 function exportValidationResult( type )
 {
-    window.location.href = 'exportValidationResult.action?type=' + type;
+    var url = 'exportValidationResult.action?type=' + type + 
+    	"&organisationUnitId=" + $( "#organisationUnitId" ).val();
+    	
+    window.location.href = url;
 }

=== 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	2011-07-28 09:34:27 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.vm	2011-09-08 17:31:21 +0000
@@ -6,7 +6,9 @@
 	var i18n_analysing_please_wait = '$encoder.jsEscape( $i18n.getString( "analysing_please_wait" ) , "'")';
 </script>
 
-<h3>$encoder.htmlEncode( $i18n.getString( "validation_violations" ) )</h3>
+<input type="hidden" id="organisationUnitId" value="$!{organisationUnit.id}" />
+
+<h3>$encoder.htmlEncode( $i18n.getString( "validation_violations" ) ) - $encoder.htmlEncode( $!{organisationUnit.name} )</h3>
 
 <table>
 	<colgroup>