=== 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_ = "" + String title_ = "" + this.title + ""; String indicator_ = "" + this.indicator.getName() + ""; - String period_ = "" + String period_ = "" + this.period.getName() + ""; String svg_ = doctype + this.svg; @@ -81,8 +81,6 @@ if ( this.includeLegends ) { svg_ = svg_.replaceFirst( "", this.getLegendScript( 30, 45 ) + "" ); - - svg_ = svg_.replaceFirst( "", this.getLegendScript( 15, 70 ) + "" ); } return new StringBuffer( svg_ ); @@ -111,8 +109,11 @@ JSONArray jsonLegends = json.getJSONArray( "legends" ); String result = doctype; + result += ""; + result += ""; int x = 0; @@ -138,6 +139,7 @@ } result += ""; + result += ""; 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.');