dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #05298
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1741: Previous merge complete.
------------------------------------------------------------
revno: 1741
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-04-07 13:02:26 +0200
message:
Previous merge complete.
modified:
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
--
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/export/SVGDocument.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/export/SVGDocument.java 2010-04-07 10:21:57 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/export/SVGDocument.java 2010-04-07 11:02:26 +0000
@@ -63,13 +63,13 @@
public StringBuffer getSVGForImage()
{
- String title_ = "<g id=\"title\" style=\"display: block; visibility: visible;\"><text id=\"title\" x=\"15\" 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=\"15\" font-size=\"14\" font-weight=\"bold\"><tspan>"
+ this.title + "</tspan></text></g>";
String indicator_ = "<g id=\"indicator\" style=\"display: block; visibility: visible;\"><text id=\"indicator\" x=\"30\" y=\"45\" font-size=\"12\"><tspan>"
+ this.indicator.getName() + "</tspan></text></g>";
- String period_ = "<g id=\"period\" style=\"display: block; visibility: visible;\"><text id=\"period\" x=\"15\" y=\"30\" font-size=\"12\"><tspan>"
+ String period_ = "<g id=\"period\" style=\"display: block; visibility: visible;\"><text id=\"period\" x=\"30\" y=\"30\" font-size=\"12\"><tspan>"
+ this.period.getName() + "</tspan></text></g>";
String svg_ = doctype + this.svg;
@@ -81,8 +81,6 @@
if ( this.includeLegends )
{
svg_ = svg_.replaceFirst( "</svg>", this.getLegendScript( 30, 45 ) + "</svg>" );
-
- svg_ = svg_.replaceFirst( "</svg>", this.getLegendScript( 15, 70 ) + "</svg>" );
}
return new StringBuffer( svg_ );
@@ -111,8 +109,11 @@
JSONArray jsonLegends = json.getJSONArray( "legends" );
String result = doctype;
+
result += "<svg width='100%' height='100%' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' ";
+
result += "xmlns:attrib='http://www.carto.net/attrib/' viewBox='0 0 1 " + jsonLegends.size() + "'>";
+
result += "<g id='legend'>";
int x = 0;
@@ -138,6 +139,7 @@
}
result += "</g>";
+
result += "</svg>";
return result;
=== 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-04-07 10:21:57 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-04-07 11:02:26 +0000
@@ -1,4 +1,4 @@
-Ext.BLANK_IMAGE_URL = '../resources/ext/resources/images/default/s.gif';
+Ext.BLANK_IMAGE_URL = '../resources/ext/resources/images/default/s.gif';
var MAP;
var BASECOORDINATE;
@@ -621,10 +621,10 @@
minListWidth: combo_list_width_fieldset,
mode: 'local',
triggerAction: 'all',
- value: 2,
+ value: 1,
store: new Ext.data.SimpleStore({
fields: ['id', 'text'],
- data: [[1, 'Small'], [2, 'Medium'], [4, 'Large']]
+ data: [[1, 'Medium'], [2, 'Large']]
})
},
{
@@ -648,9 +648,6 @@
&& Ext.getCmp('indicator_cb').getValue()!=''
&& Ext.getCmp('map_cb').getValue()!='') {
- MASK.msg = 'Exporting image...';
- MASK.show();
-
var svg = document.getElementById('OpenLayers.Layer.Vector_17').innerHTML;
var objectSVGDocument = document.getElementById('OpenLayers.Layer.Vector_17').childNodes[0];
var viewBox = objectSVGDocument.getAttribute('viewBox');
@@ -661,27 +658,22 @@
var includeLegend = Ext.getCmp('export_image_include_legend').getValue();
var period = Ext.getCmp('period_cb').getValue();
var indicator = Ext.getCmp('indicator_cb').getValue();
+
+ var exportForm = document.getElementById('exportForm');
+ exportForm.action = '../exportImage.action';
+ exportForm.target = '_blank';
+
+ document.getElementById('titleField').value = title;
+ document.getElementById('viewBoxField').value = 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 = period;
+ document.getElementById('indicatorField').value = indicator;
+ document.getElementById('legendsField').value = getLegendsJSON();
- Ext.Ajax.request({
- url: path + 'exportImage' + type,
- method: 'POST',
- params: {
- title: title,
- viewBox: viewBox,
- svg: svg,
- width: w,
- height: h,
- includeLegends: includeLegend,
- period: period,
- indicator: indicator,
- legends: getLegendsJSON()
- },
- success: function(r) {
- MASK.hide();
- var file = Ext.util.JSON.decode(r.responseText).file;
- window.open(path + "download" + type + "?path=" + file + "&outputFormat=application/image" );
- }
- });
+ exportForm.submit();
}
else {
Ext.messageRed.msg('Export map as image', 'Please render the thematic map first.');
@@ -738,35 +730,28 @@
&& Ext.getCmp('indicator_cb').getValue()!=''
&& Ext.getCmp('map_cb').getValue()!='') {
- MASK.msg = 'Exporting spreadsheet...';
- MASK.show();
var title = Ext.getCmp('export_excel_title').getValue();
var svg = document.getElementById('OpenLayers.Layer.Vector_17').innerHTML;
var includeLegend = Ext.getCmp('export_excel_include_legend').getValue();
var includeValues = Ext.getCmp('export_excel_include_value').getValue();
var period = Ext.getCmp('period_cb').getValue();
- var indicator = Ext.getCmp('indicator_cb').getValue();
- Ext.Ajax.request({
- url: path + 'exportExcel' + type,
- method: 'POST',
- params: {
- title: title,
- width: 500,
- height: 500,
- svg: svg,
- includeLegends: includeLegend,
- includeValues: includeValues,
- period: period,
- indicator: indicator,
- datavalues: EXPORTVALUES,
- legends: getLegendsJSON()
- },
- success: function(r) {
- MASK.hide();
- var file = Ext.util.JSON.decode(r.responseText).file;
- window.open(path + "download" + type + "?path=" + file + "&outputFormat=application/ms-excel" );
- }
- });
+ var indicator = Ext.getCmp('indicator_cb').getValue();
+
+ var exportForm = document.getElementById('exportForm');
+ exportForm.action = '../exportExcel.action';
+
+ document.getElementById('titleField').value = title;
+ document.getElementById('svgField').value = svg;
+ document.getElementById('widthField').value = 500;
+ document.getElementById('heightField').value = 500;
+ document.getElementById('includeLegendsField').value = includeLegend;
+ document.getElementById('includeValuesField').value = includeValues;
+ document.getElementById('periodField').value = period;
+ document.getElementById('indicatorField').value = indicator;
+ document.getElementById('legendsField').value = getLegendsJSON();
+ document.getElementById('dataValuesField').value = EXPORTVALUES;
+
+ exportForm.submit();
}
else {
Ext.messageRed.msg('Export map as Excel spreadsheet', 'Please render the thematic map first.');