dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11409
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3234: Finished js/validation in datadictionary
------------------------------------------------------------
revno: 3234
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-03-31 15:13:10 +0200
message:
Finished js/validation in datadictionary
added:
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/updateIndicatorGroupSet.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorTypeForm.js
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-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorGroupSet.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorTypeForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorType.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorGroupSet.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorTypeForm.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2011-03-31 12:05:54 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2011-03-31 13:13:10 +0000
@@ -204,5 +204,20 @@
"alphanumericwithbasicpuncspaces" : true,
"firstletteralphabet" : true
}
+ },
+ "indicatorGroupSet" : {
+ "name" : {
+ "rangelength" : [ 2, 230 ]
+ }
+ },
+ "indicatorType" : {
+ "name" : {
+ "rangelength" : [ 3, 150 ],
+ "alphanumericwithbasicpuncspaces" : true,
+ "firstletteralphabet" : true
+ },
+ "factor" : {
+ "rangelength" : [ 1, 10 ]
+ }
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorGroupSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorGroupSet.vm 2011-03-18 14:14:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorGroupSet.vm 2011-03-31 13:13:10 +0000
@@ -1,12 +1,4 @@
-<script type="text/javascript">
- jQuery(document).ready( function(){
- validation( 'addIndicatorGroupSet', function( form ){ form.submit()}, function(){
- listValidator( 'memberValidator', 'groupMembers' );
- } );
-
- checkValueIsExist( "name", "validateIndicatorGroupSet.action");
- });
-</script>
+<script type="text/javascript" src="javascript/addIndicatorGroupSet.js"></script>
<h3>$i18n.getString( "add_indicatorgroupset" )</h3>
@@ -18,7 +10,7 @@
</tr>
<tr>
<td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name" style="width:20em" maxlength="230" class="{validate:{required:true,minlength:2}}"/></td>
+ <td><input type="text" id="name" name="name" style="width:20em"/></td>
</tr>
<tr>
<td colspan="2" height="15px"></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorTypeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorTypeForm.vm 2011-03-18 14:14:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorTypeForm.vm 2011-03-31 13:13:10 +0000
@@ -1,9 +1,4 @@
-<script type="text/javascript">
- jQuery(document).ready( function() {
- validation( 'addIndicatorTypeForm', function( form ){ form.submit()} );
- checkValueIsExist( "name", "validateIndicatorType.action");
- });
-</script>
+<script type="text/javascript" src="javascript/addIndicatorTypeForm.js"></script>
<h3>$i18n.getString( "create_new_indicator_type" )</h3>
@@ -15,11 +10,11 @@
</tr>
<tr>
<td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name" style="width:20em" maxlength="150" class="{validate:{required:true,minlength:3,alphanumericwithbasicpuncspaces:true,firstletteralphabet:true}}"/></td>
+ <td><input type="text" id="name" name="name" style="width:20em"/></td>
</tr>
<tr>
<td><label for="factor">$i18n.getString( "factor" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="factor" name="factor" style="width:20em" maxlength="10" class="{validate:{required:true,number:true,min:1}}"/></td>
+ <td><input type="text" id="factor" name="factor" style="width:20em"/></td>
</tr>
<tr>
<td><label for="number">$i18n.getString( "number" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView.vm 2011-03-18 14:14:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditorView.vm 2011-03-31 13:13:10 +0000
@@ -6,6 +6,7 @@
getAssignedDataElementGroups();
jQuery( "#addDataElementGroupForm" ).dialog({autoOpen:false, modal:true});
+ jQuery("#tabs").tabs();
});
var dataElementGroups = new Array();
@@ -336,7 +337,7 @@
}
</script>
-<style type="text/javascript">
+<style type="text/css">
#addDataElementGroupForm{
width:300px;
}
@@ -351,11 +352,6 @@
<h3>
$i18n.getString( "data_element_group_management" ) #openHelp( "dataElementGroupEditor" )
</h3>
-<script>
- jQuery(function(){
- jQuery("#tabs").tabs();
- });
-</script>
<div id="tabs" style="position:absolute">
<ul>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorType.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorType.vm 2011-03-18 14:14:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorType.vm 2011-03-31 13:13:10 +0000
@@ -3,13 +3,6 @@
tableSorter( 'listTable' );
});
- var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_indicator_type" ) , "'")';
- var i18n_adding_indicator_type_failed = '$encoder.jsEscape( $i18n.getString( "adding_indicator_type_failed" ) , "'")';
- var i18n_saving_indicator_type_failed = '$encoder.jsEscape( $i18n.getString( "saving_indicator_type_failed" ) , "'")';
-
- // -----------------------------------------------------------------------------
- // View details
- // -----------------------------------------------------------------------------
function showIndicatorTypeDetails( indicatorTypeId )
{
var request = new Request();
@@ -26,13 +19,14 @@
showDetails();
}
- // -----------------------------------------------------------------------------
- // Remove indicator type
- // -----------------------------------------------------------------------------
function removeIndicatorType( indicatorTypeId, indicatorTypeName )
{
removeItem( indicatorTypeId, indicatorTypeName, i18n_confirm_delete, 'removeIndicatorType.action' );
}
+
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_indicator_type" ) , "'")';
+ var i18n_adding_indicator_type_failed = '$encoder.jsEscape( $i18n.getString( "adding_indicator_type_failed" ) , "'")';
+ var i18n_saving_indicator_type_failed = '$encoder.jsEscape( $i18n.getString( "saving_indicator_type_failed" ) , "'")';
</script>
<h3>$i18n.getString( "indicator_type_management" ) #openHelp( "indicatorType" )</h3>
=== added 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 1970-01-01 00:00:00 +0000
+++ 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
@@ -0,0 +1,23 @@
+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
+ });
+
+ jQuery("#name").attr("maxlength", r.indicatorGroupSet.name.rangelength[1]);
+
+ checkValueIsExist("name", "validateIndicatorGroupSet.action");
+});
=== added 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 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorTypeForm.js 2011-03-31 13:13:10 +0000
@@ -0,0 +1,27 @@
+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
+ }
+ };
+
+ validation2('addIndicatorTypeForm', function(form) {
+ form.submit()
+ }, {
+ 'rules' : rules
+ });
+
+ jQuery("#name").attr("maxlength", r.indicatorType.name.rangelength[1]);
+ jQuery("#factor").attr("maxlength", r.indicatorType.factor.rangelength[1]);
+
+ checkValueIsExist("name", "validateIndicatorType.action");
+});
=== added 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 1970-01-01 00:00:00 +0000
+++ 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
@@ -0,0 +1,18 @@
+jQuery(document).ready(function() {
+ var r = getValidationRules();
+
+ var rules = {
+ name : {
+ required : true,
+ rangelength : r.indicatorGroupSet.name.rangelength
+ }
+ };
+
+ validation('updateIndicatorGroupSet', function(form) {
+ form.submit()
+ }, function() {
+ listValidator('memberValidator', 'groupMembers');
+ });
+
+ jQuery("#name").attr("maxlength", r.indicatorGroupSet.name.rangelength[1]);
+});
=== added 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 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorTypeForm.js 2011-03-31 13:13:10 +0000
@@ -0,0 +1,29 @@
+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
+ }
+ };
+
+ validation2('updateIndicatorTypeForm', function(form) {
+ form.submit()
+ }, {
+ 'rules' : rules
+ });
+
+ jQuery("#name").attr("maxlength", r.indicatorType.name.rangelength[1]);
+ jQuery("#factor").attr("maxlength", r.indicatorType.factor.rangelength[1]);
+
+ var nameField = document.getElementById( 'name' );
+ nameField.select();
+ nameField.focus();
+});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorGroupSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorGroupSet.vm 2011-03-18 14:14:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorGroupSet.vm 2011-03-31 13:13:10 +0000
@@ -1,9 +1,6 @@
+<script type="text/javascript" src="javascript/updateIndicatorGroupSet.js"></script>
<script type="text/javascript">
- jQuery(document).ready( function(){
- validation( 'updateIndicatorGroupSet', function( form ){ form.submit()}, function(){
- listValidator( 'memberValidator', 'groupMembers' );
- } );
-
+ jQuery(document).ready( function() {
checkValueIsExist( "name", "validateIndicatorGroupSet.action", {id: $indicatorGroupSet.id});
});
</script>
@@ -18,7 +15,7 @@
</tr>
<tr>
<td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name" style="width:20em" value="$encoder.htmlEncode( $indicatorGroupSet.name )" maxlength="230" class="{validate:{required:true,minlength:2}}"/></td>
+ <td><input type="text" id="name" name="name" style="width:20em" value="$encoder.htmlEncode( $indicatorGroupSet.name )"/></td>
</tr>
<tr>
<td colspan="2" height="15px"></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorTypeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorTypeForm.vm 2011-03-18 14:14:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorTypeForm.vm 2011-03-31 13:13:10 +0000
@@ -1,11 +1,7 @@
+<script type="text/javascript" src="javascript/updateIndicatorTypeForm.js"></script>
<script type="text/javascript">
jQuery(document).ready( function(){
- validation( 'updateIndicatorTypeForm', function( form ){ form.submit()} );
checkValueIsExist( "name", "validateIndicatorType.action", {id: $indicatorType.id});
-
- var nameField = document.getElementById( 'name' );
- nameField.select();
- nameField.focus();
});
</script>
@@ -23,11 +19,11 @@
</tr>
<tr>
<td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name" value="$encoder.htmlEncode( $indicatorType.name )" style="width:20em" maxlength="150" class="{validate:{required:true,minlength:3,alphanumericwithbasicpuncspaces:true,firstletteralphabet:true}}"/> </td>
+ <td><input type="text" id="name" name="name" value="$encoder.htmlEncode( $indicatorType.name )" style="width:20em"/> </td>
</tr>
<tr>
<td><label for="factor">$i18n.getString( "factor" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="factor" name="factor" value="$indicatorType.factor" style="width:20em" maxlength="10" class="{validate:{required:true,number:true,min:1}}"/></td>
+ <td><input type="text" id="factor" name="factor" value="$indicatorType.factor" style="width:20em"/></td>
</tr>
<tr>
<td><label for="number">$i18n.getString( "number" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>