=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SvgConversionController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SvgConversionController.java 2013-12-23 22:31:12 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SvgConversionController.java 2013-12-24 15:33:27 +0000 @@ -45,7 +45,6 @@ import org.hisp.dhis.system.util.CodecUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; @@ -57,8 +56,8 @@ @Autowired private ContextUtils contextUtils; - @RequestMapping( value = "/svg.png", method = RequestMethod.POST, consumes = ContextUtils.CONTENT_TYPE_XML ) - public void toPng( @RequestBody String svg, @RequestParam( required = false ) String filename, HttpServletResponse response ) + @RequestMapping( value = "/svg.png", method = RequestMethod.POST, consumes = { ContextUtils.CONTENT_TYPE_XML, ContextUtils.CONTENT_TYPE_FORM_ENCODED } ) + public void toPng( @RequestParam String svg, @RequestParam( required = false ) String filename, HttpServletResponse response ) throws Exception { String name = filename != null ? ( CodecUtils.filenameEncode( filename ) + ".png" ) : "file.png"; @@ -68,8 +67,8 @@ convertToPng( svg, response.getOutputStream() ); } - @RequestMapping( value = "/svg.pdf", method = RequestMethod.POST, consumes = ContextUtils.CONTENT_TYPE_XML ) - public void toPdf( @RequestBody String svg, @RequestParam( required = false ) String filename, HttpServletResponse response ) + @RequestMapping( value = "/svg.pdf", method = RequestMethod.POST, consumes = { ContextUtils.CONTENT_TYPE_XML, ContextUtils.CONTENT_TYPE_FORM_ENCODED } ) + public void toPdf( @RequestParam String svg, @RequestParam( required = false ) String filename, HttpServletResponse response ) throws Exception { String name = filename != null ? ( CodecUtils.filenameEncode( filename ) + ".pdf" ) : "file.pdf"; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java 2013-12-22 09:15:53 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java 2013-12-24 15:33:27 +0000 @@ -74,6 +74,7 @@ public static final String CONTENT_TYPE_JPG = "image/jpeg"; public static final String CONTENT_TYPE_EXCEL = "application/vnd.ms-excel"; public static final String CONTENT_TYPE_JAVASCRIPT = "application/javascript; charset=UTF-8"; + public static final String CONTENT_TYPE_FORM_ENCODED = "application/x-www-form-urlencoded"; public static final String HEADER_USER_AGENT = "User-Agent"; public static final String HEADER_CACHE_CONTROL = "Cache-Control"; === 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 2013-11-28 11:24:14 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/index.html 2013-12-24 15:33:27 +0000 @@ -13,8 +13,7 @@
- - +
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2013-12-24 15:22:04 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2013-12-24 15:33:27 +0000 @@ -1356,10 +1356,9 @@ svg = svg.parent().dom.innerHTML; Ext.query('#svgField')[0].value = svg; - Ext.query('#typeField')[0].value = type; - Ext.query('#nameField')[0].value = 'test'; + Ext.query('#filenameField')[0].value = 'test'; - form.action = '../exportImage.action'; + form.action = '../../api/svg.' + type; form.submit(); }; }());