=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportExcelAction.java' --- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportExcelAction.java 2010-09-03 14:54:54 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportExcelAction.java 2010-10-14 11:58:33 +0000 @@ -58,8 +58,6 @@ import org.hisp.dhis.mapping.export.SVGUtils; 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.util.StreamActionSupport; /** @@ -67,7 +65,6 @@ * @version $Id$ */ -@SuppressWarnings( "serial" ) public class ExportExcelAction extends StreamActionSupport { @@ -104,13 +101,6 @@ this.organisationUnitService = organisationUnitService; } - private PeriodService periodService; - - public void setPeriodService( PeriodService periodService ) - { - this.periodService = periodService; - } - private IndicatorService indicatorService; public void setIndicatorService( IndicatorService indicatorService ) === 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-27 11:18:38 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportImageAction.java 2010-10-14 11:58:33 +0000 @@ -32,16 +32,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -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; -import org.hisp.dhis.period.PeriodService; import org.hisp.dhis.util.SessionUtils; import org.hisp.dhis.util.StreamActionSupport; @@ -49,7 +45,7 @@ * @author Tran Thanh Tri * @version $Id$ */ -@SuppressWarnings( "serial" ) + public class ExportImageAction extends StreamActionSupport { @@ -61,13 +57,6 @@ // Dependencies // ------------------------------------------------------------------------- - private PeriodService periodService; - - public void setPeriodService( PeriodService periodService ) - { - this.periodService = periodService; - } - private IndicatorService indicatorService; public void setIndicatorService( IndicatorService indicatorService ) @@ -81,13 +70,6 @@ { this.dataElementService = dataElementService; } - - private MappingService mappingService; - - public void setMappingService( MappingService mappingService ) - { - this.mappingService = mappingService; - } // ------------------------------------------------------------------------- // Output & input @@ -155,7 +137,7 @@ protected String execute( HttpServletResponse response, OutputStream out ) throws Exception { - log.info( "Exporting image, title: " + title + ", indicator: " + indicator + ", period" + period + ", width: " + width + ", height: " + height ); + log.info( "Exporting image, title: " + title + ", indicator: " + indicator + ", period: " + period + ", width: " + width + ", height: " + height ); log.info( "Legends: " + legends ); === 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-27 11:18:38 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/export/SVGDocument.java 2010-10-14 11:58:33 +0000 @@ -30,6 +30,7 @@ import net.sf.json.JSONObject; import net.sf.json.JSONSerializer; +import org.apache.commons.lang.StringEscapeUtils; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.indicator.Indicator; @@ -70,15 +71,15 @@ public StringBuffer getSVGForImage() { String indicatorName = this.indicator != null ? this.indicator.getName() : this.dataElement.getName(); - + String title_ = "" - + this.title + ""; + + StringEscapeUtils.escapeXml( this.title ) + ""; String indicator_ = "" - + indicatorName + ""; + + StringEscapeUtils.escapeXml( indicatorName ) + ""; String period_ = "" - + this.period + ""; + + StringEscapeUtils.escapeXml( this.period ) + ""; String svg_ = doctype + this.svg; @@ -131,13 +132,10 @@ for ( int i = 0; i < jsonLegends.size(); i++ ) { legend = jsonLegends.getJSONObject( i ); - - String label = legend.getString( "label" ); - - String color = legend.getString( "color" ); - - System.out.println( "1 l " + label + " c " + color ); - System.out.println( legend ); + + String label = StringEscapeUtils.escapeXml( legend.getString( "label" ) ); + + String color = StringEscapeUtils.escapeXml( legend.getString( "color" ) ); result += ""; @@ -168,13 +166,10 @@ for ( int i = 0; i < jsonLegends.size(); i++ ) { legend = jsonLegends.getJSONObject( i ); - - String label = legend.getString( "label" ); - - String color = legend.getString( "color" ); - - System.out.println( "1 l " + label + " c " + color ); - System.out.println( legend ); + + String label = StringEscapeUtils.escapeXml( legend.getString( "label" ) ); + + String color = StringEscapeUtils.escapeXml( legend.getString( "color" ) ); result += ""; === 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-10-13 13:00:43 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2010-10-14 11:58:33 +0000 @@ -364,14 +364,12 @@ - - === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js 2010-10-13 14:51:29 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js 2010-10-14 11:58:33 +0000 @@ -168,11 +168,11 @@ json += '{'; json += '"organisation": "' + mapValues[i].orgUnitId + '",'; json += '"value": "' + mapValues[i].value + '" '; - json += i < mapValues.length - 1 ? '},' : '}' + json += i < mapValues.length - 1 ? '},' : '}'; } json += ']'; json += '}'; - return json + return json; }, getLegendsJSON: function() { === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js 2010-10-13 21:44:10 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js 2010-10-14 11:58:33 +0000 @@ -255,10 +255,10 @@ var labelGenerator = this.labelGenerator || this.defaultLabelGenerator; bins[i].label = labelGenerator(bins[i], i, nbBins, maxDec); imageLegend[i] = new Object(); - imageLegend[i].label = bins[i].label; + imageLegend[i].label = bins[i].label.replace('  ', ' '); } - if (ACTIVEPANEL == GLOBALS.config.thematicMap) { + if (ACTIVEPANEL == GLOBALS.config.thematicMap) { choropleth.imageLegend = imageLegend; } else if (ACTIVEPANEL == GLOBALS.config.thematicMap2) {