=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2011-05-18 01:07:51 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2011-05-18 03:07:12 +0000 @@ -586,9 +586,15 @@ /main.vm + /dhis-web-maintenance-patient/programAttribute.vm + /dhis-web-maintenance-patient/patientAndProgramMenu.vm + javascript/commons.js,javascript/programAttribute.js + + + + /content.vm /dhis-web-maintenance-patient/programAttributeList.vm - /dhis-web-maintenance-patient/patientAndProgramMenu.vm - javascript/programAttribute.js - programAttribute.action - + + /dhis-web-commons/ajax/jsonResponseSuccess.vm F_PROGRAM_ATTRIBUTE_ADD - programAttribute.action - + + /dhis-web-commons/ajax/jsonResponseSuccess.vm F_PROGRAM_ATTRIBUTE_UPDATE @@ -631,23 +637,18 @@ - /main.vm + /content.vm /dhis-web-maintenance-patient/addProgramAttributeForm.vm - /dhis-web-maintenance-patient/patientAndProgramMenu.vm - javascript/programAttribute.js F_PROGRAM_ATTRIBUTE_ADD - /main.vm + /content.vm /dhis-web-maintenance-patient/updateProgramAttributeForm.vm - /dhis-web-maintenance-patient/patientAndProgramMenu.vm - javascript/programAttribute.js F_PROGRAM_ATTRIBUTE_UPDATE - @@ -959,16 +960,19 @@ /main.vm /dhis-web-maintenance-patient/caseAggregation.vm /dhis-web-maintenance-patient/patientAndProgramMenu.vm - javascript/caseaggregation.js + javascript/commons.js,javascript/caseaggregation.js + + + + /content.vm + /dhis-web-maintenance-patient/caseAggregationList.vm - /main.vm + /content.vm /dhis-web-maintenance-patient/addCaseAggregation.vm - /dhis-web-maintenance-patient/patientAndProgramMenu.vm - javascript/commons.js, - javascript/caseaggregation.js - /main.vm + /content.vm /dhis-web-maintenance-patient/updateCaseAggregation.vm /dhis-web-maintenance-patient/patientAndProgramMenu.vm javascript/commons.js, === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm 2011-05-16 09:29:20 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm 2011-05-18 03:07:12 +0000 @@ -34,6 +34,7 @@ +

$i18n.getString( "add_new_patient_attribute" )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramAttributeForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramAttributeForm.vm 2011-04-28 08:15:18 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramAttributeForm.vm 2011-05-18 03:07:12 +0000 @@ -4,20 +4,30 @@ var i18n_at_least_2_option = '$encoder.jsEscape( $i18n.getString( "at_least_2_option" ) , "'") '; var isSubmit = true; - jQuery(document).ready( function(){ - - validation( 'addProgramAttributeForm', function(form){ - if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) { - form.submit(); + jQuery('#addProgramAttributeForm').ready( function(){ + + validation( 'addProgramAttributeForm', function(form){ + if( isSubmit ) + { + addProgramAttribute(); } }, function(){ - isSubmit = true; - jQuery.each($('#addProgramAttributeForm').serializeArray(), function(i, field) { - if( field.value == ""){ - setInnerHTML("attrMessage", i18n_field_is_required); - isSubmit = false; - } - }); + isSubmit = ATTRIBUTE_OPTION.checkOnSubmit(); + + if( isSubmit ) + { + var fields = $("#addProgramAttributeForm").serializeArray(); + jQuery.each(fields, function(i, field) { + if( field.name.match("^attrOption")=='attrOption' && field.value == ""){ + setInnerHTML( "attrMessage", i18n_field_is_required ); + isSubmit = false; + } + }); + + }else + { + setInnerHTML( "attrMessage", i18n_at_least_2_option ); + } }); jQuery("#attributeComboRow").hide(); @@ -25,7 +35,9 @@ checkValueIsExist( "name", "validateProgramAttribute.action"); }); - + + +

$i18n.getString( "add_new_program_attribute" )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programAttribute.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programAttribute.js 2010-11-09 02:09:53 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programAttribute.js 2011-05-18 03:07:12 +0000 @@ -27,6 +27,7 @@ // ----------------------------------------------------------------------------- // Remove Program Attribute // ----------------------------------------------------------------------------- + function removeProgramAttribute( programAttributeId, name ) { removeItem( programAttributeId, name, i18n_confirm_delete, 'removeProgramAttribute.action' ); @@ -61,7 +62,6 @@ }); if( $("input","#attrOptionContainer").length < 2) { - alert(i18n_at_least_2_option); return false; }else return true; } @@ -99,6 +99,92 @@ }, createInput : function () { - return "[ - ]"; + return "[ - ]"; } -} \ No newline at end of file +} + +// ----------------------------------------------------------------------------- +// Add Program Attribute +// ----------------------------------------------------------------------------- + +function showAddProgramAttributeForm() +{ + hideById('programAttributeList'); + jQuery('#loaderDiv').show(); + jQuery('#editProgramAttributeForm').load('showAddProgramAttributeForm.action', + { + }, function() + { + showById('editProgramAttributeForm'); + jQuery('#loaderDiv').hide(); + }); +} + +function addProgramAttribute() +{ + $.ajax({ + type: "POST", + url: 'addProgramAttribute.action', + data: getParamsForDiv('addProgramAttributeForm'), + success: function( json ) { + if( json.response == 'success') + { + onClickBackBtn(); + } + } + }); + + return false; +} + +// ----------------------------------------------------------------------------- +// Update Program Attribute +// ----------------------------------------------------------------------------- + +function showUpdateProgramAttributeForm( programAttributeId ) +{ + hideById('programAttributeList'); + jQuery('#loaderDiv').show(); + jQuery('#editProgramAttributeForm').load('showUpdateProgramAttributeForm.action', + { + id:programAttributeId + }, function() + { + showById('editProgramAttributeForm'); + jQuery('#loaderDiv').hide(); + }); +} + +function updateProgramAttribute() +{ + $.ajax({ + type: "POST", + url: 'updateProgramAttribute.action', + data: getParamsForDiv('updateProgramAttributeForm'), + success: function( json ) { + if( json.response == 'success') + { + onClickBackBtn(); + } + } + }); + + return false; +} + +// ------------------------------------------------------------------ +// Click Back button +// ------------------------------------------------------------------ + +function onClickBackBtn() +{ + hideById('editProgramAttributeForm'); + jQuery('#loaderDiv').show(); + jQuery('#programAttributeList').load('programAttributeList.action', + { + }, function() + { + showById('programAttributeList'); + jQuery('#loaderDiv').hide(); + }); +} === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programAttribute.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programAttribute.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programAttribute.vm 2011-05-18 03:07:12 +0000 @@ -0,0 +1,30 @@ +
+ #parse( "/dhis-web-maintenance-patient/programAttributeList.vm" ) +
+ +#parse( "/dhis-web-commons/loader/loader.vm" ) + +
+

+ + + + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programAttributeList.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programAttributeList.vm 2010-11-09 02:09:53 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programAttributeList.vm 2011-05-18 03:07:12 +0000 @@ -9,7 +9,7 @@ - + $i18n.getString( "name" ) @@ -17,13 +17,14 @@ + #set( $mark = false ) #foreach( $programAttribute in $programAttributes ) - + $programAttribute.name - $i18n.getString( + $i18n.getString( @@ -31,14 +32,14 @@ - $i18n.getString( + $i18n.getString( + #set( $mark = !$mark) #end - - + @@ -56,21 +57,3 @@ - - - - === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm 2011-05-16 09:29:20 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm 2011-05-18 03:07:12 +0000 @@ -13,7 +13,7 @@ if( isSubmit ) { - var fields = $("#addPatientAttributeForm").serializeArray(); + var fields = $("#updatePatientAttributeForm").serializeArray(); jQuery.each(fields, function(i, field) { if( field.name.match("^attrOption")=='attrOption' && field.value == ""){ setInnerHTML( "attrMessage", i18n_field_is_required ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramAttributeForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramAttributeForm.vm 2011-04-28 08:15:18 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramAttributeForm.vm 2011-05-18 03:07:12 +0000 @@ -1,28 +1,38 @@ - + + +

$i18n.getString( "update_new_program_attribute" )