dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34080
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17492: support csv.gz export in event export UI, add attachment= parameter to URL so that files are down...
------------------------------------------------------------
revno: 17492
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-11-17 14:54:34 +0700
message:
support csv.gz export in event export UI, add attachment= parameter to URL so that files are downloaded and not directly shown in the browser.
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/eventExportForm.vm
--
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-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java 2014-11-17 07:37:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java 2014-11-17 07:54:34 +0000
@@ -205,7 +205,15 @@
events.setEvents( PagerUtils.pageCollection( events.getEvents(), pager ) );
}
- OutputStream outputStream = isGzip( request ) ? new GZIPOutputStream( response.getOutputStream() ) : response.getOutputStream();
+ OutputStream outputStream = response.getOutputStream();
+ response.setContentType( "application/csv" );
+
+ if ( isGzip( request ) )
+ {
+ response.addHeader( ContextUtils.HEADER_CONTENT_TRANSFER_ENCODING, "binary" );
+ outputStream = new GZIPOutputStream( outputStream );
+ response.setContentType( "application/csv+gzip" );
+ }
if ( !StringUtils.isEmpty( attachment ) )
{
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/eventExportForm.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/eventExportForm.vm 2014-11-11 21:08:03 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/eventExportForm.vm 2014-11-17 07:54:34 +0000
@@ -10,8 +10,9 @@
var program = $( '#programs' ).val();
var programStage = $( '#programStages' ).val();
var inclusion = $( '#inclusion' ).val();
+ var file = "events" + format + compression;
- var url = '../api/events' + format + compression + "?program=" + program;
+ var url = '../api/' + file + "?attachment=" + file + "&program=" + program;
if( programStage && programStage.length > 0 ) {
url += "&programStage=" + programStage;