dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11598
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3343: WIP: validation rules
------------------------------------------------------------
revno: 3343
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-04-11 14:08:16 +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-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/addSqlViewForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/collectiveDataLockingForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/dataBrowserForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidationForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/updateSqlViewForm.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 11:52:24 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2011-04-11 12:08:16 +0000
@@ -157,18 +157,39 @@
/* dhis-web-maintenance-dataadmin */
"sqlView" : {
"name" : {
+ "required" : true,
"rangelength" : [ 2, 50 ]
},
"description" : {
+ "required" : true,
"rangelength" : [ 2, 255 ]
},
"sqlquery" : {
+ "required" : true,
"rangelength" : [ 1, 255 ]
}
},
- "dataLocking" : {},
- "dataBrowser" : {},
- "minMax" : {},
+ "dataLocking" : {
+ "selectedPeriods" : {
+ "required" : true
+ },
+ "selectedDataSets" : {
+ "required" : true
+ }
+ },
+ "dataBrowser" : {
+ "periodTypeId" : {
+ "required" : true
+ },
+ "mode" : {
+ "required" : true
+ }
+ },
+ "minMax" : {
+ "dataSetIds" : {
+ "required" : true
+ }
+ },
/* dhis-web-validationrule */
"validationRule" : {
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/addSqlViewForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/addSqlViewForm.js 2011-03-29 07:05:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/addSqlViewForm.js 2011-04-11 12:08:16 +0000
@@ -1,28 +1,7 @@
jQuery(document).ready(function() {
- var r = getValidationRules();
-
- var rules = {
- name: {
- required: true,
- rangelength: r.sqlView.name.rangelength
- },
- description: {
- required: true,
- rangelength: r.sqlView.description.rangelength
- },
- sqlquery: {
- required: true,
- rangelength: r.sqlView.sqlquery.rangelength
- }
- };
-
- validation2( 'addSqlViewForm', function() {
- validateAddUpdateSqlView( 'add' );
+ validation2('addSqlViewForm', function() {
+ validateAddUpdateSqlView('add');
}, {
- 'rules': rules
+ 'rules' : getValidationRules("sqlView")
});
-
- jQuery("#name").attr("maxlength", r.sqlView.name.rangelength[1]);
- jQuery("#description").attr("maxlength", r.sqlView.description.rangelength[1]);
- jQuery("#sqlquery").attr("maxlength", r.sqlView.sqlquery.rangelength[1]);
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/collectiveDataLockingForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/collectiveDataLockingForm.js 2011-03-29 07:05:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/collectiveDataLockingForm.js 2011-04-11 12:08:16 +0000
@@ -1,19 +1,7 @@
-jQuery(document).ready( function() {
- var r = getValidationRules();
-
- var rules = {
- selectedPeriods: {
- required: true
- },
- selectedDataSets: {
- required: true
- }
- };
-
- validation2( 'lockingForm', function( form )
- {
- validateCollectiveDataLockingForm( form );
+jQuery(document).ready(function() {
+ validation2('lockingForm', function(form) {
+ validateCollectiveDataLockingForm(form);
}, {
- 'rules': rules
+ 'rules' : getValidationRules("dataLocking")
});
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/dataBrowserForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/dataBrowserForm.js 2011-04-05 06:02:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/dataBrowserForm.js 2011-04-11 12:08:16 +0000
@@ -1,22 +1,13 @@
jQuery(document).ready(function() {
- selection.setListenerFunction( organisationUnitModeSelected );
- datePickerInRange( 'fromDate' , 'toDate' );
-
- var r = getValidationRules();
-
- var rules = {
- periodTypeId: {
- required: true
- },
- mode: {
- required: true
- }
- };
-
- validation2( 'databrowser', function( form ){
+ selection.setListenerFunction(organisationUnitModeSelected);
+ datePickerInRange('fromDate', 'toDate');
+
+ validation2('databrowser', function(form) {
validateBeforeSubmit();
- }, { 'rules': rules });
+ }, {
+ 'rules' : getValidationRules("dataBrowser")
+ });
});
var flag;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidationForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidationForm.js 2011-03-29 07:05:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidationForm.js 2011-04-11 12:08:16 +0000
@@ -1,20 +1,12 @@
jQuery(document).ready(function() {
- var r = getValidationRules();
-
- var rules = {
- dataSetIds: {
- required: true
- }
- };
-
- validation2( "minMaxGeneratingForm", function() {
- if(isGenerate) {
+ validation2("minMaxGeneratingForm", function() {
+ if (isGenerate) {
generateMinMaxValue();
} else {
removeMinMaxValue();
}
}, {
- 'rules': rules
+ 'rules' : getValidationRules("minMax")
});
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/updateSqlViewForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/updateSqlViewForm.js 2011-03-29 07:05:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/updateSqlViewForm.js 2011-04-11 12:08:16 +0000
@@ -1,28 +1,7 @@
jQuery(document).ready(function() {
- var r = getValidationRules();
-
- var rules = {
- name: {
- required: true,
- rangelength: r.sqlView.name.rangelength
- },
- description: {
- required: true,
- rangelength: r.sqlView.description.rangelength
- },
- sqlquery: {
- required: true,
- rangelength: r.sqlView.sqlquery.rangelength
- }
- };
-
- validation2( 'updateSqlViewForm', function() {
- validateAddUpdateSqlView( 'update' );
+ validation2('updateSqlViewForm', function() {
+ validateAddUpdateSqlView('update');
}, {
- 'rules': rules
+ 'rules' : getValidationRules("sqlView")
});
-
- jQuery("#name").attr("maxlength", r.sqlView.name.rangelength[1]);
- jQuery("#description").attr("maxlength", r.sqlView.description.rangelength[1]);
- jQuery("#sqlquery").attr("maxlength", r.sqlView.sqlquery.rangelength[1]);
});