← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4862: Added new property metaData to Message. Currently used for persisting the content of the user-age...

 

------------------------------------------------------------
revno: 4862
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-10-06 17:39:08 +0200
message:
  Added new property metaData to Message. Currently used for persisting the content of the user-agent http header for each sent message. This means that we don't have to ask what browser and operating system the user is using every time a problem is reported.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/Message.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/message/hibernate/Message.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/message/MessageServiceTest.java
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonUser.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/about/action/AboutAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/ContextUtils.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendFeedbackAction.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendMessageAction.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendReplyAction.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/readMessage.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.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-api/src/main/java/org/hisp/dhis/message/Message.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/Message.java	2011-09-30 08:00:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/Message.java	2011-10-06 15:39:08 +0000
@@ -51,6 +51,11 @@
      * The message text.
      */
     private String text;
+    
+    /**
+     * The message meta data, like user agent and OS of sender.
+     */
+    private String metaData;
 
     /**
      * The message sender.
@@ -68,10 +73,11 @@
         this.sentDate = new Date();
     }
     
-    public Message( String text, User sender )
+    public Message( String text, String metaData, User sender )
     {
         this.key = UUID.randomUUID().toString();
         this.text = text;
+        this.metaData = metaData;
         this.sender = sender;
         this.sentDate = new Date();
     }
@@ -106,6 +112,16 @@
         this.text = text;
     }
 
+    public String getMetaData()
+    {
+        return metaData;
+    }
+
+    public void setMetaData( String metaData )
+    {
+        this.metaData = metaData;
+    }
+
     public User getSender()
     {
         return sender;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageService.java	2011-08-04 07:52:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageService.java	2011-10-06 15:39:08 +0000
@@ -38,12 +38,13 @@
 public interface MessageService
 {
     final String ID = MessageService.class.getName();
-    
-    int sendMessage( String subject, String text, Set<User> users );
-    
-    int sendFeedback( String subject, String text );
-    
-    void sendReply( MessageConversation conversation, String text );
+    final String META_USER_AGENT = "User-agent: ";
+    
+    int sendMessage( String subject, String text, String metaData, Set<User> users );
+    
+    int sendFeedback( String subject, String text, String metaData );
+    
+    void sendReply( MessageConversation conversation, String text, String metaData );
     
     int saveMessageConversation( MessageConversation conversation );
     

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java	2011-09-30 17:01:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java	2011-10-06 15:39:08 +0000
@@ -80,7 +80,7 @@
     // MessageService implementation
     // -------------------------------------------------------------------------
 
-    public int sendMessage( String subject, String text, Set<User> users )
+    public int sendMessage( String subject, String text, String metaData, Set<User> users )
     {
         // ---------------------------------------------------------------------
         // Add feedback recipients to users if they are not there
@@ -101,7 +101,7 @@
         
         MessageConversation conversation = new MessageConversation( subject, sender );
         
-        conversation.addMessage( new Message( text, sender ) );
+        conversation.addMessage( new Message( text, metaData, sender ) );
         
         for ( User user : users )
         {
@@ -115,16 +115,16 @@
         return id;
     }
 
-    public int sendFeedback( String subject, String text )
+    public int sendFeedback( String subject, String text, String metaData )
     {
-        return sendMessage( subject, text, new HashSet<User>() );
+        return sendMessage( subject, text, metaData, new HashSet<User>() );
     }
     
-    public void sendReply( MessageConversation conversation, String text )
+    public void sendReply( MessageConversation conversation, String text, String metaData )
     {
         User sender = currentUserService.getCurrentUser();
         
-        Message message = new Message( text, sender );
+        Message message = new Message( text, metaData, sender );
         
         conversation.markReplied( sender, message );
         

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java	2011-10-03 10:33:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java	2011-10-06 15:39:08 +0000
@@ -430,7 +430,7 @@
     {
         Session session = sessionFactory.getCurrentSession();
         Query query = session.createQuery( "from UserSetting us where us.name = :name" );
-        query.setEntity( "name", name );
+        query.setString( "name", name );
 
         return query.list();
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/message/hibernate/Message.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/message/hibernate/Message.hbm.xml	2011-08-04 10:32:02 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/message/hibernate/Message.hbm.xml	2011-10-06 15:39:08 +0000
@@ -14,6 +14,7 @@
 	
 	<property name="key" column="messagekey" not-null="true"/>
 	<property name="text" column="messagetext"/>
+	<property name="metaData" column="metadata"/>
 	
     <many-to-one name="sender" class="org.hisp.dhis.user.User" column="userid" 
 	  foreign-key="fk_message_userid" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/message/MessageServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/message/MessageServiceTest.java	2011-09-30 17:01:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/message/MessageServiceTest.java	2011-10-06 15:39:08 +0000
@@ -105,8 +105,8 @@
         conversation.addUserMessage( userMessageA );
         conversation.addUserMessage( userMessageB );
         
-        Message contentA = new Message( "TextA", sender );
-        Message contentB = new Message( "TextB", sender );
+        Message contentA = new Message( "TextA", "MetaA", sender );
+        Message contentB = new Message( "TextB", "MetaB", sender );
         
         conversation.addMessage( contentA );
         conversation.addMessage( contentB );
@@ -128,7 +128,7 @@
     @Test
     public void testSendMessage()
     {
-        int id = messageService.sendMessage( "Subject", "Text", users );
+        int id = messageService.sendMessage( "Subject", "Text", "Meta", users );
         
         MessageConversation conversation = messageService.getMessageConversation( id );
         
@@ -142,7 +142,7 @@
     @Test
     public void testSendFeedback()
     {
-        int id = messageService.sendFeedback( "Subject", "Text" );
+        int id = messageService.sendFeedback( "Subject", "Text", "Meta" );
         
         MessageConversation conversation = messageService.getMessageConversation( id );
         
@@ -156,10 +156,10 @@
     public void testSendReply()
     {
         MessageConversation message = new MessageConversation( "Subject", sender );
-        message.addMessage( new Message( "TextA", sender ) );
+        message.addMessage( new Message( "TextA", "MetaA", sender ) );
         int id = messageService.saveMessageConversation( message );
         
-        messageService.sendReply( message, "TextB" );
+        messageService.sendReply( message, "TextB", "MetaB" );
         
         message = messageService.getMessageConversation( id );
         

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonUser.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonUser.vm	2011-09-28 07:11:18 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonUser.vm	2011-10-06 15:39:08 +0000
@@ -1,25 +1,21 @@
 { "user":
   {
-    "id": ${userCredentials.id},
-    "surname": "$!encoder.jsonEncode( ${userCredentials.user.surname} )",
-    "firstName": "$!encoder.jsonEncode( ${userCredentials.user.firstName} )",
-    "username": "$!encoder.jsonEncode( ${userCredentials.username} )",
-    "email": "$!encoder.jsonEncode( ${userCredentials.email} )",
-    "phoneNumber": "$!encoder.jsonEncode( ${userCredentials.phoneNumber} )",
-    "lastLogin": "$!format.formatDate( ${userCredentials.lastLogin} )",
-	
-	#set( $size = ${userCredentials.user.organisationUnits.size()} )
-	"orgunits": [
-	#foreach( $unit in $userCredentials.user.organisationUnits )
-	  { "name": "$!{unit}" }#if( $velocityCount < $size ),#end
-	#end
-	],
-	
-	#set( $size = ${userCredentials.userAuthorityGroups.size()} )
-	"roles": [
-	#foreach( $role in $userCredentials.userAuthorityGroups )
-	  { "name": "$!{role.name}" }#if( $velocityCount < $size ),#end
-	#end
-	]
+    "id": ${user.id},
+    "surname": "$!encoder.jsonEncode( ${user.surname} )",
+    "firstName": "$!encoder.jsonEncode( ${user.firstName} )",
+    "username": "$!encoder.jsonEncode( ${user.userCredentials.username} )",
+    "email": "$!encoder.jsonEncode( ${user.email} )",
+    "phoneNumber": "$!encoder.jsonEncode( ${user.phoneNumber} )",
+    "lastLogin": "$!format.formatDate( ${user.userCredentials.lastLogin} )",	
+    #set( $size = ${user.organisationUnits.size()} )
+    "organisationUnits": [
+    #foreach( $unit in $user.organisationUnits )
+      { "name": "$!{unit.name}" }#if( $velocityCount < $size ),#end
+    #end ],
+    #set( $size = ${userCredentials.userAuthorityGroups.size()} )
+    "roles": [
+    #foreach( $role in $user.userCredentials.userAuthorityGroups )
+      { "name": "$!{role.name}" }#if( $velocityCount < $size ),#end
+    #end ]
   }
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2011-09-26 09:31:56 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2011-10-06 15:39:08 +0000
@@ -37,6 +37,27 @@
 }
 
 /**
+ * Joins the names of the given array of objects and returns it as a single string.
+ */
+function joinNameableObjects( objects )
+{
+	var string = "";
+	var size = objects.length;
+	
+	for ( var i in objects )
+	{
+		string += objects[i].name;
+		
+		if ( i < ( size - 1 ) )
+		{
+			string += ", ";
+		}
+	}
+	
+	return string;
+}
+
+/**
  * Gets help content for the given id. Opens the right bar and puts the content
  * inside. Reads data from an underlying docbook file.
  * 

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/about/action/AboutAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/about/action/AboutAction.java	2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/about/action/AboutAction.java	2011-10-06 15:39:08 +0000
@@ -43,6 +43,7 @@
 import org.hisp.dhis.system.database.DatabaseInfo;
 import org.hisp.dhis.system.database.DatabaseInfoProvider;
 import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.util.ContextUtils;
 
 import com.opensymphony.xwork2.Action;
 
@@ -213,7 +214,7 @@
         // User agent
         // ---------------------------------------------------------------------
 
-        userAgent = request.getHeader( "user-agent" );
+        userAgent = request.getHeader( ContextUtils.HEADER_USER_AGENT );
 
         // ---------------------------------------------------------------------
         // External directory

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/ContextUtils.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/ContextUtils.java	2011-09-16 15:59:35 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/util/ContextUtils.java	2011-10-06 15:39:08 +0000
@@ -54,10 +54,12 @@
     public static final String CONTENT_TYPE_EXCEL = "application/vnd.ms-excel";
     public static final String CONTENT_TYPE_JAVASCRIPT = "application/javascript";
 
+    public static final String HEADER_USER_AGENT = "User-Agent";
+
     private static final String SEPARATOR = "/";
     private static final String PORT_SEPARATOR = ":";
     private static final String PROTOCOL = "http://";;
-
+    
     private static final Map<String, String> CONTENT_TYPE_MAP = new HashMap<String, String>() {
         /**
          * Determines if a de-serialized file is compatible with this class.

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendFeedbackAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendFeedbackAction.java	2011-08-04 10:06:15 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendFeedbackAction.java	2011-10-06 15:39:08 +0000
@@ -27,7 +27,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.message.MessageService;
+import org.hisp.dhis.util.ContextUtils;
 
 import com.opensymphony.xwork2.Action;
 
@@ -72,7 +74,10 @@
 
     public String execute()
     {
-        messageService.sendFeedback( subject, text );
+        String metaData = MessageService.META_USER_AGENT + 
+            ServletActionContext.getRequest().getHeader( ContextUtils.HEADER_USER_AGENT );
+
+        messageService.sendFeedback( subject, text, metaData );
         
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendMessageAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendMessageAction.java	2011-08-04 10:06:15 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendMessageAction.java	2011-10-06 15:39:08 +0000
@@ -30,10 +30,12 @@
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.message.MessageService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.oust.manager.SelectionTreeManager;
 import org.hisp.dhis.user.User;
+import org.hisp.dhis.util.ContextUtils;
 
 import com.opensymphony.xwork2.Action;
 
@@ -85,6 +87,9 @@
 
     public String execute()
     {
+        String metaData = MessageService.META_USER_AGENT + 
+            ServletActionContext.getRequest().getHeader( ContextUtils.HEADER_USER_AGENT );
+
         Set<User> users = new HashSet<User>();
         
         for ( OrganisationUnit unit : selectionTreeManager.getReloadedSelectedOrganisationUnits() )
@@ -92,7 +97,7 @@
             users.addAll( unit.getUsers() );
         }
         
-        messageService.sendMessage( subject, text, users );
+        messageService.sendMessage( subject, text, metaData, users );
         
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendReplyAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendReplyAction.java	2011-08-04 10:06:15 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/SendReplyAction.java	2011-10-06 15:39:08 +0000
@@ -27,8 +27,10 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.message.MessageConversation;
 import org.hisp.dhis.message.MessageService;
+import org.hisp.dhis.util.ContextUtils;
 
 import com.opensymphony.xwork2.Action;
 
@@ -73,9 +75,12 @@
 
     public String execute()
     {
+        String metaData = MessageService.META_USER_AGENT + 
+            ServletActionContext.getRequest().getHeader( ContextUtils.HEADER_USER_AGENT );
+
         MessageConversation conversation = messageService.getMessageConversation( id );
         
-        messageService.sendReply( conversation, text );
+        messageService.sendReply( conversation, text, metaData );
         
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties	2011-08-29 21:12:03 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties	2011-10-06 15:39:08 +0000
@@ -36,4 +36,6 @@
 enter_subject = Please enter a subject
 enter_text = Please enter text
 reply = Reply
-username = Username
\ No newline at end of file
+username = Username
+user_roles = User roles
+meta_data = Meta data
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js	2011-08-29 21:12:03 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js	2011-10-06 15:39:08 +0000
@@ -36,19 +36,23 @@
 	return true;
 }
 
-function showSenderInfo( id )
+function showSenderInfo( messageId, senderId )
 {
-	$.getJSON( "../dhis-web-commons-ajax-json/getUser.action", { id:id }, function( json ) {
+	var metaData = $( "#metaData" + messageId ).html();
+	
+	$.getJSON( "../dhis-web-commons-ajax-json/getUser.action", { id:senderId }, function( json ) {
 		$( "#senderName" ).html( json.user.firstName + " " + json.user.surname );
 		$( "#senderEmail" ).html( json.user.email );
 		$( "#senderUsername" ).html( json.user.username );
 		$( "#senderPhoneNumber" ).html( json.user.phoneNumber );
-		$( "#senderOrganisationUnits" ).html( json.user.organisationUnits );
-		
+		$( "#senderOrganisationUnits" ).html( joinNameableObjects( json.user.organisationUnits ) );
+		$( "#senderUserRoles" ).html( joinNameableObjects( json.user.roles ) );		
+		$( "#messageMetaData" ).html( metaData );	
+				
 		$( "#senderInfo" ).dialog( {
 	        modal : true,
-	        width : 300,
-	        height : 250,
+	        width : 350,
+	        height : 350,
 	        title : "Sender"
 	    } );
 	} );

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/readMessage.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/readMessage.vm	2011-08-29 21:12:03 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/readMessage.vm	2011-10-06 15:39:08 +0000
@@ -22,6 +22,19 @@
 <td><label>$i18n.getString( "organisation_units" ):</label></td>
 <td><span id="senderOrganisationUnits"></span></td>
 </tr>
+<tr>
+<td><label>$i18n.getString( "user_roles" ):</label></td>
+<td><span id="senderUserRoles"></span></td>
+</tr>
+<tr>
+<td colspan="2" style="height:15px"></td>
+</tr>
+#if( $auth.hasAccess( "dhis-web-dashboard-integration", "sendMessage" ) )
+<tr>
+<td><label>$i18n.getString( "meta_data" ):</label></td>
+<td><span id="messageMetaData"></span></td>
+</tr>
+#end
 </table>
 </div>
 
@@ -39,10 +52,11 @@
 
 #foreach( $message in $conversation.messages )
 <div class="messageDiv">
-<span class="bold" style="cursor:pointer" onclick="showSenderInfo( ${message.sender.id} )">$encoder.htmlEncode( $message.sender.name )</span>&nbsp;
+<span class="bold" style="cursor:pointer" onclick="showSenderInfo( ${message.id}, ${message.sender.id} )">$encoder.htmlEncode( $message.sender.name )</span>&nbsp;
 <span style="color:#606060">$format.formatDate( $message.sentDate )</span>
 
 <p>$encoder.htmlEncode( $message.text )</p>
+<span id="metaData${message.id}" style="display:none">$!encoder.htmlEncode( $message.metaData )</span>
 </div>
 #end
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserAction.java	2010-12-30 09:13:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserAction.java	2011-10-06 15:39:08 +0000
@@ -32,7 +32,6 @@
 
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserAuthorityGroup;
-import org.hisp.dhis.user.UserCredentials;
 import org.hisp.dhis.user.UserService;
 
 import com.opensymphony.xwork2.Action;
@@ -66,11 +65,11 @@
         this.id = id;
     }
 
-    private UserCredentials userCredentials;
+    private User user;
 
-    public UserCredentials getUserCredentials()
+    public User getUser()
     {
-        return userCredentials;
+        return user;
     }
 
     private Collection<UserAuthorityGroup> userAuthorityGroups;
@@ -87,13 +86,14 @@
     public String execute()
         throws Exception
     {
-        User user = userService.getUser( id );
-
-        userCredentials = userService.getUserCredentials( user );
+        user = userService.getUser( id );
 
         userAuthorityGroups = new ArrayList<UserAuthorityGroup>( userService.getAllUserAuthorityGroups() );
 
-        userAuthorityGroups.removeAll( userCredentials.getUserAuthorityGroups() );        
+        if ( user != null )
+        {
+            userAuthorityGroups.removeAll( user.getUserCredentials().getUserAuthorityGroups() );
+        }
         
         return SUCCESS;
     }

=== 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-28 07:11:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js	2011-10-06 15:39:08 +0000
@@ -58,21 +58,11 @@
 		var lastLogin = json.user.lastLogin;
 		setInnerHTML( 'lastLoginField', lastLogin ? lastLogin : '[' + i18n_none + ']' );
 		
-		var temp = '';
-		var orgunits = json.user.orgunits;
-		for( var i = 0 ; i < orgunits.length ; i ++ )
-		{
-			temp += orgunits[i].name + "<br/>";
-		}
-		setInnerHTML( 'assignedOrgunitField', temp ? temp : '[' + i18n_none + ']' );
+		var organisationUnits = joinNameableObjects( json.user.organisationUnits );
+		setInnerHTML( 'assignedOrgunitField', organisationUnits ? organisationUnits : '[' + i18n_none + ']' );
 		
-		temp = '';
-		var roles = json.user.roles;
-		for( var i = 0 ; i < roles.length ; i ++ )
-		{
-			temp += roles[i].name + "<br/>";
-		}
-		setInnerHTML( 'roleField', temp ? temp : '[' + i18n_none + ']' );
+		var roles = joinNameableObjects( json.user.roles );
+		setInnerHTML( 'roleField', roles ? roles : '[' + i18n_none + ']' );
 		
 		showDetails();
 	});