dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #10889
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3007: made more changes to user/usergroup/role validation, add/update should now use the same validation
------------------------------------------------------------
revno: 3007
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-03-11 14:35:36 +0100
message:
made more changes to user/usergroup/role validation, add/update should now use the same validation
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/updateUserAccountForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateRoleForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserGroupForm.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/useraccount/updateUserAccountForm.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/updateUserAccountForm.vm 2011-03-10 16:31:56 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/useraccount/updateUserAccountForm.vm 2011-03-11 13:35:36 +0000
@@ -1,8 +1,8 @@
<script>
- jQuery(document).ready( function(){
+ jQuery(document).ready( function() {
var rules = {
oldPassword: {required: true},
- rawPassword: {required:false, password:true, minlength:8, notequalto:'#username'},
+ rawPassword: {required:false, password:true, rangelength: [8, 35], notequalto:'#username'},
retypePassword: {required:true, equalTo:'#rawPassword'},
surname: {required:true, minlength:2},
firstName: {required:true, minlength:2},
@@ -10,16 +10,14 @@
phoneNumber: {}
}
- validation2('updateUserinforForm', updateUser,
- {
- 'rules': rules
- }
- );
-
+ validation2('updateUserinforForm', updateUser, {
+ 'rules': rules
+ });
+
jQuery("#rawPassword").attr("maxlength", "35");
jQuery("#retypePassword").attr("maxlength", jQuery("#rawPassword").attr("maxlength"));
- jQuery("#surname").attr("maxlength", "160");
- jQuery("#firstName").attr("maxlength", "160");
+ jQuery("#surname").attr("maxlength", "140");
+ jQuery("#firstName").attr("maxlength", "140");
jQuery("#email").attr("maxlength", "160");
jQuery("#phoneNumber").attr("maxlength", "80");
});
@@ -43,11 +41,11 @@
</tr>
<tr>
<td><label for="rawPassword">$i18n.getString( "old_password" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
- <td><input type="password" id="oldPassword" name="oldPassword" style="width:20em" style="width:20em"/></td>
+ <td><input type="password" id="oldPassword" name="oldPassword" style="width:20em"></td>
</tr>
<tr>
<td><label for="rawPassword">$i18n.getString( "new_password" )</label></td>
- <td><input type="password" id="rawPassword" name="rawPassword" style="width:20em" style="width:20em"></td>
+ <td><input type="password" id="rawPassword" name="rawPassword" style="width:20em"></td>
</tr>
<tr>
<td><label for="retypePassword">$i18n.getString( "retype_new_password" )</label></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm 2011-03-10 17:04:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm 2011-03-11 13:35:36 +0000
@@ -1,5 +1,5 @@
<script>
- jQuery(document).ready( function(){
+ jQuery(document).ready( function() {
jQuery("#name").focus();
var rules = {
@@ -15,7 +15,7 @@
'rules': rules
});
- jQuery("#name").attr("maxlength", "160");
+ jQuery("#name").attr("maxlength", "140");
/* remote validation */
checkValueIsExist( "name", "validateRole.action");
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm 2011-03-10 16:31:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm 2011-03-11 13:35:36 +0000
@@ -1,8 +1,8 @@
<script>
- jQuery(document).ready( function(){
+ jQuery(document).ready( function() {
var rules = {
username: {required:true, firstletteralphabet:true, minlength:2, alphanumeric:true},
- rawPassword: {required:false, password:true, minlength:8, notequalto:'#username'},
+ rawPassword: {required:false, password:true, rangelength: [8, 35], notequalto:'#username'},
retypePassword: {required:true, equalTo:'#rawPassword'},
surname: {required:true, minlength:2},
firstName: {required:true, minlength:2},
@@ -10,20 +10,18 @@
phoneNumber: {}
};
- validation2('addUserForm', function( form ){ form.submit() },
- {
- 'beforeValidateHandler': function() {
- listValidator( 'roleValidator','selectedList');
- },
- 'rules' : rules
- }
- );
+ validation2('addUserForm', function( form ) { form.submit() }, {
+ 'beforeValidateHandler': function() {
+ listValidator( 'roleValidator','selectedList');
+ },
+ 'rules' : rules
+ });
- jQuery("#username").attr("maxlength", "50");
+ jQuery("#username").attr("maxlength", "140");
jQuery("#rawPassword").attr("maxlength", "35");
- jQuery("#retypePassword").attr("maxlength", "35");
- jQuery("#surname").attr("maxlength", "160");
- jQuery("#firstName").attr("maxlength", "160");
+ jQuery("#retypePassword").attr("maxlength", jQuery("#rawPassword").attr("maxlength"));
+ jQuery("#surname").attr("maxlength", "140");
+ jQuery("#firstName").attr("maxlength", "140");
jQuery("#email").attr("maxlength", "160");
jQuery("#phoneNumber").attr("maxlength", "80");
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm 2010-12-30 04:29:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm 2011-03-11 13:35:36 +0000
@@ -1,15 +1,27 @@
<script>
- jQuery(document).ready( function(){
- validation( 'addUserGroupForm', function( form ){ form.submit() }, function(){
- listValidator( 'memberValidator','groupMembers');
- } );
+ jQuery(document).ready( function() {
+ var rules = {
+ name: {required:true, minlength:2, alphanumericwithbasicpuncspaces:true, firstletteralphabet:true},
+ memberValidator: {required:true},
+ };
+
+ validation2( 'addUserGroupForm', function( form ) { form.submit() }, {
+ 'beforeValidateHandler': function() {
+ listValidator( 'memberValidator','groupMembers');
+ },
+ 'rules': rules
+ });
+
+ jQuery("#name").attr("maxlength", "210");
+
+ /* remote validation */
checkValueIsExist( "name", "validateUserGroup.action");
});
</script>
<h3>$i18n.getString( "add_user_group" )</h3>
-<form id="addUserGroupForm" name="addUserGroupForm" action = " addUserGroup.action" method="post" >
+<form id="addUserGroupForm" name="addUserGroupForm" action="addUserGroup.action" method="post" >
<table id="detailsList">
<col/>
@@ -22,9 +34,7 @@
<tbody>
<tr>
<td><label>$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:4,alphanumericwithbasicpuncspaces:true,firstletteralphabet:false}}"/>
- </td>
+ <td><input type="text" id="name" name="name" style="width:20em"></td>
</tr>
<tr><td colspan="2" style="height:15px"></td></tr>
</tbody>
@@ -33,7 +43,7 @@
<tr>
<th>$i18n.getString( "available_users" )</th><td></td>
<th>$i18n.getString( "group_members" )
- <select id="memberValidator" multiple="multiple" style="display:none" class="{validate:{required:true}}"/>
+ <select id="memberValidator" multiple="multiple" style="display:none"/>
</th>
</tr>
<tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateRoleForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateRoleForm.vm 2011-01-20 22:08:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateRoleForm.vm 2011-03-11 13:35:36 +0000
@@ -1,11 +1,23 @@
<script>
- jQuery(document).ready( function(){
+ jQuery(document).ready( function() {
jQuery("#name").focus();
- validation( 'updateRoleForm', function( form ){
+
+ var rules = {
+ name: {required:true, minlength:2},
+ description: {required:true}
+ };
+
+ validation2( 'updateRoleForm', function( form ) {
selectAllById( 'selectedList' );
selectAllById( 'selectedListAuthority' );
form.submit();
+ }, {
+ 'rules': rules
});
+
+ jQuery("#name").attr("maxlength", "140");
+
+ /* remote validation */
checkValueIsExist( "name", "validateRole.action", {id:getFieldValue('id')});
});
</script>
@@ -23,13 +35,13 @@
</tr>
<tr>
<td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name" value="$!encoder.htmlEncode( $userAuthorityGroup.name )" style="width:20em" maxlength="160" class="{validate:{required:true,minlength:2}}"/></td>
+ <td><input type="text" id="name" name="name" value="$!encoder.htmlEncode( $userAuthorityGroup.name )" style="width:20em"></td>
<td></td>
<td></td>
</tr>
<tr>
<td><label for="description">$i18n.getString( "description" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="description" name="description" value="$!encoder.htmlEncode( $userAuthorityGroup.description )" style="width:20em" class="{validate:{required:true}}"/></td>
+ <td><input type="text" id="description" name="description" value="$!encoder.htmlEncode( $userAuthorityGroup.description )" style="width:20em"/></td>
<td></td>
<td></td>
</tr>
@@ -93,6 +105,7 @@
</tr>
</table>
</form>
+
<script>
sortList('availableListAuthority','ASC');
sortList('selectedListAuthority','ASC');
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.vm 2011-01-19 15:48:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.vm 2011-03-11 13:35:36 +0000
@@ -1,8 +1,26 @@
<script>
- jQuery(document).ready( function(){
- validation( 'updateUserForm', function( form ){ form.submit() }, function(){
- listValidator( 'roleValidator','selectedList');
- } );
+ jQuery(document).ready( function() {
+ var rules = {
+ rawPassword: {rangelength: [8,35], password:true, notequalto:'#username'},
+ retypePassword: {rangelength: [8,35], equalTo:'#rawPassword'},
+ surname: {required:true,minlength:2},
+ firstName: {required:true,minlength:2},
+ email: {email:true},
+ phoneNumber: {}
+ };
+
+ validation2( 'updateUserForm', function( form ) { form.submit() }, {
+ 'beforeValidateHandler': function() {
+ listValidator( 'roleValidator','selectedList');
+ },
+ 'rules': rules
+ });
+
+ jQuery("#rawPassword").attr("maxlength", "35");
+ jQuery("#retypePassword").attr("maxlength", "35");
+ jQuery("#surname").attr("maxlength", "140");
+ jQuery("#firstName").attr("maxlength", "140");
+ jQuery("#email").attr("maxlength", "160");
});
</script>
@@ -24,27 +42,27 @@
</tr>
<tr>
<td><label for="rawPassword">$i18n.getString( "password" )</label></td>
- <td colspan="3"><input type="password" id="rawPassword" name="rawPassword" style="width:20em" maxlength="50" autocomplete="off" class="{validate:{rangelength:[8,35],password:true,notequalto:'#username'}}"/></td>
+ <td colspan="3"><input type="password" id="rawPassword" name="rawPassword" style="width:20em" autocomplete="off"></td>
</tr>
<tr>
<td><label for="retypePassword">$i18n.getString( "retype_password" ) </label></td>
- <td colspan="3"><input type="password" id="retypePassword" name="retypePassword" style="width:20em" maxlength="50" autocomplete="off" class="{validate:{rangelength:[8,35],equalTo:'#rawPassword'}}"/></td>
+ <td colspan="3"><input type="password" id="retypePassword" name="retypePassword" style="width:20em" autocomplete="off"></td>
</tr>
<tr>
<td><label for="surname">$i18n.getString( "surname" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td colspan="3"><input type="text" id="surname" name="surname" value="$encoder.htmlEncode( $userCredentials.user.surname )" style="width:20em" maxlength="160" class="{validate:{required:true,minlength:2}}"/></td>
+ <td colspan="3"><input type="text" id="surname" name="surname" value="$encoder.htmlEncode( $userCredentials.user.surname )" style="width:20em"></td>
</tr>
<tr>
<td><label for="firstName">$i18n.getString( "firstName" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td colspan="3"><input type="text" id="firstName" name="firstName" value="$encoder.htmlEncode( $userCredentials.user.firstName )" style="width:20em" maxlength="160" class="{validate:{required:true,minlength:2}}"/></td>
+ <td colspan="3"><input type="text" id="firstName" name="firstName" value="$encoder.htmlEncode( $userCredentials.user.firstName )" style="width:20em"></td>
</tr>
<tr>
<td><label for="email">$i18n.getString( "email" )</label></td>
- <td colspan="3"><input type="text" id="email" name="email" value="$!encoder.htmlEncode( $userCredentials.user.email )" style="width:20em" maxlength="160" class="{validate:{email:true}}"/></td>
+ <td colspan="3"><input type="text" id="email" name="email" value="$!encoder.htmlEncode( $userCredentials.user.email )" style="width:20em"></td>
</tr>
<tr>
<td><label for="phoneNumber">$i18n.getString( "phone_number" )</label></td>
- <td colspan="3"><input type="text" id="phoneNumber" name="phoneNumber" value="$!encoder.htmlEncode( $userCredentials.user.phoneNumber )" maxlength="80" style="width:20em"/></td>
+ <td colspan="3"><input type="text" id="phoneNumber" name="phoneNumber" value="$!encoder.htmlEncode( $userCredentials.user.phoneNumber )" style="width:20em"/></td>
</tr>
<tr>
<td colspan="4" height="10"></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserGroupForm.vm 2010-12-30 04:29:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserGroupForm.vm 2011-03-11 13:35:36 +0000
@@ -1,8 +1,20 @@
<script>
- jQuery(document).ready( function(){
- validation( 'editUserGroupForm', function( form ){ form.submit() }, function(){
- listValidator( 'memberValidator','groupMembers');
- } );
+ jQuery(document).ready( function() {
+ var rules = {
+ 'name': {required:true, minlength:2, alphanumericwithbasicpuncspaces:true, firstletteralphabet:true},
+ 'memberValidator': {required:true}
+ };
+
+ validation2( 'editUserGroupForm', function( form ) { form.submit() }, {
+ 'beforeValidateHandler': function() {
+ listValidator( 'memberValidator','groupMembers');
+ },
+ 'rules': rules
+ });
+
+ jQuery("#name").attr("maxlength", "210");
+
+ /* remote validation */
checkValueIsExist( "name", "validateUserGroup.action", {id:$group.id});
});
</script>
@@ -22,7 +34,7 @@
<tbody>
<tr>
<td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name" value ="$encoder.htmlEncode( $group.name )" style="width:20em" maxlength="150" /></td>
+ <td><input type="text" id="name" name="name" value ="$encoder.htmlEncode( $group.name )" style="width:20em"></td>
</tr>
<tr><td colspan="2" style="height:15px"></td></tr>
</tbody>
@@ -31,7 +43,7 @@
<tr>
<th>$i18n.getString( "available_users" )</th><td></td>
<th>$i18n.getString( "group_members" )
- <select id="memberValidator" multiple="multiple" style="display:none" class="{validate:{required:true}}"/>
+ <select id="memberValidator" multiple="multiple" style="display:none"/>
</th>
</tr>
<tr>