dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07266
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2051: (GIS) Export to image fixed.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2051 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-09-03 20:26:34 +0530
message:
(GIS) Export to image fixed.
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/script/index.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.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-09-03 09:19:46 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportExcelAction.java 2010-09-03 14:54:54 +0000
@@ -164,9 +164,9 @@
this.indicator = indicator;
}
- private Integer period;
+ private String period;
- public void setPeriod( Integer period )
+ public void setPeriod( String period )
{
this.period = period;
}
@@ -216,10 +216,6 @@
{
log.info( "Exporting workbook, width: " + width + ", height: " + height );
- Period p = periodService.getPeriod( period );
-
- p.setName( format.formatPeriod( p ) );
-
Indicator i = indicatorService.getIndicator( indicator );
// ---------------------------------------------------------------------
@@ -230,7 +226,7 @@
svgDocument.setTitle( this.title );
svgDocument.setSvg( this.svg );
- svgDocument.setPeriod( p );
+ svgDocument.setPeriod( period );
svgDocument.setIndicator( i );
svgDocument.setLegends( this.legends );
svgDocument.setIncludeLegends( this.includeLegends );
@@ -286,7 +282,7 @@
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, titlePositionRow + 2, i18n.getString( "Period" ), header ) );
- sheet.addCell( new Label( titlePositionCol + 2, titlePositionRow + 2, p.getName(), headerContent ) );
+ sheet.addCell( new Label( titlePositionCol + 2, titlePositionRow + 2, period, headerContent ) );
// ---------------------------------------------------------------------
// Write data values to workbook
=== 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 11:09:50 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportImageAction.java 2010-09-03 14:54:54 +0000
@@ -72,13 +72,6 @@
this.indicatorService = indicatorService;
}
- protected I18nFormat format;
-
- public void setFormat( I18nFormat format )
- {
- this.format = format;
- }
-
// -------------------------------------------------------------------------
// Output & input
// -------------------------------------------------------------------------
@@ -104,9 +97,9 @@
this.indicator = indicator;
}
- private Integer period;
+ private String period;
- public void setPeriod( Integer period )
+ public void setPeriod( String period )
{
this.period = period;
}
@@ -159,10 +152,6 @@
{
log.info( "Export map from request" );
- Period _period = periodService.getPeriod( period );
-
- _period.setName( format.formatPeriod( _period ) );
-
Indicator _indicator = indicatorService.getIndicator( indicator );
svgDocument = new SVGDocument();
@@ -170,7 +159,7 @@
svgDocument.setTitle( title );
svgDocument.setSvg( svg );
svgDocument.setIndicator( _indicator );
- svgDocument.setPeriod( _period );
+ svgDocument.setPeriod( period );
svgDocument.setLegends( legends );
svgDocument.setIncludeLegends( includeLegends );
svgDocument.setWidth( width );
=== 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 09:19:46 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/export/SVGDocument.java 2010-09-03 14:54:54 +0000
@@ -51,7 +51,7 @@
private String legends;
- private Period period;
+ private String period;
private Indicator indicator;
@@ -74,7 +74,7 @@
+ this.indicator.getName() + "</tspan></text></g>";
String period_ = "<g id=\"period\" style=\"display: block; visibility: visible;\"><text id=\"period\" x=\"30\" y=\"45\" font-size=\"12\"><tspan>"
- + this.period.getName() + "</tspan></text></g>";
+ + this.period + "</tspan></text></g>";
String svg_ = doctype + this.svg;
@@ -233,12 +233,12 @@
this.legends = legends;
}
- public Period getPeriod()
+ public String getPeriod()
{
return period;
}
- public void setPeriod( Period period )
+ public void setPeriod( String period )
{
this.period = period;
}
=== 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-09-03 12:26:57 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-09-03 14:54:54 +0000
@@ -90,12 +90,10 @@
function toggleFeatureLabelsPoints(layer) {
function activateLabels() {
layer.styleMap = getActivatedOpenLayersStyleMap(MAPDATA[thematicMap2].nameColumn);
- layer.refresh();
LABELS[thematicMap2] = true;
}
function deactivateLabels() {
layer.styleMap = getDeactivatedOpenLayersStyleMap();
- layer.refresh();
LABELS[thematicMap2] = false;
}
@@ -112,12 +110,10 @@
function toggleFeatureLabelsAssignment(classify, layer) {
function activateLabels() {
layer.styleMap = getActivatedOpenLayersStyleMap(MAPDATA[organisationUnitAssignment].nameColumn);
- layer.refresh();
LABELS[organisationUnitAssignment] = true;
}
function deactivateLabels() {
layer.styleMap = getDeactivatedOpenLayersStyleMap();
- layer.refresh();
LABELS[organisationUnitAssignment] = false;
}
@@ -143,18 +139,17 @@
function getExportDataValueJSON(mapvalues){var json='{';json+='"datavalues":';json+='[';mapvalues.sort(sortByValue);for(var i=0;i<mapvalues.length;i++){json+='{';json+='"organisation": "'+mapvalues[i].orgUnitId+'",';json+='"value": "'+mapvalues[i].value+'" ';json+=i<mapvalues.length-1?'},':'}'}json+=']';json+='}';return json}
function getLegendsJSON(){
- var legends=choropleth.imageLegend;
- var json='{';
- json+='"legends":';
- json+='[';
- for(var i=0;i<choropleth.imageLegend.length;i++){
- json+='{';
- json+='"label": "'+choropleth.imageLegend[i].label+'",';
- json+='"color": "'+choropleth.imageLegend[i].color+'" ';
- json+=i<choropleth.imageLegend.length-1?'},':'}';
+ var json = '{';
+ json += '"legends":';
+ json += '[';
+ for(var i = 0; i < choropleth.imageLegend.length; i++) {
+ json += '{';
+ json += '"label": "' + choropleth.imageLegend[i].label + '",';
+ json += '"color": "' + choropleth.imageLegend[i].color + '" ';
+ json += i < choropleth.imageLegend.length-1 ? '},' : '}';
}
- json+=']';
- json+='}';
+ json += ']';
+ json += '}';
return json;
}
@@ -560,7 +555,7 @@
width: combo_width_fieldset,
minListWidth: combo_list_width_fieldset,
mode: 'local',
- triggerAction: 'all'
+ triggerAction: 'all'
},
{
xtype: 'combo',
@@ -602,25 +597,25 @@
if (ACTIVEPANEL == thematicMap) {
vcb = Ext.getCmp('mapvaluetype_cb').getValue() == map_value_type_indicator ? Ext.getCmp('indicator_cb').getValue() : Ext.getCmp('dataelement_cb').getValue();
dcb = MAPDATETYPE == map_date_type_fixed ? Ext.getCmp('period_cb').getValue() : Ext.getCmp('startdate_df').getValue() && Ext.getCmp('startdate_df').getValue() ? true : false;
- period = MAPDATETYPE == map_date_type_fixed ? Ext.getCmp('period_cb').getValue() : Ext.getCmp('startdate_df').getValue() + ' - ' + Ext.getCmp('enddate_df').getValue();
+ period = MAPDATETYPE == map_date_type_fixed ? Ext.getCmp('period_cb').getRawValue() : new Date(Ext.getCmp('startdate_df').getRawValue()).format('Y M j') + ' - ' + new Date(Ext.getCmp('enddate_df').getRawValue()).format('Y M j');
mcb = MAPSOURCE == map_source_type_database ? Ext.getCmp('map_tf').getValue() : Ext.getCmp('map_cb').getValue();
- lcb = Ext.getCmp('maplegendtype_cb').getValue() == map_legend_type_automatic ? true : Ext.getCmp('maplegend_cb').getValue() ? true : false;
+ lcb = Ext.getCmp('maplegendtype_cb').getValue() == map_legend_type_automatic ? true : Ext.getCmp('maplegendset_cb').getValue() ? true : false;
}
else if (ACTIVEPANEL == thematicMap2) {
vcb = Ext.getCmp('mapvaluetype_cb2').getValue() == map_value_type_indicator ? Ext.getCmp('indicator_cb2').getValue() : Ext.getCmp('dataelement_cb2').getValue();
dcb = MAPDATETYPE == map_date_type_fixed ? Ext.getCmp('period_cb2').getValue() : Ext.getCmp('startdate_df2').getValue() && Ext.getCmp('startdate_df2').getValue() ? true : false;
- period = MAPDATETYPE == map_date_type_fixed ? Ext.getCmp('period_cb2').getValue() : Ext.getCmp('startdate_df2').getValue() + ' - ' + Ext.getCmp('enddate_df2').getValue();
+ period = MAPDATETYPE == map_date_type_fixed ? Ext.getCmp('period_cb2').getRawValue() : new Date(Ext.getCmp('startdate_df2').getRawValue()).format('Y M j') + ' - ' + new Date(Ext.getCmp('enddate_df2').getRawValue()).format('Y M j');
mcb = MAPSOURCE == map_source_type_database ? Ext.getCmp('map_tf2').getValue() : Ext.getCmp('map_cb2').getValue();
- lcb = Ext.getCmp('maplegendtype_cb2').getValue() == map_legend_type_automatic ? true : Ext.getCmp('maplegend_cb2').getValue() ? true : false;
+ lcb = Ext.getCmp('maplegendtype_cb2').getValue() == map_legend_type_automatic ? true : Ext.getCmp('maplegendset_cb2').getValue() ? true : false;
}
if (vcb && dcb && mcb && lcb) {
var svgChildren = document.getElementById('_OpenLayers_Container').childNodes;
var svgDivId = null;
- for ( i=0; i<svgChildren.length; i++ ) { // Search for div containing SVG
+ for (i = 0; i < svgChildren.length; i++) { // Search for div containing SVG
svgDivId = svgChildren[i].getAttribute('id');
- if ( svgDivId && svgDivId.indexOf( 'OpenLayers.Layer.Vector_' ) != -1 ) {
+ if (svgDivId && svgDivId.indexOf('OpenLayers.Layer.Vector_') != -1) {
break;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js 2010-08-26 16:20:21 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js 2010-09-03 14:54:54 +0000
@@ -113,9 +113,9 @@
map_legend_type_automatic : Ext.getCmp('maplegendtype_cb').getValue();
if (mapLegendType == map_legend_type_automatic) {
- this.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(initialColors[0], initialColors[1], numColors);
- for (var i = 0; i < choropleth.imageLegend.length && i < choropleth.colorInterpolation.length; i++) {
- choropleth.imageLegend[i].color = choropleth.colorInterpolation[i].toHexString();
+ this.colorInterpolation = choropleth.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(initialColors[0], initialColors[1], numColors);
+ for (var i = 0; i < choropleth.imageLegend.length && i < this.colorInterpolation.length; i++) {
+ choropleth.imageLegend[i].color = this.colorInterpolation[i].toHexString();
}
}
else if (mapLegendType == map_legend_type_predefined) {
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js 2010-08-03 17:21:49 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js 2010-09-03 14:54:54 +0000
@@ -120,9 +120,9 @@
var mapLegendType = ACTIVEPANEL == organisationUnitAssignment ? map_legend_type_automatic : Ext.getCmp('maplegendtype_cb2').getValue();
if (mapLegendType == map_legend_type_automatic) {
- this.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(initialColors[0], initialColors[1], numColors);
- for (var i = 0; i < proportionalSymbol.imageLegend.length && i < proportionalSymbol.colorInterpolation.length; i++) {
- proportionalSymbol.imageLegend[i].color = proportionalSymbol.colorInterpolation[i].toHexString();
+ this.colorInterpolation = proportionalSymbol.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(initialColors[0], initialColors[1], numColors);
+ for (var i = 0; i < proportionalSymbol.imageLegend.length && i < this.colorInterpolation.length; i++) {
+ proportionalSymbol.imageLegend[i].color = this.colorInterpolation[i].toHexString();
}
}
else if (mapLegendType == map_legend_type_predefined) {
=== 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-03 12:59:16 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2010-09-03 14:54:54 +0000
@@ -171,7 +171,7 @@
});
},
- validateForm: function() {
+ validateForm2: function() {
if (!Ext.getCmp('indicator_cb').getValue() && !Ext.getCmp('dataelement_cb').getValue()) {
return false;
}