← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5541: Harmonization of png and DV charts

 

------------------------------------------------------------
revno: 5541
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-12-22 14:09:31 +0100
message:
  Harmonization of png and DV charts
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ChartConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/ChartDeletionHandler.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java
  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/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml
  dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java
  dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartStoreTest.java
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
  dhis-2/dhis-web/dhis-web-portal/pom.xml
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetChartOptionsAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartDataElementModeForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartIndicatorModeForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartOrganisationUnitModeForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js


--
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/chart/Chart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java	2011-12-22 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java	2011-12-22 13:09:31 +0000
@@ -117,8 +117,6 @@
 
     private List<DataSet> dataSets = new ArrayList<DataSet>();
 
-    private List<Period> periods = new ArrayList<Period>();
-
     private List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
 
     private RelativePeriods relatives;
@@ -133,8 +131,6 @@
 
     private transient List<Period> relativePeriods = new ArrayList<Period>();
 
-    private transient List<Period> allPeriods = new ArrayList<Period>();
-
     private transient OrganisationUnit organisationUnit;
 
     private transient List<OrganisationUnit> allOrganisationUnits = new ArrayList<OrganisationUnit>();
@@ -154,8 +150,6 @@
 
     public void init()
     {
-        allPeriods.addAll( periods );
-        allPeriods.addAll( relativePeriods );
         allOrganisationUnits.addAll( organisationUnits );
 
         if ( organisationUnit != null )
@@ -217,7 +211,7 @@
     {
         if ( DIMENSION_PERIOD.equals( filter ) )
         {
-            return format.formatPeriod( getAllPeriods().get( 0 ) );
+            return format.formatPeriod( getRelativePeriods().get( 0 ) );
         }
         
         return filter().getName();
@@ -234,9 +228,9 @@
         }
         else if ( DIMENSION_PERIOD.equals( dimension ) )
         {
-            namePeriods( getAllPeriods(), format );
+            namePeriods( getRelativePeriods(), format );
             
-            list.addAll( getAllPeriods() );
+            list.addAll( getRelativePeriods() );
         }
         else if ( DIMENSION_ORGANISATIONUNIT.equals( dimension ) )
         {
@@ -563,18 +557,6 @@
         this.dataSets = dataSets;
     }
 
-    @XmlElement
-    @JsonProperty
-    public List<Period> getPeriods()
-    {
-        return periods;
-    }
-
-    public void setPeriods( List<Period> periods )
-    {
-        this.periods = periods;
-    }
-
     @XmlElementWrapper( name = "organisationUnits" )
     @XmlElement( name = "organisationUnit" )
     @XmlJavaTypeAdapter( OrganisationUnitXmlAdapter.class )
@@ -634,16 +616,6 @@
         this.relativePeriods = relativePeriods;
     }
 
-    public List<Period> getAllPeriods()
-    {
-        return allPeriods;
-    }
-
-    public void setAllPeriods( List<Period> allPeriods )
-    {
-        this.allPeriods = allPeriods;
-    }
-
     public OrganisationUnit getOrganisationUnit()
     {
         return organisationUnit;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2011-12-22 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2011-12-22 13:09:31 +0000
@@ -265,6 +265,8 @@
         executeSql( "ALTER TABLE chart DROP COLUMN lastYear" );
         executeSql( "ALTER TABLE chart DROP COLUMN last6BiMonths" );
         
+        executeSql( "DROP TABLE chart_periods" );
+        
         // remove outdated relative periods
         
         executeSql( "ALTER TABLE reporttable DROP COLUMN last3months" );

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ChartConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ChartConverter.java	2011-12-21 20:41:22 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ChartConverter.java	2011-12-22 13:09:31 +0000
@@ -43,8 +43,6 @@
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.RelativePeriods;
 
 public class ChartConverter
@@ -62,7 +60,6 @@
     private static final String FIELD_REGRESSION = "regression";
 
     private static final String FIELD_INDICATORS = "indicators";
-    private static final String FIELD_PERIODS = "periods";
     private static final String FIELD_ORGANISATION_UNITS = "organisationUnits";
 
     private static final String FIELD_REPORTING_MONTH = "reportingMonth";
@@ -74,11 +71,9 @@
     private static final String FIELD_LAST_YEAR = "lastYear";
     
     private IndicatorService indicatorService;
-    private PeriodService periodService;
     private OrganisationUnitService organisationUnitService;
 
     private Map<Object, Integer> indicatorMapping;
-    private Map<Object, Integer> periodMapping;
     private Map<Object, Integer> organisationUnitMapping;
 
     /**
@@ -98,20 +93,16 @@
      */
     public ChartConverter( ChartService chartService, 
         ImportObjectService importObjectService, 
-        IndicatorService indicatorService, 
-        PeriodService periodService,
+        IndicatorService indicatorService,
         OrganisationUnitService organisationUnitService,
         Map<Object, Integer> indicatorMapping,
-        Map<Object, Integer> periodMapping,
         Map<Object, Integer> organisationUnitMapping )
     {
         this.chartService = chartService;
         this.importObjectService = importObjectService;
         this.indicatorService = indicatorService;
-        this.periodService = periodService;
         this.organisationUnitService = organisationUnitService;
         this.indicatorMapping = indicatorMapping;
-        this.periodMapping = periodMapping;
         this.organisationUnitMapping = organisationUnitMapping;
     }
     
@@ -143,13 +134,6 @@
                 }
                 writer.closeElement();
 
-                writer.openElement( FIELD_PERIODS );
-                for ( Period period : chart.getPeriods() )
-                {
-                    writer.writeElement( FIELD_ID, String.valueOf( period.getId() ) );
-                }
-                writer.closeElement();
-                
                 writer.openElement( FIELD_ORGANISATION_UNITS );
                 for ( OrganisationUnit unit : chart.getOrganisationUnits() )
                 {
@@ -210,12 +194,6 @@
                 chart.getIndicators().add( indicatorService.getIndicator( indicatorMapping.get( id ) ) );
             }
 
-            while ( reader.moveToStartElement( FIELD_ID, FIELD_PERIODS ) )
-            {
-                int id = Integer.parseInt( reader.getElementValue() );
-                chart.getPeriods().add( periodService.getPeriod( periodMapping.get( id ) ) );
-            }
-
             while ( reader.moveToStartElement( FIELD_ID, FIELD_ORGANISATION_UNITS ) )
             {
                 int id = Integer.parseInt( reader.getElementValue() );

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java	2011-12-19 13:10:25 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java	2011-12-22 13:09:31 +0000
@@ -910,9 +910,8 @@
                 state.setMessage( "importing_charts" );
 
                 XMLConverter converter = new ChartConverter( chartService, importObjectService, indicatorService,
-                    periodService, organisationUnitService, objectMappingGenerator.getIndicatorMapping( params
-                        .skipMapping() ), objectMappingGenerator.getPeriodMapping( params.skipMapping() ),
-                    objectMappingGenerator.getOrganisationUnitMapping( params.skipMapping() ) );
+                    organisationUnitService, objectMappingGenerator.getIndicatorMapping( params
+                        .skipMapping() ), objectMappingGenerator.getOrganisationUnitMapping( params.skipMapping() ) );
 
                 converterInvoker.invokeRead( converter, reader, params );
 

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/ChartDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/ChartDeletionHandler.java	2011-09-29 07:41:04 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/ChartDeletionHandler.java	2011-12-22 13:09:31 +0000
@@ -29,7 +29,6 @@
 
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.period.Period;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 
 /**
@@ -75,20 +74,6 @@
     }
 
     @Override
-    public String allowDeletePeriod( Period period )
-    {
-        for ( Chart chart : chartService.getAllCharts() )
-        {
-            if ( chart.getPeriods().contains( period ) )
-            {
-                return chart.getName();
-            }
-        }
-
-        return null;
-    }
-
-    @Override
     public void deleteOrganisationUnit( OrganisationUnit unit )
     {
         for ( Chart chart : chartService.getAllCharts() )

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java	2011-12-21 22:58:46 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java	2011-12-22 13:09:31 +0000
@@ -250,7 +250,7 @@
         chart.setDimensions( Chart.DIMENSION_DATA, Chart.DIMENSION_PERIOD, Chart.DIMENSION_ORGANISATIONUNIT );
         chart.setHideLegend( true );
         chart.getIndicators().add( indicator );
-        chart.setPeriods( periods );
+        chart.setRelativePeriods( periods );
         chart.setOrganisationUnit( unit );
         chart.setFormat( format );
 
@@ -276,7 +276,7 @@
         chart.setDimensions( Chart.DIMENSION_DATA, Chart.DIMENSION_ORGANISATIONUNIT, Chart.DIMENSION_PERIOD );
         chart.setHideLegend( true );
         chart.getIndicators().add( indicator );
-        chart.setPeriods( periods );
+        chart.setRelativePeriods( periods );
         chart.setOrganisationUnits( parent.getSortedChildren() );
         chart.setFormat( format );
 
@@ -299,7 +299,7 @@
         chart.setIndicators( indicators );
         chart.setDataElements( dataElements );
         chart.setDataSets( dataSets );
-        chart.setPeriods( periods );
+        chart.setRelativePeriods( periods );
         chart.setOrganisationUnits( organisationUnits );
         chart.setFormat( format );
         chart.setName( chart.getTitle() );

=== modified 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	2011-12-21 20:06:49 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java	2011-12-22 13:09:31 +0000
@@ -218,7 +218,7 @@
         String indicatorIds = TextUtils.getCommaDelimitedString( 
             ConversionUtils.getIdentifiers( Indicator.class, chart.getIndicators() ) );
         String periodIds = TextUtils.getCommaDelimitedString( 
-            ConversionUtils.getIdentifiers( Period.class, chart.getAllPeriods() ) );
+            ConversionUtils.getIdentifiers( Period.class, chart.getRelativePeriods() ) );
         String unitIds = TextUtils.getCommaDelimitedString( 
             ConversionUtils.getIdentifiers( OrganisationUnit.class, chart.getAllOrganisationUnits() ) );
 

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml	2011-12-22 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml	2011-12-22 13:09:31 +0000
@@ -60,13 +60,6 @@
       <many-to-many column="datasetid" class="org.hisp.dhis.dataset.DataSet" foreign-key="fk_chart_datasets_datasetid" />
     </list>
 
-    <list name="periods" table="chart_periods">
-      <cache usage="read-write" />
-      <key column="chartid" foreign-key="fk_chart_periods_chartid" />
-      <list-index column="sort_order" base="0" />
-      <many-to-many column="periodid" class="org.hisp.dhis.period.Period" foreign-key="fk_chart_periods_periodid" />
-    </list>
-
     <list name="organisationUnits" table="chart_organisationunits">
       <cache usage="read-write" />
       <key column="chartid" foreign-key="fk_chart_organisationunits_chartid" />

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java	2011-11-12 18:43:35 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java	2011-12-22 13:09:31 +0000
@@ -182,7 +182,6 @@
         assertEquals( chartC, chartService.getChart( idC ) );
         
         assertTrue( equals( chartService.getChart( idA ).getIndicators(), indicatorA, indicatorB, indicatorC ) );
-        assertTrue( equals( chartService.getChart( idA ).getPeriods(), periodA, periodB, periodC ) );
         assertTrue( equals( chartService.getChart( idA ).getOrganisationUnits(), unitA, unitB, unitC ) );
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartStoreTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartStoreTest.java	2011-12-09 20:04:48 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartStoreTest.java	2011-12-22 13:09:31 +0000
@@ -166,7 +166,6 @@
         assertEquals( chartC, chartStore.get( idC ) );
         
         assertTrue( equals( chartStore.get( idA ).getIndicators(), indicatorA, indicatorB, indicatorC ) );
-        assertTrue( equals( chartStore.get( idA ).getPeriods(), periodA, periodB, periodC ) );
         assertTrue( equals( chartStore.get( idA ).getOrganisationUnits(), unitA, unitB, unitC ) );
     }
 

=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2011-12-21 20:06:49 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2011-12-22 13:09:31 +0000
@@ -822,7 +822,7 @@
 
         chart.setName( "Chart" + uniqueCharacter );
         chart.setIndicators( indicators );
-        chart.setPeriods( periods );
+        chart.setRelativePeriods( periods );
         chart.setOrganisationUnits( units );
         chart.setDimensions( Chart.DIMENSION_DATA, Chart.DIMENSION_PERIOD, Chart.DIMENSION_ORGANISATIONUNIT );
 

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2011-12-21 09:38:14 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2011-12-22 13:09:31 +0000
@@ -1408,6 +1408,10 @@
     if ( isChecked( "reportingMonth" ) ||
          isChecked( "reportingBimonth" ) ||
          isChecked( "reportingQuarter" ) ||
+         isChecked( "lastMonth" ) ||
+         isChecked( "lastBimonth" ) ||
+         isChecked( "lastQuarter" ) ||
+         isChecked( "lastSixMonth" ) ||
          isChecked( "monthsThisYear" ) ||
          isChecked( "quartersThisYear" ) ||
          isChecked( "thisYear" ) ||
@@ -1416,7 +1420,9 @@
          isChecked( "lastYear" ) ||
          isChecked( "last5Years" ) ||
          isChecked( "last12Months" ) ||
-         isChecked( "last4Quarters" ) )
+         isChecked( "last6BiMonths" ) ||
+         isChecked( "last4Quarters" ) ||
+         isChecked( "last2SixMonths" ) )
     {
         return true;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-portal/pom.xml'
--- dhis-2/dhis-web/dhis-web-portal/pom.xml	2011-12-06 17:41:41 +0000
+++ dhis-2/dhis-web/dhis-web-portal/pom.xml	2011-12-22 13:09:31 +0000
@@ -37,7 +37,7 @@
     </dependency>
     
     <!-- Web maintenance modules -->
-    
+    <!--
     <dependency>
       <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-web-maintenance-datadictionary</artifactId>
@@ -87,8 +87,6 @@
       <type>war</type>
     </dependency>
 	
-    <!-- Web service modules -->
-	
     <dependency>
       <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-web-importexport</artifactId>
@@ -112,13 +110,7 @@
       <artifactId>dhis-web-dataentry</artifactId>
       <version>${project.version}</version>
       <type>war</type>
-    </dependency>	
-    <dependency>
-      <groupId>org.hisp.dhis</groupId>
-      <artifactId>dhis-web-reporting</artifactId>
-      <version>${project.version}</version>
-      <type>war</type>
-    </dependency>	
+    </dependency>
     <dependency>
       <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-web-dashboard-integration</artifactId>
@@ -130,12 +122,6 @@
       <artifactId>dhis-web-mapping</artifactId>
       <version>${project.version}</version>
       <type>war</type>
-    </dependency>	
-    <dependency>
-      <groupId>org.hisp.dhis</groupId>
-      <artifactId>dhis-web-visualizer</artifactId>
-      <version>${project.version}</version>
-      <type>war</type>
     </dependency>
     <dependency>
       <groupId>org.hisp.dhis</groupId>
@@ -145,12 +131,6 @@
     </dependency>
     <dependency>
       <groupId>org.hisp.dhis</groupId>
-      <artifactId>dhis-web-api</artifactId>
-      <version>${project.version}</version>
-      <type>war</type>
-    </dependency>
-    <dependency>
-      <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-web-api-mobile</artifactId>
       <version>${project.version}</version>
       <type>war</type>
@@ -161,6 +141,25 @@
       <version>${project.version}</version>
       <type>war</type>
     </dependency>
+	-->
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-web-reporting</artifactId>
+      <version>${project.version}</version>
+      <type>war</type>
+    </dependency>	
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-web-api</artifactId>
+      <version>${project.version}</version>
+      <type>war</type>
+    </dependency>	
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-web-visualizer</artifactId>
+      <version>${project.version}</version>
+      <type>war</type>
+    </dependency>
     
   </dependencies>
   <properties>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetChartOptionsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetChartOptionsAction.java	2011-10-29 14:16:54 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetChartOptionsAction.java	2011-12-22 13:09:31 +0000
@@ -30,7 +30,6 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.Date;
 import java.util.List;
 
 import org.hisp.dhis.chart.Chart;
@@ -50,12 +49,7 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.organisationunit.comparator.OrganisationUnitLevelComparator;
-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.system.filter.PastAndCurrentPeriodFilter;
-import org.hisp.dhis.system.util.FilterUtils;
 
 import com.opensymphony.xwork2.Action;
 
@@ -97,13 +91,6 @@
         this.dataSetService = dataSetService;
     }
 
-    private PeriodService periodService;
-
-    public void setPeriodService( PeriodService periodService )
-    {
-        this.periodService = periodService;
-    }
-
     private OrganisationUnitService organisationUnitService;
 
     public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
@@ -243,20 +230,6 @@
         return periodTypes;
     }
 
-    private List<Period> availablePeriods;
-
-    public List<Period> getAvailablePeriods()
-    {
-        return availablePeriods;
-    }
-
-    private List<Period> selectedPeriods;
-
-    public List<Period> getSelectedPeriods()
-    {
-        return selectedPeriods;
-    }
-
     private List<OrganisationUnitLevel> levels = new ArrayList<OrganisationUnitLevel>();
 
     public List<OrganisationUnitLevel> getLevels()
@@ -294,10 +267,6 @@
 
         availableDataSets = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
 
-        periodTypes = new ArrayList<PeriodType>( periodService.getAllPeriodTypes() );
-
-        availablePeriods = new MonthlyPeriodType().generatePeriods( new Date() );
-
         levels = organisationUnitService.getOrganisationUnitLevels();
 
         availableOrganisationUnits = new ArrayList<OrganisationUnit>(
@@ -311,9 +280,6 @@
         Collections.sort( levels, new OrganisationUnitLevelComparator() );
         Collections.sort( availableOrganisationUnits, organisationUnitComparator );
 
-        Collections.reverse( availablePeriods );
-        FilterUtils.filter( availablePeriods, new PastAndCurrentPeriodFilter() );
-
         displayPropertyHandler.handle( availableIndicators );
         displayPropertyHandler.handle( availableDataElements );
         displayPropertyHandler.handle( availableDataSets );
@@ -332,9 +298,6 @@
             selectedDataSets = chart.getDataSets();
             availableDataSets.removeAll( selectedDataSets );
 
-            selectedPeriods = chart.getPeriods();
-            availablePeriods.removeAll( selectedPeriods );
-
             selectedOrganisationUnits = chart.getOrganisationUnits();
             availableOrganisationUnits.removeAll( selectedOrganisationUnits );
 

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java	2011-12-22 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java	2011-12-22 13:09:31 +0000
@@ -30,7 +30,6 @@
 import static org.hisp.dhis.system.util.ConversionUtils.getIntegerCollection;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
@@ -44,10 +43,7 @@
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.RelativePeriods;
-import org.hisp.dhis.period.comparator.AscendingPeriodComparator;
 
 import com.opensymphony.xwork2.Action;
 
@@ -90,13 +86,6 @@
         this.dataSetService = dataSetService;
     }
 
-    private PeriodService periodService;
-
-    public void setPeriodService( PeriodService periodService )
-    {
-        this.periodService = periodService;
-    }
-
     private OrganisationUnitService organisationUnitService;
 
     public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
@@ -227,13 +216,6 @@
         this.selectedDataElements = selectedDataElements;
     }
 
-    private List<String> selectedPeriods = new ArrayList<String>();
-
-    public void setSelectedPeriods( List<String> selectedPeriods )
-    {
-        this.selectedPeriods = selectedPeriods;
-    }
-
     private List<String> selectedOrganisationUnits = new ArrayList<String>();
 
     public void setSelectedOrganisationUnits( List<String> selectedOrganisationUnits )
@@ -316,7 +298,6 @@
         List<DataElement> dataElements = new ArrayList<DataElement>();
         List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
         List<DataSet> dataSets = new ArrayList<DataSet>();
-        List<Period> periods = new ArrayList<Period>( periodService.getPeriodsByExternalIds( selectedPeriods ) );
 
         for ( Integer id : getIntegerCollection( selectedIndicators ) )
         {
@@ -338,8 +319,6 @@
             organisationUnits.add( organisationUnitService.getOrganisationUnit( id ) );
         }
 
-        Collections.sort( periods, new AscendingPeriodComparator() );
-
         chart.setName( name );
         chart.setDomainAxixLabel( StringUtils.trimToNull( domainAxisLabel ) );
         chart.setRangeAxisLabel( StringUtils.trimToNull( rangeAxisLabel ) );
@@ -357,7 +336,6 @@
         chart.setIndicators( indicators );
         chart.setDataElements( dataElements );
         chart.setDataSets( dataSets );
-        chart.setPeriods( periods );
         chart.setOrganisationUnits( organisationUnits );
 
         RelativePeriods rp = new RelativePeriods();

=== 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	2011-11-21 12:44:20 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml	2011-12-22 13:09:31 +0000
@@ -74,7 +74,6 @@
     <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
     <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
-    <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
   </bean>
 
@@ -89,7 +88,6 @@
     <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
     <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
-    <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
   </bean>
 

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartDataElementModeForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartDataElementModeForm.vm	2011-12-22 10:35:54 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartDataElementModeForm.vm	2011-12-22 13:09:31 +0000
@@ -1,57 +1,4 @@
 <table>
-<!-- Periods -->
-
-<tr>
-    <th colspan="2">$i18n.getString( "category_y_available_periods" )</th>
-</tr>
-<tr>
-	<td>
-		<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:478px" onchange="getAvailablePeriods( 'periodType', 'availablePeriods', 'selectedPeriods', '0' )">
-			<option value="">[ $i18n.getString( "select_period_type_all" ) ]</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:600px" ondblclick="moveSelectedById( 'availablePeriods', 'selectedPeriods' )">
-            #foreach ( $period in $availablePeriods )
-                <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( "category_y_selected_periods" )</th>
-</tr>
-
-<tr>
-    <td>
-        <select size="6" id="selectedPeriods" name="selectedPeriods" style="min-width:600px" multiple ondblclick="moveSelectedById( 'selectedPeriods', 'availablePeriods' )">               
-            #foreach ( $period in $selectedPeriods )
-                <option value="$period.externalId">$format.formatPeriod( $period )</option>
-            #end
-        </select>
-    </td>
-    <td></td>
-</tr>
-<tr>
-    <td colspan="2" style="height:15px"></td>
-</tr>
 <!-- Relative periods -->
 
 <tr>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartIndicatorModeForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartIndicatorModeForm.vm	2011-12-22 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartIndicatorModeForm.vm	2011-12-22 13:09:31 +0000
@@ -1,57 +1,4 @@
 <table>
-<!-- Periods -->
-
-<tr>
-    <th colspan="2">$i18n.getString( "category_y_available_periods" )</th>
-</tr>
-<tr>
-	<td>
-		<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:478px" onchange="getAvailablePeriods( 'periodType', 'availablePeriods', 'selectedPeriods', '0' )">
-			<option value="">[ $i18n.getString( "select_period_type_all" ) ]</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:600px" ondblclick="moveSelectedById( 'availablePeriods', 'selectedPeriods' )">
-            #foreach ( $period in $availablePeriods )
-                <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( "category_y_selected_periods" )</th>
-</tr>
-
-<tr>
-    <td>
-        <select size="6" id="selectedPeriods" name="selectedPeriods" style="min-width:600px" multiple ondblclick="moveSelectedById( 'selectedPeriods', 'availablePeriods' )">               
-            #foreach ( $period in $selectedPeriods )
-                <option value="$period.externalId">$format.formatPeriod( $period )</option>
-            #end
-        </select>
-    </td>
-    <td></td>
-</tr>
-<tr>
-    <td colspan="2" style="height:15px"></td>
-</tr>
 <!-- Relative periods -->
 
 <tr>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartOrganisationUnitModeForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartOrganisationUnitModeForm.vm	2011-07-01 08:11:03 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartOrganisationUnitModeForm.vm	2011-12-22 13:09:31 +0000
@@ -63,26 +63,15 @@
 <tr>
     <th colspan="2">$i18n.getString( "filter_available_periods" )</th>
 </tr>
-
 <tr>
 	<td>
-		<input type="button" style="width:60px" value="$i18n.getString( 'prev' )" onclick="getAvailablePeriods( 'periodType', 'selectedPeriods', 'selectedPeriods', '-1' )" />
-		<input type="button" style="width:60px" value="$i18n.getString( 'next' )" onclick="getAvailablePeriods( 'periodType', 'selectedPeriods', 'selectedPeriods', '1' )" />
-		<select id="periodType" name="periodType" style="min-width:478px" onchange="getAvailablePeriods( 'periodType', 'selectedPeriods', 'selectedPeriods', '0' )">
-			<option value="">[ $i18n.getString( "select_period_type_all" ) ]</option>
-			#foreach ( $type in $periodTypes )
-				<option value="$type.name">$i18n.getString( $type.name )</option>
-			#end
-		</select>
-	</td>
-</tr>
-
-<tr>
-    <td colspan="2">
-        <select id="selectedPeriods" name="selectedPeriods" style="min-width:600px">               
-            #foreach ( $period in $selectedPeriods )
-                <option value="$period.externalId">$format.formatPeriod( $period )</option>
-            #end
-        </select>
+	    <label for="lastMonth">$i18n.getString( "last_month" )</label>
+		<input type="checkbox" id="lastMonth" name="lastMonth" value="true"#if( $chart.relatives.isReportingMonth() ) checked#end>&nbsp;
+		<label for="lastQuarter">$i18n.getString( "last_quarter" )</label>
+		<input type="checkbox" id="lastQuarter" name="lastQuarter" value="true""#if( $chart.relatives.isReportingQuarter() ) checked#end>&nbsp;
+		<label for="lastSixMonth">$i18n.getString( "last_six_month" )</label>
+		<input type="checkbox" id="lastSixMonth" name="lastSixMonth" value="true"#if( $chart.relatives.isLastSixMonth() ) checked#end>&nbsp;
+		<label for="thisYear">$i18n.getString( "this_year" )</label>
+		<input type="checkbox" id="thisYear" name="thisYear" value="true"#if( $chart.relatives.isThisYear() ) checked#end>
     </td>
-</tr>
+</tr>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm	2011-12-22 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm	2011-12-22 13:09:31 +0000
@@ -1,55 +1,4 @@
 <table>
-<!-- Periods -->
-
-<tr>
-    <th colspan="2">$i18n.getString( "category_x_available_periods" )</th>
-</tr>
-<tr>
-	<td>
-		<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:478px" onchange="getAvailablePeriods( 'periodType', 'availablePeriods', 'selectedPeriods', '0' )">
-			<option value="">[ $i18n.getString( "select_period_type_all" ) ]</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:600px" ondblclick="moveSelectedById( 'availablePeriods', 'selectedPeriods' )">
-            #foreach ( $period in $availablePeriods )
-                <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( "category_x_selected_periods" )</th>
-</tr>
-<tr>
-    <td>
-        <select size="6" id="selectedPeriods" name="selectedPeriods" style="min-width:600px" multiple ondblclick="moveSelectedById( 'selectedPeriods', 'availablePeriods' )">               
-            #foreach ( $period in $selectedPeriods )
-                <option value="$period.externalId">$format.formatPeriod( $period )</option>
-            #end
-        </select>
-    </td>
-    <td></td>
-</tr>
-<tr>
-    <td colspan="2" style="height:15px"></td>
-</tr>
-
 <!-- Relative periods -->
 
 <tr>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js	2011-12-21 11:19:47 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js	2011-12-22 13:09:31 +0000
@@ -57,14 +57,6 @@
 
             $( '#dataElementsField' ).text( dataElements );
         }
-        else if ( isCompletenessChart( json.chart.dimension ) )
-        {
-            $( '#indicatorsView' ).hide();
-            $( '#dataElementsView' ).hide();
-            $( '#dataSetsView' ).show();
-
-            $( '#dataSetsField' ).text( dataSets );
-        }
 
         setInnerHTML( 'periodsField', json.chart.periods );
         setInnerHTML( 'organisationUnitsField', json.chart.organisationUnits );
@@ -108,11 +100,6 @@
                     $( "#selectedDataSets" ).children().attr( "selected", true );
                 }
 
-                if ( $( "#selectedPeriods" ).attr( 'multiple' ) !== undefined )
-                {
-                    $( "#selectedPeriods" ).children().attr( "selected", true );
-                }
-
                 if ( $( "#selectedOrganisationUnits" ).attr( 'multiple' ) !== undefined )
                 {
                     $( "#selectedOrganisationUnits" ).children().attr( "selected", true );
@@ -181,17 +168,6 @@
     return false;
 }
 
-function isCompletenessChart( dimension )
-{
-    if ( dimension == "period_completeness" || dimension == "organisationUnit_completeness"
-            || dimension == "completeness_period" )
-    {
-        return true;
-    }
-
-    return false;
-}
-
 function validateCollections( dimension )
 {
     if ( isIndicatorChart( dimension ) && !hasElements( "selectedIndicators" ) )
@@ -208,13 +184,6 @@
         return false;
     }
 
-    if ( isCompletenessChart( dimension ) && !hasElements( "selectedDataSets" ) )
-    {
-        setMessage( i18n_must_select_at_least_one_dataset );
-
-        return false;
-    }
-
     if ( !hasElements( "selectedOrganisationUnits" ) && !isChecked( "userOrganisationUnit" ) )
     {
         setMessage( i18n_must_select_at_least_one_unit );
@@ -222,7 +191,7 @@
         return false;
     }
 
-    if ( !hasElements( "selectedPeriods" ) && !relativePeriodsChecked() )
+    if ( !relativePeriodsChecked() )
     {
         setMessage( i18n_must_select_at_least_one_period );