dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17966
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7375: List anonymous programs by the selected prgunit when to select an orgunit.
------------------------------------------------------------
revno: 7375
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-06-25 13:15:22 +0700
message:
List anonymous programs by the selected prgunit when to select an orgunit.
added:
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonAnonymousPrograms.vm
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.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-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-06-25 04:46:52 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-06-25 06:15:22 +0000
@@ -119,7 +119,7 @@
<action name="anonymousPrograms"
class="org.hisp.dhis.caseentry.action.caseentry.LoadAnonymousProgramsAction">
- <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonPrograms.vm</result>
+ <result name="success" type="velocity-json">/dhis-web-caseentry/jsonAnonymousPrograms.vm</result>
<param name="requiredAuthorities">F_NAME_BASED_DATA_ENTRY</param>
</action>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2012-06-25 02:11:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2012-06-25 06:15:22 +0000
@@ -1,12 +1,7 @@
<script type="text/javascript">
jQuery(document).ready( function(){
datePickerInRange( 'startDate' , 'endDate' );
-
- jQuery('#criteriaDiv :input').each( function( idx, item ){
- disable(this.id);
- });
- enable('orgunitName');
- enable('programId');
+ disableCriteriaDiv();
});
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2012-06-25 04:35:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2012-06-25 06:15:22 +0000
@@ -1,6 +1,24 @@
function organisationUnitSelected( orgUnits, orgUnitNames )
{
+ hideById('dataEntryInfor');
+ hideById('listDiv');
+
+ jQuery.getJSON( "anonymousPrograms.action",{},
+ function( json )
+ {
+ clearListById('searchObjectId');
+ clearListById('compulsoryDE');
+ clearListById('programId');
+
+ jQuery( '#programId').append( '<option value="">[' + i18n_please_select + ']</option>' );
+ for ( i in json.programs ) {
+ jQuery( '#programId').append( '<option value="' + json.programs[i].id +'" programStageId="' + json.programs[i].programStageId + '">' + json.programs[i].name + '</option>' );
+ }
+
+ disableCriteriaDiv();
+ });
+
setFieldValue( 'orgunitId', orgUnits[0] );
setFieldValue( 'orgunitName', orgUnitNames[0] );
hideById('listDiv');
@@ -9,6 +27,22 @@
selection.setListenerFunction( organisationUnitSelected );
+function disableCriteriaDiv()
+{
+ jQuery('#criteriaDiv :input').each( function( idx, item ){
+ disable(this.id);
+ });
+ enable('orgunitName');
+ enable('programId');
+}
+
+function enableCriteriaDiv()
+{
+ jQuery('#criteriaDiv :input').each( function( idx, item ){
+ enable(this.id);
+ });
+}
+
function getDataElements()
{
hideById('dataEntryInfor');
@@ -20,9 +54,7 @@
if( programStageId == '')
{
removeAllAttributeOption();
- jQuery('#criteriaDiv :input').each( function( idx, item ){
- disable(this.id);
- });
+ disableCriteriaDiv();
enable('orgunitName');
enable('programId');
hideById('listDiv');
@@ -36,6 +68,7 @@
},
function( json )
{
+ clearListById('searchObjectId');
clearListById('compulsoryDE');
jQuery( '#searchObjectId').append( '<option value="">[' + i18n_please_select + ']</option>' );
@@ -47,9 +80,7 @@
}
}
- jQuery('#criteriaDiv :input').each( function( idx, item ){
- enable(this.id);
- });
+ enableCriteriaDiv();
});
}
@@ -82,7 +113,7 @@
}
}
-function autocompletedFilterField( idField, dataElementId )
+function autocompletedFilterField( idField, searchObjectId )
{
var input = jQuery( "#" + idField );
input.autocomplete({
@@ -90,7 +121,7 @@
minLength: 0,
source: function( request, response ){
$.ajax({
- url: "getOptions.action?id=" + dataElementId + "&query=" + input.val(),
+ url: "getOptions.action?id=" + searchObjectId + "&query=" + input.val(),
dataType: "json",
success: function(data) {
response($.map(data.options, function(item) {
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js 2012-06-25 04:17:52 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js 2012-06-25 06:15:22 +0000
@@ -5,8 +5,9 @@
jQuery('#programDiv').load("getPrograms.action",{},
function()
{
+ hideById('btnBack');
+ hideById('programName');
showById('programDiv');
- hideById('btnBack');
setFieldValue( 'orgunitName', orgUnitNames[0] );
hideLoader();
});
@@ -33,6 +34,7 @@
showById('programName');
showById('btnBack');
+ showById('programName');
showById("listPatient");
hideLoader();
});
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonAnonymousPrograms.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonAnonymousPrograms.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonAnonymousPrograms.vm 2012-06-25 06:15:22 +0000
@@ -0,0 +1,14 @@
+#set( $size = $programs.size() )
+{
+ "programs": [
+ #foreach( $program in $programs )
+ {
+ "id": ${program.id} ,
+ "name": "$!encoder.jsonEncode( ${program.name} )",
+ "programStageId":
+ #foreach( $programStage in $program.programStages )
+ "$programStage.id"
+ #end
+ }#if( $velocityCount < $size ),#end
+ #end]
+}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm 2012-06-25 02:11:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm 2012-06-25 06:15:22 +0000
@@ -8,7 +8,8 @@
</td>
<td>
<input type="button" class='large-button' id='listPatientBtn' value="$i18n.getString( 'list_all_patients' )" onclick="javascript:listAllPatient();" #if($organisationUnit) #else disabled #end>
- </td>
+ </td>
+ <td><input type="button" id='addPatientBtn' name='addPatientBtn' class='large-button' value='$i18n.getString( "add_new" )' onclick="showAddPatientForm();"></td>
</tr>
</table>