dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24286
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11876: made it possible to export all types of programs, also possible to export all programstages or a ...
------------------------------------------------------------
revno: 11876
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-09-03 13:15:40 +0200
message:
made it possible to export all types of programs, also possible to export all programstages or a specific one
modified:
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/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-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-09-02 08:27:33 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2013-09-03 11:15:40 +0000
@@ -298,13 +298,16 @@
event_data_import=Event Data Import
event_data_export=Event Data Export
programs=Programs
+program_stages=Program Stages
format=Format
compression=Compression
compression_gzip=Gzip
compression_zip=Zip
uncompressed=Uncompressed
no_programs_available=No programs available
+no_program_stages_available=No program stages available
no_data_values_found=No data values found
+all_program_stages=All program stages
create_new_route=Create new route
integration=Integration
add_route=Add route
=== 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 2013-09-02 10:47:40 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/eventExportForm.vm 2013-09-03 11:15:40 +0000
@@ -7,8 +7,14 @@
$( '#submit' ).on( 'click', function() {
var format = $( '#format' ).val();
var program = $( '#programs' ).val();
+ var programStage = $( '#programStages' ).val();
+
var url = '../api/events' + format + "?program=" + program;
+ if( programStage && programStage.length > 0 ) {
+ url += "&programStage=" + programStage;
+ }
+
if( program.length == 0 ) {
setHeaderDelayMessage( "No program selected." );
return false;
@@ -29,7 +35,6 @@
url += "&links=false";
window.location = url;
- console.log(url);
});
selectionTreeSelection.setMultipleSelectionAllowed( false );
@@ -37,10 +42,7 @@
selectionTree.buildSelectionTree();
$.ajax({
- url: '../api/programs.json',
- data: {
- type: 3
- }
+ url: '../api/programs.json'
} ).done(function(data) {
var options = [];
@@ -57,6 +59,30 @@
}
$( '#programs' ).html( options );
+ $( '#programs' ).trigger('change');
+ });
+
+ $( '#programs' ).on( 'change', function( e ) {
+ var program = $( '#programs' ).val();
+ $( '#programStages' ).attr('disabled', true);
+ $( '#programStages' ).html($( '<option/>' ).html('$i18n.getString( "no_program_stages_available" )'));
+
+ $.ajax({
+ url: '../api/programs/' + program + '.json'
+ } ).done(function(data) {
+ var options = [];
+
+ $.each(data.programStages, function(idx, item) {
+ var option = $( '<option/>' ).html( item.name ).val(item.id);
+ options.push( option );
+ });
+
+ if( options.length > 0 ) {
+ var option = $( '<option/>' ).html( "[ " + "$i18n.getString("all_program_stages")" +" ]" ).val( '' );
+ options.unshift( option );
+ $( '#programStages' ).removeAttr( 'disabled' ).html( options );
+ }
+ });
});
});
</script>
@@ -86,6 +112,14 @@
</tr>
<tr>
+ <td>$i18n.getString( "program_stages" )</td>
+ <td><select disabled="disabled" style="width: 300px;" id="programStages" name="programStages">
+ <option>$i18n.getString( "no_program_stages_available" )</option>
+ </select>
+ </td>
+</tr>
+
+<tr>
<td>$i18n.getString("start_date")</td>
<td><input type="text" id="startDate" name="startDate" value="$!startDate" style="width:300px"></td>
</tr>