dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23630
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11512: implemented export stddev analysis as pdf, xls, csv
------------------------------------------------------------
revno: 11512
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-07-25 12:37:29 +0700
message:
implemented export stddev analysis as pdf, xls, csv
added:
dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/dataanalysis/ExportAnalysisResultAction.java
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/java/org/hisp/dhis/validationrule/action/dataanalysis/GetAnalysisAction.java
dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties
dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/dataAnalysis.js
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/searchResult.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 2013-04-04 18:06:19 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java 2013-07-25 05:37:29 +0000
@@ -1,7 +1,7 @@
package org.hisp.dhis.validationrule.action;
/*
- * Copyright (c) 2004-2012, University of Oslo
+ * Copyright (c) 2004-2013, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,8 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.List;
-
+import com.opensymphony.xwork2.Action;
import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.GridHeader;
@@ -41,7 +40,7 @@
import org.hisp.dhis.util.SessionUtils;
import org.hisp.dhis.validation.ValidationResult;
-import com.opensymphony.xwork2.Action;
+import java.util.List;
/**
* @author Lars Helge Overland
@@ -50,7 +49,7 @@
implements Action
{
private static final String DEFAULT_TYPE = "pdf";
-
+
private static final String KEY_VALIDATIONRESULT = "validationResult";
// -------------------------------------------------------------------------
@@ -70,14 +69,14 @@
{
this.format = format;
}
-
+
private I18n i18n;
public void setI18n( I18n i18n )
{
this.i18n = i18n;
}
-
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -88,7 +87,7 @@
{
this.type = type;
}
-
+
private Integer organisationUnitId;
public void setOrganisationUnitId( Integer organisationUnitId )
@@ -115,29 +114,29 @@
throws Exception
{
grid = generateGrid();
-
+
type = StringUtils.defaultIfEmpty( type, DEFAULT_TYPE );
-
+
return type;
}
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
private Grid generateGrid()
{
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 ) );
@@ -145,12 +144,12 @@
grid.addHeader( new GridHeader( i18n.getString( "operator" ), false, false ) );
grid.addHeader( new GridHeader( i18n.getString( "value" ), false, false ) );
grid.addHeader( new GridHeader( i18n.getString( "right_side_description" ), false, true ) );
-
+
for ( ValidationResult validationResult : results )
{
OrganisationUnit unit = validationResult.getSource();
Period period = validationResult.getPeriod();
-
+
grid.addRow();
grid.addValue( unit.getName() );
grid.addValue( format.formatPeriod( period ) );
@@ -160,7 +159,7 @@
grid.addValue( String.valueOf( validationResult.getRightsideValue() ) );
grid.addValue( validationResult.getValidationRule().getRightSide().getDescription() );
}
-
+
return grid;
}
}
=== 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 2012-09-22 18:42:59 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/RunValidationAction.java 2013-07-25 05:37:29 +0000
@@ -27,11 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
+import com.opensymphony.xwork2.Action;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.common.Grid;
@@ -44,7 +40,10 @@
import org.hisp.dhis.validation.ValidationRuleService;
import org.hisp.dhis.validation.comparator.ValidationResultComparator;
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
/**
* @author Margrethe Store
@@ -82,13 +81,13 @@
{
this.organisationUnitService = organisationUnitService;
}
-
+
// -------------------------------------------------------------------------
// Input/output
// -------------------------------------------------------------------------
private Integer organisationUnitId;
-
+
public void setOrganisationUnitId( Integer organisationUnitId )
{
this.organisationUnitId = organisationUnitId;
@@ -124,14 +123,14 @@
{
this.validationRuleGroupId = validationRuleGroupId;
}
-
+
private List<ValidationResult> validationResults = new ArrayList<ValidationResult>();
public List<ValidationResult> getValidationResults()
{
return validationResults;
}
-
+
private Grid aggregateResults;
public Grid getAggregateResults()
@@ -145,7 +144,7 @@
{
return maxExceeded;
}
-
+
private OrganisationUnit organisationUnit;
public OrganisationUnit getOrganisationUnit()
@@ -160,7 +159,7 @@
public String execute()
{
organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
-
+
Collection<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnitWithChildren( organisationUnit.getId() );
if ( validationRuleGroupId == -1 )
@@ -181,13 +180,13 @@
}
maxExceeded = validationResults.size() > ValidationRuleService.MAX_VIOLATIONS;
-
+
Collections.sort( validationResults, new ValidationResultComparator() );
SessionUtils.setSessionVar( KEY_VALIDATIONRESULT, validationResults );
log.info( "Validation done" );
-
+
return SUCCESS;
}
}
=== added file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/dataanalysis/ExportAnalysisResultAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/dataanalysis/ExportAnalysisResultAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/dataanalysis/ExportAnalysisResultAction.java 2013-07-25 05:37:29 +0000
@@ -0,0 +1,143 @@
+package org.hisp.dhis.validationrule.action.dataanalysis;
+
+/*
+ * Copyright (c) 2004-2013, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import com.opensymphony.xwork2.Action;
+import org.apache.commons.lang.StringUtils;
+import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.common.GridHeader;
+import org.hisp.dhis.datavalue.DeflatedDataValue;
+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;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class ExportAnalysisResultAction implements Action
+{
+ private static final String DEFAULT_TYPE = "pdf";
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ private I18nFormat format;
+
+ public void setFormat( I18nFormat format )
+ {
+ this.format = format;
+ }
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String type;
+
+ public void setType( String type )
+ {
+ this.type = type;
+ }
+
+ private Integer organisationUnitId;
+
+ public void setOrganisationUnitId( Integer organisationUnitId )
+ {
+ this.organisationUnitId = organisationUnitId;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Grid grid;
+
+ public Grid getGrid()
+ {
+ return grid;
+ }
+
+ @Override
+ public String execute() throws Exception
+ {
+ grid = generateGrid();
+
+ type = StringUtils.defaultIfEmpty( type, DEFAULT_TYPE );
+
+ return type;
+ }
+
+ @SuppressWarnings( "unchecked" )
+ private Grid generateGrid()
+ {
+ List<DeflatedDataValue> results = (List<DeflatedDataValue>) SessionUtils.getSessionVar( GetAnalysisAction.KEY_ANALYSIS_DATA_VALUES );
+
+ Grid grid = new ListGrid();
+ grid.setTitle( i18n.getString( "data_analysis_report" ) );
+
+ grid.addHeader( new GridHeader( i18n.getString( "dataelement" ), false, true ) );
+ grid.addHeader( new GridHeader( i18n.getString( "source" ), false, true ) );
+ grid.addHeader( new GridHeader( i18n.getString( "period" ), false, true ) );
+ grid.addHeader( new GridHeader( i18n.getString( "min" ), false, false ) );
+ grid.addHeader( new GridHeader( i18n.getString( "value" ), false, false ) );
+ grid.addHeader( new GridHeader( i18n.getString( "max" ), false, false ) );
+
+ for ( DeflatedDataValue dataValue : results )
+ {
+ Period period = dataValue.getPeriod();
+
+ grid.addRow();
+ grid.addValue( dataValue.getDataElementName() );
+ grid.addValue( dataValue.getSourceName() );
+ grid.addValue( format.formatPeriod( period ) );
+ grid.addValue( dataValue.getMin() );
+ grid.addValue( dataValue.getValue() );
+ grid.addValue( dataValue.getMax() );
+ }
+
+ return grid;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/dataanalysis/GetAnalysisAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/dataanalysis/GetAnalysisAction.java 2012-07-26 10:07:01 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/dataanalysis/GetAnalysisAction.java 2013-07-25 05:37:29 +0000
@@ -27,11 +27,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
+import com.opensymphony.xwork2.Action;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.common.ServiceProvider;
@@ -45,13 +41,17 @@
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;
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
/**
* Finds outliers in given data elements for given sources in a given period and
* displays a list of them.
- *
+ *
* @author Jon Moen Drange, Peter Flem, Dag Haavi Finstad, Lars Helge Oeverland
* @version $Id: GetOutliersAction.java 1005 2009-06-04 13:29:44Z jonmd $
*/
@@ -60,6 +60,8 @@
{
private static final Log log = LogFactory.getLog( GetAnalysisAction.class );
+ public static final String KEY_ANALYSIS_DATA_VALUES = "analysisDataValues";
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -185,13 +187,13 @@
Collection<Period> periods = null;
OrganisationUnit unit = selectionTreeManager.getReloadedSelectedOrganisationUnit();
Collection<OrganisationUnit> orgUnits = null;
-
+
// TODO filter periods with data element period type
-
+
if ( fromDate != null && toDate != null && dataSets != null && unit != null )
{
orgUnits = organisationUnitService.getOrganisationUnitWithChildren( unit.getId() );
-
+
periods = periodService.getPeriodsBetweenDates( format.parseDate( fromDate ), format.parseDate( toDate ) );
for ( String id : dataSets )
@@ -201,7 +203,7 @@
log.info( "From date: " + fromDate + ", To date: " + toDate + ", Organisation unit: " + unit
+ ", Std dev: " + standardDeviation + ", Key: " + key );
-
+
log.info( "Nr of data elements: " + dataElements.size() + " Nr of periods: " + periods.size() );
}
@@ -214,6 +216,8 @@
maxExceeded = dataValues.size() > DataAnalysisService.MAX_OUTLIERS;
}
+ SessionUtils.setSessionVar( KEY_ANALYSIS_DATA_VALUES, dataValues );
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties 2012-12-04 17:33:33 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties 2013-07-25 05:37:29 +0000
@@ -94,6 +94,7 @@
mark_value_for_followup=Mark value for follow-up
unmark_value_for_followup=Unmark value for follow-up
data_analysis=Data Analysis
+data_analysis_report=Data Analysis Report
stddevoutlier_analysis=Std Dev Outlier Analysis
minmaxoutlier_analysis=Min-Max Outlier Analysis
gap_analysis=Gap Analysis
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml 2012-10-31 13:56:02 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml 2013-07-25 05:37:29 +0000
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
-"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
-"http://struts.apache.org/dtds/struts-2.0.dtd">
+ "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+ "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<include file="dhis-web-commons.xml" />
@@ -13,7 +13,7 @@
<param name="page">/dhis-web-validationrule/index.vm</param>
<param name="menu">/dhis-web-validationrule/menu.vm</param>
</action>
-
+
<!-- ValidationRule CRUD operations -->
<action name="validationRule" class="org.hisp.dhis.validationrule.action.GetValidationRuleListAction">
@@ -25,7 +25,7 @@
<action name="getValidationRule" class="org.hisp.dhis.validationrule.action.GetValidationRuleAction">
<result name="success" type="velocity-json">/dhis-web-validationrule/jsonValidationRule.vm</result>
- <param name="onExceptionReturn">plainTextError</param>
+ <param name="onExceptionReturn">plainTextError</param>
</action>
<action name="showAddValidationRuleForm" class="org.hisp.dhis.validationrule.action.GetPeriodTypesAction">
@@ -33,7 +33,8 @@
<param name="page">/dhis-web-validationrule/addValidationRuleForm.vm</param>
<param name="menu">/dhis-web-validationrule/menu.vm</param>
<param name="javascripts">javascript/general.js,javascript/expression.js,
- javascript/expressionBuilder.js,javascript/addValidationRuleForm.js</param>
+ javascript/expressionBuilder.js,javascript/addValidationRuleForm.js
+ </param>
<param name="requiredAuthorities">F_VALIDATIONRULE_ADD</param>
</action>
@@ -63,7 +64,8 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-validationrule/updateValidationRuleForm.vm</param>
<param name="javascripts">javascript/general.js,javascript/expression.js,
- javascript/expressionBuilder.js,javascript/updateValidationRuleForm.js</param>
+ javascript/expressionBuilder.js,javascript/updateValidationRuleForm.js
+ </param>
<param name="requiredAuthorities">F_VALIDATIONRULE_UPDATE</param>
</action>
@@ -76,10 +78,11 @@
<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonOperands.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
-
+
<!-- ValidationRuleGroup CRUD operations -->
- <action name="showValidationRuleGroupForm" class="org.hisp.dhis.validationrule.action.validationrulegroup.GetValidationRuleGroupListAction">
+ <action name="showValidationRuleGroupForm"
+ class="org.hisp.dhis.validationrule.action.validationrulegroup.GetValidationRuleGroupListAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-validationrule/validationRuleGroup.vm</param>
<param name="menu">/dhis-web-validationrule/menu.vm</param>
@@ -88,10 +91,11 @@
<action name="getValidationRuleGroup" class="org.hisp.dhis.validationrule.action.validationrulegroup.GetValidationRuleGroupAction">
<result name="success" type="velocity-json">/dhis-web-validationrule/jsonValidationRuleGroup.vm</result>
- <param name="onExceptionReturn">plainTextError</param>
+ <param name="onExceptionReturn">plainTextError</param>
</action>
- <action name="removeValidationRuleGroup" class="org.hisp.dhis.validationrule.action.validationrulegroup.RemoveValidationRuleGroupAction">
+ <action name="removeValidationRuleGroup"
+ class="org.hisp.dhis.validationrule.action.validationrulegroup.RemoveValidationRuleGroupAction">
<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
<param name="requiredAuthorities">F_VALIDATIONRULEGROUP_DELETE</param>
<param name="onExceptionReturn">plainTextError</param>
@@ -117,24 +121,28 @@
<param name="requiredAuthorities">F_VALIDATIONRULEGROUP_UPDATE</param>
</action>
- <action name="updateValidationRuleGroup" class="org.hisp.dhis.validationrule.action.validationrulegroup.UpdateValidationRuleGroupAction">
+ <action name="updateValidationRuleGroup"
+ class="org.hisp.dhis.validationrule.action.validationrulegroup.UpdateValidationRuleGroupAction">
<result name="success" type="redirect">showValidationRuleGroupForm.action?currentPage=${keyCurrentPage}</result>
<param name="requiredAuthorities">F_VALIDATIONRULEGROUP_UPDATE</param>
</action>
- <action name="validateValidationRuleGroup" class="org.hisp.dhis.validationrule.action.validationrulegroup.ValidateValidationRuleGroupAction">
+ <action name="validateValidationRuleGroup"
+ class="org.hisp.dhis.validationrule.action.validationrulegroup.ValidateValidationRuleGroupAction">
<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
<result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
<result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
</action>
-
+
<!-- Run validation -->
<action name="showRunValidationForm" class="org.hisp.dhis.validationrule.action.SetupTreeAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-validationrule/runValidationForm.vm</param>
<param name="menu">/dhis-web-validationrule/menu.vm</param>
- <param name="javascripts">../dhis-web-commons/oust/oust.js,../dhis-web-commons/ouwt/ouwt.js,javascript/general.js,javascript/runValidation.js</param>
+ <param
+ name="javascripts">../dhis-web-commons/oust/oust.js,../dhis-web-commons/ouwt/ouwt.js,javascript/general.js,javascript/runValidation.js
+ </param>
<param name="requiredAuthorities">F_RUN_VALIDATION</param>
</action>
@@ -157,7 +165,7 @@
<result name="xls" type="gridXlsResult" />
<result name="pdf" type="gridPdfResult" />
</action>
-
+
<!-- Data analysis -->
<action name="viewAnalysisForm" class="org.hisp.dhis.validationrule.action.dataanalysis.ViewAnalysisFormAction">
@@ -179,8 +187,8 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-validationrule/followUpAnalysisForm.vm</param>
<param name="menu">/dhis-web-validationrule/menu.vm</param>
- <param name="javascripts"> javascript/dataAnalysis.js,javascript/editDataValue.js</param>
- <param name="requiredAuthorities">F_RUN_VALIDATION</param>
+ <param name="javascripts">javascript/dataAnalysis.js,javascript/editDataValue.js</param>
+ <param name="requiredAuthorities">F_RUN_VALIDATION</param>
</action>
<action name="getAnalysis" class="org.hisp.dhis.validationrule.action.dataanalysis.GetAnalysisAction">
@@ -194,15 +202,21 @@
</action>
<action name="markForFollowup" class="org.hisp.dhis.validationrule.action.dataanalysis.MarkForFollowupAction">
- <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
</action>
<action name="validateRunAnalysis" class="org.hisp.dhis.validationrule.action.dataanalysis.ValidationRunAnalysisAction">
<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
<result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
</action>
-
- <!-- PDF -->
+
+ <action name="exportAnalysisResult" class="org.hisp.dhis.validationrule.action.dataanalysis.ExportAnalysisResultAction">
+ <result name="csv" type="gridCsvResult" />
+ <result name="xls" type="gridXlsResult" />
+ <result name="pdf" type="gridPdfResult" />
+ </action>
+
+ <!-- PDF -->
<action name="exportToPdf" class="org.hisp.dhis.validationrule.action.pdf.ExportToPdfAction">
<result name="success" type="stream">
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/dataAnalysis.js'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/dataAnalysis.js 2013-04-30 08:31:58 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/dataAnalysis.js 2013-07-25 05:37:29 +0000
@@ -89,4 +89,10 @@
$( "div#analysisResult" ).show();
$( "div#analysisResult" ).html( data );
} );
-}
\ No newline at end of file
+}
+
+function exportAnalysisResult( type )
+{
+ var url = 'exportAnalysisResult.action?type=' + type;
+ window.location.href = url;
+}
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/searchResult.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/searchResult.vm 2012-05-01 13:14:33 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/searchResult.vm 2013-07-25 05:37:29 +0000
@@ -23,7 +23,11 @@
<span id="info">#if( $maxExceeded )$i18n.getString( "max_values_exceeded" ) #else$!dataValues.size() $i18n.getString( "values_found" ) #end</span>
-<input type="button" onclick="window.location.href='viewAnalysisForm.action?key=$!{key}'" value="Back" style="width:120px"><br><br>
+<input type="button" onclick="window.location.href='viewAnalysisForm.action?key=$!{key}'" value="Back" style="width:120px">
+<input type="button" value="$i18n.getString( 'get_report_as_pdf' )" style="width:140px" onclick="exportAnalysisResult( 'pdf' )">
+<input type="button" value="$i18n.getString( 'get_report_as_xls' )" style="width:140px" onclick="exportAnalysisResult( 'xls' )">
+<input type="button" value="$i18n.getString( 'get_report_as_csv' )" style="width:140px" onclick="exportAnalysisResult( 'cvs' )">
+<br><br>
<table class="listTable" id="listTable" style="width:100%">
<thead>
@@ -64,10 +68,10 @@
<td style="text-align:center">
#if ( $value.followup )
- <img id="value-${count}-followUp" src="../images/marked.png" onclick="markFollowUp($count)" style="cursor:pointer">
+ <img id="value-${count}-followUp" src="../images/marked.png" onclick="markFollowUp($count)" style="cursor:pointer">
#else
<img id="value-${count}-followUp" src="../images/unmarked.png" onclick="markFollowUp($count)" style="cursor:pointer">
- #end
+ #end
</td>
</tr>
#end