dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14880
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5174: Chart/map title included in PNG filename.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 5174 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-11-16 16:14:51 +0000
message:
Chart/map title included in PNG filename.
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportImageAction.java
dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/ExportImageAction.java
dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/export/SVGDocument.java
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/datatable.png
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/exportimage.png
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/index.html
--
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/ExportImageAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportImageAction.java 2011-11-16 13:24:53 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/ExportImageAction.java 2011-11-16 16:13:06 +0000
@@ -199,7 +199,7 @@
@Override
protected String getFilename()
{
- return "DHIS2_GIS_" + this.title + ".png";
+ return "dhis2_gis_" + this.title + ".png";
}
@Override
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/ExportImageAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/ExportImageAction.java 2011-11-16 13:24:53 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/ExportImageAction.java 2011-11-16 16:13:06 +0000
@@ -54,6 +54,13 @@
// -------------------------------------------------------------------------
// Output & input
// -------------------------------------------------------------------------
+
+ private String title;
+
+ public void setTitle( String title )
+ {
+ this.title = title;
+ }
private String svg;
@@ -82,7 +89,7 @@
protected String execute( HttpServletResponse response, OutputStream out )
throws Exception
{
- if ( svg == null || width == null || height == null )
+ if ( title == null || svg == null || width == null || height == null )
{
log.info( "Export map from session" );
@@ -94,6 +101,7 @@
svgDocument = new SVGDocument();
+ svgDocument.setTitle( this.title );
svgDocument.setSvg( this.svg );
svgDocument.setWidth( this.width );
svgDocument.setHeight( this.height );
@@ -115,7 +123,7 @@
@Override
protected String getFilename()
{
- return "DHIS2_Visualizer.png";
+ return "dhis2_dv_" + this.title + ".png";
}
@Override
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/export/SVGDocument.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/export/SVGDocument.java 2011-11-16 13:24:53 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/export/SVGDocument.java 2011-11-16 16:13:06 +0000
@@ -37,6 +37,8 @@
+ "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\" ["
+ "<!ATTLIST svg xmlns:attrib CDATA #IMPLIED> <!ATTLIST path attrib:divname CDATA #IMPLIED>]>";
+ private String title;
+
private String svg;
private int width;
@@ -60,6 +62,17 @@
return svg;
}
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void setTitle( String title )
+ {
+ this.title = title;
+
+ }
+
public String getSvg()
{
return svg;
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js 2011-11-16 15:11:03 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js 2011-11-16 16:13:06 +0000
@@ -54,8 +54,7 @@
degrees: 330
}
}
- },
- inset: 30
+ }
},
style: {
label: {
@@ -361,18 +360,9 @@
'stroke-width': 0.2
};
},
- getTitle: function() {
- return {
- type: 'text',
- text: DV.init.isInit ? 'Example chart' : DV.state.filter.data[0],
- font: 'bold 15px arial',
- fill: '#222',
- width: 300,
- height: 20,
- x: 28,
- y: 16
- };
- },
+ //getTitlePosition: function(title) {
+ //var w = DV.util.viewport.getSize().x;
+ //var p = (w/2) - ((title.length/2) *
line: {
getSeriesArray: function() {
var a = [];
@@ -778,11 +768,21 @@
this.chart = Ext.create('Ext.chart.Chart', {
animate: true,
store: DV.store.chart,
- insetPadding: DV.conf.chart.inset,
- items: DV.util.chart.getTitle(),
+ insetPadding: 25,
+ items: [{
+ type: 'text',
+ text: DV.init.isInit ? 'Example chart' : DV.state.filter.data[0],
+ font: 'bold 15px arial',
+ fill: '#222',
+ width: 300,
+ height: 20,
+ x: 41,
+ y: 15
+ }],
legend: DV.util.chart.getLegend(),
axes: [
{
+ title: DV.init.isInit ? 'Value' : '',
type: 'Numeric',
position: 'left',
minimum: 0,
@@ -820,10 +820,10 @@
},
bar: function(stacked) {
this.chart = Ext.create('Ext.chart.Chart', {
+ width: DV.util.viewport.getSize().x,
+ height: DV.util.viewport.getSize().y,
animate: true,
store: DV.store.chart,
- insetPadding: DV.conf.chart.inset,
- items: DV.util.chart.getTitle(),
legend: DV.util.chart.getLegend(),
axes: [
{
@@ -865,10 +865,10 @@
},
line: function() {
this.chart = Ext.create('Ext.chart.Chart', {
+ width: DV.util.viewport.getSize().x,
+ height: DV.util.viewport.getSize().y,
animate: true,
store: DV.store.chart,
- insetPadding: DV.conf.chart.inset,
- items: DV.util.chart.getTitle(),
legend: DV.util.chart.getLegend(),
axes: [
{
@@ -897,10 +897,10 @@
},
area: function() {
this.chart = Ext.create('Ext.chart.Chart', {
+ width: DV.util.viewport.getSize().x,
+ height: DV.util.viewport.getSize().y,
animate: true,
store: DV.store.chart,
- insetPadding: DV.conf.chart.inset,
- items: DV.util.chart.getTitle(),
legend: DV.util.chart.getLegend(),
axes: [
{
@@ -937,12 +937,13 @@
},
pie: function() {
this.chart = Ext.create('Ext.chart.Chart', {
+ width: DV.util.viewport.getSize().x,
+ height: DV.util.viewport.getSize().y,
animate: true,
shadow: true,
store: DV.store.chart,
+ legend: DV.util.chart.getLegend(),
insetPadding: 60,
- items: DV.util.chart.getTitle(),
- legend: DV.util.chart.getLegend(),
series: [{
type: 'pie',
field: DV.store.chart.left[0],
@@ -1843,6 +1844,7 @@
return;
}
+ document.getElementById('titleField').value = DV.state.filter.data[0];
document.getElementById('svgField').value = svg[0].parentNode.innerHTML;
document.getElementById('widthField').value = DV.util.viewport.getSize().x - 100;
document.getElementById('heightField').value = DV.util.viewport.getSize().y - 100;
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/datatable.png'
Binary files dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/datatable.png 2011-11-16 15:22:52 +0000 and dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/datatable.png 2011-11-16 16:13:06 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/exportimage.png'
Binary files dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/exportimage.png 2011-11-16 15:22:52 +0000 and dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/exportimage.png 2011-11-16 16:13:06 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/index.html'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/index.html 2011-11-16 13:24:53 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/index.html 2011-11-16 16:13:06 +0000
@@ -9,6 +9,7 @@
<script type="text/javascript" src="app.js"></script>
<form id="exportPNGForm" method="post">
+ <input type="hidden" id="titleField" name="title"/>
<input type="hidden" id="svgField" name="svg"/>
<input type="hidden" id="widthField" name="width"/>
<input type="hidden" id="heightField" name="height"/>