dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33978
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17414: implemented csv import ui
------------------------------------------------------------
revno: 17414
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-11-11 12:27:33 +0545
message:
implemented csv import ui
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/event/ImportEventAction.java
dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/eventImportForm.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-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2014-11-06 09:35:11 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2014-11-11 06:42:33 +0000
@@ -72,6 +72,7 @@
import org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValueService;
import org.hisp.dhis.user.CurrentUserService;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.io.IOException;
@@ -91,6 +92,7 @@
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
+@Transactional
public abstract class AbstractEventService
implements EventService
{
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/event/ImportEventAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/event/ImportEventAction.java 2014-11-11 06:11:25 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/event/ImportEventAction.java 2014-11-11 06:42:33 +0000
@@ -89,11 +89,11 @@
this.dryRun = dryRun;
}
- public String format;
+ public String payloadFormat;
- public void setFormat( String format )
+ public void setPayloadFormat( String payloadFormat )
{
- this.format = format;
+ this.payloadFormat = payloadFormat;
}
private String orgUnitIdScheme = "UID";
@@ -128,14 +128,14 @@
importOptions.setDryRun( dryRun );
importOptions.setOrgUnitIdScheme( orgUnitIdScheme );
- if ( "csv".equals( format ) )
+ if ( "csv".equals( payloadFormat ) )
{
Events events = csvEventService.readEvents( in, skipFirst );
scheduler.executeTask( new ImportEventsTask( events.getEvents(), eventService, importOptions, taskId ) );
}
else
{
- boolean jsonInput = "json".equals( format );
+ boolean jsonInput = "json".equals( payloadFormat );
scheduler.executeTask( new ImportEventTask( in, eventService, importOptions, taskId, jsonInput ) );
}
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2014-10-10 14:07:30 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2014-11-11 06:42:33 +0000
@@ -316,6 +316,7 @@
programs=Programs
program_stages=Program Stages
format=Format
+skip_first=Skip First Row
compression=Compression
compression_gzip=Gzip
compression_zip=Zip
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/eventImportForm.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/eventImportForm.vm 2014-11-11 06:11:25 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/eventImportForm.vm 2014-11-11 06:42:33 +0000
@@ -1,4 +1,14 @@
-
+<script>
+$(function() {
+ $('#payloadFormat').on('change', function( e ) {
+ if( "csv" === $('#payloadFormat').val() ) {
+ $('#trSkipFirst').show();
+ } else {
+ $('#trSkipFirst').hide();
+ }
+ });
+})
+</script>
<h3>$i18n.getString( "event_data_import" )</h3>
<div id="inputCriteria" class="inputCriteria" style="width: 380px">
@@ -20,13 +30,22 @@
<tr>
<td>$i18n.getString( "format" )</td>
<td>
- <select id="format" style="width: 190px;">
+ <select id="payloadFormat" name="payloadFormat" style="width: 190px;">
<option value="xml">XML</option>
<option value="json">JSON</option>
<option value="csv">CSV</option>
</select>
</td>
</tr>
+<tr id="trSkipFirst" style="display: none;">
+ <td>$i18n.getString( "skip_first" )</td>
+ <td>
+ <select id="skipFirst" name="skipFirst" style="width: 190px;">
+ <option value="true">Yes</option>
+ <option value="false">No</option>
+ </select>
+ </td>
+</tr>
<tr>
<td>$i18n.getString( "orgunit_scheme" )</td>
<td><select id="orgUnitIdScheme" name="orgUnitIdScheme" style="width:190px">