← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 3344
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-04-11 14:23:17 +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-validationrule/src/main/webapp/dhis-web-validationrule/javascript/addValidationRuleForm.js
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/addValidationRuleGroupForm.js
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/updateValidationRuleForm.js
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/updateValidationRuleGroupForm.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-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 12:08:16 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js	2011-04-11 12:23:17 +0000
@@ -194,14 +194,28 @@
 	/* dhis-web-validationrule */
 	"validationRule" : {
 		"name" : {
+			"required" : true,
 			"rangelength" : [ 2, 160 ]
 		},
 		"description" : {
 			"rangelength" : [ 2, 160 ]
+		},
+		"periodTypeName" : {
+			"required" : true
+		},
+		"operator" : {
+			"required" : true
+		},
+		"leftSideExpression" : {
+			"required" : true
+		},
+		"rightSideExpression" : {
+			"required" : true
 		}
 	},
 	"validationRuleGroup" : {
 		"name" : {
+			"required" : true,
 			"rangelength" : [ 2, 160 ]
 		},
 		"description" : {

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/addValidationRuleForm.js'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/addValidationRuleForm.js	2011-03-29 08:15:49 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/addValidationRuleForm.js	2011-04-11 12:23:17 +0000
@@ -1,38 +1,11 @@
 jQuery(document).ready(function() {
 	jQuery("#name").focus();
 
-	var r = getValidationRules();
-
-	var rules = {
-		name : {
-			required : true,
-			rangelength : r.validationRule.name.rangelength
-		},
-		description : {
-			rangelength : r.validationRule.description.rangelength
-		},
-		periodTypeName : {
-			required : true
-		},
-		operator : {
-			required : true
-		},
-		leftSideExpression : {
-			required : true
-		},
-		rightSideExpression : {
-			required : true
-		}
-	};
-
 	validation2('addValidationRuleForm', function(form) {
 		form.submit();
 	}, {
-		'rules' : rules
+		'rules' : getValidationRules("validationRule")
 	});
 
-	jQuery("#name").attr("maxlength", r.validationRule.name.rangelength[1]);
-	jQuery("#description").attr("maxlength", r.validationRule.description.rangelength[1]);
-
 	checkValueIsExist("name", "validateValidationRule.action");
 });

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/addValidationRuleGroupForm.js'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/addValidationRuleGroupForm.js	2011-03-29 08:15:49 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/addValidationRuleGroupForm.js	2011-04-11 12:23:17 +0000
@@ -1,30 +1,15 @@
 jQuery(document).ready(function() {
 	jQuery("#name").focus();
 
-	var r = getValidationRules();
-
-	var rules = {
-		name : {
-			required : true,
-			rangelength : r.validationRuleGroup.name.rangelength
-		},
-		description : {
-			rangelength : r.validationRuleGroup.description.rangelength
-		}
-	};
-
 	validation2('addValidationRuleGroupForm', function(form) {
 		form.submit()
 	}, {
 		'beforeValidateHandler' : function() {
 			selectAllById('groupMembers')
 		},
-		'rules' : rules
+		'rules' : getValidationRules("validationRuleGroup")
 	});
 
-	jQuery("#name").attr("maxlength", r.validationRuleGroup.name.rangelength[1]);
-	jQuery("#description").attr("maxlength", r.validationRuleGroup.description.rangelength[1]);
-
 	checkValueIsExist("name", "validateValidationRuleGroup.action");
 
 	initLists();

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/updateValidationRuleForm.js'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/updateValidationRuleForm.js	2011-03-29 08:15:49 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/updateValidationRuleForm.js	2011-04-11 12:23:17 +0000
@@ -1,39 +1,12 @@
-jQuery(document).ready( function() {
+jQuery(document).ready(function() {
 	jQuery("#name").focus();
 
-	var r = getValidationRules();
-
-	var rules = {
-		name : {
-			required : true,
-			rangelength : r.validationRule.name.rangelength
-		},
-		description : {
-			rangelength : r.validationRule.description.rangelength
-		},
-		periodTypeName : {
-			required : true
-		},
-		operator : {
-			required : true
-		},
-		leftSideExpression : {
-			required : true
-		},
-		rightSideExpression : {
-			required : true
-		}
-	};
-
 	validation2('updateValidationRuleForm', function(form) {
 		form.submit();
 	}, {
-		'rules' : rules
+		'rules' : getValidationRules("validationRule")
 	});
 
-	jQuery("#name").attr("maxlength", r.validationRule.name.rangelength[1]);
-	jQuery("#description").attr("maxlength", r.validationRule.description.rangelength[1]);
-
 	checkValueIsExist("name", "validateValidationRule.action", {
 		id : getFieldValue('id')
 	});

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/updateValidationRuleGroupForm.js'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/updateValidationRuleGroupForm.js	2011-03-29 08:15:49 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/updateValidationRuleGroupForm.js	2011-04-11 12:23:17 +0000
@@ -1,30 +1,15 @@
 jQuery(document).ready(function() {
 	jQuery("#name").focus();
 
-	var r = getValidationRules();
-
-	var rules = {
-		name : {
-			required : true,
-			rangelength : r.validationRuleGroup.name.rangelength
-		},
-		description : {
-			rangelength : r.validationRuleGroup.description.rangelength
-		}
-	};
-
 	validation2('updateValidationRuleGroupForm', function(form) {
 		form.submit()
 	}, {
 		'beforeValidateHandler' : function() {
 			selectAllById('groupMembers')
 		},
-		'rules' : rules
+		'rules' : getValidationRules("validationRuleGroup")
 	});
 
-	jQuery("#name").attr("maxlength", r.validationRuleGroup.name.rangelength[1]);
-	jQuery("#description").attr("maxlength", r.validationRuleGroup.description.rangelength[1]);
-	
 	checkValueIsExist("name", "validateValidationRuleGroup.action", {
 		id : getFieldValue('id')
 	});