=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java 2015-01-12 17:23:39 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java 2015-01-14 16:58:34 +0000 @@ -169,6 +169,7 @@ @RequestParam( value = "ou", required = false ) String ou, @RequestParam( value = "width", defaultValue = "800", required = false ) int width, @RequestParam( value = "height", defaultValue = "500", required = false ) int height, + @RequestParam( value = "attachment", required = false ) boolean attachment, HttpServletResponse response ) throws IOException { Chart chart = chartService.getChartNoAcl( uid ); @@ -185,7 +186,7 @@ String filename = CodecUtils.filenameEncode( chart.getName() ) + ".png"; - contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PNG, CacheStrategy.RESPECT_SYSTEM_SETTING, filename, false ); + contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PNG, CacheStrategy.RESPECT_SYSTEM_SETTING, filename, attachment ); ChartUtilities.writeChartAsPNG( response.getOutputStream(), jFreeChart, width, height ); } @@ -198,6 +199,7 @@ @RequestParam( value = "width", defaultValue = "800", required = false ) int width, @RequestParam( value = "height", defaultValue = "500", required = false ) int height, @RequestParam( value = "skipTitle", required = false ) boolean skipTitle, + @RequestParam( value = "attachment", required = false ) boolean attachment, HttpServletResponse response ) throws IOException { Indicator indicator = indicatorService.getIndicator( indicatorUid ); @@ -214,7 +216,7 @@ chart = chartService.getJFreeOrganisationUnitChart( indicator, unit, !skipTitle, i18nManager.getI18nFormat() ); } - contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PNG, CacheStrategy.RESPECT_SYSTEM_SETTING, "chart.png", false ); + contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PNG, CacheStrategy.RESPECT_SYSTEM_SETTING, "chart.png", attachment ); ChartUtilities.writeChartAsPNG( response.getOutputStream(), chart, width, height ); } === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java 2015-01-02 11:37:51 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java 2015-01-14 16:58:34 +0000 @@ -195,6 +195,7 @@ @RequestParam( value = "ou", required = false ) String ou, @RequestParam( required = false ) Integer width, @RequestParam( required = false ) Integer height, + @RequestParam( value = "attachment", required = false ) boolean attachment, HttpServletResponse response ) throws Exception { Map map = mappingService.getMapNoAcl( uid ); @@ -219,7 +220,7 @@ OrganisationUnit unit = ou != null ? organisationUnitService.getOrganisationUnit( ou ) : null; - renderMapViewPng( map, date, unit, width, height, response ); + renderMapViewPng( map, date, unit, width, height, attachment, response ); } //-------------------------------------------------------------------------- @@ -283,14 +284,14 @@ } } - private void renderMapViewPng( Map map, Date date, OrganisationUnit unit, Integer width, Integer height, HttpServletResponse response ) + private void renderMapViewPng( Map map, Date date, OrganisationUnit unit, Integer width, Integer height, boolean attachment, HttpServletResponse response ) throws Exception { BufferedImage image = mapGenerationService.generateMapImage( map, date, unit, width, height ); if ( image != null ) { - contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PNG, CacheStrategy.RESPECT_SYSTEM_SETTING, "map.png", false ); + contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PNG, CacheStrategy.RESPECT_SYSTEM_SETTING, "map.png", attachment ); ImageIO.write( image, "PNG", response.getOutputStream() ); } === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2015-01-14 10:27:59 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2015-01-14 16:58:34 +0000 @@ -121,3 +121,6 @@ could_not_delete_interpretation=Could not delete interpretation, please try again later could_not_delete_interpretation_comment=Could not delete interpretation comment, please try again later could_not_save_interpretation=Could not save interpretation, please try again later +download=Download +api_link=API link +get_as_image=Get as image \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm 2015-01-14 16:50:54 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm 2015-01-14 16:58:34 +0000 @@ -31,9 +31,10 @@ var i18n_see_fewer_hits = '$encoder.jsEscape( $i18n.getString( "see_fewer_hits" ), "'")'; var i18n_add = '$encoder.jsEscape( $i18n.getString( "add" ), "'")'; var i18n_click_and_drag_to_new_position = '$encoder.jsEscape( $i18n.getString( "click_and_drag_to_new_position" ), "'")'; +var i18n_get_as_image = '$encoder.jsEscape( $i18n.getString( "get_as_image" ), "'")'; jQuery( document ).ready( function() { - dhis2.leftBar.resetPosition(); ## Force left bar initial position when displaying dashboard + dhis2.leftBar.resetPosition(); }); @@ -81,7 +82,11 @@