← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3338: WIP: validation rules

 

------------------------------------------------------------
revno: 3338
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-04-11 13:16:51 +0200
message:
  WIP: validation rules
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addRoleForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addUserGroupForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/updateRoleForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/updateUserGroupForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateRoleForm.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/javascripts/validationRules.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js	2011-04-11 09:51:38 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js	2011-04-11 11:16:51 +0000
@@ -43,17 +43,23 @@
 	},
 	"role" : {
 		"name" : {
+			"required" : true,
 			"rangelength" : [ 2, 140 ]
 		},
 		"description" : {
+			"required" : true,
 			"rangelength" : [ 2, 210 ]
 		}
 	},
 	"userGroup" : {
 		"name" : {
+			"required" : true,
 			"rangelength" : [ 2, 210 ],
 			"alphanumericwithbasicpuncspaces" : true,
 			"firstletteralphabet" : true
+		},
+		"memberValidator" : {
+			"required" : true
 		}
 	},
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm	2011-03-14 21:10:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm	2011-04-11 11:16:51 +0000
@@ -12,15 +12,11 @@
 	</tr>
 	<tr>
 		<td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td><input type="text" id="name" name="name" style="width:20em"></td>
-		<td></td>
-		<td></td>
+		<td colspan="3"><input type="text" id="name" name="name" style="width:20em"></td>
 	</tr>
 	<tr>
 		<td><label for="description">$i18n.getString( "description" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td><input type="text" id="description" name="description" style="width:20em""></td>
-		<td></td>
-		<td></td>
+		<td colspan="3"><input type="text" id="description" name="description" style="width:20em""></td>
 	</tr>
 	<tr>
 		<td colspan="4" height="10"></td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addRoleForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addRoleForm.js	2011-03-23 08:45:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addRoleForm.js	2011-04-11 11:16:51 +0000
@@ -2,31 +2,15 @@
 {
 	jQuery( "#name" ).focus();
 
-	var r = getValidationRules();
-
-	var rules = {
-		name : {
-			required : true,
-			rangelength : r.role.name.rangelength
-		},
-		description : {
-			required : true,
-			rangelength : r.role.description.rangelength
-		}
-	}
-
 	validation2( 'addRoleForm', function( form )
 	{
 		selectAllById( 'selectedList' );
 		selectAllById( 'selectedListAuthority' );
 		form.submit();
 	}, {
-		'rules' : rules
+		'rules' : getValidationRules("role")
 	} );
 
-	jQuery( "#name" ).attr( "maxlength", r.role.name.rangelength[1] );
-	jQuery( "#description" ).attr( "maxlength", r.role.description.rangelength[1] );
-
 	/* remote validation */
 	checkValueIsExist( "name", "validateRole.action" );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addUserGroupForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addUserGroupForm.js	2011-03-23 08:45:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addUserGroupForm.js	2011-04-11 11:16:51 +0000
@@ -1,19 +1,5 @@
 jQuery( document ).ready( function()
 {
-	var r = getValidationRules();
-
-	var rules = {
-		name : {
-			required : true,
-			alphanumericwithbasicpuncspaces : r.userGroup.name.alphanumericwithbasicpuncspaces,
-			firstletteralphabet : r.userGroup.name.firstletteralphabet,
-			rangelength : r.userGroup.name.rangelength
-		},
-		memberValidator : {
-			required : true
-		}
-	};
-
 	validation2( 'addUserGroupForm', function( form )
 	{
 		form.submit()
@@ -22,11 +8,9 @@
 		{
 			listValidator( 'memberValidator', 'groupMembers' );
 		},
-		'rules' : rules
+		'rules' : getValidationRules("userGroup")
 	} );
 
-	jQuery( "#name" ).attr( "maxlength", r.userGroup.name.rangelength[1] );
-
 	/* remote validation */
 	checkValueIsExist( "name", "validateUserGroup.action" );
 } );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/updateRoleForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/updateRoleForm.js	2011-03-23 08:45:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/updateRoleForm.js	2011-04-11 11:16:51 +0000
@@ -2,31 +2,15 @@
 {
 	jQuery( "#name" ).focus();
 
-	var r = getValidationRules();
-
-	var rules = {
-		name : {
-			required : true,
-			rangelength : r.role.name.rangelength
-		},
-		description : {
-			required : true,
-			rangelength : r.role.description.rangelength
-		}
-	};
-
 	validation2( 'updateRoleForm', function( form )
 	{
 		selectAllById( 'selectedList' );
 		selectAllById( 'selectedListAuthority' );
 		form.submit();
 	}, {
-		'rules' : rules
+		'rules' : getValidationRules("role")
 	} );
 
-	jQuery( "#name" ).attr( "maxlength", r.role.name.rangelength[1] );
-	jQuery( "#description" ).attr( "maxlength", r.role.description.rangelength[1] );
-
 	/* remote validation */
 	checkValueIsExist( "name", "validateRole.action", {
 		id : getFieldValue( 'id' )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/updateUserGroupForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/updateUserGroupForm.js	2011-03-23 08:45:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/updateUserGroupForm.js	2011-04-11 11:16:51 +0000
@@ -1,19 +1,5 @@
 jQuery( document ).ready( function()
 {
-	var r = getValidationRules();
-
-	var rules = {
-		name : {
-			required : true,
-			alphanumericwithbasicpuncspaces : r.userGroup.name.alphanumericwithbasicpuncspaces,
-			firstletteralphabet : r.userGroup.name.firstletteralphabet,
-			rangelength : r.userGroup.name.rangelength
-		},
-		memberValidator : {
-			required : true
-		}
-	};
-
 	validation2( 'editUserGroupForm', function( form )
 	{
 		form.submit()
@@ -22,8 +8,6 @@
 		{
 			listValidator( 'memberValidator', 'groupMembers' );
 		},
-		'rules' : rules
+		'rules' : getValidationRules("userGroup")
 	} );
-
-	jQuery( "#name" ).attr( "maxlength", r.userGroup.name.rangelength[1] );
 } );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateRoleForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateRoleForm.vm	2011-03-14 21:10:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateRoleForm.vm	2011-04-11 11:16:51 +0000
@@ -13,15 +13,11 @@
 		</tr>
 		<tr>
 			<td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-			<td><input type="text" id="name" name="name" value="$!encoder.htmlEncode( $userAuthorityGroup.name )" style="width:20em"></td>
-			<td></td>
-			<td></td>
+			<td colspan="3"><input type="text" id="name" name="name" value="$!encoder.htmlEncode( $userAuthorityGroup.name )" style="width:20em"></td>
 		</tr>
 		<tr>
 			<td><label for="description">$i18n.getString( "description" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-			<td><input type="text" id="description" name="description" value="$!encoder.htmlEncode( $userAuthorityGroup.description )" style="width:20em"/></td>
-			<td></td>
-			<td></td>
+			<td colspan="3"><input type="text" id="description" name="description" value="$!encoder.htmlEncode( $userAuthorityGroup.description )" style="width:20em"/></td>
 		</tr>
 		<tr>
 			<td colspan="4" height="10"></td>