dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11600
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3345: WIP: validation rules
------------------------------------------------------------
revno: 3345
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-04-11 15:46:07 +0200
message:
WIP: validation rules
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-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js
dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataDictionaryForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupSet.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorGroupForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorGroupSet.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorTypeForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryCombo.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataDictionary.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementCategoryList.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroup.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/optionCombinationList.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/selectedOptionList.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataDictionaryForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupSet.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorGroupForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorGroupSet.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorTypeForm.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/i18n/i18n.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.vm 2011-01-20 02:57:30 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.vm 2011-04-11 13:46:07 +0000
@@ -129,6 +129,7 @@
,rangeWords : validatorFormat('$encoder.jsEscape($i18n.getString( 'please_enter_betwwen_a_and_b_words' ) , "'")')
,lettersonly : '$encoder.jsEscape($i18n.getString( 'letters_only_please' ) , "'")'
,nowhitespace : '$encoder.jsEscape($i18n.getString( 'no_white_space_please' ) , "'")'
+ ,nostartwhitespace : '$encoder.jsEscape($i18n.getString( 'no_start_white_space_please' ) , "'")'
,ziprange : '$encoder.jsEscape($i18n.getString( 'ZIP_code_must_be_in_the_range' ) , "'")'
,time : '$encoder.jsEscape($i18n.getString( 'please_enter_valid_time' ) , "'")'
,phone : '$encoder.jsEscape($i18n.getString( 'please_enter_valid_phone_number' ) , "'")'
=== 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 2011-03-25 02:08:24 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js 2011-04-11 13:46:07 +0000
@@ -186,6 +186,10 @@
return this.optional(element) || /^\S+$/i.test(value);
}, "No white space please");
+jQuery.validator.addMethod("nostartwhitespace", function(value, element) {
+ return this.optional(element) || /^\S+/i.test(value);
+}, "Can not start with whitespace");
+
jQuery.validator.addMethod("ziprange", function(value, element) {
return this.optional(element) || /^90[2-5]\d\{2}-\d{4}$/.test(value);
}, "Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx");
=== 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:23:17 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2011-04-11 13:46:07 +0000
@@ -191,44 +191,45 @@
}
},
- /* 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" : {
- "rangelength" : [ 2, 160 ]
- }
- },
-
/* dhis-web-maintenance-datadictionary */
"concept" : {
"name" : {
"rangelength" : [ 3, 10 ]
}
},
+ "dataElement" : {
+ "name" : {
+ "required" : true,
+ "rangelength" : [ 3, 150 ],
+ "alphanumericwithbasicpuncspaces" : true,
+ "notOnlyDigits" : true
+ },
+ "shortName" : {
+ "required" : true,
+ "rangelength" : [ 2, 20 ],
+ "alphanumericwithbasicpuncspaces" : true,
+ "notOnlyDigits" : true
+ },
+ "alternativeName" : {
+ "rangelength" : [ 3, 150 ],
+ "alphanumericwithbasicpuncspaces" : true,
+ "notOnlyDigits" : true
+ },
+ "code" : {
+ "rangelength" : [ 3, 40 ],
+ "alphanumericwithbasicpuncspaces" : true,
+ "notOnlyDigits" : false
+ },
+ "description" : {
+ "rangelength" : [ 3, 250 ],
+ "alphanumericwithbasicpuncspaces" : true,
+ "notOnlyDigits" : true
+ },
+ "url" : {
+ "url" : true,
+ "rangelength" : [ 0, 255 ]
+ }
+ },
"dateElementCategoryCombo" : {
"name" : {
"rangelength" : [ 2, 160 ]
@@ -241,21 +242,46 @@
},
"dataElementGroup" : {
"name" : {
+ "required" : true,
+ "alphanumericwithbasicpuncspaces" : true,
+ "notOnlyDigits" : true,
+ "firstletteralphabet" : true,
"rangelength" : [ 3, 150 ]
}
},
"dataElementGroupSet" : {
"name" : {
+ "required" : true,
"rangelength" : [ 2, 230 ]
}
},
+ "dataDictionary" : {
+ "name" : {
+ "required" : true,
+ "rangelength" : [ 2, 160 ]
+ },
+ "description" : {
+ "rangelength" : [ 0, 255 ]
+ },
+ "region" : {
+ "rangelength" : [ 0, 255 ]
+ },
+ "memberValidator" : {
+ "required" : true
+ },
+ "memberValidatorIn" : {
+ "required" : true
+ }
+ },
"indicator" : {
"name" : {
+ "required" : true,
"rangelength" : [ 3, 150 ],
"alphanumericwithbasicpuncspaces" : true,
- "firstletteralphabet" : true
+ "nostartwhitespace" : true
},
"shortName" : {
+ "required" : true,
"rangelength" : [ 2, 20 ],
"alphanumericwithbasicpuncspaces" : true,
"firstletteralphabet" : true
@@ -276,29 +302,71 @@
"firstletteralphabet" : true
},
"url" : {
+ "url" : true,
"rangelength" : [ 0, 255 ]
+ },
+ "indicatorTypeId" : {
+ "required" : true
+ },
+ "denominator" : {
+ "required" : true
}
},
"indicatorGroup" : {
"name" : {
+ "required" : true,
"rangelength" : [ 3, 150 ],
"alphanumericwithbasicpuncspaces" : true,
- "firstletteralphabet" : true
}
},
"indicatorGroupSet" : {
"name" : {
+ "required" : true,
"rangelength" : [ 2, 230 ]
}
},
"indicatorType" : {
"name" : {
+ "required" : true,
"rangelength" : [ 3, 150 ],
"alphanumericwithbasicpuncspaces" : true,
- "firstletteralphabet" : true
},
"factor" : {
- "rangelength" : [ 1, 10 ]
+ "required" : true,
+ "rangelength" : [ 1, 10 ],
+ "digits" : true
+ }
+ },
+
+ /* 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" : {
+ "rangelength" : [ 2, 160 ]
}
}
}
=== 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 2011-04-07 14:07:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 2011-04-11 13:46:07 +0000
@@ -349,6 +349,7 @@
please_enter_betwwen_a_and_b_words = Please enter between {0} and {1} words.
letters_only_please = Letters only please.
no_white_space_please = No white space please
+no_start_white_space_please = Can not start with whitespace
ZIP_code_must_be_in_the_range = Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx
please_enter_valid_time = Please enter a valid time, between 00:00 and 23:59
please_enter_valid_phone_number = Please specify a valid phone number
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataDictionaryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataDictionaryForm.js 2011-03-30 11:04:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataDictionaryForm.js 2011-04-11 13:46:07 +0000
@@ -1,32 +1,13 @@
-jQuery(document).ready( function() {
- var r = getValidationRules();
-
- var rules = {
- name: {
- required: true,
- rangelength: [2, 160]
- },
- description: {
- rangelength: [0, 255]
- },
- region: {
- rangelength: [0, 255]
- },
- memberValidator: {
- required: true
- },
- memberValidatorIn: {
- required: true
- }
- };
+jQuery(document).ready(function() {
+ validation2('addDataDictionaryForm', function(form) {
+ form.submit()
+ }, {
+ 'beforeValidateHandler' : function() {
+ listValidator('memberValidator', 'selectedDataElements');
+ listValidator('memberValidatorIn', 'selectedIndicators');
+ },
+ 'rules' : getValidationRules("dataDictionary")
+ });
- validation2( 'addDataDictionaryForm', function( form ){ form.submit()}, {
- 'beforeValidateHandler': function() {
- listValidator( 'memberValidator', 'selectedDataElements' );
- listValidator( 'memberValidatorIn', 'selectedIndicators' );
- },
- 'rules': rules
- });
-
- checkValueIsExist( "name", "validateDataDictionary.action");
+ checkValueIsExist("name", "validateDataDictionary.action");
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementForm.js 2011-04-08 12:48:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementForm.js 2011-04-11 13:46:07 +0000
@@ -1,40 +1,4 @@
jQuery(document).ready( function() {
- var r = getValidationRules();
-
- var rules = {
- name: {
- required:true,
- rangelength: [3, 150],
- alphanumericwithbasicpuncspaces:true,
- notOnlyDigits:true
- },
- shortName: {
- required:true,
- rangelength: [2, 20],
- alphanumericwithbasicpuncspaces:true,
- notOnlyDigits:true
- },
- alternativeName: {
- rangelength: [3, 150],
- alphanumericwithbasicpuncspaces:true,
- notOnlyDigits:true
- },
- code: {
- rangelength: [3, 40],
- alphanumericwithbasicpuncspaces:true,
- notOnlyDigits:false
- },
- description: {
- rangelength: [3, 250],
- alphanumericwithbasicpuncspaces:true,
- notOnlyDigits:true
- },
- url: {
- url: true,
- rangelength: [0, 255]
- }
- };
-
validation2( 'addDataElementForm', function( form ){ form.submit(); }, {
'beforeValidateHandler': function() {
getDataElementIdsForValidate();
@@ -42,16 +6,9 @@
setFieldValue( 'submitCategoryComboId', getFieldValue( 'selectedCategoryComboId' ) );
setFieldValue( 'submitValueType', getFieldValue( 'valueType' ) );
},
- 'rules': rules
+ 'rules': getValidationRules("dataElement")
});
- jQuery("#name").attr("maxlength", "150");
- jQuery("#shortName").attr("maxlength", "20");
- jQuery("#alternativeName").attr("maxlength", "150");
- jQuery("#code").attr("maxlength", "40");
- jQuery("#description").attr("maxlength", "250");
- jQuery("#url").attr("maxlength", "255");
-
checkValueIsExist( "name", "validateDataElement.action");
checkValueIsExist( "shortName", "validateDataElement.action");
checkValueIsExist( "alternativeName", "validateDataElement.action");
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupForm.js 2011-03-31 11:17:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupForm.js 2011-04-11 13:46:07 +0000
@@ -1,24 +1,10 @@
jQuery(document).ready(function() {
- var r = getValidationRules();
-
- var rules = {
- name : {
- required : true,
- rangelength : r.dataElementGroup.name.rangelength,
- alphanumericwithbasicpuncspaces : true,
- notOnlyDigits : true,
- firstletteralphabet : true
- }
- };
-
validation2('addDataElementGroupForm', function(form) {
form.submit()
}, {
'beforeValidateHandler' : beforeSubmit,
- 'rules' : rules
+ 'rules' : getValidationRules("dataElementGroup")
});
- jQuery("#name").attr("maxlength", r.dataElementGroup.name.rangelength[1]);
-
checkValueIsExist("name", "validateDataElementGroup.action");
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupSet.js 2011-03-31 11:17:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupSet.js 2011-04-11 13:46:07 +0000
@@ -1,21 +1,10 @@
jQuery(document).ready(function() {
- var r = getValidationRules();
-
- var rules = {
- name : {
- required : true,
- rangelength : r.dataElementGroupSet.name.rangelength
- }
- };
-
validation2('addDataElementGroupSet', function(form) {
form.submit()
}, {
'beforeValidateHandler' : beforeSubmit,
- 'rules' : rules
+ 'rules' : getValidationRules("dataElementGroupSet")
});
- jQuery("#name").attr("maxlength", r.dataElementGroupSet.name.rangelength[1]);
-
checkValueIsExist("name", "validateDataElementGroupSet.action");
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorForm.js 2011-03-31 12:05:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorForm.js 2011-04-11 13:46:07 +0000
@@ -1,59 +1,10 @@
jQuery(document).ready(function() {
- var r = getValidationRules();
-
- var rules = {
- name : {
- required : true,
- rangelength : r.indicator.name.rangelength,
- alphanumericwithbasicpuncspaces : r.indicator.name.alphanumericwithbasicpuncspaces,
- firstletteralphabet : r.indicator.name.firstletteralphabet
- },
- shortName : {
- required : true,
- rangelength : r.indicator.shortName.rangelength,
- alphanumericwithbasicpuncspaces : r.indicator.shortName.alphanumericwithbasicpuncspaces,
- firstletteralphabet : r.indicator.shortName.firstletteralphabet
- },
- alternativeName : {
- rangelength : r.indicator.alternativeName.rangelength,
- alphanumericwithbasicpuncspaces : r.indicator.alternativeName.alphanumericwithbasicpuncspaces,
- firstletteralphabet : r.indicator.alternativeName.firstletteralphabet
- },
- code : {
- rangelength : r.indicator.code.rangelength,
- alphanumericwithbasicpuncspaces : r.indicator.code.alphanumericwithbasicpuncspaces,
- notOnlyDigits : r.indicator.code.notOnlyDigits
- },
- description : {
- rangelength : r.indicator.description.rangelength,
- alphanumericwithbasicpuncspaces : r.indicator.description.alphanumericwithbasicpuncspaces,
- firstletteralphabet : r.indicator.description.firstletteralphabet
- },
- indicatorTypeId : {
- required : true
- },
- url : {
- url : true,
- rangelength : r.indicator.url.rangelength
- },
- denominator : {
- required : true
- }
- };
-
validation2('addIndicatorForm', function(form) {
form.submit();
}, {
- 'rules' : rules
+ 'rules' : getValidationRules("indicator")
});
- jQuery("#name").attr("maxlength", r.indicator.name.rangelength[1]);
- jQuery("#shortName").attr("maxlength", r.indicator.shortName.rangelength[1]);
- jQuery("#alternativeName").attr("maxlength", r.indicator.alternativeName.rangelength[1]);
- jQuery("#code").attr("maxlength", r.indicator.code.rangelength[1]);
- jQuery("#description").attr("maxlength", r.indicator.description.rangelength[1]);
- jQuery("#url").attr("maxlength", r.indicator.url.rangelength[1]);
-
checkValueIsExist("name", "validateIndicator.action");
checkValueIsExist("shortName", "validateIndicator.action");
checkValueIsExist("alternativeName", "validateIndicator.action");
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorGroupForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorGroupForm.js 2011-03-31 12:05:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorGroupForm.js 2011-04-11 13:46:07 +0000
@@ -1,26 +1,13 @@
jQuery(document).ready(function() {
- var r = getValidationRules();
-
- var rules = {
- name : {
- required : true,
- rangelength : r.indicatorGroup.name.rangelength,
- alphanumericwithbasicpuncspaces : true,
- firstletteralphabet : true
- }
- };
-
validation2('addIndicatorGroupForm', function(form) {
form.submit()
}, {
'beforeValidateHandler' : function() {
listValidator('memberValidator', 'groupMembers');
},
- 'rules' : rules
+ 'rules' : getValidationRules("indicatorGroup")
});
- jQuery("#name").attr("maxlength", r.indicatorGroup.name.rangelength[1]);
-
checkValueIsExist("name", "validateIndicatorGroup.action");
var nameField = document.getElementById('name');
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorGroupSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorGroupSet.js 2011-03-31 13:13:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorGroupSet.js 2011-04-11 13:46:07 +0000
@@ -1,23 +1,12 @@
jQuery(document).ready(function() {
- var r = getValidationRules();
-
- var rules = {
- name : {
- required : true,
- rangelength : r.indicatorGroupSet.name.rangelength
- }
- };
-
validation2('addIndicatorGroupSet', function(form) {
form.submit()
}, {
'beforeValidateHandler' : function() {
listValidator('memberValidator', 'groupMembers');
},
- 'rules' : rules
+ 'rules' : getValidationRules("indicatorGroupSet")
});
- jQuery("#name").attr("maxlength", r.indicatorGroupSet.name.rangelength[1]);
-
checkValueIsExist("name", "validateIndicatorGroupSet.action");
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorTypeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorTypeForm.js 2011-04-08 05:58:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorTypeForm.js 2011-04-11 13:46:07 +0000
@@ -1,28 +1,9 @@
jQuery(document).ready(function() {
- var r = getValidationRules();
-
- var rules = {
- name : {
- required : true,
- rangelength : r.indicatorType.name.rangelength,
- alphanumericwithbasicpuncspaces : r.indicatorType.name.alphanumericwithbasicpuncspaces,
- firstletteralphabet : r.indicatorType.name.firstletteralphabet
- },
- factor : {
- required : true,
- rangelength : r.indicatorType.factor.rangelength,
- digits : true
- }
- };
-
validation2('addIndicatorTypeForm', function(form) {
form.submit()
}, {
- 'rules' : rules
+ 'rules' : getValidationRules("indicatorType")
});
- jQuery("#name").attr("maxlength", r.indicatorType.name.rangelength[1]);
- jQuery("#factor").attr("maxlength", r.indicatorType.factor.rangelength[1]);
-
checkValueIsExist("name", "validateIndicatorType.action");
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryCombo.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryCombo.js 2010-12-21 07:10:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryCombo.js 2011-04-11 13:46:07 +0000
@@ -38,5 +38,4 @@
if( json.response == 'success' ) form.submit();
else markInvalid( 'selectedCategories', json.message );
});
-
-}
\ No newline at end of file
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataDictionary.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataDictionary.js 2010-09-08 10:40:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataDictionary.js 2011-04-11 13:46:07 +0000
@@ -44,4 +44,4 @@
function removeDataDictionary( dataDictionaryId, dataDictionaryName )
{
removeItem( dataDictionaryId, dataDictionaryName, i18n_confirm_delete, 'removeDataDictionary.action' );
-}
\ No newline at end of file
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementCategoryList.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementCategoryList.js 2010-09-27 12:39:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementCategoryList.js 2011-04-11 13:46:07 +0000
@@ -1,5 +1,4 @@
-
var selectedList;
var availableList;
@@ -92,4 +91,4 @@
{
option.selected = true;
}
-}
\ No newline at end of file
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroup.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroup.js 2010-11-25 21:34:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroup.js 2011-04-11 13:46:07 +0000
@@ -8,6 +8,7 @@
memberValidator.append( '<option value="' + item.value + '" selected="selected">' + item.value + '</option>');
});
}
+
// -----------------------------------------------------------------------------
// View details
// -----------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js 2011-04-08 05:34:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js 2011-04-11 13:46:07 +0000
@@ -1,316 +1,316 @@
jQuery(document).ready(function() {
- loadAvailableGroups();
- getDataElementsByGroup();
- getAssignedDataElementGroups();
-
- jQuery( "#addDataElementGroupForm" ).dialog({autoOpen:false, modal:true});
- jQuery("#tabs").tabs();
+ loadAvailableGroups();
+ getDataElementsByGroup();
+ getAssignedDataElementGroups();
+
+ jQuery( "#addDataElementGroupForm" ).dialog({autoOpen:false, modal:true});
+ jQuery("#tabs").tabs();
+});
+
+function loadAvailableDataElements()
+{
+ var filter_1 = jQuery( '#view_1 #availableDataElementsFilter' ).val();
+ var filter_2 = jQuery( '#view_2 #availableDataElementsFilter' ).val();
+ var list_1 = jQuery( "#view_1 #availableDataElements" );
+ var list_2 = jQuery( "#view_2 #availableDataElements2" );
+ list_1.empty();
+ list_2.empty();
+
+ for( var id in availableDataElements)
+ {
+ var text = availableDataElements[id];
+ if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
+ {
+ list_1.append('<option value="' + id + '">' + text + '</option>' );
+ list_2.append('<option value="' + id + '">' + text + '</option>' );
+ }
+ }
+ list_1.find(":first").attr("selected", "selected");
+ list_2.find(":first").attr("selected", "selected");
+
+}
+
+function loadAvailableGroups()
+{
+ var filter_1 = jQuery( '#view_1 #dataElementGroupsFilter' ).val();
+ var filter_2 = jQuery( '#view_2 #dataElementGroupsFilter' ).val();
+ var list_1 = jQuery( "#view_1 #dataElementGroups" );
+ var list_2 = jQuery( "#view_2 #availableGroups" );
+ list_1.empty();
+ list_2.empty();
+ for( var id in dataElementGroups)
+ {
+ var text = dataElementGroups[id];
+ if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
+ {
+ list_1.append('<option value="' + id + '">' + text + '</option>' );
+ list_2.append('<option value="' + id + '">' + text + '</option>' );
+ }
+ }
+ sortList( 'dataElementGroups', 'ASC' );
+ sortList( 'availableGroups', 'ASC' );
+ list_1.find(":first").attr("selected", "selected");
+ list_2.find(":first").attr("selected", "selected");
+
+ var list_3 = jQuery( "#view_2 #assignedGroups").children();
+ list_2.children().each( function(i, item ){
+ list_3.each( function(k, it ){
+ if( it.value == item.value ){
+ jQuery( item ).remove();
+ }
+ });
});
-
- function loadAvailableDataElements()
- {
- var filter_1 = jQuery( '#view_1 #availableDataElementsFilter' ).val();
- var filter_2 = jQuery( '#view_2 #availableDataElementsFilter' ).val();
- var list_1 = jQuery( "#view_1 #availableDataElements" );
- var list_2 = jQuery( "#view_2 #availableDataElements2" );
- list_1.empty();
- list_2.empty();
-
- for( var id in availableDataElements)
- {
- var text = availableDataElements[id];
- if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
- {
- list_1.append('<option value="' + id + '">' + text + '</option>' );
- list_2.append('<option value="' + id + '">' + text + '</option>' );
- }
- }
- list_1.find(":first").attr("selected", "selected");
- list_2.find(":first").attr("selected", "selected");
-
- }
-
- function loadAvailableGroups()
- {
- var filter_1 = jQuery( '#view_1 #dataElementGroupsFilter' ).val();
- var filter_2 = jQuery( '#view_2 #dataElementGroupsFilter' ).val();
- var list_1 = jQuery( "#view_1 #dataElementGroups" );
- var list_2 = jQuery( "#view_2 #availableGroups" );
- list_1.empty();
- list_2.empty();
- for( var id in dataElementGroups)
- {
- var text = dataElementGroups[id];
+}
+
+function getDataElementsByGroup()
+{
+
+ loadAvailableDataElements();
+
+ var filter_1 = jQuery( '#view_1 #selecteDataElementsFilter' ).val();
+ var list_1 = jQuery( "#view_1 #selectedDataElements" );
+ list_1.empty();
+
+ jQuery.postJSON( "../dhis-web-commons-ajax-json/getDataElements.action", {
+ id: jQuery( '#view_1 #dataElementGroups' ).val()
+ }, function( json ){
+ jQuery.each( json.dataElements, function(i, item){
+ var text = item.name;
if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
{
- list_1.append('<option value="' + id + '">' + text + '</option>' );
- list_2.append('<option value="' + id + '">' + text + '</option>' );
+ list_1.append('<option value="' + item.id + '">' + text + '</option>' );
}
- }
- sortList( 'dataElementGroups', 'ASC' );
- sortList( 'availableGroups', 'ASC' );
- list_1.find(":first").attr("selected", "selected");
- list_2.find(":first").attr("selected", "selected");
-
- var list_3 = jQuery( "#view_2 #assignedGroups").children();
- list_2.children().each( function(i, item ){
- list_3.each( function(k, it ){
- if( it.value == item.value ){
- jQuery( item ).remove();
- }
- });
- });
- }
-
- function getDataElementsByGroup()
- {
-
- loadAvailableDataElements();
-
- var filter_1 = jQuery( '#view_1 #selecteDataElementsFilter' ).val();
- var list_1 = jQuery( "#view_1 #selectedDataElements" );
- list_1.empty();
-
- jQuery.postJSON( "../dhis-web-commons-ajax-json/getDataElements.action", {
- id: jQuery( '#view_1 #dataElementGroups' ).val()
- }, function( json ){
- jQuery.each( json.dataElements, function(i, item){
- var text = item.name;
- if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
+ jQuery( "#view_1 #availableDataElements" ).children().each( function(k, it){
+ if( item.id == it.value )
{
- list_1.append('<option value="' + item.id + '">' + text + '</option>' );
+ jQuery(it).remove();
}
- jQuery( "#view_1 #availableDataElements" ).children().each( function(k, it){
- if( item.id == it.value )
- {
- jQuery(it).remove();
- }
- });
});
});
- }
-
- function showAddGroup()
- {
-
- jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_new);
- jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
- text: i18n_save,
- click: function(){
- jQuery.postJSON( "validateDataElementGroup.action", {
- name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
- }, function( json ){
- if( json.response == 'success' ){
- jQuery.postJSON( "addDataElementGroupEditor.action", {
- name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
- }, function( json ){
- dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
- loadAvailableGroups();
- loadAvailableDataElements();
- jQuery( "#view_1 #selectedDataElements" ).empty();
- jQuery( '#addDataElementGroupForm' ).dialog('close');
- } );
- }else{
- markInvalid( "addDataElementGroupForm #name", json.message );
- }
- });
- }
- }]);
-
- jQuery( '#addDataElementGroupForm' ).dialog('open');
- }
-
- function showAddGroupView2()
- {
-
- jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_new);
- jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
- text: i18n_save,
- click: function(){
- jQuery.postJSON( "validateDataElementGroup.action", {
- name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
- }, function( json ){
- if( json.response == 'success' ){
- jQuery.postJSON( "addDataElementGroupEditor.action", {
- name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
- }, function( json ){
- dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
- loadAvailableGroups();
- jQuery( '#addDataElementGroupForm' ).dialog('close');
- } );
- }else{
- markInvalid( "addDataElementGroupForm #name", json.message );
- }
- });
- }
- }]);
- jQuery( '#addDataElementGroupForm' ).dialog('open');
- }
-
- function showUpdateGroup()
- {
- var id = jQuery( "#view_1 #dataElementGroups" ).val();
- var text = jQuery( "#view_1 #dataElementGroups option[value=" + id + "]" ).text();
- jQuery( '#addDataElementGroupForm #name' ).val( text );
-
- jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
- text: i18n_save,
- click: function(){
-
- jQuery.postJSON( "validateDataElementGroup.action", {
- id: id,
- name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
- }, function( json ){
- if( json.response == 'success' ){
- jQuery.postJSON( "renameDataElementGroupEditor.action", {
- name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); },
- id: id
- }, function( json ){
- dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
- loadAvailableGroups();
- jQuery( '#addDataElementGroupForm' ).dialog('close');
- showSuccessMessage( i18n_update_success );
- } );
- }else{
- markInvalid( "addDataElementGroupForm #name", json.message );
- }
- });
- }
- }]);
-
- jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_rename);
- jQuery( '#addDataElementGroupForm' ).dialog('open');
- }
-
- function showUpdateGroup2()
- {
- var id = jQuery( "#view_2 #availableGroups" ).val();
- var text = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text();
- jQuery( '#addDataElementGroupForm #name' ).val( text );
-
- jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
- text: i18n_save,
- click: function(){
-
- jQuery.postJSON( "validateDataElementGroup.action", {
- id: id,
- name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
- }, function( json ){
- if( json.response == 'success' ){
- jQuery.postJSON( "renameDataElementGroupEditor.action", {
- name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); },
- id: id
- }, function( json ){
- dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
- loadAvailableGroups();
- jQuery( '#addDataElementGroupForm' ).dialog('close');
- showSuccessMessage( i18n_update_success );
- } );
- }else{
- markInvalid( "addDataElementGroupForm #name", json.message );
- }
- });
- }
- }]);
-
- jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_rename);
- jQuery( '#addDataElementGroupForm' ).dialog('open');
- }
-
- function deleteDataElemenGroup()
- {
- if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
- {
- var id = jQuery( "#view_1 #dataElementGroups" ).val();
-
- jQuery.postJSON( "deleteDataElemenGroupEditor.action",{
- id: id
- }, function( json ){
- if( json.response == 'success'){
- dataElementGroups.splice(id, 1);
- loadAvailableGroups();
- showSuccessMessage( json.message );
- }else{
- showErrorMessage( json.message );
- }
- });
- }
- }
-
- function deleteDataElemenGroupView2()
- {
- if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
- {
- var id = jQuery( "#view_2 #availableGroups" ).val()[0];
-
- jQuery.postJSON( "deleteDataElemenGroupEditor.action",{
- id: id
- }, function( json ){
- if( json.response == 'success'){
- dataElementGroups.splice(id, 1);
- loadAvailableGroups();
- showSuccessMessage( json.message );
- }else{
- showErrorMessage( json.message );
- }
- });
- }
- }
-
- function updateGroupMembers()
- {
+ });
+}
+
+function showAddGroup()
+{
+
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_new);
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
+ text: i18n_save,
+ click: function(){
+ jQuery.postJSON( "validateDataElementGroup.action", {
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+ }, function( json ){
+ if( json.response == 'success' ){
+ jQuery.postJSON( "addDataElementGroupEditor.action", {
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+ }, function( json ){
+ dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
+ loadAvailableGroups();
+ loadAvailableDataElements();
+ jQuery( "#view_1 #selectedDataElements" ).empty();
+ jQuery( '#addDataElementGroupForm' ).dialog('close');
+ } );
+ }else{
+ markInvalid( "addDataElementGroupForm #name", json.message );
+ }
+ });
+ }
+ }]);
+
+ jQuery( '#addDataElementGroupForm' ).dialog('open');
+}
+
+function showAddGroupView2()
+{
+
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_new);
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
+ text: i18n_save,
+ click: function(){
+ jQuery.postJSON( "validateDataElementGroup.action", {
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+ }, function( json ){
+ if( json.response == 'success' ){
+ jQuery.postJSON( "addDataElementGroupEditor.action", {
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+ }, function( json ){
+ dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
+ loadAvailableGroups();
+ jQuery( '#addDataElementGroupForm' ).dialog('close');
+ } );
+ }else{
+ markInvalid( "addDataElementGroupForm #name", json.message );
+ }
+ });
+ }
+ }]);
+ jQuery( '#addDataElementGroupForm' ).dialog('open');
+}
+
+function showUpdateGroup()
+{
+ var id = jQuery( "#view_1 #dataElementGroups" ).val();
+ var text = jQuery( "#view_1 #dataElementGroups option[value=" + id + "]" ).text();
+ jQuery( '#addDataElementGroupForm #name' ).val( text );
+
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
+ text: i18n_save,
+ click: function(){
+
+ jQuery.postJSON( "validateDataElementGroup.action", {
+ id: id,
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+ }, function( json ){
+ if( json.response == 'success' ){
+ jQuery.postJSON( "renameDataElementGroupEditor.action", {
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); },
+ id: id
+ }, function( json ){
+ dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
+ loadAvailableGroups();
+ jQuery( '#addDataElementGroupForm' ).dialog('close');
+ showSuccessMessage( i18n_update_success );
+ } );
+ }else{
+ markInvalid( "addDataElementGroupForm #name", json.message );
+ }
+ });
+ }
+ }]);
+
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_rename);
+ jQuery( '#addDataElementGroupForm' ).dialog('open');
+}
+
+function showUpdateGroup2()
+{
+ var id = jQuery( "#view_2 #availableGroups" ).val();
+ var text = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text();
+ jQuery( '#addDataElementGroupForm #name' ).val( text );
+
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{
+ text: i18n_save,
+ click: function(){
+
+ jQuery.postJSON( "validateDataElementGroup.action", {
+ id: id,
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }
+ }, function( json ){
+ if( json.response == 'success' ){
+ jQuery.postJSON( "renameDataElementGroupEditor.action", {
+ name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); },
+ id: id
+ }, function( json ){
+ dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name;
+ loadAvailableGroups();
+ jQuery( '#addDataElementGroupForm' ).dialog('close');
+ showSuccessMessage( i18n_update_success );
+ } );
+ }else{
+ markInvalid( "addDataElementGroupForm #name", json.message );
+ }
+ });
+ }
+ }]);
+
+ jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_rename);
+ jQuery( '#addDataElementGroupForm' ).dialog('open');
+}
+
+function deleteDataElemenGroup()
+{
+ if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
+ {
var id = jQuery( "#view_1 #dataElementGroups" ).val();
- jQuery.getJSON( "updateDataElementGroupEditor.action?id=" + id + "&" + toQueryString( '#view_1 #selectedDataElements', 'groupMembers' ),
- function( json ){
- showSuccessMessage( i18n_update_success );
- });
- }
-
- function toQueryString( jQueryString, paramName )
- {
- var p = "";
- jQuery( jQueryString ).children().each(function(i, item ){
- item.selected = "selected";
- p += paramName + "=" + item.value + "&";
- });
- return p;
- }
-
- // View 2
-
- function getAssignedDataElementGroups()
- {
- loadAvailableGroups();
-
- var id = jQuery( "#view_2 #availableDataElements2" ).val();
- var list_2 = jQuery( "#view_2 #assignedGroups" );
- list_2.empty();
-
- jQuery.postJSON( "getAssignedDataElementGroups.action", {
- dataElementId: id
- }, function( json ){
- jQuery.each(json.dataElementGroups, function(i, item ){
- list_2.append('<option value="' + item.id + '">' + item.name + '</option>' );
-
- jQuery( "#view_2 #availableGroups" ).children().each( function(k, it){
- if( item.id == it.value )
- {
- jQuery(it).remove();
- }
- });
-
- });
-
- });
- }
-
- function assignGroupsForDataElement()
- {
- var dataElementId = jQuery("#view_2 #availableDataElements2").val();
-
- jQuery.getJSON( "asignGroupsForDataElement.action?dataElementId=" + dataElementId + "&" + toQueryString( '#view_2 #assignedGroups', 'dataElementGroups' ),
- function( json ){
- showSuccessMessage( i18n_update_success );
- });
- }
\ No newline at end of file
+ jQuery.postJSON( "deleteDataElemenGroupEditor.action",{
+ id: id
+ }, function( json ){
+ if( json.response == 'success'){
+ dataElementGroups.splice(id, 1);
+ loadAvailableGroups();
+ showSuccessMessage( json.message );
+ }else{
+ showErrorMessage( json.message );
+ }
+ });
+ }
+}
+
+function deleteDataElemenGroupView2()
+{
+ if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
+ {
+ var id = jQuery( "#view_2 #availableGroups" ).val()[0];
+
+ jQuery.postJSON( "deleteDataElemenGroupEditor.action",{
+ id: id
+ }, function( json ){
+ if( json.response == 'success'){
+ dataElementGroups.splice(id, 1);
+ loadAvailableGroups();
+ showSuccessMessage( json.message );
+ }else{
+ showErrorMessage( json.message );
+ }
+ });
+ }
+}
+
+function updateGroupMembers()
+{
+ var id = jQuery( "#view_1 #dataElementGroups" ).val();
+
+ jQuery.getJSON( "updateDataElementGroupEditor.action?id=" + id + "&" + toQueryString( '#view_1 #selectedDataElements', 'groupMembers' ),
+ function( json ){
+ showSuccessMessage( i18n_update_success );
+ });
+}
+
+function toQueryString( jQueryString, paramName )
+{
+ var p = "";
+ jQuery( jQueryString ).children().each(function(i, item ){
+ item.selected = "selected";
+ p += paramName + "=" + item.value + "&";
+ });
+ return p;
+}
+
+// View 2
+
+function getAssignedDataElementGroups()
+{
+ loadAvailableGroups();
+
+ var id = jQuery( "#view_2 #availableDataElements2" ).val();
+ var list_2 = jQuery( "#view_2 #assignedGroups" );
+ list_2.empty();
+
+ jQuery.postJSON( "getAssignedDataElementGroups.action", {
+ dataElementId: id
+ }, function( json ){
+ jQuery.each(json.dataElementGroups, function(i, item ){
+ list_2.append('<option value="' + item.id + '">' + item.name + '</option>' );
+
+ jQuery( "#view_2 #availableGroups" ).children().each( function(k, it){
+ if( item.id == it.value )
+ {
+ jQuery(it).remove();
+ }
+ });
+
+ });
+
+ });
+}
+
+function assignGroupsForDataElement()
+{
+ var dataElementId = jQuery("#view_2 #availableDataElements2").val();
+
+ jQuery.getJSON( "asignGroupsForDataElement.action?dataElementId=" + dataElementId + "&" + toQueryString( '#view_2 #assignedGroups', 'dataElementGroups' ),
+ function( json ){
+ showSuccessMessage( i18n_update_success );
+ });
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js 2010-12-16 04:38:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js 2011-04-11 13:46:07 +0000
@@ -70,4 +70,3 @@
{
removeItem( indicatorId, indicatorName, i18n_confirm_delete, 'removeIndicator.action' );
}
-
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView.js 2011-04-08 05:34:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView.js 2011-04-11 13:46:07 +0000
@@ -1,321 +1,320 @@
jQuery(document).ready(function() {
- loadAvailableGroups();
- getIndicatorsByGroup();
- getAssignedIndicatorGroups();
- jQuery( "#addIndicatorGroupForm" ).dialog({autoOpen:false, modal:true});
- jQuery("#tabs").tabs();
+ loadAvailableGroups();
+ getIndicatorsByGroup();
+ getAssignedIndicatorGroups();
+ jQuery( "#addIndicatorGroupForm" ).dialog({autoOpen:false, modal:true});
+ jQuery("#tabs").tabs();
+});
+
+function loadAvailableIndicators()
+{
+ var filter_1 = jQuery( '#view_1 #availableIndicatorsFilter' ).val();
+ var filter_2 = jQuery( '#view_2 #availableIndicatorsFilter' ).val();
+ var list_1 = jQuery( "#view_1 #availableIndicators" );
+ var list_2 = jQuery( "#view_2 #availableIndicators2" );
+ list_1.empty();
+ list_2.empty();
+
+ for( var id in availableIndicators)
+ {
+ var text = availableIndicators[id];
+ if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
+ {
+ list_1.append('<option value="' + id + '">' + text + '</option>' );
+ list_2.append('<option value="' + id + '">' + text + '</option>' );
+ }
+ }
+
+ list_1.find(":first").attr("selected", "selected");
+ list_2.find(":first").attr("selected", "selected");
+
+}
+
+function loadAvailableGroups()
+{
+ var filter_1 = jQuery( '#view_1 #indicatorGroupsFilter' ).val();
+ var filter_2 = jQuery( '#view_2 #indicatorGroupsFilter' ).val();
+ var list_1 = jQuery( "#view_1 #indicatorGroups" );
+ var list_2 = jQuery( "#view_2 #availableGroups" );
+ list_1.empty();
+ list_2.empty();
+ for( var id in indicatorGroups)
+ {
+ var text = indicatorGroups[id];
+ if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
+ {
+ list_1.append('<option value="' + id + '">' + text + '</option>' );
+ list_2.append('<option value="' + id + '">' + text + '</option>' );
+ }
+ }
+
+ sortList( 'indicatorGroups', 'ASC' );
+ sortList( 'availableGroups', 'ASC' );
+ list_1.find(":first").attr("selected", "selected");
+ list_2.find(":first").attr("selected", "selected");
+
+ var list_3 = jQuery( "#view_2 #assignedGroups").children();
+ list_2.children().each( function(i, item ){
+ list_3.each( function(k, it ){
+ if( it.value == item.value ){
+ jQuery( item ).remove();
+ }
+ });
});
+}
-
- function loadAvailableIndicators()
- {
- var filter_1 = jQuery( '#view_1 #availableIndicatorsFilter' ).val();
- var filter_2 = jQuery( '#view_2 #availableIndicatorsFilter' ).val();
- var list_1 = jQuery( "#view_1 #availableIndicators" );
- var list_2 = jQuery( "#view_2 #availableIndicators2" );
- list_1.empty();
- list_2.empty();
-
- for( var id in availableIndicators)
- {
- var text = availableIndicators[id];
- if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
- {
- list_1.append('<option value="' + id + '">' + text + '</option>' );
- list_2.append('<option value="' + id + '">' + text + '</option>' );
- }
- }
-
- list_1.find(":first").attr("selected", "selected");
- list_2.find(":first").attr("selected", "selected");
-
- }
-
- function loadAvailableGroups()
- {
- var filter_1 = jQuery( '#view_1 #indicatorGroupsFilter' ).val();
- var filter_2 = jQuery( '#view_2 #indicatorGroupsFilter' ).val();
- var list_1 = jQuery( "#view_1 #indicatorGroups" );
- var list_2 = jQuery( "#view_2 #availableGroups" );
- list_1.empty();
- list_2.empty();
- for( var id in indicatorGroups)
- {
- var text = indicatorGroups[id];
+function getIndicatorsByGroup()
+{
+
+ loadAvailableIndicators();
+
+ var filter_1 = jQuery( '#view_1 #selectedIndicatorsFilter' ).val();
+ var list_1 = jQuery( "#view_1 #selectedIndicators" );
+ list_1.empty();
+
+ jQuery.postJSON( "../dhis-web-commons-ajax-json/getIndicators.action", {
+ id: jQuery( '#view_1 #indicatorGroups' ).val()
+ }, function( json ){
+ jQuery.each( json.indicators, function(i, item){
+ var text = item.name;
if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
{
- list_1.append('<option value="' + id + '">' + text + '</option>' );
- list_2.append('<option value="' + id + '">' + text + '</option>' );
- }
- }
-
- sortList( 'indicatorGroups', 'ASC' );
- sortList( 'availableGroups', 'ASC' );
- list_1.find(":first").attr("selected", "selected");
- list_2.find(":first").attr("selected", "selected");
-
- var list_3 = jQuery( "#view_2 #assignedGroups").children();
- list_2.children().each( function(i, item ){
- list_3.each( function(k, it ){
- if( it.value == item.value ){
- jQuery( item ).remove();
- }
- });
- });
- }
-
- function getIndicatorsByGroup()
- {
-
- loadAvailableIndicators();
-
- var filter_1 = jQuery( '#view_1 #selectedIndicatorsFilter' ).val();
- var list_1 = jQuery( "#view_1 #selectedIndicators" );
- list_1.empty();
-
- jQuery.postJSON( "../dhis-web-commons-ajax-json/getIndicators.action", {
- id: jQuery( '#view_1 #indicatorGroups' ).val()
- }, function( json ){
- jQuery.each( json.indicators, function(i, item){
- var text = item.name;
- if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1)
- {
- list_1.append('<option value="' + item.id + '">' + text + '</option>' );
- }
- jQuery( "#view_1 #availableIndicators" ).children().each( function(k, it){
- if( item.id == it.value )
- {
- jQuery(it).remove();
- }
- });
- });
- });
- }
-
- function showAddGroup()
- {
-
- jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_new);
- jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
- text: i18n_save,
- click: function(){
- jQuery.postJSON( "validateIndicatorGroup.action", {
- name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
- }, function( json ){
- if( json.response == 'success' ){
- jQuery.postJSON( "addIndicatorGroupEditor.action", {
- name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
- }, function( json ){
- indicatorGroups[json.indicatorGroup.id] = json.indicatorGroup.name;
- loadAvailableGroups();
- loadAvailableIndicators();
-
- jQuery( "#view_1 #selectedIndicators" ).empty();
- jQuery( '#addIndicatorGroupForm' ).dialog('close');
- } );
- }else{
- markInvalid( "addIndicatorGroupForm #name", json.message );
- }
- });
- }
- }]);
- jQuery( '#addIndicatorGroupForm' ).dialog('open');
-
- }
-
- function showUpdateGroup()
- {
- var id = jQuery( "#view_1 #indicatorGroups" ).val();
- var text = jQuery( "#view_1 #indicatorGroups option[value=" + id + "]" ).text();
- jQuery( '#addIndicatorGroupForm #name' ).val( text );
-
- jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
- text: i18n_save,
- click: function(){
-
- jQuery.postJSON( "validateIndicatorGroup.action", {
- id: id,
- name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
- }, function( json ){
- if( json.response == 'success' ){
- jQuery.postJSON( "renameIndicatorGroupEditor.action", {
- name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); },
- id: id
- }, function( json ){
- indicatorGroups[id] = jQuery( '#addIndicatorGroupForm #name' ).val();
- loadAvailableGroups();
- jQuery( '#addIndicatorGroupForm' ).dialog('close');
- showSuccessMessage( i18n_update_success );
- } );
- }else{
- markInvalid( "addIndicatorGroupForm #name", json.message );
- }
- });
- }
- }]);
-
- jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_rename);
- jQuery( '#addIndicatorGroupForm' ).dialog('open');
-
- }
-
- function deleteIndicatorGroup()
- {
- var id = jQuery( "#view_1 #indicatorGroups" ).val();
- var name = jQuery( "#view_1 #indicatorGroups option[value=" + id + "]" ).text();
-
- if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
- {
-
- jQuery.postJSON( "deleteIndicatorGroupEditor.action",{
- id: id
- }, function( json ){
- if( json.response == 'success'){
- indicatorGroups.splice(id, 1);
- loadAvailableGroups();
- showSuccessMessage( json.message );
- }else{
- showErrorMessage( json.message );
- }
- });
- }
- }
-
- function updateGroupMembers()
- {
- var id = jQuery( "#view_1 #indicatorGroups" ).val();
-
- jQuery.getJSON( "updateIndicatorGroupEditor.action?id=" + id + "&" + toQueryString( '#view_1 #selectedIndicators', 'groupMembers' ),
- function( json ){
- showSuccessMessage( i18n_update_success );
- });
- }
-
- function toQueryString( jQueryString, paramName )
- {
- var p = "";
- jQuery( jQueryString ).children().each(function(i, item ){
- item.selected = "selected";
- p += paramName + "=" + item.value + "&";
- });
- return p;
- }
-
- // View2
- function getAssignedIndicatorGroups()
- {
- loadAvailableGroups();
-
- var id = jQuery( "#view_2 #availableIndicators2" ).val();
- var list_2 = jQuery( "#view_2 #assignedGroups" );
- list_2.empty();
-
- jQuery.postJSON( "getAssignedIndicatorGroups.action", {
- indicatorId: id
- }, function( json ){
- jQuery.each(json.indicatorGroups, function(i, item ){
- list_2.append('<option value="' + item.id + '">' + item.name + '</option>' );
-
- jQuery( "#view_2 #availableGroups" ).children().each( function(k, it){
- if( item.id == it.value )
- {
- jQuery(it).remove();
- }
- });
-
- });
-
- });
- }
-
- function showAddGroup2()
- {
- jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_new);
- jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
- text: i18n_save,
- click: function(){
- jQuery.postJSON( "validateIndicatorGroup.action", {
- name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
- }, function( json ){
- if( json.response == 'success' ){
- jQuery.postJSON( "addIndicatorGroupEditor.action", {
- name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
- }, function( json ){
- indicatorGroups[json.indicatorGroup.id] = json.indicatorGroup.name;
- loadAvailableGroups();
- jQuery( '#addIndicatorGroupForm' ).dialog('close');
- } );
- }else{
- markInvalid( "addIndicatorGroupForm #name", json.message );
- }
- });
- }
- }]);
- jQuery( '#addIndicatorGroupForm' ).dialog('open');
- }
-
- function showUpdateGroup2()
- {
- var id = jQuery( "#view_2 #availableGroups" ).val()[0];
- var text = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text();
- jQuery( '#addIndicatorGroupForm #name' ).val( text );
-
- jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
- text: i18n_save,
- click: function(){
- jQuery.postJSON( "validateIndicatorGroup.action", {
- id: id,
- name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
- }, function( json ){
- if( json.response == 'success' ){
- jQuery.postJSON( "renameIndicatorGroupEditor.action", {
- name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); },
- id: id
- }, function( json ){
- indicatorGroups[id] = jQuery( '#addIndicatorGroupForm #name' ).val();
- loadAvailableGroups();
- jQuery( '#addIndicatorGroupForm' ).dialog('close');
- showSuccessMessage( i18n_update_success );
- } );
- }else{
- markInvalid( "addIndicatorGroupForm #name", json.message );
- }
- });
- }
- }]);
-
- jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_rename);
- jQuery( '#addIndicatorGroupForm' ).dialog('open');
- }
-
- function deleteIndicatorGroup2()
- {
- var id = jQuery( "#view_2 #availableGroups" ).val()[0];
- var name = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text();
-
- if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
- {
-
- jQuery.postJSON( "deleteIndicatorGroupEditor.action",{
- id: id
- }, function( json ){
- if( json.response == 'success'){
- indicatorGroups.splice(id, 1);
- loadAvailableGroups();
- showSuccessMessage( json.message );
- }else{
- showErrorMessage( json.message );
- }
- });
- }
- }
-
- function assignGroupsForIndicator()
- {
- var id = jQuery( "#view_2 #availableIndicators2" ).val();
-
- jQuery.getJSON( "asignGroupsForIndicator.action?indicatorId=" + id + "&" + toQueryString( '#view_2 #assignedGroups', 'indicatorGroups' ),
- function( json ){
- showSuccessMessage( i18n_update_success );
- });
- }
\ No newline at end of file
+ list_1.append('<option value="' + item.id + '">' + text + '</option>' );
+ }
+ jQuery( "#view_1 #availableIndicators" ).children().each( function(k, it){
+ if( item.id == it.value )
+ {
+ jQuery(it).remove();
+ }
+ });
+ });
+ });
+}
+
+function showAddGroup()
+{
+
+ jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_new);
+ jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
+ text: i18n_save,
+ click: function(){
+ jQuery.postJSON( "validateIndicatorGroup.action", {
+ name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
+ }, function( json ){
+ if( json.response == 'success' ){
+ jQuery.postJSON( "addIndicatorGroupEditor.action", {
+ name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
+ }, function( json ){
+ indicatorGroups[json.indicatorGroup.id] = json.indicatorGroup.name;
+ loadAvailableGroups();
+ loadAvailableIndicators();
+
+ jQuery( "#view_1 #selectedIndicators" ).empty();
+ jQuery( '#addIndicatorGroupForm' ).dialog('close');
+ } );
+ }else{
+ markInvalid( "addIndicatorGroupForm #name", json.message );
+ }
+ });
+ }
+ }]);
+ jQuery( '#addIndicatorGroupForm' ).dialog('open');
+
+}
+
+function showUpdateGroup()
+{
+ var id = jQuery( "#view_1 #indicatorGroups" ).val();
+ var text = jQuery( "#view_1 #indicatorGroups option[value=" + id + "]" ).text();
+ jQuery( '#addIndicatorGroupForm #name' ).val( text );
+
+ jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
+ text: i18n_save,
+ click: function(){
+
+ jQuery.postJSON( "validateIndicatorGroup.action", {
+ id: id,
+ name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
+ }, function( json ){
+ if( json.response == 'success' ){
+ jQuery.postJSON( "renameIndicatorGroupEditor.action", {
+ name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); },
+ id: id
+ }, function( json ){
+ indicatorGroups[id] = jQuery( '#addIndicatorGroupForm #name' ).val();
+ loadAvailableGroups();
+ jQuery( '#addIndicatorGroupForm' ).dialog('close');
+ showSuccessMessage( i18n_update_success );
+ } );
+ }else{
+ markInvalid( "addIndicatorGroupForm #name", json.message );
+ }
+ });
+ }
+ }]);
+
+ jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_rename);
+ jQuery( '#addIndicatorGroupForm' ).dialog('open');
+
+}
+
+function deleteIndicatorGroup()
+{
+ var id = jQuery( "#view_1 #indicatorGroups" ).val();
+ var name = jQuery( "#view_1 #indicatorGroups option[value=" + id + "]" ).text();
+
+ if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
+ {
+
+ jQuery.postJSON( "deleteIndicatorGroupEditor.action",{
+ id: id
+ }, function( json ){
+ if( json.response == 'success'){
+ indicatorGroups.splice(id, 1);
+ loadAvailableGroups();
+ showSuccessMessage( json.message );
+ }else{
+ showErrorMessage( json.message );
+ }
+ });
+ }
+}
+
+function updateGroupMembers()
+{
+ var id = jQuery( "#view_1 #indicatorGroups" ).val();
+
+ jQuery.getJSON( "updateIndicatorGroupEditor.action?id=" + id + "&" + toQueryString( '#view_1 #selectedIndicators', 'groupMembers' ),
+ function( json ){
+ showSuccessMessage( i18n_update_success );
+ });
+}
+
+function toQueryString( jQueryString, paramName )
+{
+ var p = "";
+ jQuery( jQueryString ).children().each(function(i, item ){
+ item.selected = "selected";
+ p += paramName + "=" + item.value + "&";
+ });
+ return p;
+}
+
+// View2
+function getAssignedIndicatorGroups()
+{
+ loadAvailableGroups();
+
+ var id = jQuery( "#view_2 #availableIndicators2" ).val();
+ var list_2 = jQuery( "#view_2 #assignedGroups" );
+ list_2.empty();
+
+ jQuery.postJSON( "getAssignedIndicatorGroups.action", {
+ indicatorId: id
+ }, function( json ){
+ jQuery.each(json.indicatorGroups, function(i, item ){
+ list_2.append('<option value="' + item.id + '">' + item.name + '</option>' );
+
+ jQuery( "#view_2 #availableGroups" ).children().each( function(k, it){
+ if( item.id == it.value )
+ {
+ jQuery(it).remove();
+ }
+ });
+
+ });
+
+ });
+}
+
+function showAddGroup2()
+{
+ jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_new);
+ jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
+ text: i18n_save,
+ click: function(){
+ jQuery.postJSON( "validateIndicatorGroup.action", {
+ name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
+ }, function( json ){
+ if( json.response == 'success' ){
+ jQuery.postJSON( "addIndicatorGroupEditor.action", {
+ name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
+ }, function( json ){
+ indicatorGroups[json.indicatorGroup.id] = json.indicatorGroup.name;
+ loadAvailableGroups();
+ jQuery( '#addIndicatorGroupForm' ).dialog('close');
+ } );
+ }else{
+ markInvalid( "addIndicatorGroupForm #name", json.message );
+ }
+ });
+ }
+ }]);
+ jQuery( '#addIndicatorGroupForm' ).dialog('open');
+}
+
+function showUpdateGroup2()
+{
+ var id = jQuery( "#view_2 #availableGroups" ).val()[0];
+ var text = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text();
+ jQuery( '#addIndicatorGroupForm #name' ).val( text );
+
+ jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{
+ text: i18n_save,
+ click: function(){
+ jQuery.postJSON( "validateIndicatorGroup.action", {
+ id: id,
+ name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }
+ }, function( json ){
+ if( json.response == 'success' ){
+ jQuery.postJSON( "renameIndicatorGroupEditor.action", {
+ name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); },
+ id: id
+ }, function( json ){
+ indicatorGroups[id] = jQuery( '#addIndicatorGroupForm #name' ).val();
+ loadAvailableGroups();
+ jQuery( '#addIndicatorGroupForm' ).dialog('close');
+ showSuccessMessage( i18n_update_success );
+ } );
+ }else{
+ markInvalid( "addIndicatorGroupForm #name", json.message );
+ }
+ });
+ }
+ }]);
+
+ jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_rename);
+ jQuery( '#addIndicatorGroupForm' ).dialog('open');
+}
+
+function deleteIndicatorGroup2()
+{
+ var id = jQuery( "#view_2 #availableGroups" ).val()[0];
+ var name = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text();
+
+ if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
+ {
+
+ jQuery.postJSON( "deleteIndicatorGroupEditor.action",{
+ id: id
+ }, function( json ){
+ if( json.response == 'success'){
+ indicatorGroups.splice(id, 1);
+ loadAvailableGroups();
+ showSuccessMessage( json.message );
+ }else{
+ showErrorMessage( json.message );
+ }
+ });
+ }
+}
+
+function assignGroupsForIndicator()
+{
+ var id = jQuery( "#view_2 #availableIndicators2" ).val();
+
+ jQuery.getJSON( "asignGroupsForIndicator.action?indicatorId=" + id + "&" + toQueryString( '#view_2 #assignedGroups', 'indicatorGroups' ),
+ function( json ){
+ showSuccessMessage( i18n_update_success );
+ });
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/optionCombinationList.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/optionCombinationList.js 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/optionCombinationList.js 2011-04-11 13:46:07 +0000
@@ -1,51 +1,50 @@
var selectedList;
var availableList;
-function move( listId ) {
-
- var fromList = document.getElementById(listId);
-
- if ( fromList.selectedIndex == -1 ) { return; }
-
- if ( ! availableList ) {
- availableList = document.getElementById('availableList');
- }
-
- if ( ! selectedList ) {
- selectedList = document.getElementById('selectedList');
- }
-
- var toList = ( fromList == availableList ? selectedList : availableList );
-
- while ( fromList.selectedIndex > -1 ) {
- option = fromList.options.item(fromList.selectedIndex);
- fromList.remove(fromList.selectedIndex);
- toList.add(option, null);
- }
-
+function move(listId) {
+
+ var fromList = document.getElementById(listId);
+
+ if (fromList.selectedIndex == -1) {
+ return;
+ }
+
+ if (!availableList) {
+ availableList = document.getElementById('availableList');
+ }
+
+ if (!selectedList) {
+ selectedList = document.getElementById('selectedList');
+ }
+
+ var toList = (fromList == availableList ? selectedList : availableList);
+
+ while (fromList.selectedIndex > -1) {
+ option = fromList.options.item(fromList.selectedIndex);
+ fromList.remove(fromList.selectedIndex);
+ toList.add(option, null);
+ }
}
function submitForm() {
- if ( ! availableList ) {
- availableList = document.getElementById('availableList');
- }
-
- if ( ! selectedList ) {
- selectedList = document.getElementById('selectedList');
- }
-
- // selectAll(availableList);
- selectAll(selectedList);
-
- return false;
-
+ if (!availableList) {
+ availableList = document.getElementById('availableList');
+ }
+
+ if (!selectedList) {
+ selectedList = document.getElementById('selectedList');
+ }
+
+ // selectAll(availableList);
+ selectAll(selectedList);
+
+ return false;
}
function selectAll(list) {
- for ( var i = 0, option; option = list.options.item(i); i++ ) {
- option.selected = true;
- }
-
-}
\ No newline at end of file
+ for ( var i = 0, option; option = list.options.item(i); i++) {
+ option.selected = true;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/selectedOptionList.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/selectedOptionList.js 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/selectedOptionList.js 2011-04-11 13:46:07 +0000
@@ -1,32 +1,28 @@
var selectedList;
-function addToSelectedList( srcListId ) {
-
- selectedList = document.getElementById('selectedList');
- srcList = document.getElementById(srcListId);
-
- option = srcList.options.item(srcList.selectedIndex);
- selectedList.add(option,null);
-
+function addToSelectedList(srcListId) {
+
+ selectedList = document.getElementById('selectedList');
+ srcList = document.getElementById(srcListId);
+
+ option = srcList.options.item(srcList.selectedIndex);
+ selectedList.add(option, null);
}
function submitForm() {
- if ( ! selectedList ) {
- selectedList = document.getElementById('selectedList');
- }
-
- // selectAll(availableList);
- selectAll(selectedList);
-
- return false;
-
+ if (!selectedList) {
+ selectedList = document.getElementById('selectedList');
+ }
+
+ // selectAll(availableList);
+ selectAll(selectedList);
+
+ return false;
}
function selectAll(list) {
-
- for ( var i = 0, option; option = list.options.item(i); i++ ) {
- option.selected = true;
- }
-
-}
\ No newline at end of file
+ for ( var i = 0, option; option = list.options.item(i); i++) {
+ option.selected = true;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataDictionaryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataDictionaryForm.js 2011-03-30 11:04:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataDictionaryForm.js 2011-04-11 13:46:07 +0000
@@ -1,34 +1,9 @@
jQuery(document).ready( function(){
- var r = getValidationRules();
-
- var rules = {
- name: {
- required: true,
- rangelength: [2, 160]
- },
- description: {
- rangelength: [0, 255]
- },
- region: {
- rangelength: [0, 255]
- },
- memberValidator: {
- required: true
- },
- memberValidatorIn: {
- required: true
- }
- };
-
validation2( 'updateDataDictionaryForm', function( form ){ form.submit()}, {
'beforeValidateHandler': function(){
listValidator( 'memberValidator', 'selectedDataElements' );
listValidator( 'memberValidatorIn', 'selectedIndicators' );
},
- 'rules': rules
+ 'rules': getValidationRules("dataDictionary")
});
-
- jQuery("#name").attr("maxlength", "160");
- jQuery("#description").attr("maxlength", "255");
- jQuery("#region").attr("maxlength", "255");
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementForm.js 2011-04-08 12:48:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementForm.js 2011-04-11 13:46:07 +0000
@@ -1,40 +1,4 @@
jQuery(document).ready( function() {
- var r = getValidationRules();
-
- var rules = {
- name: {
- required:true,
- rangelength: [3, 150],
- alphanumericwithbasicpuncspaces:true,
- notOnlyDigits:true
- },
- shortName: {
- required:true,
- rangelength: [2, 20],
- alphanumericwithbasicpuncspaces:true,
- notOnlyDigits:true
- },
- alternativeName: {
- rangelength: [3, 150],
- alphanumericwithbasicpuncspaces:true,
- notOnlyDigits:true
- },
- code: {
- rangelength: [3, 40],
- alphanumericwithbasicpuncspaces:true,
- notOnlyDigits:false
- },
- description: {
- rangelength: [3, 250],
- alphanumericwithbasicpuncspaces:true,
- notOnlyDigits:true
- },
- url: {
- url: true,
- rangelength: [0, 255]
- }
- };
-
validation2( 'updateDataElementForm', function( form ) { form.submit(); }, {
'beforeValidateHandler': function() {
getDataElementIdsForValidate();
@@ -42,13 +6,6 @@
setFieldValue( 'submitCategoryComboId', getFieldValue( 'selectedCategoryComboId' ) );
setFieldValue( 'submitValueType', getFieldValue( 'valueType' ) );
},
- 'rules': rules
+ 'rules': getValidationRules("dataElement")
});
-
- jQuery("#name").attr("maxlength", "150");
- jQuery("#shortName").attr("maxlength", "20");
- jQuery("#alternativeName").attr("maxlength", "150");
- jQuery("#code").attr("maxlength", "40");
- jQuery("#description").attr("maxlength", "250");
- jQuery("#url").attr("maxlength", "255");
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupForm.js 2011-03-31 11:17:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupForm.js 2011-04-11 13:46:07 +0000
@@ -1,25 +1,11 @@
jQuery(document).ready(function() {
- var r = getValidationRules();
-
- var rules = {
- name : {
- required : true,
- rangelength : r.dataElementGroup.name.rangelength,
- alphanumericwithbasicpuncspaces : true,
- notOnlyDigits : true,
- firstletteralphabet : true
- }
- };
-
validation2('updateDataElementGroupForm', function(form) {
form.submit()
}, {
'beforeValidateHandler' : beforeSubmit,
- 'rules' : rules
+ 'rules' : getValidationRules("dataElementGroup")
});
- jQuery("#name").attr("maxlength", r.dataElementGroup.name.rangelength[1]);
-
checkValueIsExist("name", "validateDataElementGroup.action", {
id : getFieldValue('id')
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupSet.js 2011-03-31 11:17:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupSet.js 2011-04-11 13:46:07 +0000
@@ -1,22 +1,11 @@
jQuery(document).ready(function() {
- var r = getValidationRules();
-
- var rules = {
- name : {
- required : true,
- rangelength : r.dataElementGroupSet.name.rangelength
- }
- };
-
validation2('updateDataElementGroupSet', function(form) {
form.submit()
}, {
'beforeValidateHandler' : beforeSubmit,
- 'rules' : rules
+ 'rules' : getValidationRules("dataElementGroupSet")
});
- jQuery("#name").attr("maxlength", r.dataElementGroupSet.name.rangelength[1]);
-
checkValueIsExist("name", "validateDataElementGroupSet.action", {
id : getFieldValue('id')
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorForm.js 2011-03-31 12:05:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorForm.js 2011-04-11 13:46:07 +0000
@@ -1,59 +1,10 @@
jQuery(document).ready(function() {
- var r = getValidationRules();
-
- var rules = {
- name : {
- required : true,
- rangelength : r.indicator.name.rangelength,
- alphanumericwithbasicpuncspaces : r.indicator.name.alphanumericwithbasicpuncspaces,
- firstletteralphabet : r.indicator.name.firstletteralphabet
- },
- shortName : {
- required : true,
- rangelength : r.indicator.shortName.rangelength,
- alphanumericwithbasicpuncspaces : r.indicator.shortName.alphanumericwithbasicpuncspaces,
- firstletteralphabet : r.indicator.shortName.firstletteralphabet
- },
- alternativeName : {
- rangelength : r.indicator.alternativeName.rangelength,
- alphanumericwithbasicpuncspaces : r.indicator.alternativeName.alphanumericwithbasicpuncspaces,
- firstletteralphabet : r.indicator.alternativeName.firstletteralphabet
- },
- code : {
- rangelength : r.indicator.code.rangelength,
- alphanumericwithbasicpuncspaces : r.indicator.code.alphanumericwithbasicpuncspaces,
- notOnlyDigits : r.indicator.code.notOnlyDigits
- },
- description : {
- rangelength : r.indicator.description.rangelength,
- alphanumericwithbasicpuncspaces : r.indicator.description.alphanumericwithbasicpuncspaces,
- firstletteralphabet : r.indicator.description.firstletteralphabet
- },
- indicatorTypeId : {
- required : true
- },
- url : {
- url : true,
- rangelength : r.indicator.url.rangelength
- },
- denominator : {
- required : true
- }
- };
-
validation2('updateIndicatorForm', function(form) {
form.submit();
}, {
- 'rules' : rules
+ 'rules' : getValidationRules("indicator")
});
- jQuery("#name").attr("maxlength", r.indicator.name.rangelength[1]);
- jQuery("#shortName").attr("maxlength", r.indicator.shortName.rangelength[1]);
- jQuery("#alternativeName").attr("maxlength", r.indicator.alternativeName.rangelength[1]);
- jQuery("#code").attr("maxlength", r.indicator.code.rangelength[1]);
- jQuery("#description").attr("maxlength", r.indicator.description.rangelength[1]);
- jQuery("#url").attr("maxlength", r.indicator.url.rangelength[1]);
-
checkValueIsExist("name", "validateIndicator.action", {
id : getFieldValue('id')
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorGroupForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorGroupForm.js 2011-03-31 12:05:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorGroupForm.js 2011-04-11 13:46:07 +0000
@@ -1,23 +1,10 @@
jQuery(document).ready(function() {
- var r = getValidationRules();
-
- var rules = {
- name : {
- required : true,
- rangelength : r.indicatorGroup.name.rangelength,
- alphanumericwithbasicpuncspaces : true,
- firstletteralphabet : true
- }
- };
-
validation2('updateIndicatorGroupForm', function(form) {
form.submit()
}, {
'beforeValidateHandler' : function() {
listValidator('memberValidator', 'groupMembers');
},
- 'rules' : rules
+ 'rules' : getValidationRules("indicatorGroup")
});
-
- jQuery("#name").attr("maxlength", r.indicatorGroup.name.rangelength[1]);
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorGroupSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorGroupSet.js 2011-03-31 13:13:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorGroupSet.js 2011-04-11 13:46:07 +0000
@@ -1,18 +1,10 @@
jQuery(document).ready(function() {
- var r = getValidationRules();
-
- var rules = {
- name : {
- required : true,
- rangelength : r.indicatorGroupSet.name.rangelength
- }
- };
-
- validation('updateIndicatorGroupSet', function(form) {
+ validation2('updateIndicatorGroupSet', function(form) {
form.submit()
- }, function() {
- listValidator('memberValidator', 'groupMembers');
+ }, {
+ 'beforeValidateHandler' : function() {
+ listValidator('memberValidator', 'groupMembers');
+ },
+ 'rules' : getValidationRules("indicatorGroupSet")
});
-
- jQuery("#name").attr("maxlength", r.indicatorGroupSet.name.rangelength[1]);
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorTypeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorTypeForm.js 2011-04-08 05:58:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorTypeForm.js 2011-04-11 13:46:07 +0000
@@ -1,30 +1,11 @@
jQuery(document).ready(function() {
- var r = getValidationRules();
-
- var rules = {
- name : {
- required : true,
- rangelength : r.indicatorType.name.rangelength,
- alphanumericwithbasicpuncspaces : r.indicatorType.name.alphanumericwithbasicpuncspaces,
- firstletteralphabet : r.indicatorType.name.firstletteralphabet
- },
- factor : {
- required : true,
- rangelength : r.indicatorType.factor.rangelength,
- digits : true
- }
- };
-
validation2('updateIndicatorTypeForm', function(form) {
form.submit()
}, {
- 'rules' : rules
+ 'rules' : getValidationRules("indicatorType")
});
- jQuery("#name").attr("maxlength", r.indicatorType.name.rangelength[1]);
- jQuery("#factor").attr("maxlength", r.indicatorType.factor.rangelength[1]);
-
- var nameField = document.getElementById( 'name' );
+ var nameField = document.getElementById('name');
nameField.select();
nameField.focus();
});