dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22634
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10934: Removed outdated report table code
------------------------------------------------------------
revno: 10934
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-05-22 15:14:47 +0200
message:
Removed outdated report table code
removed:
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/ReportTableManager.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetTableOptionsAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableTest.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/light_blue/light_blue.css
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.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-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2013-05-22 11:33:46 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2013-05-22 13:14:47 +0000
@@ -33,13 +33,11 @@
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.common.BaseAnalyticalObject;
import org.hisp.dhis.common.BaseNameableObject;
import org.hisp.dhis.common.CombinationGenerator;
@@ -147,34 +145,10 @@
{
{
put( CATEGORYCOMBO_ID, "Category combination ID" );
-
put( INDICATOR_ID, "Indicator ID" );
- put( INDICATOR_UID, "Indicator UID" );
- put( INDICATOR_NAME, "Indicator" );
- put( INDICATOR_CODE, "Indicator code" );
- put( INDICATOR_DESCRIPTION, "Indicator description" );
-
put( PERIOD_ID, "Period ID" );
- put( PERIOD_UID, "Period UID" );
- put( PERIOD_NAME, "Period" );
- put( PERIOD_CODE, "Period code" );
- put( PERIOD_DESCRIPTION, "Period description" );
-
put( ORGANISATIONUNIT_ID, "Organisation unit ID" );
- put( ORGANISATIONUNIT_UID, "Organisation unit UID" );
- put( ORGANISATIONUNIT_NAME, "Organisation unit" );
- put( ORGANISATIONUNIT_CODE, "Organisation unit code" );
- put( ORGANISATIONUNIT_DESCRIPTION, "Organisation unit description" );
-
put( ORGANISATIONUNITGROUP_ID, "Organisation unit group ID" );
- put( ORGANISATIONUNITGROUP_UID, "Organisation unit group UID" );
- put( ORGANISATIONUNITGROUP_NAME, "Organisation unit group" );
- put( ORGANISATIONUNITGROUP_CODE, "Organisation unit group code" );
- put( ORGANISATIONUNITGROUP_DESCRIPTION, "Organisation unit group description" );
-
- put( REPORTING_MONTH_COLUMN_NAME, "Reporting month" );
- put( PARAM_ORGANISATIONUNIT_COLUMN_NAME, "Organisation unit parameter" );
- put( ORGANISATION_UNIT_IS_PARENT_COLUMN_NAME, "Organisation unit is parent" );
}
};
@@ -197,8 +171,6 @@
private static final NameableObject[] IRT = new NameableObject[0];
private static final NameableObject[][] IRT2D = new NameableObject[0][];
- private static final String[] SRT = new String[0];
-
private static final String ILLEGAL_FILENAME_CHARS_REGEX = "[/\\?%*:|\"'<>.]";
// -------------------------------------------------------------------------
@@ -505,97 +477,6 @@
}
/**
- * Generates a grid identifier based on the internal identifiers of the
- * argument objects.
- */
- public static String getIdentifier( List<NameableObject> objects )
- {
- return getIdentifier( objects, new ArrayList<NameableObject>() );
- }
-
- /**
- * Generates a grid identifier based on the internal identifiers of the
- * argument objects.
- */
- public static String getIdentifier( List<? extends NameableObject> objects1, List<? extends NameableObject> objects2 )
- {
- List<String> identifiers = new ArrayList<String>();
-
- for ( NameableObject object : objects1 )
- {
- identifiers.add( getIdentifier( getNameableClass( object.getClass() ), object.getId() ) );
- }
-
- for ( NameableObject object : objects2 )
- {
- identifiers.add( getIdentifier( getNameableClass( object.getClass() ), object.getId() ) );
- }
-
- return getIdentifier( identifiers.toArray( SRT ) );
- }
-
- /**
- * Generates a grid column identifier based on the argument identifiers.
- */
- public static String getIdentifier( List<NameableObject> objects, Class<? extends NameableObject> clazz, int id )
- {
- List<String> identifiers = new ArrayList<String>();
-
- for ( NameableObject object : objects )
- {
- identifiers.add( getIdentifier( getNameableClass( object.getClass() ), object.getId() ) );
- }
-
- identifiers.add( getIdentifier( clazz, id ) );
-
- return getIdentifier( identifiers.toArray( SRT ) );
- }
-
- /**
- * Generates a grid column identifier based on the argument identifiers.
- */
- public static String getIdentifier( String... identifiers )
- {
- List<String> ids = Arrays.asList( identifiers );
-
- Collections.sort( ids ); // Sort to remove the significance of order
-
- return StringUtils.join( ids, SEPARATOR );
- }
-
- /**
- * Returns a grid identifier based on the argument class and id.
- */
- public static String getIdentifier( Class<? extends NameableObject> clazz, int id )
- {
- return CLASS_ID_MAP.get( clazz ) + id;
- }
-
- /**
- * Indicates whether the report table contains data elements.
- */
- public boolean hasDataElements()
- {
- return dataElements != null && dataElements.size() > 0;
- }
-
- /**
- * Indicates whether the report table contains indicators.
- */
- public boolean hasIndicators()
- {
- return indicators != null && indicators.size() > 0;
- }
-
- /**
- * Indicates whether the report table contains data sets.
- */
- public boolean hasDataSets()
- {
- return dataSets != null && dataSets.size() > 0;
- }
-
- /**
* Generates a string which is acceptable as a filename.
*/
public static String columnEncode( String string )
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2013-05-20 06:10:29 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2013-05-22 13:14:47 +0000
@@ -29,7 +29,6 @@
import static org.hisp.dhis.reporttable.ReportTable.ORGANISATION_UNIT_IS_PARENT_COLUMN_NAME;
import static org.hisp.dhis.reporttable.ReportTable.PARAM_ORGANISATIONUNIT_COLUMN_NAME;
-import static org.hisp.dhis.reporttable.ReportTable.PRETTY_COLUMNS;
import static org.hisp.dhis.reporttable.ReportTable.REPORTING_MONTH_COLUMN_NAME;
import static org.hisp.dhis.reporttable.ReportTable.SPACE;
import static org.hisp.dhis.reporttable.ReportTable.getColumnName;
@@ -329,11 +328,11 @@
grid.addHeader( new GridHeader( name + " description", row + "_description", String.class.getName(), true, true ) );
}
- grid.addHeader( new GridHeader( PRETTY_COLUMNS.get( REPORTING_MONTH_COLUMN_NAME ), REPORTING_MONTH_COLUMN_NAME,
+ grid.addHeader( new GridHeader( "Reporting month", REPORTING_MONTH_COLUMN_NAME,
String.class.getName(), true, true ) );
- grid.addHeader( new GridHeader( PRETTY_COLUMNS.get( PARAM_ORGANISATIONUNIT_COLUMN_NAME ),
+ grid.addHeader( new GridHeader( "Organisation unit parameter",
PARAM_ORGANISATIONUNIT_COLUMN_NAME, String.class.getName(), true, true ) );
- grid.addHeader( new GridHeader( PRETTY_COLUMNS.get( ORGANISATION_UNIT_IS_PARENT_COLUMN_NAME ),
+ grid.addHeader( new GridHeader( "Organisation unit is parent",
ORGANISATION_UNIT_IS_PARENT_COLUMN_NAME, String.class.getName(), true, true ) );
final int startColumnIndex = grid.getHeaders().size();
=== removed directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc'
=== removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java 2013-05-19 18:49:47 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java 1970-01-01 00:00:00 +0000
@@ -1,202 +0,0 @@
-package org.hisp.dhis.reporttable.jdbc;
-
-/*
- * Copyright (c) 2004-2012, 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 static org.hisp.dhis.reporttable.ReportTable.getIdentifier;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.hisp.dhis.chart.Chart;
-import org.hisp.dhis.common.NameableObject;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOption;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.reporttable.ReportTable;
-import org.hisp.dhis.system.util.ConversionUtils;
-import org.hisp.dhis.system.util.TextUtils;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.support.rowset.SqlRowSet;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class JDBCReportTableManager
- implements ReportTableManager
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private JdbcTemplate jdbcTemplate;
-
- public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
- {
- this.jdbcTemplate = jdbcTemplate;
- }
-
- // -------------------------------------------------------------------------
- // ReportTableManager implementation
- // -------------------------------------------------------------------------
-
- public Map<String, Double> getAggregatedValueMap( ReportTable reportTable )
- {
- return getAggregatedValueMapOrgUnitHierarchy( reportTable.getDataElements(), reportTable.getIndicators(), reportTable.getDataSets(),
- reportTable.getPeriods(), reportTable.getOrganisationUnits(), null, reportTable.isDimensional(), false );
- }
-
- public Map<String, Double> getAggregatedValueMap( Chart chart )
- {
- return getAggregatedValueMapOrgUnitHierarchy( chart.getDataElements(), chart.getIndicators(), chart.getDataSets(),
- chart.getAllPeriods(), chart.getAllOrganisationUnits(), null, false, false );
- }
-
- private Map<String, Double> getAggregatedValueMapOrgUnitHierarchy( List<DataElement> dataElements, List<Indicator> indicators,
- List<DataSet> dataSets, List<Period> periods, Collection<? extends NameableObject> organisationUnits, DataElementCategoryCombo categoryCombo,
- boolean isDimensional, boolean doTotal )
- {
- Map<String, Double> map = new HashMap<String, Double>();
-
- String dataElementIds = TextUtils.getCommaDelimitedString(
- ConversionUtils.getIdentifiers( DataElement.class, dataElements ) );
- String indicatorIds = TextUtils.getCommaDelimitedString(
- ConversionUtils.getIdentifiers( Indicator.class, indicators ) );
- String dataSetIds = TextUtils.getCommaDelimitedString(
- ConversionUtils.getIdentifiers( DataSet.class, dataSets ) );
- String periodIds = TextUtils.getCommaDelimitedString(
- ConversionUtils.getIdentifiers( Period.class, periods ) );
- String unitIds = TextUtils.getCommaDelimitedString(
- ConversionUtils.getIdentifiers( NameableObject.class, organisationUnits ) );
-
- if ( dataElementIds != null && !dataElementIds.isEmpty() ) // Data element totals
- {
- final String sql = "SELECT dataelementid, periodid, organisationunitid, SUM(value) FROM aggregateddatavalue " +
- "WHERE dataelementid IN (" + dataElementIds + ") AND periodid IN (" + periodIds + ") AND organisationunitid IN (" + unitIds + ") " +
- "GROUP BY dataelementid, periodid, organisationunitid";
-
- SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
-
- while ( rowSet.next() )
- {
- String id = getIdentifier( getIdentifier( DataElement.class, rowSet.getInt( 1 ) ),
- getIdentifier( Period.class, rowSet.getInt( 2 ) ),
- getIdentifier( OrganisationUnit.class, rowSet.getInt( 3 ) ) );
-
- map.put( id, rowSet.getDouble( 4 ) );
- }
- }
-
- if ( indicatorIds != null && !indicatorIds.isEmpty() )
- {
- final String sql = "SELECT indicatorid, periodid, organisationunitid, value FROM aggregatedindicatorvalue " +
- "WHERE indicatorid IN (" + indicatorIds + ") AND periodid IN (" + periodIds + ") AND organisationunitid IN (" + unitIds + ")";
-
- SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
-
- while ( rowSet.next() )
- {
- String id = getIdentifier( getIdentifier( Indicator.class, rowSet.getInt( 1 ) ),
- getIdentifier( Period.class, rowSet.getInt( 2 ) ),
- getIdentifier( OrganisationUnit.class, rowSet.getInt( 3 ) ) );
-
- map.put( id, rowSet.getDouble( 4 ) );
- }
- }
-
- if ( dataSetIds != null && !dataSetIds.isEmpty() )
- {
- final String sql = "SELECT datasetid, periodid, organisationunitid, value FROM aggregateddatasetcompleteness " +
- "WHERE datasetid IN (" + dataSetIds + ") AND periodid IN (" + periodIds + ") AND organisationunitid IN (" + unitIds + ")";
-
- SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
-
- while ( rowSet.next() )
- {
- String id = getIdentifier( getIdentifier( DataSet.class, rowSet.getInt( 1 ) ),
- getIdentifier( Period.class, rowSet.getInt( 2 ) ),
- getIdentifier( OrganisationUnit.class, rowSet.getInt( 3 ) ) );
-
- map.put( id, rowSet.getDouble( 4 ) );
- }
- }
-
- if ( isDimensional ) // Category option combo values
- {
- final String sql = "SELECT dataelementid, categoryoptioncomboid, periodid, organisationunitid, value FROM aggregateddatavalue " +
- "WHERE dataelementid IN (" + dataElementIds + ") AND periodid IN (" + periodIds + ") AND organisationunitid IN (" + unitIds + ")";
-
- SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
-
- while ( rowSet.next() )
- {
- String id = getIdentifier( getIdentifier( DataElement.class, rowSet.getInt( 1 ) ),
- getIdentifier( DataElementCategoryOptionCombo.class, rowSet.getInt( 2 ) ),
- getIdentifier( Period.class, rowSet.getInt( 3 ) ),
- getIdentifier( OrganisationUnit.class, rowSet.getInt( 4 ) ) );
-
- map.put( id, rowSet.getDouble( 5 ) );
- }
- }
-
- if ( doTotal ) // Category option sub totals
- {
- for ( DataElementCategoryOption categoryOption : categoryCombo.getCategoryOptions() )
- {
- String cocIds = TextUtils.getCommaDelimitedString(
- ConversionUtils.getIdentifiers( DataElementCategoryOptionCombo.class, categoryOption.getCategoryOptionCombos() ) );
-
- final String sql = "SELECT dataelementid, periodid, organisationunitid, SUM(value) FROM aggregateddatavalue " +
- "WHERE dataelementid IN (" + dataElementIds + ") AND categoryoptioncomboid IN (" + cocIds + ") " +
- "AND periodid IN (" + periodIds + ") AND organisationunitid IN (" + unitIds + ") " +
- "GROUP BY dataelementid, periodid, organisationunitid";
-
- SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
-
- while ( rowSet.next() )
- {
- String id = getIdentifier( getIdentifier( DataElement.class, rowSet.getInt( 1 ) ),
- getIdentifier( Period.class, rowSet.getInt( 2 ) ),
- getIdentifier( OrganisationUnit.class, rowSet.getInt( 3 ) ),
- getIdentifier( DataElementCategoryOption.class, categoryOption.getId() ) );
-
- map.put( id, rowSet.getDouble( 4 ) );
- }
- }
- }
-
- return map;
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/ReportTableManager.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/ReportTableManager.java 2012-03-05 16:37:17 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/ReportTableManager.java 1970-01-01 00:00:00 +0000
@@ -1,56 +0,0 @@
-package org.hisp.dhis.reporttable.jdbc;
-
-/*
- * Copyright (c) 2004-2012, 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 java.util.Map;
-
-import org.hisp.dhis.chart.Chart;
-import org.hisp.dhis.reporttable.ReportTable;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public interface ReportTableManager
-{
- String ID = ReportTableManager.class.getName();
-
- /**
- * Generates a map with a key identifying the dimensions of each value.
- *
- * @param reportTable the ReportTable for which to create the value map.
- */
- Map<String, Double> getAggregatedValueMap( ReportTable reportTable );
-
- /**
- * Generates a map with a key identifying the dimensions of each value.
- *
- * @param chart the Chart for which to create the value map.
- */
- Map<String, Double> getAggregatedValueMap( Chart chart );
-}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2013-05-19 18:49:47 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2013-05-22 13:14:47 +0000
@@ -6,10 +6,6 @@
<!-- ReportTable -->
- <bean id="org.hisp.dhis.reporttable.jdbc.ReportTableManager" class="org.hisp.dhis.reporttable.jdbc.JDBCReportTableManager">
- <property name="jdbcTemplate" ref="jdbcTemplate" />
- </bean>
-
<bean id="org.hisp.dhis.reporttable.ReportTableStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
<property name="clazz" value="org.hisp.dhis.reporttable.ReportTable" />
<property name="sessionFactory" ref="sessionFactory" />
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableTest.java 2013-05-19 18:49:47 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableTest.java 2013-05-22 13:14:47 +0000
@@ -27,14 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.reporttable.ReportTable.DATAELEMENT_ID;
-import static org.hisp.dhis.reporttable.ReportTable.INDICATOR_ID;
-import static org.hisp.dhis.reporttable.ReportTable.ORGANISATIONUNITGROUP_ID;
-import static org.hisp.dhis.reporttable.ReportTable.PERIOD_ID;
import static org.hisp.dhis.reporttable.ReportTable.getColumnName;
-import static org.hisp.dhis.reporttable.ReportTable.getIdentifier;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -242,97 +236,6 @@
// -------------------------------------------------------------------------
@Test
- public void testGetIdentifierA()
- {
- List<NameableObject> a1 = getList( unitA, periodA );
- List<NameableObject> a2 = getList( indicatorA );
-
- List<NameableObject> b1 = getList( periodA );
- List<NameableObject> b2 = getList( indicatorA, unitA );
-
- List<NameableObject> c1 = getList( groupA, periodA );
- List<NameableObject> c2 = getList( indicatorA );
-
- assertNotNull( getIdentifier( a1, a2 ) );
- assertNotNull( getIdentifier( b1, b2 ) );
- assertNotNull( getIdentifier( c1, c2 ) );
- assertEquals( getIdentifier( a1, a2 ), getIdentifier( b1, b2 ) );
-
- String identifier = getIdentifier( getIdentifier( unitA.getClass(), unitA.getId() ),
- getIdentifier( periodA.getClass(), periodA.getId() ), getIdentifier( indicatorA.getClass(), indicatorA.getId() ) );
-
- assertEquals( getIdentifier( a1, a2 ), identifier );
-
- identifier = getIdentifier( getIdentifier( periodA.getClass(), periodA.getId() ),
- getIdentifier( indicatorA.getClass(), indicatorA.getId() ), getIdentifier( unitA.getClass(), unitA.getId() ) );
-
- assertEquals( getIdentifier( b1, b2 ), identifier );
-
- identifier = getIdentifier( getIdentifier( groupA.getClass(), groupA.getId() ),
- getIdentifier( periodA.getClass(), periodA.getId() ), getIdentifier( indicatorA.getClass(), indicatorA.getId() ) );
-
- assertEquals( getIdentifier( c1, c2 ), identifier );
- }
-
- @Test
- public void testGetIdentifierB()
- {
- String a1 = getIdentifier( Indicator.class, 1 );
- String a2 = getIdentifier( DataElement.class, 2 );
-
- assertEquals( INDICATOR_ID + 1, a1 );
- assertEquals( DATAELEMENT_ID + 2, a2 );
-
- String b1 = getIdentifier( Indicator.class, 2 );
- String b2 = getIdentifier( DataElement.class, 1 );
-
- assertEquals( INDICATOR_ID + 2, b1 );
- assertEquals( DATAELEMENT_ID + 1, b2 );
-
- String c1 = getIdentifier( OrganisationUnitGroup.class, 1 );
- String c2 = getIdentifier( Period.class, 2 );
-
- assertEquals( getIdentifier( ORGANISATIONUNITGROUP_ID + 1 ), c1 );
- assertEquals( getIdentifier( PERIOD_ID + 2 ), c2 );
-
- assertFalse( getIdentifier( a1, a2 ).equals( getIdentifier( b1, b2 ) ) );
- }
-
- @Test
- public void testGetIdentifierC()
- {
- List<NameableObject> a1 = getList( dataElementA, periodA, categoryOptionComboA );
- List<NameableObject> a2 = getList( unitA );
-
- String b1 = getIdentifier( DataElement.class, 'A' );
- String b2 = getIdentifier( Period.class, 'A' );
- String b3 = getIdentifier( DataElementCategoryOptionCombo.class, 'A' );
- String b4 = getIdentifier( OrganisationUnit.class, 'A' );
-
- String a = getIdentifier( a1, a2 );
- String b = getIdentifier( b1, b2, b3, b4 );
-
- assertEquals( a, b );
- }
-
- @Test
- public void testGetIdentifierD()
- {
- List<NameableObject> a1 = getList( dataElementA, periodA, categoryOptionComboA );
- List<NameableObject> a2 = getList( groupA );
-
- String b1 = getIdentifier( DataElement.class, 'A' );
- String b2 = getIdentifier( Period.class, 'A' );
- String b3 = getIdentifier( DataElementCategoryOptionCombo.class, 'A' );
- String b4 = getIdentifier( OrganisationUnitGroup.class, 'A' );
-
- String a = getIdentifier( a1, a2 );
- String b = getIdentifier( b1, b2, b3, b4 );
-
- assertEquals( a, b );
- }
-
- @Test
public void testGetColumnName()
{
List<NameableObject> a1 = getList( unitA, periodC );
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/light_blue/light_blue.css'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/light_blue/light_blue.css 2013-05-22 10:32:44 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/light_blue/light_blue.css 2013-05-22 13:14:47 +0000
@@ -364,20 +364,16 @@
.page th, thead tr, .tabHead
{
+ background-color: #ebf0f6;
text-align: left;
color: #39547d;
padding: 3px 0 2px 6px;
- border-bottom: 1px solid #cad5e5;
+ border: 1px solid #cad5e5;
font-family: LiberationSansBold, arial;
font-size: 13px;
font-weight: normal;
}
-.page th
-{
- padding: 6px 0 3px 5px;
-}
-
#mainPage
{
margin: 65px 10px 10px 270px;
@@ -396,6 +392,14 @@
padding-top: 10px;
}
+.listTable th, .listTable thead tr
+{
+ background-color: #fff;
+ border: 0px solid #fff;
+ border-bottom: 1px solid #cad5e5;
+ padding: 6px 0 3px 5px;
+}
+
.listTable td
{
padding: 2px 2px 2px 5px;
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetTableOptionsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetTableOptionsAction.java 2013-02-26 17:45:20 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetTableOptionsAction.java 1970-01-01 00:00:00 +0000
@@ -1,399 +0,0 @@
-package org.hisp.dhis.reporting.tablecreator.action;
-
-/*
- * Copyright (c) 2004-2012, 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 java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementGroup;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorGroup;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
-import org.hisp.dhis.oust.manager.SelectionTreeManager;
-import org.hisp.dhis.period.MonthlyPeriodType;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.period.RelativePeriods;
-import org.hisp.dhis.reporttable.ReportTable;
-import org.hisp.dhis.reporttable.ReportTableService;
-import org.hisp.dhis.system.filter.AggregatableDataElementFilter;
-import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter;
-import org.hisp.dhis.system.util.FilterUtils;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class GetTableOptionsAction
- implements Action
-{
- private static final int AVAILABLE_REPORTING_MONTHS = 12;
-
- private static final int ALL = 0;
-
- public int getALL()
- {
- return ALL;
- }
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private ReportTableService reportTableService;
-
- public void setReportTableService( ReportTableService reportTableService )
- {
- this.reportTableService = reportTableService;
- }
-
- private DataElementService dataElementService;
-
- public void setDataElementService( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
- private DataElementCategoryService categoryService;
-
- public void setCategoryService( DataElementCategoryService categoryService )
- {
- this.categoryService = categoryService;
- }
-
- private IndicatorService indicatorService;
-
- public void setIndicatorService( IndicatorService indicatorService )
- {
- this.indicatorService = indicatorService;
- }
-
- private PeriodService periodService;
-
- public void setPeriodService( PeriodService periodService )
- {
- this.periodService = periodService;
- }
-
- private OrganisationUnitGroupService organisationUnitGroupService;
-
- public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
- {
- this.organisationUnitGroupService = organisationUnitGroupService;
- }
-
- private DataSetService dataSetService;
-
- public void setDataSetService( DataSetService dataSetService )
- {
- this.dataSetService = dataSetService;
- }
-
- private SelectionTreeManager selectionTreeManager;
-
- public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
- {
- this.selectionTreeManager = selectionTreeManager;
- }
-
- private I18nFormat format;
-
- public void setFormat( I18nFormat format )
- {
- this.format = format;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Integer id;
-
- public void setId( Integer id )
- {
- this.id = id;
- }
-
- private boolean dimension;
-
- public boolean isDimension()
- {
- return dimension;
- }
-
- public void setDimension( boolean dimension )
- {
- this.dimension = dimension;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private List<DataElementGroup> dataElementGroups = new ArrayList<DataElementGroup>();
-
- public List<DataElementGroup> getDataElementGroups()
- {
- return dataElementGroups;
- }
-
- private List<DataElementCategoryCombo> categoryCombos = new ArrayList<DataElementCategoryCombo>();
-
- public List<DataElementCategoryCombo> getCategoryCombos()
- {
- return categoryCombos;
- }
-
- private List<DataElement> dataElements = new ArrayList<DataElement>();
-
- public List<DataElement> getDataElements()
- {
- return dataElements;
- }
-
- private List<IndicatorGroup> indicatorGroups = new ArrayList<IndicatorGroup>();
-
- public List<IndicatorGroup> getIndicatorGroups()
- {
- return indicatorGroups;
- }
-
- private List<Indicator> indicators = new ArrayList<Indicator>();
-
- public List<Indicator> getIndicators()
- {
- return indicators;
- }
-
- private List<DataSet> dataSets = new ArrayList<DataSet>();
-
- public List<DataSet> getDataSets()
- {
- return dataSets;
- }
-
- private List<PeriodType> periodTypes = new ArrayList<PeriodType>();
-
- public List<PeriodType> getPeriodTypes()
- {
- return periodTypes;
- }
-
- private List<Period> periods = new ArrayList<Period>();
-
- public List<Period> getPeriods()
- {
- return periods;
- }
-
- private List<OrganisationUnitGroup> organisationUnitGroups = new ArrayList<OrganisationUnitGroup>();
-
- public List<OrganisationUnitGroup> getOrganisationUnitGroups()
- {
- return organisationUnitGroups;
- }
-
- private ReportTable reportTable;
-
- public ReportTable getReportTable()
- {
- return reportTable;
- }
-
- private RelativePeriods relatives;
-
- public RelativePeriods getRelatives()
- {
- return relatives;
- }
-
- private List<DataElement> selectedDataElements = new ArrayList<DataElement>();
-
- public List<DataElement> getSelectedDataElements()
- {
- return selectedDataElements;
- }
-
- private List<Indicator> selectedIndicators = new ArrayList<Indicator>();
-
- public List<Indicator> getSelectedIndicators()
- {
- return selectedIndicators;
- }
-
- private List<DataSet> selectedDataSets = new ArrayList<DataSet>();
-
- public List<DataSet> getSelectedDataSets()
- {
- return selectedDataSets;
- }
-
- private List<Period> selectedPeriods = new ArrayList<Period>();
-
- public List<Period> getSelectedPeriods()
- {
- return selectedPeriods;
- }
-
- private List<OrganisationUnitGroup> selectedOrganisationUnitGroups = new ArrayList<OrganisationUnitGroup>();
-
- public List<OrganisationUnitGroup> getSelectedOrganisationUnitGroups()
- {
- return selectedOrganisationUnitGroups;
- }
-
- private SortedMap<Integer, String> reportingPeriods = new TreeMap<Integer, String>();
-
- public SortedMap<Integer, String> getReportingPeriods()
- {
- return reportingPeriods;
- }
-
- private Comparator<Indicator> indicatorComparator;
-
- public void setIndicatorComparator( Comparator<Indicator> indicatorComparator )
- {
- this.indicatorComparator = indicatorComparator;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- {
- // ---------------------------------------------------------------------
- // Available metadata
- // ---------------------------------------------------------------------
-
- if ( dimension )
- {
- categoryCombos = new ArrayList<DataElementCategoryCombo>( categoryService.getAllDataElementCategoryCombos() );
- Collections.sort( categoryCombos, IdentifiableObjectNameComparator.INSTANCE );
- }
- else
- {
- dataElementGroups = new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() );
- Collections.sort( dataElementGroups, IdentifiableObjectNameComparator.INSTANCE );
-
- dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
- Collections.sort( dataElements, IdentifiableObjectNameComparator.INSTANCE );
- FilterUtils.filter( dataElements, new AggregatableDataElementFilter() );
-
- indicatorGroups = new ArrayList<IndicatorGroup>( indicatorService.getAllIndicatorGroups() );
- Collections.sort( indicatorGroups, IdentifiableObjectNameComparator.INSTANCE );
-
- indicators = new ArrayList<Indicator>( indicatorService.getAllIndicators() );
- Collections.sort( indicators, indicatorComparator );
-
- dataSets = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
- Collections.sort( dataSets, IdentifiableObjectNameComparator.INSTANCE );
- }
-
- periodTypes = periodService.getAllPeriodTypes();
-
- periods = new MonthlyPeriodType().generatePeriods( new Date() );
- Collections.reverse( periods );
- FilterUtils.filter( periods, new PastAndCurrentPeriodFilter() );
-
- organisationUnitGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService.getOrganisationUnitGroupsWithGroupSets() );
- Collections.sort( organisationUnitGroups, new IdentifiableObjectNameComparator() );
-
- // ---------------------------------------------------------------------
- // Reporting periods
- // ---------------------------------------------------------------------
-
- MonthlyPeriodType periodType = new MonthlyPeriodType();
-
- Calendar cal = PeriodType.createCalendarInstance();
-
- for ( int i = 0; i < AVAILABLE_REPORTING_MONTHS; i++ )
- {
- int month = i + 1;
- cal.add( Calendar.MONTH, -1 );
- Period period = periodType.createPeriod( cal.getTime() );
- String periodName = format.formatPeriod( period );
-
- reportingPeriods.put( month, periodName );
- }
-
- selectionTreeManager.clearSelectedOrganisationUnits();
-
- // ---------------------------------------------------------------------
- // Report table
- // ---------------------------------------------------------------------
-
- if ( id != null )
- {
- reportTable = reportTableService.getReportTable( id );
-
- relatives = reportTable.getRelatives();
-
- dataElements.removeAll( reportTable.getDataElements() );
-
- indicators.removeAll( reportTable.getIndicators() );
-
- dataSets.removeAll( reportTable.getDataSets() );
-
- periods.removeAll( reportTable.getPeriods() );
-
- selectedDataElements = reportTable.getDataElements();
-
- selectedIndicators = reportTable.getIndicators();
-
- selectedDataSets = reportTable.getDataSets();
-
- selectedPeriods = reportTable.getPeriods();
-
- selectedOrganisationUnitGroups = reportTable.getOrganisationUnitGroups();
-
- selectionTreeManager.setSelectedOrganisationUnits( reportTable.getOrganisationUnits() );
- }
-
- return SUCCESS;
- }
-}
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java 2013-05-19 18:49:47 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/SaveTableAction.java 1970-01-01 00:00:00 +0000
@@ -1,335 +0,0 @@
-package org.hisp.dhis.reporting.tablecreator.action;
-
-/*
- * Copyright (c) 2004-2012, 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 static org.hisp.dhis.system.util.ConversionUtils.getIntegerCollection;
-import static org.hisp.dhis.system.util.ConversionUtils.getList;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hisp.dhis.commons.action.AbstractRelativePeriodsAction;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
-import org.hisp.dhis.oust.manager.SelectionTreeManager;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.period.RelativePeriods;
-import org.hisp.dhis.reporttable.ReportParams;
-import org.hisp.dhis.reporttable.ReportTable;
-import org.hisp.dhis.reporttable.ReportTableService;
-
-/**
- * @author Lars Helge Overland
- */
-public class SaveTableAction
- extends AbstractRelativePeriodsAction
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private ReportTableService reportTableService;
-
- public void setReportTableService( ReportTableService reportTableService )
- {
- this.reportTableService = reportTableService;
- }
-
- private DataElementService dataElementService;
-
- public void setDataElementService( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
- private IndicatorService indicatorService;
-
- public void setIndicatorService( IndicatorService indicatorService )
- {
- this.indicatorService = indicatorService;
- }
-
- private PeriodService periodService;
-
- public void setPeriodService( PeriodService periodService )
- {
- this.periodService = periodService;
- }
-
- private OrganisationUnitGroupService organisationUnitGroupService;
-
- public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
- {
- this.organisationUnitGroupService = organisationUnitGroupService;
- }
-
- private DataSetService dataSetService;
-
- public void setDataSetService( DataSetService dataSetService )
- {
- this.dataSetService = dataSetService;
- }
-
- private SelectionTreeManager selectionTreeManager;
-
- public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
- {
- this.selectionTreeManager = selectionTreeManager;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Integer tableId;
-
- public void setTableId( Integer id )
- {
- this.tableId = id;
- }
-
- private String tableName;
-
- public void setTableName( String tableName )
- {
- this.tableName = tableName;
- }
-
- private Integer sortOrder;
-
- public void setSortOrder( Integer sortOrder )
- {
- this.sortOrder = sortOrder;
- }
-
- private Integer topLimit;
-
- public void setTopLimit( Integer topLimit )
- {
- this.topLimit = topLimit;
- }
-
- private boolean regression;
-
- public void setRegression( boolean regression )
- {
- this.regression = regression;
- }
-
- private boolean cumulative;
-
- public void setCumulative( boolean cumulative )
- {
- this.cumulative = cumulative;
- }
-
- private boolean doIndicators;
-
- public void setDoIndicators( boolean doIndicators )
- {
- this.doIndicators = doIndicators;
- }
-
- private boolean doPeriods;
-
- public void setDoPeriods( boolean doPeriods )
- {
- this.doPeriods = doPeriods;
- }
-
- private boolean doOrganisationUnits;
-
- public void setDoOrganisationUnits( boolean doUnits )
- {
- this.doOrganisationUnits = doUnits;
- }
-
- private List<String> selectedDataElements = new ArrayList<String>();
-
- public void setSelectedDataElements( List<String> selectedDataElements )
- {
- this.selectedDataElements = selectedDataElements;
- }
-
- private List<String> selectedIndicators = new ArrayList<String>();
-
- public void setSelectedIndicators( List<String> selectedIndicators )
- {
- this.selectedIndicators = selectedIndicators;
- }
-
- private List<String> selectedDataSets = new ArrayList<String>();
-
- public void setSelectedDataSets( List<String> selectedDataSets )
- {
- this.selectedDataSets = selectedDataSets;
- }
-
- private List<String> selectedPeriods = new ArrayList<String>();
-
- public void setSelectedPeriods( List<String> selectedPeriods )
- {
- this.selectedPeriods = selectedPeriods;
- }
-
- private List<String> selectedOrganisationUnitGroups = new ArrayList<String>();
-
- public void setSelectedOrganisationUnitGroups( List<String> selectedOrganisationUnitGroups )
- {
- this.selectedOrganisationUnitGroups = selectedOrganisationUnitGroups;
- }
-
- private boolean paramReportingMonth;
-
- public void setParamReportingMonth( boolean paramReportingMonth )
- {
- this.paramReportingMonth = paramReportingMonth;
- }
-
- private boolean paramGrandParentOrganisationUnit;
-
- public void setParamGrandParentOrganisationUnit( boolean paramGrandParentOrganisationUnit )
- {
- this.paramGrandParentOrganisationUnit = paramGrandParentOrganisationUnit;
- }
-
- private boolean paramParentOrganisationUnit;
-
- public void setParamParentOrganisationUnit( boolean paramParentOrganisationUnit )
- {
- this.paramParentOrganisationUnit = paramParentOrganisationUnit;
- }
-
- private boolean paramOrganisationUnit;
-
- public void setParamOrganisationUnit( boolean paramOrganisationUnit )
- {
- this.paramOrganisationUnit = paramOrganisationUnit;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- ReportTable reportTable = getReportTable();
-
- reportTableService.saveReportTable( reportTable );
-
- return SUCCESS;
- }
-
- // -------------------------------------------------------------------------
- // Supportive methods
- // -------------------------------------------------------------------------
-
- private ReportTable getReportTable()
- throws Exception
- {
- List<Period> periods = getList( periodService.getPeriodsByExternalIds( selectedPeriods ) );
-
- List<DataElement> dataElements = new ArrayList<DataElement>();
- List<Indicator> indicators = new ArrayList<Indicator>();
- List<DataSet> dataSets = new ArrayList<DataSet>();
- List<OrganisationUnit> units = new ArrayList<OrganisationUnit>( selectionTreeManager.getReloadedSelectedOrganisationUnits() );
- List<OrganisationUnitGroup> organisationUnitGroups = new ArrayList<OrganisationUnitGroup>();
-
- for ( Integer id : getIntegerCollection( selectedDataElements ) )
- {
- dataElements.add( dataElementService.getDataElement( id ) );
- }
-
- for ( Integer id : getIntegerCollection( selectedIndicators ) )
- {
- indicators.add( indicatorService.getIndicator( id ) );
- }
-
- for ( Integer id : getIntegerCollection( selectedDataSets ) )
- {
- dataSets.add( dataSetService.getDataSet( id ) );
- }
-
- for ( Integer id : getIntegerCollection( selectedOrganisationUnitGroups ) )
- {
- organisationUnitGroups.add( organisationUnitGroupService.getOrganisationUnitGroup( id ) );
- }
-
- RelativePeriods relatives = getRelativePeriods();
-
- ReportParams reportParams = new ReportParams();
-
- reportParams.setParamReportingMonth( paramReportingMonth );
- reportParams.setParamGrandParentOrganisationUnit( paramGrandParentOrganisationUnit );
- reportParams.setParamParentOrganisationUnit( paramParentOrganisationUnit );
- reportParams.setParamOrganisationUnit( paramOrganisationUnit );
-
- ReportTable reportTable = null;
-
- if ( tableId == null )
- {
- reportTable = new ReportTable( tableName,
- dataElements, indicators, dataSets, periods, units,
- doIndicators, doPeriods, doOrganisationUnits, relatives, reportParams, null );
- }
- else
- {
- reportTable = reportTableService.getReportTable( tableId );
-
- reportTable.setName( tableName );
- reportTable.setRegression( regression );
- reportTable.setDataElements( dataElements );
- reportTable.setIndicators( indicators );
- reportTable.setDataSets( dataSets );
- reportTable.setPeriods( periods );
- reportTable.setOrganisationUnits( units );
- reportTable.setOrganisationUnitGroups( organisationUnitGroups );
- reportTable.setDoIndicators( doIndicators );
- reportTable.setDoPeriods( doPeriods );
- reportTable.setDoUnits( doOrganisationUnits );
- reportTable.setRelatives( relatives );
- reportTable.setReportParams( reportParams );
- }
-
- reportTable.setRegression( regression );
- reportTable.setCumulative( cumulative );
- reportTable.setSortOrder( sortOrder );
- reportTable.setTopLimit( topLimit );
-
- return reportTable;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2013-05-19 18:49:47 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2013-05-22 13:14:47 +0000
@@ -53,29 +53,6 @@
<!-- TableCreator -->
- <bean id="org.hisp.dhis.reporting.tablecreator.action.GetTableOptionsAction" class="org.hisp.dhis.reporting.tablecreator.action.GetTableOptionsAction"
- scope="prototype">
- <property name="reportTableService" ref="org.hisp.dhis.reporttable.ReportTableService" />
- <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
- <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
- <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
- <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
- <property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
- <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
- <property name="selectionTreeManager" ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
- </bean>
-
- <bean id="org.hisp.dhis.reporting.tablecreator.action.SaveTableAction" class="org.hisp.dhis.reporting.tablecreator.action.SaveTableAction"
- scope="prototype">
- <property name="reportTableService" ref="org.hisp.dhis.reporttable.ReportTableService" />
- <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
- <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
- <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
- <property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
- <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
- <property name="selectionTreeManager" ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
- </bean>
-
<bean id="org.hisp.dhis.reporting.tablecreator.action.GetReportParamsAction" class="org.hisp.dhis.reporting.tablecreator.action.GetReportParamsAction"
scope="prototype">
<property name="reportService" ref="org.hisp.dhis.report.ReportService" />
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2013-04-30 11:20:20 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2013-05-22 13:14:47 +0000
@@ -119,7 +119,6 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-reporting/viewTableForm.vm</param>
<param name="menu">/dhis-web-reporting/menu.vm</param>
- <param name="javascripts">javascript/table.js</param>
</action>
<action name="getReportTables" class="org.hisp.dhis.reporting.tablecreator.action.GetAllTablesAction">
@@ -132,10 +131,6 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
- <action name="saveTable" class="org.hisp.dhis.reporting.tablecreator.action.SaveTableAction">
- <result name="success" type="redirect">displayManageTableForm.action</result>
- </action>
-
<action name="getReportParams" class="org.hisp.dhis.reporting.tablecreator.action.GetReportParamsAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-reporting/inputReportParamsForm.vm</param>
@@ -143,13 +138,6 @@
<param name="javascripts">../dhis-web-commons/oust/oust.js,javascript/generateReport.js</param>
</action>
- <action name="displayAddTableForm" class="org.hisp.dhis.reporting.tablecreator.action.GetTableOptionsAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-reporting/addTableForm.vm</param>
- <param name="menu">/dhis-web-reporting/menu.vm</param>
- <param name="javascripts">../dhis-web-commons/oust/oust.js,javascript/table.js,javascript/lists.js</param>
- </action>
-
<action name="getTable" class="org.hisp.dhis.reporting.tablecreator.action.GetTableAction">
<result name="success" type="velocity-json">/dhis-web-reporting/jsonTable.vm</result>
<param name="onExceptionReturn">plainTextError</param>
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm 2013-04-30 08:03:51 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addTableForm.vm 1970-01-01 00:00:00 +0000
@@ -1,480 +0,0 @@
-<script type="text/javascript">
- jQuery(document).ready(function() {
- #if ( $dimension )
- document.getElementById( "doIndicators" ).disabled = true;
- document.getElementById( "doOrganisationUnits" ).disabled = true;
- document.getElementById( "doPeriods" ).disabled = true;
- #end
- });
-
- var i18n_done = '$encoder.jsEscape( $i18n.getString( "done" ), "'")';
- var i18n_must_enter_name = '$encoder.jsEscape( $i18n.getString( "must_enter_name" ), "'")';
- var i18n_cannot_include_more_organisation_unit_regression = '$encoder.jsEscape( $i18n.getString( "cannot_include_more_organisation_unit_regression" ), "'")';
- var i18n_must_select_at_least_one_indictor_data_element_data_set = '$encoder.jsEscape( $i18n.getString( "must_select_at_least_one_indictor_data_element_data_set" ), "'")';
- var i18n_must_select_at_least_one_unit = '$encoder.jsEscape( $i18n.getString( "must_select_at_least_one_unit" ), "'")';
- var i18n_must_select_at_least_one_period = '$encoder.jsEscape( $i18n.getString( "must_select_at_least_one_period" ), "'")';
- var i18n_cannot_select_orgunit_and_parent_orgunit_param = '$encoder.jsEscape( $i18n.getString( "cannot_select_orgunit_and_parent_orgunit_param" ), "'")';
- var i18n_specify_name = '$encoder.jsEscape( $i18n.getString( "specify_name" ) , "'")';
-</script>
-
-<h3>$i18n.getString( "create_report_table" )</h3>
-
-#sharingCreateNotification( "reportTable" )
-
-<form id="tableForm" name="tableForm" method="post" action="saveTable.action">
-
-<input type="hidden" id="tableId" name="tableId" value="$!reportTable.id">
-<input type="hidden" id="mode" name="mode" value="$!mode">
-<input type="hidden" id="dimension" name="dimension" value="$!dimension">
-
-<table>
-
- <colgroup>
- <col style="width:120px">
- <col style="width:290px">
- <col style="width:200px">
- <col style="width:30px">
- </colgroup>
-
- <tr>
- <th colspan="2">$i18n.getString( "report_table" )</th>
- <th colspan="2">$i18n.getString( "crosstab_dimensions" )</th>
- </tr>
- <tr>
- <td><label for="tableName">$i18n.getString( "name" )</label></td>
- <td><input type="text" id="tableName" name="tableName" style="width:260px" value="$!reportTable.name"></td>
- <td><label for="doIndicators">$i18n.getString( "indicators_data_elements_data_sets" )</label></td>
- <td><input type="checkbox" id="doIndicators" name="doIndicators" value="true"#if( $reportTable.doIndicators ) checked#end></td>
- </tr>
- <tr>
- <td><label for="sortOrder">$i18n.getString( "sort_order" )</label></td>
- <td>
- <select id="sortOrder" name="sortOrder" style="width:260px">
- <option value="0"#if( $reportTable.sortOrder() == 0 ) selected#end>$i18n.getString( "none" )</option>
- <option value="-1"#if( $reportTable.sortOrder() == -1 ) selected#end>$i18n.getString( "ascending" )</option>
- <option value="1"#if( $reportTable.sortOrder() == 1 ) selected#end>$i18n.getString( "descending" )</option>
- </select>
- </td>
- <td><label for="doOrganisationUnits">$i18n.getString( "organisation_units" )</label></td>
- <td><input type="checkbox" id="doOrganisationUnits" name="doOrganisationUnits" value="true"#if( $reportTable.doUnits ) checked#end></td>
- </tr>
- <tr>
- <td><label for="topLimit">$i18n.getString( "top_limit" )</label></td>
- <td>
- <select id="topLimit" name="topLimit" style="width:260px">
- <option value="0"#if( $reportTable.topLimit() == 0 ) selected#end>$i18n.getString( "none" )</option>
- <option value="5"#if( $reportTable.topLimit() == 5 ) selected#end>5</option>
- <option value="10"#if( $reportTable.topLimit() == 10 ) selected#end>10</option>
- <option value="20"#if( $reportTable.topLimit() == 20 ) selected#end>20</option>
- <option value="50"#if( $reportTable.topLimit() == 50 ) selected#end>50</option>
- <option value="100"#if( $reportTable.topLimit() == 100 ) selected#end>100</option>
- </select>
- </td>
- <td><label for="doPeriods">$i18n.getString( "periods" )</label></td>
- <td><input type="checkbox" id="doPeriods" name="doPeriods" value="true"#if( $reportTable.doPeriods ) checked#end></td>
- </tr>
- <tr>
- <td><label for="regression">$i18n.getString( "include_regression" )</label></td>
- <td><input type="checkbox" onclick="toggleRegression()" id="regression" name="regression" value="true"#if( $reportTable.isRegression() ) checked#end></td>
- <td></td>
- <td></td>
- </tr>
- <tr>
- <td><label for="cumulative">$i18n.getString( "include_cumulative" )</label></td>
- <td><input type="checkbox" onclick="toggleCumulative()" id="cumulative" name="cumulative" value="true"#if( $reportTable.isCumulative() ) checked#end></td>
- <td></td>
- <td></td>
- </tr>
- <tr>
- <td colspan="4" style="height:15px"></td>
- </tr>
-
-</table>
-
-<table>
-
- #if( $dimension )
-
- <!-- Dimensional Data Elements-->
-
- <tr>
- <th colspan="2">$i18n.getString( "available_dataelements" )</th>
- </tr>
- <tr>
- <td colspan="2">
- <select id="categoryComboId" name="categoryComboId" style="min-width:640px" onchange="getCategoryComboDataElements()">
- <option value="-1">[ $i18n.getString( "select_category_combo" ) ]</option>
- #foreach ( $categoryCombo in $categoryCombos )
- <option value="$categoryCombo.id"#if( $reportTable && $reportTable.categoryCombo.id == $categoryCombo.id ) selected#end>$encoder.htmlEncode( $categoryCombo.name )</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <select multiple size="6" id="availableDataElements" name="availableDataElements" style="min-width:640px" ondblclick="moveSelectedById( 'availableDataElements', 'selectedDataElements' )">
- #foreach ( $element in $dataElements )
- <option value="$element.id">$encoder.htmlEncode( $element.displayName )</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add_selected' )" style="width:120px" onclick="moveSelectedById( 'availableDataElements', 'selectedDataElements' )" />
- <input type="button" value="$i18n.getString( 'add_all' )" title="$i18n.getString( 'add_all' )" style="width:120px" onclick="moveAllById( 'availableDataElements', 'selectedDataElements' )" />
- <input type="button" value="$i18n.getString( 'remove_selected' )" title="$i18n.getString( 'remove_selected' )" style="width:120px" onclick="moveSelectedById( 'selectedDataElements', 'availableDataElements' )" />
- <input type="button" value="$i18n.getString( 'remove_all' )" title="$i18n.getString( 'remove_all' )" style="width:120px" onclick="moveAllById( 'selectedDataElements', 'availableDataElements' )" />
- </td>
- </tr>
- <tr>
- <th colspan="2">$i18n.getString( "selected_dataelements" )</th>
- </tr>
- <tr>
- <td>
- <select multiple size="6" id="selectedDataElements" name="selectedDataElements" style="min-width:640px" ondblclick="moveSelectedById( 'selectedDataElements', 'availableDataElements' )">
- #foreach( $element in $selectedDataElements )
- <option value="$element.id">$encoder.htmlEncode( $element.displayName )</option>
- #end
- </select>
- </td>
- <td>
- <a href="javascript:moveUpSelectedOption( 'selectedDataElements' )"><img src="../images/move_up.png"/></a><br>
- <a href="javascript:moveDownSelectedOption( 'selectedDataElements' )"><img src="../images/move_down.png"/></a>
- </td>
- </tr>
- <tr>
- <td style="height:15px" colspan="2"></td>
- </tr>
-
- #else
-
- <!-- Indicators -->
-
- <tr>
- <th colspan="2">$i18n.getString( "available_indicators" )</th>
- </tr>
- <tr>
- <td colspan="2">
- <select id="indicatorGroupId" name="indicatorGroupId" style="min-width:640px" onchange="getIndicators()">
- <option value="$ALL">[ $i18n.getString( "select_indicatorgroup_all" ) ]</option>
- #foreach ( $group in $indicatorGroups )
- <option value="$group.id">$encoder.htmlEncode( $group.displayName )</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <select multiple size="6" id="availableIndicators" name="availableIndicators" style="min-width:640px" ondblclick="moveSelectedById( 'availableIndicators', 'selectedIndicators' )">
- #foreach ( $indicator in $indicators )
- <option value="$indicator.id">$encoder.htmlEncode( $indicator.displayName )</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add_selected' )" style="width:120px" onclick="moveSelectedById( 'availableIndicators', 'selectedIndicators' )"><input
- type="button" value="$i18n.getString( 'add_all' )" title="$i18n.getString( 'add_all' )" style="width:120px" onclick="moveAllById( 'availableIndicators', 'selectedIndicators' )"><input
- type="button" value="$i18n.getString( 'remove_selected' )" title="$i18n.getString( 'remove_selected' )" style="width:120px" onclick="moveSelectedById( 'selectedIndicators', 'availableIndicators' )"><input
- type="button" value="$i18n.getString( 'remove_all' )" title="$i18n.getString( 'remove_all' )" style="width:120px" onclick="moveAllById( 'selectedIndicators', 'availableIndicators' )">
- </td>
- </tr>
- <tr>
- <th colspan="2">$i18n.getString( "selected_indicators" )</th>
- </tr>
- <tr>
- <td>
- <select multiple size="6" id="selectedIndicators" name="selectedIndicators" style="min-width:640px" ondblclick="moveSelectedById( 'selectedIndicators', 'availableIndicators' )">
- #foreach( $indicator in $selectedIndicators )
- <option value="$indicator.id">$encoder.htmlEncode( $indicator.displayName )</option>
- #end
- </select>
- </td>
- <td>
- <a href="javascript:moveUpSelectedOption( 'selectedIndicators' )"><img src="../images/move_up.png"/></a><br>
- <a href="javascript:moveDownSelectedOption( 'selectedIndicators' )"><img src="../images/move_down.png"/></a>
- </td>
- </tr>
- <tr>
- <td style="height:15px" colspan="2"></td>
- </tr>
-
- <!-- DataElements -->
-
- <tr>
- <th colspan="2">$i18n.getString( "available_dataelements" )</th>
- </tr>
- <tr>
- <td colspan="2">
- <select id="dataElementGroupId" name="dataElementGroupId" style="min-width:640px" onchange="getDataElements()">
- <option value="$ALL">[ $i18n.getString( "select_dataelementgroup_all" ) ]</option>
- #foreach ( $group in $dataElementGroups )
- <option value="$group.id">$encoder.htmlEncode( $group.displayName )</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <select multiple size="6" id="availableDataElements" name="availableDataElements" style="min-width:640px" ondblclick="moveSelectedById( 'availableDataElements', 'selectedDataElements' )">
- #foreach ( $element in $dataElements )
- <option value="$element.id">$encoder.htmlEncode( $element.displayName )</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add_selected' )" style="width:120px" onclick="moveSelectedById( 'availableDataElements', 'selectedDataElements' )"><input
- type="button" value="$i18n.getString( 'add_all' )" title="$i18n.getString( 'add_all' )" style="width:120px" onclick="moveAllById( 'availableDataElements', 'selectedDataElements' )"><input
- type="button" value="$i18n.getString( 'remove_selected' )" title="$i18n.getString( 'remove_selected' )" style="width:120px" onclick="moveSelectedById( 'selectedDataElements', 'availableDataElements' )"><input
- type="button" value="$i18n.getString( 'remove_all' )" title="$i18n.getString( 'remove_all' )" style="width:120px" onclick="moveAllById( 'selectedDataElements', 'availableDataElements' )">
- </td>
- </tr>
- <tr>
- <th colspan="2">$i18n.getString( "selected_dataelements" )</th>
- </tr>
- <tr>
- <td>
- <select multiple size="6" id="selectedDataElements" name="selectedDataElements" style="min-width:640px" ondblclick="moveSelectedById( 'selectedDataElements', 'availableDataElements' )">
- #foreach( $element in $selectedDataElements )
- <option value="$element.id">$encoder.htmlEncode( $element.displayName )</option>
- #end
- </select>
- </td>
- <td>
- <a href="javascript:moveUpSelectedOption( 'selectedDataElements' )"><img src="../images/move_up.png"/></a><br>
- <a href="javascript:moveDownSelectedOption( 'selectedDataElements' )"><img src="../images/move_down.png"/></a>
- </td>
- </tr>
- <tr>
- <td style="height:15px" colspan="2"></td>
- </tr>
-
- <!-- DataSets -->
-
- <tr>
- <th colspan="2">$i18n.getString( "available_reporting_rates" )</th>
- </tr>
- <tr>
- <td colspan="2">
- <select multiple size="6" id="availableDataSets" name="availableDataSets" style="min-width:640px" ondblclick="moveSelectedById( 'availableDataSets', 'selectedDataSets' )">
- #foreach ( $dataSet in $dataSets )
- <option value="$dataSet.id">$encoder.htmlEncode( $dataSet.displayName )</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add_selected' )" style="width:120px" onclick="moveSelectedById( 'availableDataSets', 'selectedDataSets' )"><input
- type="button" value="$i18n.getString( 'add_all' )" title="$i18n.getString( 'add_all' )" style="width:120px" onclick="moveAllById( 'availableDataSets', 'selectedDataSets' )"><input
- type="button" value="$i18n.getString( 'remove_selected' )" title="$i18n.getString( 'remove_selected' )" style="width:120px" onclick="moveSelectedById( 'selectedDataSets', 'availableDataSets' )"><input
- type="button" value="$i18n.getString( 'remove_all' )" title="$i18n.getString( 'remove_all' )" style="width:120px" onclick="moveAllById( 'selectedDataSets', 'availableDataSets' )">
- </td>
- </tr>
- <tr>
- <th colspan="2">$i18n.getString( "selected_reporting_rates" )</th>
- </tr>
- <tr>
- <td>
- <select multiple size="6" id="selectedDataSets" name="selectedDataSets" style="min-width:640px" ondblclick="moveSelectedById( 'selectedDataSets', 'availableDataSets' )">
- #foreach ( $dataSet in $selectedDataSets )
- <option value="$dataSet.id">$encoder.htmlEncode( $dataSet.displayName )</option>
- #end
- </select>
- </td>
- <td>
- <a href="javascript:moveUpSelectedOption( 'selectedDataSets' )"><img src="../images/move_up.png"/></a><br>
- <a href="javascript:moveDownSelectedOption( 'selectedDataSets' )"><img src="../images/move_down.png"/></a>
- </td>
- </tr>
- <tr>
- <td style="height:15px" colspan="2"></td>
- </tr>
-
- #end
-
-</table>
-
-<span><a href="javascript:toggleOrganisationUnitGroups()">Toggle organisation unit groups</a> </span>
-
-<div id="organisationUnitGroupsDiv" style="display:none">
-
-<table>
-
- <!-- Organisation Unit Groups -->
-
- <tr>
- <th colspan="2">$i18n.getString( "available_organisation_unit_groups" )</th>
- </tr>
- <tr>
- <td colspan="2">
- <select multiple size="6" id="availableOrganisationUnitGroups" name="availableOrganisationUnitGroups" style="min-width:640px" ondblclick="moveSelectedById( 'availableOrganisationUnitGroups', 'selectedOrganisationUnitGroups' )">
- #foreach ( $group in $organisationUnitGroups )
- <option value="$group.id">$encoder.htmlEncode( $group.displayName )</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add_selected' )" style="width:120px" onclick="moveSelectedById( 'availableOrganisationUnitGroups', 'selectedOrganisationUnitGroups' )"><input
- type="button" value="$i18n.getString( 'add_all' )" title="$i18n.getString( 'add_all' )" style="width:120px" onclick="moveAllById( 'availableOrganisationUnitGroups', 'selectedOrganisationUnitGroups' )"><input
- type="button" value="$i18n.getString( 'remove_selected' )" title="$i18n.getString( 'remove_selected' )" style="width:120px" onclick="moveSelectedById( 'selectedOrganisationUnitGroups', 'availableOrganisationUnitGroups' )"><input
- type="button" value="$i18n.getString( 'remove_all' )" title="$i18n.getString( 'remove_all' )" style="width:120px" onclick="moveAllById( 'selectedOrganisationUnitGroups', 'availableOrganisationUnitGroups' )">
- </td>
- </tr>
- <tr>
- <th colspan="2">$i18n.getString( "selected_organisation_unit_groups" )</th>
- </tr>
- <tr>
- <td>
- <select multiple size="6" id="selectedOrganisationUnitGroups" name="selectedOrganisationUnitGroups" style="min-width:640px" ondblclick="moveSelectedById( 'selectedOrganisationUnitGroups', 'availableOrganisationUnitGroups' )">
- #foreach ( $group in $selectedOrganisationUnitGroups )
- <option value="$group.id">$encoder.htmlEncode( $group.displayName )</option>
- #end
- </select>
- </td>
- <td>
- <a href="javascript:moveUpSelectedOption( 'selectedOrganisationUnitGroups' )"><img src="../images/move_up.png"/></a><br>
- <a href="javascript:moveDownSelectedOption( 'selectedOrganisationUnitGroups' )"><img src="../images/move_down.png"/></a>
- </td>
- </tr>
- <tr>
- <td style="height:15px" colspan="2"></td>
- </tr>
-
-</table>
-
-</div>
-
-<span><a href="javascript:toggleFixedOrganisationUnits()">$i18n.getString( "toggle_fixed_organisation_units" )</a> </span>
-
-<div id="fixedOrganisationUnits" style="display:none; margin-top:2px; margin-bottom:15px;">
-
- <!-- Organisation Units -->
-
-#organisationUnitSelectionTree( false true false )
-
-</div>
-
-<span><a href="javascript:toggleFixedPeriods()">$i18n.getString( "toggle_fixed_periods" )</a> </span>
-
-<div id="fixedPeriods" style="display:none">
-
-<table>
-
- <!-- Periods -->
-
- <tr>
- <th colspan="2">$i18n.getString( "available_periods" )</th>
- </tr>
- <tr>
- <td colspan="2">
- <input type="button" style="width:60px" value="$i18n.getString( 'prev' )" onclick="getAvailablePeriods( 'periodType', 'availablePeriods', 'selectedPeriods', '-1' )" />
- <input type="button" style="width:60px" value="$i18n.getString( 'next' )" onclick="getAvailablePeriods( 'periodType', 'availablePeriods', 'selectedPeriods', '1' )" />
- <select id="periodType" name="periodType" style="min-width:518px" onchange="getAvailablePeriods( 'periodType', 'availablePeriods', 'selectedPeriods', '0' )">
- <option value="">[ $i18n.getString( "select_period_type" ) ]</option>
- #foreach ( $type in $periodTypes )
- <option value="$type.name">$i18n.getString( $type.name)</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <select multiple size="6" id="availablePeriods" name="availablePeriods" style="min-width:640px" ondblclick="moveSelectedById( 'availablePeriods', 'selectedPeriods' )">
- #foreach ( $period in $periods )
- <option value="$period.externalId">$format.formatPeriod( $period )</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add_selected' )" style="width:120px" onclick="moveSelectedById( 'availablePeriods', 'selectedPeriods' )" />
- <input type="button" value="$i18n.getString( 'add_all' )" title="$i18n.getString( 'add_all' )" style="width:120px" onclick="moveAllById( 'availablePeriods', 'selectedPeriods' )" />
- <input type="button" value="$i18n.getString( 'remove_selected' )" title="$i18n.getString( 'remove_selected' )" style="width:120px" onclick="moveSelectedById( 'selectedPeriods', 'availablePeriods' )" />
- <input type="button" value="$i18n.getString( 'remove_all' )" title="$i18n.getString( 'remove_all' )" style="width:120px" onclick="moveAllById( 'selectedPeriods', 'availablePeriods' )" />
- </td>
- </tr>
- <tr>
- <th colspan="2">$i18n.getString( "selected_periods" )</th>
- </tr>
- <tr>
- <td>
- <select multiple size="6" id="selectedPeriods" name="selectedPeriods" style="min-width:640px" ondblclick="moveSelectedById( 'selectedPeriods', 'availablePeriods' )">
- #foreach ( $period in $selectedPeriods )
- <option value="$period.externalId">$format.formatPeriod( $period )</option>
- #end
- </select>
- </td>
- <td>
- <a href="javascript:moveUpSelectedOption( 'selectedPeriods' )"><img src="../images/move_up.png"/></a><br>
- <a href="javascript:moveDownSelectedOption( 'selectedPeriods' )"><img src="../images/move_down.png"/></a>
- </td>
- </tr>
- <tr>
- <td style="height:15px" colspan="2"></td>
- </tr>
-
-</table>
-
-</div>
-
-<table>
-
- <!-- Relative Periods -->
-
- <tr>
- <th>$i18n.getString( "relative_periods" )</th>
- </tr>
- <tr>
- <td>
- #parse( "/dhis-web-reporting/relativePeriodsInput.vm" )
- </td>
- </tr>
- <tr>
- <td style="height:15px"></td>
- </tr>
-
-</table>
-
- <!--Report Params -->
-
-<table>
-
- <tr>
- <th>$i18n.getString( "report_parameters" )</th>
- </tr>
- <tr>
- <td>
- <label for="paramReportingMonth">$i18n.getString( "reporting_period" )</label>
- <input type="checkbox" id="paramReportingMonth" name="paramReportingMonth" value="true"#if( $reportTable.reportParams.isParamReportingMonth() ) checked#end>
- <label for="paramGrandParentOrganisationUnit">$i18n.getString( "grand_parent_organisation_unit" )</label>
- <input type="checkbox" id="paramGrandParentOrganisationUnit" name="paramGrandParentOrganisationUnit" value="true"#if( $reportTable.reportParams.isParamGrandParentOrganisationUnit() ) checked#end>
- <label for="paramParentOrganisationUnit">$i18n.getString( "parent_organisation_unit" )</label>
- <input type="checkbox" id="paramParentOrganisationUnit" name="paramParentOrganisationUnit" value="true"#if( $reportTable.reportParams.isParamParentOrganisationUnit() ) checked#end><br><br>
- <label for="paramOrganisationUnit">$i18n.getString( "organisation_unit" )</label>
- <input type="checkbox" id="paramOrganisationUnit" name="paramOrganisationUnit" value="true"#if( $reportTable.reportParams.isParamOrganisationUnit() ) checked#end>
- </td>
- </tr>
- <tr>
- <td style="height:15px"></td>
- </tr>
-
- <!-- Submit -->
-
- <tr>
- <td>
- <input type="button" value="$i18n.getString( 'save' )" onclick="saveTable()" style="width:120px" />
- <input type="button" value="$i18n.getString( 'back' )" onclick="javascript:window.location.href='displayManageTableForm.action'" style="width:120px" />
- </td>
- </tr>
-
-</table>
-
-</form>
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js 2013-03-14 10:27:27 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js 1970-01-01 00:00:00 +0000
@@ -1,203 +0,0 @@
-// -----------------------------------------------------------------------------
-// Save ReportTable
-// -----------------------------------------------------------------------------
-
-function saveTable()
-{
- if ( $( "#tableForm #tableName" ).val().trim().length == 0 )
- {
- setHeaderDelayMessage( i18n_specify_name );
- return false;
- }
-
- if ( validateCollections() )
- {
- selectTableForm();
- $( "#tableForm" ).submit();
- }
-}
-
-function selectTableForm()
-{
- selectAllById( "selectedDataElements" );
-
- if ( isNotEmpty( "selectedIndicators" ) )
- {
- selectAllById( "selectedIndicators" );
- }
-
- if ( isNotEmpty( "selectedDataSets" ) )
- {
- selectAllById( "selectedDataSets" );
- }
-
- selectAllById( "selectedPeriods" );
- selectAllById( "selectedOrganisationUnits" );
-
- if ( isNotEmpty( "selectedOrganisationUnitGroups" ) )
- {
- selectAllById( "selectedOrganisationUnitGroups" );
- }
-}
-
-// -----------------------------------------------------------------------------
-// Remove
-// -----------------------------------------------------------------------------
-
-function removeTable( tableId, tableName )
-{
- removeItem( tableId, tableName, i18n_confirm_delete, "removeTable.action" );
-}
-
-// -----------------------------------------------------------------------------
-// Validation
-// -----------------------------------------------------------------------------
-
-function validateCollections()
-{
- if ( isChecked( "regression" ) && selectionTreeSelection.getSelected().length > 1 )
- {
- setHeaderDelayMessage( i18n_cannot_include_more_organisation_unit_regression );
-
- return false;
- }
-
- if ( !hasElements( "selectedDataElements" ) && !hasElements( "selectedIndicators" )
- && !hasElements( "selectedDataSets" ) )
- {
- setHeaderDelayMessage( i18n_must_select_at_least_one_indictor_data_element_data_set );
-
- return false;
- }
-
- if ( !selectionTreeSelection.isSelected() && !hasElements( "selectedOrganisationUnitGroups" ) && !organisationUnitReportParamsChecked() )
- {
- setHeaderDelayMessage( i18n_must_select_at_least_one_unit );
-
- return false;
- }
-
- if ( bothOrganisationUnitReportParamsChecked() )
- {
- setHeaderDelayMessage( i18n_cannot_select_orgunit_and_parent_orgunit_param );
-
- return false;
- }
-
- if ( !hasElements( "selectedPeriods" ) && !relativePeriodsChecked() )
- {
- setHeaderDelayMessage( i18n_must_select_at_least_one_period );
-
- return false;
- }
-
- return true;
-}
-
-function isTrue( elementId )
-{
- var value = document.getElementById( elementId ).value;
-
- return value && value == "true" ? true : false;
-}
-
-function organisationUnitReportParamsChecked()
-{
- return ( isChecked( "paramGrandParentOrganisationUnit" )
- || isChecked( "paramParentOrganisationUnit" ) || isChecked( "paramOrganisationUnit" ) );
-}
-
-function bothOrganisationUnitReportParamsChecked()
-{
- var count = 0;
-
- if ( isChecked( "paramGrandParentOrganisationUnit" ) )
- {
- count++;
- }
- if ( isChecked( "paramParentOrganisationUnit" ) )
- {
- count++;
- }
- if ( isChecked( "paramOrganisationUnit" ) )
- {
- count++;
- }
-
- return count > 1;
-}
-
-// -----------------------------------------------------------------------------
-// Details
-// -----------------------------------------------------------------------------
-
-function showTableDetails( tableId )
-{
- jQuery.post( 'getTable.action', { id: tableId }, function ( json ) {
- setInnerHTML( 'nameField', json.table.name );
- setInnerHTML( 'indicatorsField', json.table.indicators );
- setInnerHTML( 'periodsField', json.table.periods );
- setInnerHTML( 'unitsField', json.table.units );
- setInnerHTML( 'doIndicatorsField', parseBool( json.table.doIndicators ) );
- setInnerHTML( 'doPeriodsField', parseBool( json.table.doPeriods ) );
- setInnerHTML( 'doUnitsField', parseBool( json.table.doUnits ) );
-
- showDetails();
- } );
-}
-
-function parseBool( bool )
-{
- return ( bool == "true" ) ? i18n_yes : i18n_no;
-}
-
-// -----------------------------------------------------------------------------
-// Regression
-// -----------------------------------------------------------------------------
-
-function toggleRegression()
-{
- if ( document.getElementById( "regression" ).checked )
- {
- check( "doIndicators" );
- uncheck( "doOrganisationUnits" );
- uncheck( "doPeriods" );
-
- disable( "doOrganisationUnits" );
- disable( "doPeriods" );
- }
- else
- {
- enable( "doOrganisationUnits" );
- enable( "doPeriods" );
- }
-}
-
-function toggleFixedOrganisationUnits()
-{
- $( '#fixedOrganisationUnits' ).toggle( 'fast' );
-}
-
-function toggleFixedPeriods()
-{
- $( '#fixedPeriods' ).toggle( 'fast' );
-}
-
-function toggleOrganisationUnitGroups()
-{
- $( '#organisationUnitGroupsDiv' ).toggle( 'fast' );
-}
-
-// -----------------------------------------------------------------------------
-// Dashboard
-// -----------------------------------------------------------------------------
-
-function addReportTableToDashboard( id )
-{
- var dialog = window.confirm( i18n_confirm_add_report_table_to_dashboard );
-
- if ( dialog )
- {
- $.get( "addReportTableToDashboard.action?id=" + id );
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm 2013-05-19 18:49:47 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm 2013-05-22 13:14:47 +0000
@@ -15,17 +15,11 @@
<h3>$i18n.getString( "report_table" ) #openHelp( "report_tables" )</h3>
+<p>Create report tables in <a href="../dhis-web-pivot/app/index.html">Pivot table module</a></p>
+
<table class="mainPageTable">
<tr>
<td style="vertical-align:top">
- <table width="100%">
- <tr>
- <td>#filterDiv( "displayManageTableForm" )</td>
- <td colspan="10" style="text-align:right">
- <input type="button" value="$i18n.getString( 'add_report_table' )" style="width:220px" onclick="window.location.href='displayAddTableForm.action?dimension=false'">
- </td>
- </tr>
- </table>
<table class="listTable" id="listTable">
<col>
<col width="175">
@@ -48,19 +42,11 @@
<img src="../images/relationship-denied.png">
#end
- #if( $security.canUpdate( $table ) && $table.isReportTable() )
- <a href="displayAddTableForm.action?id=${table.id}&dimension=${table.isDimensional()}" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
- #else
- <img src="../images/edit-denied.png">
- #end
-
<a href="javascript:addReportTableToDashboard( '$table.id' )" title="$i18n.getString( 'add_to_dashboard' )"><img src="../images/add_to_dashboard.png" alt="$i18n.getString( 'add_to_dashboard' )"></a>
#if( $auth.hasAccess( "dhis-web-reporting", "removeTable" ) && $security.canDelete( $table ))
<a href="javascript:removeTable( $table.id, '$encoder.jsEncode( $table.name )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
- #else <img src="../images/delete-denied.png"> #end
- <a href="javascript:showTableDetails( $table.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( "show_details" )"></a>
-
+ #else <img src="../images/delete-denied.png"> #end
</td>
</tr>
#end