← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4518: Show up more details for each user like the assigned units and roles. Combined surname and firstn...

 

------------------------------------------------------------
revno: 4518
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-09-05 11:00:20 +0700
message:
  Show up more details for each user like the assigned units and roles. Combined surname and firstname as fullname.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/allUser.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/responseUser.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-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/allUser.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/allUser.vm	2011-09-04 10:21:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/allUser.vm	2011-09-05 04:00:20 +0000
@@ -80,12 +80,12 @@
 					<a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"/></a>
 				</div>	
 				<p><label>$i18n.getString( "username" ):</label><br/><span id="usernameField"></span></p>
-				<p><label>$i18n.getString( "surname" ):</label><br/><span id="surnameField"></span></p>
-				<p><label>$i18n.getString( "firstName" ):</label><br/><span id="firstNameField"></span></p>
+				<p><label>$i18n.getString( "fullname" ):</label><br/><span id="fullNameField"></span></p>
 				<p><label>$i18n.getString( "email" ):</label><br/><span id="emailField"></span></p>
                 <p><label>$i18n.getString( "phone_number" ):</label><br/><span id="phoneNumberField"></span></p>
-				<p><label>$i18n.getString( "number_of_orgunit" ):</label><br/><span id="numberOrgunitField"></span></p>
 				<p><label>$i18n.getString( "last_login"):</label><br/><span id="lastLoginField"></span></p>
+				<p><label>$i18n.getString( "organisation_units" ):</label><br/><span id="assignedOrgunitField"></span></p>
+				<p><label>$i18n.getString( "roles" ):</label><br/><span id="roleField"></span></p>
 			</div>
 			
 			<div id="warningArea" style="position:fixed;right:10px;top:200px;display:none">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js	2011-09-04 10:21:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js	2011-09-05 04:00:20 +0000
@@ -40,21 +40,35 @@
 function userReceived( userElement )
 {
     setInnerHTML( 'usernameField', getElementValue( userElement, 'username' ) );
-    setInnerHTML( 'surnameField', getElementValue( userElement, 'surname' ) );
-    setInnerHTML( 'firstNameField', getElementValue( userElement, 'firstName' ) );
+	
+	var fullName = getElementValue( userElement, 'firstName' ) + ", " + getElementValue( userElement, 'surname' );
+    setInnerHTML( 'fullNameField', fullName );
 
     var email = getElementValue( userElement, 'email' );
     setInnerHTML( 'emailField', email ? email : '[' + i18n_none + ']' );
 
     var phoneNumber = getElementValue( userElement, 'phoneNumber' );
 	setInnerHTML( 'phoneNumberField', phoneNumber ? phoneNumber : '[' + i18n_none + ']' );
-
-	var numberOrgunit = getElementValue( userElement, 'numberOrgunit' );
-	setInnerHTML( 'numberOrgunitField', numberOrgunit ? numberOrgunit : '[' + i18n_none + ']' );
 	
 	var lastLogin = getElementValue( userElement, 'lastLogin' );;
 	setInnerHTML( 'lastLoginField', lastLogin ? lastLogin : '[' + i18n_none + ']' );
 	
+	var temp = '';
+	var orgunits = userElement.getElementsByTagName( 'orgunit' );
+	for( var i = 0 ; i < orgunits.length ; i ++ )
+	{
+		temp += orgunits[i].firstChild.nodeValue + "<br/>";
+	}
+	setInnerHTML( 'assignedOrgunitField', temp ? temp : '[' + i18n_none + ']' );
+	
+	temp = '';
+	var roles = userElement.getElementsByTagName( 'role' );
+	for( var i = 0 ; i < roles.length ; i ++ )
+	{
+		temp += roles[i].firstChild.nodeValue + "<br/>";
+	}
+	setInnerHTML( 'roleField', temp ? temp : '[' + i18n_none + ']' );
+	
     showDetails();
 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/responseUser.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/responseUser.vm	2011-06-11 19:51:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/responseUser.vm	2011-09-05 04:00:20 +0000
@@ -1,10 +1,19 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <user>
   <username>$encoder.xmlEncode( $userCredentials.username )</username>
+  <firstName>$encoder.xmlEncode( $userCredentials.user.firstName )</firstName>
   <surname>$encoder.xmlEncode( $userCredentials.user.surname )</surname>
-  <firstName>$encoder.xmlEncode( $userCredentials.user.firstName )</firstName>
   <email>$!encoder.xmlEncode( $userCredentials.user.email )</email>
   <phoneNumber>$!encoder.xmlEncode( $userCredentials.user.phoneNumber )</phoneNumber>
-  <numberOrgunit>$userCredentials.user.organisationUnits.size()</numberOrgunit>
   <lastLogin>$!format.formatDate( $!userCredentials.lastLogin )</lastLogin>
+  <orgunits>
+	#foreach( $unit in $userCredentials.user.organisationUnits )
+	  <orgunit>$unit</orgunit>
+	#end
+  </orgunits>
+  <roles>
+	#foreach( $role in $userCredentials.userAuthorityGroups )
+	  <role>$role.name</role>
+	#end
+  </roles>
 </user>