=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportImageAction.java' --- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportImageAction.java 2010-09-03 14:54:54 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportImageAction.java 2010-09-27 11:18:38 +0000 @@ -35,6 +35,9 @@ import org.hisp.dhis.i18n.I18nFormat; import org.hisp.dhis.indicator.Indicator; import org.hisp.dhis.indicator.IndicatorService; +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.mapping.MappingService; import org.hisp.dhis.mapping.export.SVGDocument; import org.hisp.dhis.mapping.export.SVGUtils; import org.hisp.dhis.period.Period; @@ -71,6 +74,20 @@ { this.indicatorService = indicatorService; } + + private DataElementService dataElementService; + + public void setDataElementService( DataElementService dataElementService ) + { + this.dataElementService = dataElementService; + } + + private MappingService mappingService; + + public void setMappingService( MappingService mappingService ) + { + this.mappingService = mappingService; + } // ------------------------------------------------------------------------- // Output & input @@ -151,14 +168,28 @@ else { log.info( "Export map from request" ); - + Indicator _indicator = indicatorService.getIndicator( indicator ); - + + DataElement _dataElement = dataElementService.getDataElement( indicator ); + svgDocument = new SVGDocument(); - + svgDocument.setTitle( title ); svgDocument.setSvg( svg ); - svgDocument.setIndicator( _indicator ); + + if ( _indicator != null ) + { + svgDocument.setIndicator( _indicator ); + svgDocument.setDataElement( null ); + } + + else + { + svgDocument.setIndicator( null ); + svgDocument.setDataElement( _dataElement ); + } + svgDocument.setPeriod( period ); svgDocument.setLegends( legends ); svgDocument.setIncludeLegends( includeLegends ); === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/export/SVGDocument.java' --- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/export/SVGDocument.java 2010-09-03 14:54:54 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/export/SVGDocument.java 2010-09-27 11:18:38 +0000 @@ -30,8 +30,8 @@ import net.sf.json.JSONObject; import net.sf.json.JSONSerializer; +import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.indicator.Indicator; -import org.hisp.dhis.period.Period; /** * @author Tran Thanh Tri @@ -54,6 +54,8 @@ private String period; private Indicator indicator; + + private DataElement dataElement; private boolean includeLegends; @@ -67,11 +69,13 @@ public StringBuffer getSVGForImage() { + String indicatorName = this.indicator != null ? this.indicator.getName() : this.dataElement.getName(); + String title_ = "" + this.title + ""; String indicator_ = "" - + this.indicator.getName() + ""; + + indicatorName + ""; String period_ = "" + this.period + ""; @@ -253,6 +257,16 @@ this.indicator = indicator; } + public DataElement getDataElement() + { + return dataElement; + } + + public void setDataElement( DataElement dataElement ) + { + this.dataElement = dataElement; + } + public int getWidth() { return width; === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2010-09-09 19:19:51 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2010-09-27 11:18:38 +0000 @@ -365,6 +365,7 @@ scope="prototype"> + polygon layer for printing'); + return; } else { Ext.message.msg(false, i18n_please_expand_layer_panel); return; - } - + } + if (vcb && dcb && mcb && lcb) { var svgElement = document.getElementsByTagName('svg')[0]; === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2010-09-24 22:44:20 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2010-09-27 11:18:38 +0000 @@ -687,10 +687,10 @@ } Ext.getCmp('colorA_cf').showField(); Ext.getCmp('colorB_cf').showField(); - Ext.getCmp('maplegendset_cb').hideField(); - - this.classify(false, true); + Ext.getCmp('maplegendset_cb').hideField(); } + + this.classify(false, true); } }, failure: function() { @@ -791,10 +791,10 @@ } Ext.getCmp('colorA_cf').showField(); Ext.getCmp('colorB_cf').showField(); - Ext.getCmp('maplegendset_cb').hideField(); - - this.classify(false, true); + Ext.getCmp('maplegendset_cb').hideField(); } + + this.classify(false, true); } }, failure: function() { === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2010-09-24 22:44:20 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2010-09-27 11:18:38 +0000 @@ -583,10 +583,10 @@ } Ext.getCmp('colorA_cf2').showField(); Ext.getCmp('colorB_cf2').showField(); - Ext.getCmp('maplegendset_cb2').hideField(); - - this.classify(false, true); + Ext.getCmp('maplegendset_cb2').hideField(); } + + this.classify(false, true); } }, failure: function() { @@ -687,10 +687,10 @@ } Ext.getCmp('colorA_cf2').showField(); Ext.getCmp('colorB_cf2').showField(); - Ext.getCmp('maplegendset_cb2').hideField(); - - this.classify(false, true); + Ext.getCmp('maplegendset_cb2').hideField(); } + + this.classify(false, true); } }, failure: function() {