dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17281
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6817: Implemented data element and org unit id scheme in import user interface
------------------------------------------------------------
revno: 6817
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-04-30 22:10:16 +0200
message:
Implemented data element and org unit id scheme in import user interface
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.utils.js
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.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/importDataValue.vm
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importSummary.vm
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importDataValue.js
--
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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.utils.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.utils.js 2012-03-26 18:11:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.utils.js 2012-04-30 20:10:16 +0000
@@ -12,5 +12,16 @@
$.ajax( { url:url, data:data, type:'get', dataType:'html', success:function( data ) {
$( '#' + elementId ).html( data );
} } );
+ },
+
+ toggleCss: function( elementId, property, value1, value2 ) {
+ var id = '#' + elementId;
+ var curValue = $( id ).css( property );
+ if ( curValue == value1 ) {
+ $( id ).css( property, value2 );
+ }
+ else {
+ $( id ).css( property, value1 );
+ }
}
} );
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java 2012-04-18 13:51:28 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java 2012-04-30 20:10:16 +0000
@@ -36,6 +36,8 @@
import java.io.InputStreamReader;
import java.io.Reader;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.common.IdentifiableObject.IdentifiableProperty;
import org.hisp.dhis.dxf2.datavalueset.DataValueSetService;
import org.hisp.dhis.dxf2.metadata.ImportOptions;
@@ -56,6 +58,8 @@
public class ImportDataValueAction
implements Action
{
+ private static final Log log = LogFactory.getLog( ImportDataValueAction.class );
+
@Autowired
private DataValueSetService dataValueSetService;
@@ -89,7 +93,21 @@
{
this.strategy = ImportStrategy.valueOf( stgy );
}
+
+ private IdentifiableProperty dataElementIdScheme;
+
+ public void setDataElementIdScheme( IdentifiableProperty dataElementIdScheme )
+ {
+ this.dataElementIdScheme = dataElementIdScheme;
+ }
+
+ private IdentifiableProperty orgUnitIdScheme;
+ public void setOrgUnitIdScheme( IdentifiableProperty orgUnitIdScheme )
+ {
+ this.orgUnitIdScheme = orgUnitIdScheme;
+ }
+
private String importFormat;
public void setImportFormat( String importFormat )
@@ -109,6 +127,10 @@
public String execute()
throws Exception
{
+ strategy = strategy != null ? strategy : ImportStrategy.NEW_AND_UPDATES;
+ dataElementIdScheme = dataElementIdScheme != null ? dataElementIdScheme : IdentifiableProperty.UID;
+ orgUnitIdScheme = orgUnitIdScheme != null ? orgUnitIdScheme : IdentifiableProperty.UID;
+
InputStream in = new FileInputStream( upload );
in = StreamUtils.wrapAndCheckZip( in );
@@ -117,7 +139,9 @@
TaskId taskId = new TaskId( TaskCategory.DATAVALUE_IMPORT, currentUserService.getCurrentUser() );
- ImportOptions options = new ImportOptions( IdentifiableProperty.UID, IdentifiableProperty.UID, dryRun, strategy );
+ ImportOptions options = new ImportOptions( dataElementIdScheme, orgUnitIdScheme, dryRun, strategy );
+
+ log.info( options );
scheduler.executeTask( new ImportDataValueTask( dataValueSetService, in, reader, options, taskId, importFormat ) );
=== 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 2013-01-01 02:14:39 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2012-04-30 20:10:16 +0000
@@ -297,4 +297,10 @@
integration=Integration
add_route=Add route
route=Route
-integration_configuration=Integration Configuration
\ No newline at end of file
+integration_configuration=Integration Configuration
+data_element_id_scheme=Data element ID scheme
+org_unit_id_scheme=Org unit ID scheme
+uid=UID
+name=Name
+code=Code
+more_options=More options
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm 2012-04-15 19:45:25 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm 2012-04-30 20:10:16 +0000
@@ -1,14 +1,14 @@
<h3>$!i18n.getString( $importFormat ) $i18n.getString( "data_import" )</h3>
-<div class="inputCriteria" style="height:130px">
+<div id="inputCriteria" class="inputCriteria" style="height:144px">
<form id="importForm" name="importForm" method="post" enctype="multipart/form-data" action="importDataValue.action?importFormat=$!{importFormat}">
<table>
-<col width="80">
+<col width="140">
<col>
<tr>
<td>$i18n.getString( "file" )</td>
- <td><input type="file" id="upload" name="upload"></td>
+ <td><input type="file" id="upload" name="upload" style="margin-left:0px"></td>
</tr>
<tr>
<td>$i18n.getString( "dry_run" )</td>
@@ -27,6 +27,26 @@
</tr>
<tr>
<td></td>
+ <td><a href="javascript:toggleOptions()">$i18n.getString( "more_options" )</a></td>
+</tr>
+<tr class="moreOptions" style="display:none">
+ <td>$i18n.getString( "data_element_id_scheme" )</td>
+ <td><select id="dataElementIdScheme" name="dataElementIdScheme" style="width:180px">
+ <option value="UID">$i18n.getString( "uid" )</option>
+ <option value="NAME">$i18n.getString( "name" )</option>
+ <option value="CODE">$i18n.getString( "code" )</option>
+ </select></td>
+</tr>
+<tr class="moreOptions" style="display:none">
+ <td>$i18n.getString( "org_unit_id_scheme" )</td>
+ <td><select id="orgUnitIdScheme" name="orgUnitIdScheme" style="width:180px">
+ <option value="UID">$i18n.getString( "uid" )</option>
+ <option value="NAME">$i18n.getString( "name" )</option>
+ <option value="CODE">$i18n.getString( "code" )</option>
+ </select></td>
+</tr>
+<tr>
+ <td></td>
<td><input type="button" value="$i18n.getString( 'import' )" style="width:120px" onclick="importDataValue()"/></td>
</tr>
</table>
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importSummary.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importSummary.vm 2012-04-15 20:21:18 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importSummary.vm 2012-04-30 20:10:16 +0000
@@ -8,8 +8,8 @@
<h4>$i18n.getString( "import_count" )</h4>
#if( $summary.dataValueCount )
<table>
-<col width="80">
-<col width="80">
+<col width="110">
+<col width="110">
<tr>
<th>$i18n.getString( "type" )</th>
<th style="text-align:center">$i18n.getString( "count" )</th>
@@ -34,6 +34,8 @@
<h4>$i18n.getString( "conflicts" )</h4>
#if( $summary.conflicts.size() > 0 )
<table>
+<col width="110">
+<col width="110">
<tr>
<th>$i18n.getString( "element" )</th>
<th>$i18n.getString( "description" )</th>
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importDataValue.js'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importDataValue.js 2012-04-14 21:03:54 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importDataValue.js 2012-04-30 20:10:16 +0000
@@ -12,6 +12,12 @@
$( "#importForm" ).submit();
}
+function toggleOptions()
+{
+ $( ".moreOptions" ).toggle();
+ $.toggleCss( "inputCriteria", "height", "144px", "200px" );
+}
+
function pingNotificationsTimeout()
{
pingNotifications( 'DATAVALUE_IMPORT', 'notificationTable', displaySummaryLink );