[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2275: (GIS) Image export for both layers implemented.

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)

revision-diff.txt (30.5 KB)

···

------------------------------------------------------------
revno: 2275 [merge]
committer: Jan Henrik Overland <janhenrik.overland@gmail.com>
branch nick: dhis2
timestamp: Fri 2010-12-03 13:58:22 +0100
message:
  (GIS) Image export for both layers implemented.
modified:
  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/ExportImageAction.java
  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/webapp/dhis-web-mapping/mapping/index.html
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js
  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/Symbol.js

--
lp:dhis2

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to OpenID transaction in progress

When exporting images:

  • select layers (polygon layer / point layer / both)

  • select width and height from the dropdownlist (small / medium / large) or type the exact number of pixels

Example image attached.

image

···

On Fri, Dec 3, 2010 at 14:02, noreply@launchpad.net wrote:

Merge authors:

Jan Henrik Øverland (janhenrik-overland)


revno: 2275 [merge]

committer: Jan Henrik Overland janhenrik.overland@gmail.com

branch nick: dhis2

timestamp: Fri 2010-12-03 13:58:22 +0100

message:

(GIS) Image export for both layers implemented.

modified:

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/ExportImageAction.java

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/webapp/dhis-web-mapping/mapping/index.html

dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js

dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js

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/Symbol.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-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-10-14 11:58:33 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportExcelAction.java 2010-12-02 19:03:23 +0000

@@ -147,9 +147,9 @@

     this.title = title;

 }
  • private Integer indicator;
  • private String indicator;
  • public void setIndicator( Integer indicator )
  • public void setIndicator( String indicator )

    {

    this.indicator = indicator;
    

    }

@@ -206,8 +206,6 @@

 {

     [log.info](http://log.info)( "Exporting workbook, width: " + width + ", height: " + height );
  •    Indicator i = indicatorService.getIndicator( indicator );
    
     // ---------------------------------------------------------------------

     // Write map image to byte array

     // ---------------------------------------------------------------------

@@ -217,7 +215,7 @@

     svgDocument.setTitle( this.title );

     svgDocument.setSvg( this.svg );

     svgDocument.setPeriod( period );
  •    svgDocument.setIndicator( i );
    
  •    svgDocument.setIndicator( indicator );
    
       svgDocument.setLegends( this.legends );
    
       svgDocument.setIncludeLegends( this.includeLegends );
    

@@ -231,7 +229,7 @@

     WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( out );
  •    WritableSheet sheet = outputReportWorkbook.createSheet( i.getName(), 1 );
    
  •    WritableSheet sheet = outputReportWorkbook.createSheet( indicator, 1 );
    
    
    
       // ---------------------------------------------------------------------
    
       // Write map image to workbook
    

@@ -270,7 +268,7 @@

     sheet.addCell( new Label( titlePositionCol, titlePositionRow, i18n.getString( "Title" ), header ) );

     sheet.addCell( new Label( titlePositionCol + 2, titlePositionRow, this.title, headerContent ) );

     sheet.addCell( new Label( titlePositionCol, titlePositionRow + 1, i18n.getString( "Indicator" ), header ) );
  •    sheet.addCell( new Label( titlePositionCol + 2, titlePositionRow + 1, i.getName(), headerContent ) );
    
  •    sheet.addCell( new Label( titlePositionCol + 2, titlePositionRow + 1, indicator, headerContent ) );
    
       sheet.addCell( new Label( titlePositionCol, titlePositionRow + 2, i18n.getString( "Period" ), header ) );
    
       sheet.addCell( new Label( titlePositionCol + 2, titlePositionRow + 2, period, headerContent ) );
    

=== 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-10-14 11:58:33 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportImageAction.java 2010-12-03 12:40:38 +0000

@@ -89,12 +89,33 @@

     this.title = title;

 }
  • private Integer indicator;

  • public void setIndicator( Integer indicator )

  • private Integer layer;

  • public void setLayer( Integer layer )

  • {

  •    this.layer = layer;
    
  • }

  • private Integer imageLegendRows;

  • public void setImageLegendRows( Integer imageLegendRows )

  • {

  •    this.imageLegendRows = imageLegendRows;
    
  • }

  • private String indicator;

  • public void setIndicator( String indicator )

    {

    this.indicator = indicator;
    

    }

  • private String indicator2;

  • public void setIndicator2( String indicator2 )

  • {

  •    this.indicator2 = indicator2;
    
  • }

    private String period;

@@ -103,6 +124,13 @@

     this.period = period;

 }
  • private String period2;

  • public void setPeriod2( String period2 )

  • {

  •    this.period2 = period2;
    
  • }

 private String legends;



 public void setLegends( String legends )

@@ -110,6 +138,13 @@

     this.legends = legends;

 }
  • private String legends2;

  • public void setLegends2( String legends2 )

  • {

  •    this.legends2 = legends2;
    
  • }

 private boolean includeLegends;



 public void setIncludeLegends( boolean includeLegends )

@@ -137,10 +172,6 @@

 protected String execute( HttpServletResponse response, OutputStream out )

     throws Exception

 {
  •    [log.info](http://log.info)( "Exporting image, title: " + title + ", indicator: " + indicator + ", period: " + period + ", width: " + width + ", height: " + height );
    
  •    [log.info](http://log.info)( "Legends: " + legends );
    
     if ( svg == null || title == null || indicator == null || period == null || width == null || height == null )

     {

         [log.info](http://log.info)( "Export map from session" );

@@ -151,37 +182,30 @@

     {

         [log.info](http://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 );
    
  •        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 );
    
  •        svgDocument.setWidth( width );
    
  •        svgDocument.setHeight( height );
    
  •        svgDocument.setTitle( this.title );
    
  •        svgDocument.setSvg( this.svg );
    
  •        svgDocument.setLayer( this.layer );
    
  •        svgDocument.setIndicator( this.indicator );
    
  •        svgDocument.setPeriod( this.period );
    
  •        svgDocument.setLegends( this.legends );
    
  •        svgDocument.setIncludeLegends( this.includeLegends );
    
  •        svgDocument.setWidth( this.width );
    
  •        svgDocument.setHeight( this.height );
    
  •        if ( this.layer == 3 )
    
  •        {
    
  •            svgDocument.setImageLegendRows( this.imageLegendRows );
    
  •            svgDocument.setPeriod2( this.period2 );
    
  •            svgDocument.setIndicator2( this.indicator2 );
    
  •            svgDocument.setLegends2( this.legends2 );
    
  •        }
    
         SessionUtils.setSessionVar( SVGDOCUMENT, svgDocument );

     }
  •    SVGUtils.convertToPNG( svgDocument.getSVGForImage(), out, width, height );
    
  •    SVGUtils.convertToPNG( svgDocument.getSVGForImage(), out, this.width, this.height );
    
    
    
       return SUCCESS;
    

    }

=== 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-10-14 11:58:33 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/export/SVGDocument.java 2010-12-03 12:40:38 +0000

@@ -34,6 +34,8 @@

import org.hisp.dhis.dataelement.DataElement;

import org.hisp.dhis.indicator.Indicator;

+import sun.rmi.runtime.Log;

/**

  • @author Tran Thanh Tri

  • @version $Id$

@@ -49,15 +51,23 @@

 private String title;



 private String svg;
  • private Integer layer;

  • private Integer imageLegendRows;

    private String legends;

  • private String legends2;

    private String period;

  • private Indicator indicator;

  • private DataElement dataElement;

  • private String period2;

  • private String indicator;

  • private String indicator2;

 private boolean includeLegends;



 private int width;

@@ -70,26 +80,61 @@

 public StringBuffer getSVGForImage()

 {
  •    String indicatorName = this.indicator != null ? this.indicator.getName() : this.dataElement.getName();
    
  •    String svg_ = doctype + this.svg;
    
  •    svg_ = svg_.replaceFirst( "<svg", "<svg " + namespace );
    
  •    String title_ = "<g id=\"title\" style=\"display: block; visibility: visible;\"><text id=\"title\" x=\"30\" y=\"15\" font-size=\"14\" font-weight=\"bold\"><tspan>"
    
  •    String title_ = "<g id=\"title\" style=\"display: block; visibility: visible;\"><text id=\"title\" x=\"30\" y=\"20\" font-size=\"18\" font-weight=\"bold\"><tspan>"
    
    
    
           + StringEscapeUtils.escapeXml( this.title ) + "</tspan></text></g>";
    
  •    String indicator_ = "<g id=\"indicator\" style=\"display: block; visibility: visible;\"><text id=\"indicator\" x=\"30\" y=\"30\" font-size=\"12\"><tspan>"
    
  •        + StringEscapeUtils.escapeXml( indicatorName ) + "</tspan></text></g>";
    
  •    String period_ = "<g id=\"period\" style=\"display: block; visibility: visible;\"><text id=\"period\" x=\"30\" y=\"45\" font-size=\"12\"><tspan>"
    
  •        + StringEscapeUtils.escapeXml( this.period ) + "</tspan></text></g>";
    
  •    String svg_ = doctype + this.svg;
    
  •    svg_ = svg_.replaceFirst( "<svg", "<svg " + namespace );
    
  •    svg_ = svg_.replaceFirst( "</svg>", title_ + indicator_ + period_ + "</svg>" );
    
  •    if ( this.includeLegends )
    
  •    {
    
  •        svg_ = svg_.replaceFirst( "</svg>", this.getLegendScript( 30, 45 ) + "</svg>" );
    
  •    if ( this.layer != 3 ) // Polygon or point layer
    
  •    {
    
  •        String indicator_ = "<g id=\"indicator\" style=\"display: block; visibility: visible;\"><text id=\"indicator\" x=\"30\" y=\"35\" font-size=\"12\"><tspan>"
    
  •            + StringEscapeUtils.escapeXml( this.indicator ) + "</tspan></text></g>";
    
  •        String period_ = "<g id=\"period\" style=\"display: block; visibility: visible;\"><text id=\"period\" x=\"30\" y=\"50\" font-size=\"12\"><tspan>"
    
  •            + StringEscapeUtils.escapeXml( this.period ) + "</tspan></text></g>";
    
  •        svg_ = svg_.replaceFirst( "</svg>", title_ + indicator_ + period_ + "</svg>" );
    
  •        if ( this.includeLegends )
    
  •        {
    
  •            svg_ = svg_.replaceFirst( "</svg>", this.getLegendScript( 30, 45 ) + "</svg>" );
    
  •        }
    
  •    }
    
  •    else if ( this.layer == 3 ) // Both layers
    
  •    {
    
  •        String heading = "<g id=\"heading\" style=\"display: block; visibility: visible;\"><text id=\"heading\" x=\"30\" y=\"50\" font-size=\"12\" font-weight=\"bold\"><tspan>"
    
  •            + "Polygons</tspan></text></g>";
    
  •        String indicator_ = "<g id=\"indicator\" style=\"display: block; visibility: visible;\"><text id=\"indicator\" x=\"30\" y=\"65\" font-size=\"12\"><tspan>"
    
  •            + StringEscapeUtils.escapeXml( this.indicator ) + "</tspan></text></g>";
    
  •        String period_ = "<g id=\"period\" style=\"display: block; visibility: visible;\"><text id=\"period\" x=\"30\" y=\"80\" font-size=\"12\"><tspan>"
    
  •            + StringEscapeUtils.escapeXml( this.period ) + "</tspan></text></g>";
    
  •        svg_ = svg_.replaceFirst( "</svg>", title_ + heading + indicator_ + period_ + "</svg>" );
    
  •        if ( this.includeLegends )
    
  •        {
    
  •            svg_ = svg_.replaceFirst( "</svg>", this.getLegendScript( 30, 75 ) + "</svg>" );
    
  •        }
    
  •        String heading2 = "<g id=\"heading2\" style=\"display: block; visibility: visible;\"><text id=\"heading2\" x=\"30\" y=\"" + (120 + 15 * this.imageLegendRows) + "\" font-size=\"12\" font-weight=\"bold\"><tspan>"
    
  •            + "Points</tspan></text></g>";
    
  •        String indicator2_ = "<g id=\"indicator2\" style=\"display: block; visibility: visible;\"><text id=\"indicator2\" x=\"30\" y=\"" + (135 + 15 * this.imageLegendRows) + "\" font-size=\"12\"><tspan>"
    
  •            + StringEscapeUtils.escapeXml( this.indicator2 ) + "</tspan></text></g>";
    
  •        String period2_ = "<g id=\"period2\" style=\"display: block; visibility: visible;\"><text id=\"period2\" x=\"30\" y=\"" + (150 + 15 * this.imageLegendRows) + "\" font-size=\"12\"><tspan>"
    
  •            + StringEscapeUtils.escapeXml( this.period2 ) + "</tspan></text></g>";
    
  •        svg_ = svg_.replaceFirst( "</svg>", heading2 + indicator2_ + period2_ + "</svg>" );
    
  •        if ( this.includeLegends )
    
  •        {
    
  •            svg_ = svg_.replaceFirst( "</svg>", this.getLegendScript2( 30, (145 + 15 * this.imageLegendRows) ) + "</svg>" );
    
  •        }
    
       }
    
    
    
       return new StringBuffer( svg_ );
    

@@ -158,7 +203,7 @@

     String result = "<g id='legend'>";



     JSONObject legend;
     JSONObject json = (JSONObject) JSONSerializer.toJSON( this.legends );



     JSONArray jsonLegends = json.getJSONArray( "legends" );

@@ -185,6 +230,38 @@

     return result;

 }
  • private String getLegendScript2( int x, int y )

  • {

  •    String result = "<g id='legend2'>";
    
  •    JSONObject legend;
    
  •    JSONObject json = (JSONObject) JSONSerializer.toJSON( this.legends2 );
    
  •    JSONArray jsonLegends = json.getJSONArray( "legends" );
    
  •    for ( int i = 0; i < jsonLegends.size(); i++ )
    
  •    {
    
  •        legend = jsonLegends.getJSONObject( i );
    
  •        String label = StringEscapeUtils.escapeXml( legend.getString( "label" ) );
    
  •        String color = StringEscapeUtils.escapeXml( legend.getString( "color" ) );
    
  •        result += "<rect x='" + x + "' y='" + (y + 15) + "' height='15' width='30' fill='" + color
    
  •            + "' stroke='#000000' stroke-width='1'/>";
    
  •        result += "<text id=\"indicator\" x='" + (x + 40) + "' y='" + (y + 27) + "' font-size=\"12\"><tspan>"
    
  •            + label + "</tspan></text>";
    
  •        y += 15;
    
  •    }
    
  •    result += "</g>";
    
  •    return result;
    
  • }

 @Override

 public String toString()

 {

@@ -222,6 +299,26 @@

 }
  • public Integer getLayer()

  • {

  •    return layer;
    
  • }

  • public void setLayer( Integer layer )

  • {

  •    this.layer = layer;
    
  • }

  • public Integer getImageLegendRows()

  • {

  •    return imageLegendRows;
    
  • }

  • public void setImageLegendRows( Integer imageLegendRows )

  • {

  •    this.imageLegendRows = imageLegendRows;
    
  • }

 public String getLegends()

 {

     return legends;

@@ -232,6 +329,16 @@

     this.legends = legends;

 }
  • public String getLegends2()

  • {

  •    return legends2;
    
  • }

  • public void setLegends2( String legends2 )

  • {

  •    this.legends2 = legends2;
    
  • }

 public String getPeriod()

 {

     return period;

@@ -242,24 +349,34 @@

     this.period = period;

 }
  • public Indicator getIndicator()
  • public String getPeriod2()

  • {

  •    return period2;
    
  • }

  • public void setPeriod2( String period2 )

  • {

  •    this.period2 = period2;
    
  • }

  • public String getIndicator()

    {

    return indicator;
    

    }

  • public void setIndicator( Indicator indicator )
  • public void setIndicator( String indicator )

    {

    this.indicator = indicator;
    

    }

  • public DataElement getDataElement()
  • public String getIndicator2()

    {

  •    return dataElement;
    
  •    return indicator;
    

    }

  • public void setDataElement( DataElement dataElement )
  • public void setIndicator2( String indicator2 )

    {

  •    this.dataElement = dataElement;
    
  •    this.indicator2 = indicator2;
    

    }

    public int getWidth()

=== modified file ‘dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html’

— dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html 2010-12-01 12:16:51 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html 2010-12-03 12:40:38 +0000

@@ -47,14 +47,19 @@

 <form id="exportForm" method="post">

     <input type="hidden" id="titleField" name="title"/>

     <input type="hidden" id="viewBoxField" name="viewBox"/>
  •    <input type="hidden" id="layerField" name="layer"/>
    
  •    <input type="hidden" id="imageLegendRowsField" name="imageLegendRows"/>
    
       <input type="hidden" id="svgField" name="svg"/>
    
       <input type="hidden" id="widthField" name="width"/>
    
       <input type="hidden" id="heightField" name="height"/>
    
       <input type="hidden" id="includeLegendsField" name="includeLegends"/>
    
       <input type="hidden" id="includeValuesField" name="includeValues"/>
    
       <input type="hidden" id="periodField" name="period"/>
    
  •    <input type="hidden" id="periodField2" name="period2"/>
    
       <input type="hidden" id="indicatorField" name="indicator"/>
    
  •    <input type="hidden" id="indicatorField2" name="indicator2"/>
    
       <input type="hidden" id="legendsField" name="legends"/>
    
  •    <input type="hidden" id="legendsField2" name="legends2"/>
    
       <input type="hidden" id="dataValuesField" name="datavalues"/>
    
              <input type="hidden" id="imageFormat" name="imageFormat"/>
    

=== modified file ‘dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js’

— dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js 2010-12-02 12:41:12 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js 2010-12-02 19:03:23 +0000

@@ -240,7 +240,7 @@

     for (var i = 0; i < mapValues.length; i++) {

         json += '{';

         json += '"organisation": "' + mapValues[i].orgUnitId + '",';
  •        json += '"value": "' + mapValues[i].value + '" ';
    
  •        json += '"value": "' + mapValues[i].value + '"';
    
           json += i < mapValues.length - 1 ? '},' : '}';
    
       }
    
       json += ']';
    

@@ -249,15 +249,14 @@

 },



 getLegendsJSON: function() {
  •    var widget = GLOBAL.vars.activePanel.isPolygon() ? choropleth : symbol;
    
       var json = '{';
    
       json += '"legends":';
    
       json += '[';
    
  •    for(var i = 0; i < widget.imageLegend.length; i++) {
    
  •    for(var i = 0; i < this.imageLegend.length; i++) {
    
           json += '{';
    
  •        json += '"label": "' + widget.imageLegend[i].label + '",';
    
  •        json += '"color": "' + widget.imageLegend[i].color + '" ';
    
  •        json += i < widget.imageLegend.length-1 ? '},' : '}';
    
  •        json += '"label": "' + this.imageLegend[i].label + '",';
    
  •        json += '"color": "' + this.imageLegend[i].color + '"';
    
  •        json += i < this.imageLegend.length-1 ? '},' : '}';
    
       }
    
       json += ']';
    
       json += '}';
    

=== modified file ‘dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js’

— dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-12-02 12:41:12 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-12-03 12:40:38 +0000

@@ -681,12 +681,12 @@

                    },

                    {

                            xtype: 'combo',
  •                           id: 'exportimagequality_cb',
    
  •                           fieldLabel: i18n_image_resolution,
    
  •                           id: 'exportimagelayers_cb',
    
  •                           fieldLabel: 'Layers',
    
                              labelSeparator: GLOBAL.conf.labelseparator,
    
                              editable: false,
    
                              valueField: 'id',
    
  •                           displayField: 'text',
    
  •                           displayField: 'layer',
    
                              isFormField: true,
    
                              width: GLOBAL.conf.combo_width_fieldset,
    
                              minListWidth: GLOBAL.conf.combo_width_fieldset,
    

@@ -694,11 +694,49 @@

                            triggerAction: 'all',

                            value: 1,

                            store: new Ext.data.ArrayStore({
  •                                   fields: ['id', 'text'],
    
  •                                   data: [[1, i18n_medium], [2, i18n_large]]
    
  •                                   fields: ['id', 'layer'],
    
  •                                   data: [[1, 'Polygon layer'], [2, 'Point layer'], [3, 'Both']]
    
                              })
    
                      },
    
                      {
    
  •                           xtype: 'combo',
    
  •                           id: 'exportimagewidth_cb',
    
  •                           fieldLabel: 'Width',
    
  •                           labelSeparator: GLOBAL.conf.labelseparator,
    
  •                           editable: true,
    
  •                           emptyText: 'Type custom px',
    
  •                           valueField: 'width',
    
  •                           displayField: 'text',
    
  •                           isFormField: true,
    
  •                           width: GLOBAL.conf.combo_width_fieldset,
    
  •                           minListWidth: GLOBAL.conf.combo_width_fieldset,
    
  •                           mode: 'local',
    
  •                           triggerAction: 'all',
    
  •                           store: new Ext.data.ArrayStore({
    
  •                                   fields: ['width', 'text'],
    
  •                                   data: [[800, 'Small'], [1190, 'Medium'], [1920, 'Large']]
    
  •                           })
    
  •                   },
    
  •                   {
    
  •                           xtype: 'combo',
    
  •                           id: 'exportimageheight_cb',
    
  •                           fieldLabel: 'Height',
    
  •                           labelSeparator: GLOBAL.conf.labelseparator,
    
  •                           editable: true,
    
  •                           emptyText: 'Type custom px',
    
  •                           valueField: 'height',
    
  •                           displayField: 'text',
    
  •                           isFormField: true,
    
  •                           width: GLOBAL.conf.combo_width_fieldset,
    
  •                           minListWidth: GLOBAL.conf.combo_width_fieldset,
    
  •                           mode: 'local',
    
  •                           triggerAction: 'all',
    
  •                           store: new Ext.data.ArrayStore({
    
  •                                   fields: ['height', 'text'],
    
  •                                   data: [[600, 'Small'], [880, 'Medium'], [1200, 'Large']]
    
  •                           })
    
  •                   },
    
  •                   {
    
                              xtype: 'checkbox',
    
                              id: 'exportimageincludelegend_chb',
    
                              fieldLabel: i18n_include_legend,
    

@@ -715,56 +753,90 @@

                            cls: 'window-button',

                            text: i18n_export,

                            handler: function() {
  •                var values, svgElement;
    
  •                if (GLOBAL.vars.activePanel.isPolygon()) {
    
  •                    if (choropleth.formValidation.validateForm()) {
    
  •                var values, svgElement, svg;
    
  •                if (Ext.getCmp('exportimagelayers_cb').getValue() == 1) {
    
  •                                           if (choropleth.formValidation.validateForm()) {
    
                                                      values = choropleth.formValues.getImageExportValues.call(choropleth);
    
  •                                                   document.getElementById('layerField').value = 1;
    
  •                                                   document.getElementById('periodField').value = values.dateValue;
    
  •                                                   document.getElementById('indicatorField').value = values.mapValueTypeValue;
    
  •                                                   document.getElementById('legendsField').value = GLOBAL.util.getLegendsJSON.call(choropleth);
    
                                                      svgElement = document.getElementsByTagName('svg')[0];
    
  •                                                   svg = svgElement.parentNode.innerHTML;
    
                                              }
    
                                              else {
    
  •                                                   Ext.message.msg(false, i18n_please_render_map_first);
    
  •                                                   Ext.message.msg(false, 'Polygon layer not rendered');
    
  •                                                   return;
    
                                              }
    
                                      }
    
  •                                   else if (GLOBAL.vars.activePanel.isPoint()) {
    
  •                    if (symbol.formValidation.validateForm()) {
    
  •                                   else if (Ext.getCmp('exportimagelayers_cb').getValue() == 2) {
    
  •                                           if (symbol.formValidation.validateForm()) {
    
                                                      values = symbol.formValues.getImageExportValues.call(symbol);
    
  •                                                   document.getElementById('layerField').value = 2;
    
  •                                                   document.getElementById('periodField').value = values.dateValue;
    
  •                                                   document.getElementById('indicatorField').value = values.mapValueTypeValue;
    
  •                                                   document.getElementById('legendsField').value = GLOBAL.util.getLegendsJSON.call(symbol);
    
                                                      svgElement = document.getElementsByTagName('svg')[1];
    
  •                                           }
    
  •                                           else {
    
  •                                                   Ext.message.msg(false, i18n_please_render_map_first);
    
  •                                                   svg = svgElement.parentNode.innerHTML;
    
  •                                           }
    
  •                                           else {
    
  •                                                   Ext.message.msg(false, 'Point layer not rendered');
    
  •                                                   return;
    
  •                                           }
    
  •                                   }
    
  •                                   else if (Ext.getCmp('exportimagelayers_cb').getValue() == 3) {
    
  •                                           if (choropleth.formValidation.validateForm()) {
    
  •                                                   if (symbol.formValidation.validateForm()) {
    
  •                                                           document.getElementById('layerField').value = 3;
    
  •                                                           document.getElementById('imageLegendRowsField').value = choropleth.imageLegend.length;
    
  •                                                           values = choropleth.formValues.getImageExportValues.call(choropleth);
    
  •                                                           document.getElementById('periodField').value = values.dateValue;
    
  •                                                           document.getElementById('indicatorField').value = values.mapValueTypeValue;
    
  •                                                           document.getElementById('legendsField').value = GLOBAL.util.getLegendsJSON.call(choropleth);
    
  •                                                           values = symbol.formValues.getImageExportValues.call(symbol);
    
  •                                                           document.getElementById('periodField2').value = values.dateValue;
    
  •                                                           document.getElementById('indicatorField2').value = values.mapValueTypeValue;
    
  •                                                           document.getElementById('legendsField2').value = GLOBAL.util.getLegendsJSON.call(symbol);
    
  •                                                           svgElement = document.getElementsByTagName('svg')[0];
    
  •                                                           var str1 = svgElement.parentNode.innerHTML;
    
  •                                                           str1 = svgElement.parentNode.innerHTML.replace('</svg>');
    
  •                                                           var str2 = document.getElementsByTagName('svg')[1].parentNode.innerHTML;
    
  •                                                           str2 = str2.substring(str2.indexOf('>')+1);
    
  •                                                           svg = str1 + str2;
    
  •                                                   }
    
  •                                                   else {
    
  •                                                           Ext.message.msg(false, 'Point layer not rendered');
    
  •                                                           return;
    
  •                                                   }
    
  •                                           }
    
  •                                           else {
    
  •                                                   Ext.message.msg(false, 'Polygon layer not rendered');
    
  •                                                   return;
    
                                              }
    
                                      }
    
  •                                   var svg = svgElement.parentNode.innerHTML;
    
  •                                   var viewBox = svgElement.getAttribute('viewBox');
    
                                      var title = Ext.getCmp('exportimagetitle_tf').getValue();
    
    
    
                                      if (!title) {
    
                                              Ext.message.msg(false, i18n_form_is_not_complete);
    
                                      }
    
                                      else {
    
  •                                           var q = Ext.getCmp('exportimagequality_cb').getValue();
    
  •                                           var w = svgElement.getAttribute('width') * q;
    
  •                                           var h = svgElement.getAttribute('height') * q;
    
  •                                           var includeLegend = Ext.getCmp('exportimageincludelegend_chb').getValue();
    
  •                                           Ext.getCmp('exportimagetitle_tf').reset();
    
                                            var exportForm = document.getElementById('exportForm');

                                            exportForm.action = '../exportImage.action';

                                            exportForm.target = '_blank';
  •                                           document.getElementById('titleField').value = title;
    
  •                                           document.getElementById('viewBoxField').value = viewBox;
    
  •                                           document.getElementById('titleField').value = title;
    
  •                                           document.getElementById('viewBoxField').value = svgElement.getAttribute('viewBox');
    
                                              document.getElementById('svgField').value = svg;
    
  •                                           document.getElementById('widthField').value = w;
    
  •                                           document.getElementById('heightField').value = h;
    
  •                                           document.getElementById('includeLegendsField').value = includeLegend;
    
  •                                           document.getElementById('periodField').value = values.dateValue;
    
  •                                           document.getElementById('indicatorField').value = values.mapValueTypeValue;
    
  •                                           document.getElementById('legendsField').value = GLOBAL.util.getLegendsJSON();
    
  •                                           document.getElementById('widthField').value = Ext.getCmp('exportimagewidth_cb').getValue();
    
  •                                           document.getElementById('heightField').value = Ext.getCmp('exportimageheight_cb').getValue();
    
  •                                           document.getElementById('includeLegendsField').value = Ext.getCmp('exportimageincludelegend_chb').getValue();
    
    
    
                                              exportForm.submit();
    
  •                                           Ext.getCmp('exportimagetitle_tf').reset();
    
                                      }
    
                              }
    
                      }
    

@@ -859,11 +931,11 @@

                     Ext.message.msg(false, i18n_please_render_map_first);

                 }

                            }
  •                   }
    
  •                   }
    
              ]
    
      });
    
  •   var exportImageWindow=new Ext.Window({id:'exportimage_w',title:'<span id="window-image-title">' + i18n_export_map_as_image + '</span>',layout:'fit',closeAction:'hide',defaults:{layout:'fit',bodyStyle:'padding:8px; border:0px'},width:250,height:158,items:[{xtype:'panel',items:[exportImagePanel]}]});
    
  •   var exportImageWindow=new Ext.Window({id:'exportimage_w',title:'<span id="window-image-title">' + i18n_export_map_as_image + '</span>',layout:'fit',closeAction:'hide',defaults:{layout:'fit',bodyStyle:'padding:8px; border:0px'},width:250,height:210,items:[{xtype:'panel',items:[exportImagePanel]}]});
    
    
    
      var exportExcelWindow=new Ext.Window({id:'exportexcel_w',title:'<span id="window-excel-title">' + i18n_export_excel + '</span>',layout:'fit',closeAction:'hide',defaults:{layout:'fit',bodyStyle:'padding:8px; border:0px'},width:260,height:157,items:[{xtype:'panel',items:[exportExcelPanel]}]});
    
    
    
    
    
      /* Section: predefined map legend set */
    

@@ -871,7 +943,7 @@

     id: 'newpredefinedmaplegend_p',

            bodyStyle: 'border:0px solid #fff',

     items:
  •    [
    
  •    [
    
           { html: '<div class="window-field-label-first">'+i18n_display_name+'</div>' },
    
           new Ext.form.TextField({id:'predefinedmaplegendname_tf',isFormField:true,hideLabel:true,emptyText:GLOBAL.conf.emptytext,width:GLOBAL.conf.combo_width}),
    
           { html: '<div class="window-field-label">'+i18n_start_value+'</div>' },
    

=== 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-12-02 12:41:12 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2010-12-02 15:46:49 +0000

@@ -1404,7 +1404,7 @@

            getImageExportValues: function() {

                    return {

                            mapValueTypeValue: this.form.findField('mapvaluetype').getValue() == GLOBAL.conf.map_value_type_indicator ?
  •                                   this.form.findField('indicator').getValue() : this.form.findField('dataelement').getValue(),
    
  •                                   this.form.findField('indicator').getRawValue() : this.form.findField('dataelement').getRawValue(),
    
                              dateValue: GLOBAL.vars.mapDateType.isFixed() ?
    
                                      this.form.findField('period').getRawValue() : new Date(this.form.findField('startdate').getRawValue()).format('Y M j') + ' - ' + new Date(this.form.findField('enddate').getRawValue()).format('Y M j')
    
    
    
                      };
    

=== 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-12-02 12:41:12 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2010-12-02 19:03:23 +0000

@@ -1371,7 +1371,7 @@

            getImageExportValues: function() {

                    return {

                            mapValueTypeValue: this.form.findField('mapvaluetype').getValue() == GLOBAL.conf.map_value_type_indicator ?
  •                                   this.form.findField('indicator').getValue() : this.form.findField('dataelement').getValue(),
    
  •                                   this.form.findField('indicator').getRawValue() : this.form.findField('dataelement').getRawValue(),
    
                              dateValue: GLOBAL.vars.mapDateType.isFixed() ?
    
                                      this.form.findField('period').getRawValue() : new Date(this.form.findField('startdate').getRawValue()).format('Y M j') + ' - ' + new Date(this.form.findField('enddate').getRawValue()).format('Y M j')
    
    
    
                      };
    

Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp