← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2207: Fix bug: Can't Add/Edit User Role ADD/SAVE buttons are not working.

 

------------------------------------------------------------
revno: 2207
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-09-23 16:32:16 +0700
message:
  Fix bug: Can't Add/Edit User Role ADD/SAVE buttons are not working.
modified:
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java
  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/javascript/role.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateRoleForm.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-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java	2010-09-23 06:55:57 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java	2010-09-23 09:32:16 +0000
@@ -217,7 +217,7 @@
             "AND dv.categoryoptioncomboid='" + categoryOptionComboId + "' " +
             "AND dv.periodid IN (" + periodIds + ") " +
             "AND dv.sourceid='" + organisationUnitId + "' " +
-            "AND dv.value < '" + lowerBound + "' " +
+            "AND ( dv.value < '" + lowerBound + "' " +
             "OR  dv.value > '" + upperBound + "' )";
    }
 

=== 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	2010-09-21 06:16:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm	2010-09-23 09:32:16 +0000
@@ -1,12 +1,17 @@
 <script>
 	jQuery(document).ready(	function(){
-			validation( 'addRoleForm', validateAddRole );				
+		jQuery("#name").focus();
+		validation( 'addRoleForm', function( form ){ 			
+			form.submit();			
+		});					
+		checkValueIsExist( "name", "validateRole.action");
 	});		
 </script>
 
 <h3>$i18n.getString( "create_new_user_role" )</h3>
 
-<form id="addRoleForm" action="addRole.action" method="post" >
+
+<form id="addRoleForm" name="addRoleForm" action="addRole.action" method="post" >
   <table>
 	<tr>
 		<th colspan="4">$i18n.getString( "details" )</th>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/role.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/role.js	2010-09-01 16:55:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/role.js	2010-09-23 09:32:16 +0000
@@ -27,83 +27,4 @@
 function removeRole(id, role)
 {
 	removeItem( id, role, i18n_confirm_delete, 'removeRole.action' );
-}
-
-// -----------------------------------------------------------------------------
-// Add role
-// -----------------------------------------------------------------------------
-
-function validateAddRole()
-{
-	var request = new Request();
-    request.setResponseTypeXML( 'message' );
-    request.setCallbackSuccess( addValidationCompleted );
-    
-    request.send( 'validateRole.action?name=' + getFieldValue( 'name' ) +
-        '&description=' + getFieldValue( 'description' ) );
-
-    return false;
-}
-
-function addValidationCompleted( messageElement )
-{
-    var type = messageElement.getAttribute( 'type' );
-    var message = messageElement.firstChild.nodeValue;
-    
-    if ( type == 'success' )
-    {
-        selectAll( document.getElementById( 'selectedList' ) );
-		selectAll( document.getElementById( 'selectedListAuthority' ) );
-        var form = document.getElementById( 'addRoleForm' );
-        
-        form.submit();
-    }
-    else if ( type == 'error' )
-    {
-        window.alert( i18n_adding_role_failed + ':' + '\n' + message );
-    }
-    else if ( type == 'input' )
-    {
-        document.getElementById( 'message' ).innerHTML = message;
-        document.getElementById( 'message' ).style.display = 'block';
-    }
-}
-
-// -----------------------------------------------------------------------------
-// Update role
-// -----------------------------------------------------------------------------
-
-function validateUpdateRole()
-{
-    var request = new Request();
-    request.setResponseTypeXML( 'message' );
-    request.setCallbackSuccess( updateValidationCompleted );
-    request.send( 'validateRole.action?id=' + getFieldValue( 'id' ) +
-        '&name=' + getFieldValue( 'name' ) +
-        '&description=' + getFieldValue( 'description' ) );
-    return false;
-}
-
-function updateValidationCompleted( messageElement )
-{
-    var type = messageElement.getAttribute( 'type' );
-    var message = messageElement.firstChild.nodeValue;
-    
-    if ( type == 'success' )
-    {
-        selectAll( document.getElementById( 'selectedList' ) );
-		selectAll( document.getElementById( 'selectedListAuthority' ) );
-        var form = document.getElementById( 'updateRoleForm' );
-        
-        form.submit();
-    }
-    else if ( type == 'error' )
-    {
-        window.alert( i18n_saving_user_failed + ':' + '\n' + message );
-    }
-    else if ( type == 'input' )
-    {
-        document.getElementById( 'message' ).innerHTML = message;
-        document.getElementById( 'message' ).style.display = 'block';
-    }
-}
+}
\ No newline at end of file

=== 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	2010-09-21 06:16:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateRoleForm.vm	2010-09-23 09:32:16 +0000
@@ -1,12 +1,16 @@
 <script>
 	jQuery(document).ready(	function(){
-			validation( 'updateRoleForm', validateUpdateRole );				
+		jQuery("#name").focus();
+		validation( 'updateRoleForm', function( form ){
+			form.submit();			
+		});
+		checkValueIsExist( "name", "validateRole.action", {id:getFieldValue('id')});				
 	});		
 </script>
 
 <h3>$i18n.getString( "edit_user_role" )</h3>
 
-<form id="updateRoleForm" action="updateRole.action" method="post">
+<form id="updateRoleForm" name="updateRoleForm" action="updateRole.action" method="post">
 	<div>
 		<input type="hidden" id="id" name="id" value="$userAuthorityGroup.id"/>
   	</div>