------------------------------------------------------------ revno: 2251 committer: Tran Chau <tran.hispviet...@gmail.com> branch nick: dhis2 timestamp: Thu 2010-12-02 10:44:08 +0700 message: Fix bug: Validate data-value according to properties file into dhis-web-commons-resources for Case-entry form. 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/dataEntryMenu.vm dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.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-caseentry/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2010-11-25 22:22:10 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2010-12-02 03:44:08 +0000 @@ -25,7 +25,7 @@ <result name="success" type="velocity">/main.vm</result> <param name="page">/dhis-web-caseentry/select.vm</param> <param name="menu">/dhis-web-caseentry/dataEntryMenu.vm</param> - <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js</param> + <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js, ../dhis-web-commons/javascripts/date.js</param> </action> <action name="searchform" class="org.hisp.dhis.caseentry.action.caseentry.SearchPatientFormAction"> @@ -33,7 +33,7 @@ <result name="success" type="velocity">/main.vm</result> <param name="page">/dhis-web-caseentry/search.vm</param> <param name="menu">/dhis-web-caseentry/dataEntryMenu.vm</param> - <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js</param> + <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js, ../dhis-web-commons/javascripts/date.js</param> </action> <action name="validateSearch" @@ -49,7 +49,7 @@ <result name="success" type="velocity">/main.vm</result> <param name="page">/dhis-web-caseentry/listPatient.vm</param> <param name="menu">/dhis-web-caseentry/dataEntryMenu.vm</param> - <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js</param> + <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js, ../dhis-web-commons/javascripts/date.js</param> </action> <action name="listAllPatients" class="org.hisp.dhis.caseentry.action.caseentry.SearchPatientAction"> @@ -58,7 +58,7 @@ <param name="listAll">true</param> <param name="page">/dhis-web-caseentry/listPatient.vm</param> <param name="menu">/dhis-web-caseentry/dataEntryMenu.vm</param> - <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js</param> + <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js, ../dhis-web-commons/javascripts/date.js</param> </action> <action name="selectDataRecording" class="org.hisp.dhis.caseentry.action.caseentry.DataRecordingSelectAction"> @@ -68,7 +68,7 @@ <result name="success" type="velocity">/main.vm</result> <param name="page">/dhis-web-caseentry/dataRecordingSelect.vm</param> <param name="menu">/dhis-web-caseentry/dataEntryMenu.vm</param> - <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js</param> + <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js, ../dhis-web-commons/javascripts/date.js</param> <param name="stylesheets">style/patient.css</param> </action> @@ -85,7 +85,7 @@ <result name="success" type="velocity">/main.vm</result> <param name="page">/dhis-web-caseentry/dataEntryForm.vm</param> <param name="menu">/dhis-web-caseentry/dataEntryMenu.vm</param> - <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js</param> + <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js, ../dhis-web-commons/javascripts/date.js</param> <param name="stylesheets">style/patient.css</param> </action> @@ -129,7 +129,7 @@ <result name="success" type="velocity">/main.vm</result> <param name="page">/dhis-web-caseentry/dataEntryForm.vm</param> <param name="menu">/dhis-web-caseentry/dataEntryMenu.vm</param> - <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js,javascript/customcheckbox/prettyCheckboxes.js</param> + <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js,javascript/customcheckbox/prettyCheckboxes.js, ../dhis-web-commons/javascripts/date.js</param> <param name="stylesheets">style/patient.css,javascript/customcheckbox/prettyCheckboxes.css</param> </action> @@ -139,7 +139,7 @@ <result name="success" type="velocity">/main.vm</result> <param name="page">/dhis-web-caseentry/multiDataEntrySelect.vm</param> <param name="menu">/dhis-web-caseentry/dataEntryMenu.vm</param> - <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js</param> + <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js, ../dhis-web-commons/javascripts/date.js</param> </action> <action name="getDataRecords" class="org.hisp.dhis.caseentry.action.caseentry.GetDataRecordsAction"> @@ -147,7 +147,7 @@ <result name="success" type="velocity">/main.vm</result> <param name="page">/dhis-web-caseentry/dataentryRecords.vm</param> <param name="menu">/dhis-web-caseentry/dataEntryMenu.vm</param> - <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js,javascript/customcheckbox/prettyCheckboxes.js</param> + <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/dataEntry.js,javascript/customcheckbox/prettyCheckboxes.js, ../dhis-web-commons/javascripts/date.js</param> <param name="stylesheets">style/patient.css,javascript/customcheckbox/prettyCheckboxes.css,../dhis-web-commons/paging/paging.css</param> </action> === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryMenu.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryMenu.vm 2010-08-05 12:25:16 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryMenu.vm 2010-12-02 03:44:08 +0000 @@ -8,3 +8,6 @@ <br> #parse( "/dhis-web-commons/ouwt/orgunittree.vm" ) +<script type="text/javascript"> + var formatter = '$encoder.jsEscape( $i18n.getString( "format.date.label" ) , "'")'; +</script> === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js 2010-10-28 09:17:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js 2010-12-02 03:44:08 +0000 @@ -786,7 +786,7 @@ function isDateFormat( value ) { - return /^\d{4}-\d{2}-\d{2}$/.test( value ); + return isDate(value, formatter); } /** @@ -927,7 +927,7 @@ if( !isDateFormat( field.value ) ) { field.style.backgroundColor = '#ffcc00'; - window.alert('Incorrect format for date value. The correct format should be yyyy-mm-d \n\n '+dataElementName ); + window.alert('Incorrect format for date value. The correct format should be ' + formatter + '\n\n '+dataElementName ); field.select(); field.focus(); @@ -952,13 +952,13 @@ var providedByAnotherFacility = document.getElementById( data.programStageId+'_'+data.dataElementId+'_facility' ).checked; if(jQuery(this_).val()!="") - { + { if( !isDateFormat( jQuery(this_).val() ) ) { jQuery(this_).css({ "background-color":"#ffcc00" }); - window.alert('Incorrect format for date value. The correct format should be yyyy-mm-d \n\n '+data.dataElementName ); + window.alert('Incorrect format for date value. The correct format should be ' + formatter +' \n\n '+data.dataElementName ); jQuery(this_).focus();
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp