=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-02-21 03:26:10 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-02-25 07:12:31 +0000 @@ -351,4 +351,5 @@ avg_dataelement_value = Average of data element values min_dataelement_value = Minimum of data element values max_dataelement_value = Maximum of data element values -assign_program_to_userroles = Assign program to userroles \ No newline at end of file +assign_program_to_userroles = Assign program to userroles +property_is_inserted = The property is inserted \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js 2013-01-29 14:45:08 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js 2013-02-25 07:12:31 +0000 @@ -132,7 +132,6 @@ function insertDataElement( source, programStageId ) { - var oEditor = jQuery("#designTextarea").ckeditorGet(); var dataElement = JSON.parse( jQuery( source + ' #dataElementIds').val() ); if( dataElement == null ) @@ -177,10 +176,11 @@ jQuery( source + " #message_").html( "" + i18n_dataelement_is_inserted + "" ); return; }else{ + var oEditor = jQuery("#designTextarea").ckeditorGet(); + oEditor.insertHtml( htmlCode ); jQuery( source + " #message_").html(""); } - oEditor.insertHtml( htmlCode ); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js 2013-02-02 10:34:22 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewPatientRegistationForm.js 2013-02-25 07:12:31 +0000 @@ -9,9 +9,8 @@ modal:false, overlay:{background:'#000000', opacity:0.1}, width:500, - height:400 + height:460 }); - showById('fixedAttrTab'); } function fixAttrOnClick() @@ -46,9 +45,110 @@ showById('programAttrTab'); } +function validateForm() +{ + var result = false; + var html = jQuery("#designTextarea").ckeditorGet().getData(); + + var requiredFields = new Array(); + requiredFields.push('fixedattributeid=registrationDate'); + requiredFields.push('fixedattributeid=fullName'); + requiredFields.push('fixedattributeid=gender'); + requiredFields.push('fixedattributeid=birthDate'); + + jQuery('#identifiersSelector option').each(function() { + var item = jQuery(this); + if( item.attr('mandatory')=='true'){ + requiredFields.push('identifierid=' + item.val()); + } + }); + + jQuery('#attributesSelector option').each(function() { + var item = jQuery(this); + if( item.attr('mandatory')=='true'){ + requiredFields.push('attributeid=' + item.val()); + } + }); + + var input = jQuery( html ).find("input"); + if( input.length > 0 ) + { + input.each( function(i, item){ + var key = ""; + var inputKey = jQuery(item).attr('fixedattributeid'); + if( inputKey!=undefined) + { + key = 'fixedattributeid=' + inputKey + } + else if( jQuery(item).attr('identifierid')!=undefined ){ + inputKey = jQuery(item).attr('identifierid'); + key = 'identifierid=' + inputKey + } + else if( jQuery(item).attr('attributeid')!=undefined ){ + inputKey = jQuery(item).attr('attributeid'); + key = 'attributeid=' + inputKey + } + else if( jQuery(item).attr('programid')!=undefined ){ + inputKey = jQuery(item).attr('programid'); + key = 'programid=' + inputKey + } + + for (var idx=0; idx 0 ) { + setFieldValue('requiredField',''); + return false; + } + else{ + setFieldValue('requiredField','everything_is_ok'); + setInnerHTML( 'designTextarea' , jQuery("#designTextarea").ckeditorGet().getData() ); + byId('saveDataEntryForm').submit(); + } +} + +function checkExisted( id ) +{ + var result = false; + var html = jQuery("#designTextarea").ckeditorGet().getData(); + var input = jQuery( html ).find("input"); + + input.each( function(i, item){ + var key = ""; + var inputKey = jQuery(item).attr('fixedattributeid'); + if( inputKey!=undefined) + { + key = 'fixedattributeid="' + inputKey + '"'; + } + else if( jQuery(item).attr('identifierid')!=undefined ){ + inputKey = jQuery(item).attr('identifierid'); + key = 'identifierid="' + inputKey + '"'; + } + else if( jQuery(item).attr('attributeid')!=undefined ){ + inputKey = jQuery(item).attr('attributeid'); + key = 'attributeid="' + inputKey + '"'; + } + else if( jQuery(item).attr('programid')!=undefined ){ + inputKey = jQuery(item).attr('programid'); + key = 'programid="' + inputKey + '"'; + } + + if( id == key ) result = true; + + }); + + return result; +} + function insertElement( type ) { - var oEditor = jQuery("#designTextarea").ckeditorGet(); var id = ''; var value = ''; if( type == 'fixedAttr' ){ @@ -74,5 +174,13 @@ var htmlCode = ""; - oEditor.insertHtml( htmlCode ); + if( checkExisted( id ) ){ + setMessage( "" + i18n_property_is_inserted + "" ); + return; + }else{ + var oEditor = jQuery("#designTextarea").ckeditorGet(); + oEditor.insertHtml( htmlCode ); + setMessage(""); + } + } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm 2013-02-20 15:10:33 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewPatientRegistationForm.vm 2013-02-25 07:12:31 +0000 @@ -7,7 +7,7 @@ setInnerHTML( 'designTextarea' , jQuery("#designTextarea").ckeditorGet().getData() ); form.submit(); } ); - + jQuery('#designTextarea').ckeditor(); #if($!registrationForm) jQuery("#designTextarea").ckeditorGet().setData('$encoder.jsEscape( $!registrationForm.dataEntryForm.htmlCode, "'" )'); @@ -42,7 +42,7 @@ } -
+ @@ -82,6 +82,9 @@ + + + @@ -100,7 +103,7 @@