dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07817
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2304: Added Closing Date Validation and OrganisationUnit Code Validation in Maintenance/Organisation unit
------------------------------------------------------------
revno: 2304
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-10-04 16:29:24 +0530
message:
Added Closing Date Validation and OrganisationUnit Code Validation in Maintenance/Organisation unit
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js
dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/ValidateOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/paging.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-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.vm 2010-08-23 08:51:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.vm 2010-10-04 10:59:24 +0000
@@ -139,5 +139,6 @@
,password: '$encoder.jsEscape($i18n.getString( 'password_must_contain_at_least_one_capital_letter_and_one_digit' ) , "'")'
,notOnlyDigits: '$encoder.jsEscape($i18n.getString('only_digits_are_not_allowed' ) , "'")'
,custome_regex: validatorFormat("{1}")
+ ,greaterDate: '$encoder.jsEscape($i18n.getString('closedDate_should_be_greater_than_openDate' ) , "'")'
};
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js 2010-09-08 10:40:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js 2010-10-04 10:59:24 +0000
@@ -141,6 +141,17 @@
},
"Please Letters, numbers, spaces or some special chars like .,-,%,(,) only ");
+ jQuery.validator.addMethod("greaterDate",function(value, element, params) {
+
+ if ($(params).val()){
+ var closedDate = new Date(value);
+ var openDate= new Date($(params).val());
+ return closedDate > openDate;
+ }
+ return true;
+
+ }, "");
+
jQuery.validator.addMethod("alphanumeric", function(value, element) {
return this.optional(element) || /^[\w\s]+$/i.test(value);
}, "Letters, numbers, spaces or underscores only please");
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 2010-09-23 15:16:08 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 2010-10-04 10:59:24 +0000
@@ -316,6 +316,7 @@
please_fill_out_at_least_one_of_these_fields = Please fill out at least one of these fields.
password_must_contain_at_least_one_capital_letter_and_one_digit = Password must contain at least one capital letter and one digit
only_digits_are_not_allowed = Only digits are not allowed
+closedDate_should_be_greater_than_openDate = ClosedDate should be greater than OpenDate
please_enter_name = Please enter name!
please_select_period = Please select period!
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/ValidateOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/ValidateOrganisationUnitAction.java 2010-09-09 09:38:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/ValidateOrganisationUnitAction.java 2010-10-04 10:59:24 +0000
@@ -69,7 +69,15 @@
{
this.name = name;
}
-
+
+ private String code;
+
+ public void setCode( String code )
+ {
+ this.code = code;
+ }
+
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -109,6 +117,20 @@
return ERROR;
}
+ }
+
+
+ if ( code != null )
+ {
+
+ OrganisationUnit match = organisationUnitService.getOrganisationUnitByCode( code );
+
+ if ( match != null && (id == null || match.getId() != id) )
+ {
+ message = i18n.getString( "name_in_use" );
+
+ return ERROR;
+ }
}
message = "OK";
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties 2010-10-01 13:08:28 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties 2010-10-04 10:59:24 +0000
@@ -117,3 +117,4 @@
filter_by_name = Filter by name
loading = Loading
coordinates = Coordinates
+
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm 2010-09-21 06:16:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm 2010-10-04 10:59:24 +0000
@@ -3,6 +3,7 @@
validation( 'addOrganisationUnitForm' );
checkValueIsExist( "name", "validateOrganisationUnit.action");
+ checkValueIsExist( "code", "validateOrganisationUnit.action");
datePicker( 'openingDate' );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm 2010-09-21 06:16:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitForm.vm 2010-10-04 10:59:24 +0000
@@ -4,9 +4,15 @@
checkValueIsExist( "name", "validateOrganisationUnit.action", {
id: $organisationUnit.id
- });
+ });
+
+ checkValueIsExist( "code", "validateOrganisationUnit.action", {
+ id: $organisationUnit.id
+ });
datePickerInRange( 'openingDate', 'closedDate', true, false );
+
+
});
</script>
@@ -44,7 +50,7 @@
<tr #if( $numberOfChildren != 0 ) style="display:none" #end>
<td><label for="closedDate">$i18n.getString( "closed_date" ) ($i18n.getString( "format.date.label" ))</label></td>
- <td><input type="text" id="closedDate" name="closedDate" value="$!format.formatDate( $organisationUnit.closedDate )" style="width:20em"/></td>
+ <td><input type="text" id="closedDate" name="closedDate" value="$!format.formatDate( $organisationUnit.closedDate )" class="{validate:{greaterDate:'#openingDate'}}" style="width:20em"/></td>
</tr>
<tr>
<td><label for="active">$i18n.getString( "registers_date" )</label></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js 2010-09-28 09:06:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js 2010-10-04 10:59:24 +0000
@@ -625,6 +625,14 @@
{
var pageSize = jQuery("#sizeOfPage").val();
var currentPage = jQuery("#jumpToPage").val();
+ var numberOfPages = jQuery("#numberOfPages").val();
+
+ if( currentPage > numberOfPages )
+ {
+ //alert( "currentPage is: " +currentPage + " Greater than No of Pages: " +numberOfPages );
+ alert("Current Page should be less than No of pages" );
+ return false;
+ }
window.location.href = baseLink +"pageSize=" + pageSize +"¤tPage=" +currentPage;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/paging.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/paging.vm 2010-09-01 08:32:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/paging.vm 2010-10-04 10:59:24 +0000
@@ -7,13 +7,14 @@
<input type="hidden" id="baseLink" value="$!baseLink"/>
<input type="hidden" id="currentPage" value="$!currentPage"/>
+ <input type="hidden" id="numberOfPages" value="$!numberOfPages"/>
#if ( $numberOfPages > 0 )
<ul class="pageSizeSelection">
<li><span > $i18n.getString("no_of_pages"):</span> $numberOfPages</li>
<li> <span >$i18n.getString("size_of_page"):</span>
<input type="text" id="sizeOfPage" value="$!pageSize" style="width:50px" onchange="changePageSize('$baseLink');"></li>
<li> <span >$i18n.getString("jump_to_page"):</span>
- <input type="text" id="jumpToPage" value="$!currentPage" style="width:50px" onchange="jumpToPage('$baseLink');"></li>
+ <input type="text" id="jumpToPage" value="$!currentPage" style="width:50px" onchange="jumpToPage('$baseLink');" ></li>
</ul>
<div class="paging">
#if ($currentPage > 1)