dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08609
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2098: Merged two requests in dataentry
------------------------------------------------------------
revno: 2098
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2010-11-18 09:13:18 +0100
message:
Merged two requests in dataentry
added:
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDataSets.vm
modified:
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.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-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java 2010-11-17 18:26:47 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java 2010-11-18 08:13:18 +0000
@@ -8,6 +8,7 @@
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.comparator.DataSetNameComparator;
import org.hisp.dhis.de.state.SelectedStateManager;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
import com.opensymphony.xwork2.Action;
@@ -35,6 +36,13 @@
{
return dataSets;
}
+
+ private OrganisationUnit organisationUnit;
+
+ public OrganisationUnit getOrganisationUnit()
+ {
+ return organisationUnit;
+ }
// -------------------------------------------------------------------------
// Action implementation
@@ -45,6 +53,8 @@
dataSets = selectedStateManager.loadDataSetsForSelectedOrgUnit();
Collections.sort( dataSets, new DataSetNameComparator() );
+
+ organisationUnit = selectedStateManager.getSelectedOrganisationUnit();
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml 2010-11-17 18:26:47 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml 2010-11-18 08:13:18 +0000
@@ -24,7 +24,7 @@
</action>
<action name="loadDataSets" class="org.hisp.dhis.de.action.LoadDataSetsAction">
- <result name="success" type="velocity-json">../dhis-web-commons/ajax/jsonDataSets.vm</result>
+ <result name="success" type="velocity-json">/dhis-web-dataentry/responseDataSets.vm</result>
</action>
<action name="loadPeriods" class="org.hisp.dhis.de.action.LoadPeriodsAction">
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2010-11-17 18:26:47 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2010-11-18 08:13:18 +0000
@@ -28,13 +28,11 @@
clearList( list );
addOptionToList( list, '-1', '[ Select ]' );
-
- $.getJSON( '../dhis-web-commons-ajax-json/getOrganisationUnit.action?id=' + orgUnits[0], function( json ) {
+
+ $.getJSON( url, function( json ) {
$('#selectedOrganisationUnit').val( json.organisationUnit.name );
$('#currentOrganisationUnit').html( json.organisationUnit.name );
- } );
-
- $.getJSON( url, function( json ) {
+
for ( i in json.dataSets ) {
addOptionToList( list, json.dataSets[i].id, json.dataSets[i].name );
}
=== added file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDataSets.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDataSets.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDataSets.vm 2010-11-18 08:13:18 +0000
@@ -0,0 +1,17 @@
+#set( $size = $dataSets.size() )
+{ "dataSets": [
+#foreach( $dataSet in $dataSets )
+ {
+ "id": $!{dataSet.id},
+ "name": "$!encoder.jsEncode( ${dataSet.name} )",
+ "shortName": "$!encoder.jsEncode( ${dataSet.shortName} )",
+ "periodTypeId": "$!{dataSet.periodTypeId}"
+ }#if( $velocityCount < $size ),#end
+#end ],
+ "organisationUnit":
+ {
+ "id": $!{organisationUnit.id},
+ "name": "$!encoder.jsEncode( ${organisationUnit.name} )",
+ "shortName": "$!encoder.jsEncode( ${organisationUnit.shortName} )"
+ }
+}
\ No newline at end of file