← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11916: Impl display of message recpients in message conversations

 

------------------------------------------------------------
revno: 11916
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-09-04 15:10:49 +0200
message:
  Impl display of message recpients in message conversations
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageConversation.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/UserMessage.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserCredentialsStore.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/readMessage.vm
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css


--
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/MessageConversation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageConversation.java	2013-09-04 07:35:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageConversation.java	2013-09-04 13:10:49 +0000
@@ -51,6 +51,8 @@
 public class MessageConversation
     extends BaseIdentifiableObject
 {
+    private static final int RECIPIENTS_MAX_DISPLAY = 25;
+    
     // --------------------------------------------------------------------------
     // Persistent fields
     // --------------------------------------------------------------------------
@@ -81,7 +83,6 @@
 
     private transient int messageCount;
 
-
     // --------------------------------------------------------------------------
     // Constructors
     // --------------------------------------------------------------------------
@@ -274,6 +275,28 @@
                 
         return hasName ? ( lastSenderFirstname + " " + lastSenderSurname ) : null;
     }
+    
+    public Set<User> getTopRecipients()
+    {
+        Set<User> recipients = new HashSet<User>();
+        
+        for ( UserMessage userMessage : userMessages )
+        {
+            recipients.add( userMessage.getUser() );
+            
+            if ( recipients.size() > RECIPIENTS_MAX_DISPLAY )
+            {
+                break;
+            }
+        }
+        
+        return recipients;
+    }
+    
+    public int getBottomRecipients()
+    {
+        return userMessages.size() - RECIPIENTS_MAX_DISPLAY;
+    }
 
     // -------------------------------------------------------------------------------------------------------
     // Persistent fields

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/UserMessage.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/UserMessage.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/UserMessage.java	2013-09-04 13:10:49 +0000
@@ -61,8 +61,6 @@
 
     private transient String lastRecipientFirstname;
     
-    
-
     public String getLastRecipientSurname()
     {
         return lastRecipientSurname;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserCredentialsStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserCredentialsStore.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserCredentialsStore.java	2013-09-04 13:10:49 +0000
@@ -93,6 +93,11 @@
 
     public UserCredentials getUserCredentials( User user )
     {
+        if ( user == null )
+        {
+            return null;
+        }
+        
         Session session = sessionFactory.getCurrentSession();
 
         return (UserCredentials) session.get( UserCredentials.class, user.getId() );

=== 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	2013-09-04 07:35:34 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties	2013-09-04 13:10:49 +0000
@@ -115,4 +115,7 @@
 arrange_dashboard_by_dragging_and_dropping=Tip: arrange dashboard by dragging and dropping items
 click_to_explore_drag_to_new_position=Click to explore or drag to new position
 drag_to_new_position=Drag to new position
-system_notification=System notification
\ No newline at end of file
+system_notification=System notification
+to=To
+and=and
+more=more
\ No newline at end of file

=== 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	2013-09-04 07:35:34 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/readMessage.vm	2013-09-04 13:10:49 +0000
@@ -23,11 +23,17 @@
 </ul>
 </div>
 
-<div>
 <h3>
 	<img id="followUp${conversation.id}" style="padding-right:8px; cursor:pointer;" onclick="toggleFollowUp( '${conversation.id}' )"#if( $conversation.followUp ) src="../images/marked.png"#else src="../images/unmarked.png"#end>
 	$encoder.htmlEncode( $conversation.subject )
 </h3>
+<div class="recipientsDiv tipText">
+    $i18n.getString( "to" )
+    #set( $recSize = $conversation.topRecipients.size() )
+    #foreach( $user in $conversation.topRecipients )
+         <a class="userLink" href="profile.action?id=${user.uid}">${user.name}</a>#if( $velocityCount < $recSize ), #end
+    #end
+    #if( $conversation.bottomRecipients > 0 ) $i18n.getString( "and" ) $conversation.bottomRecipients $i18n.getString( "more" )#end
 </div>
 
 #foreach( $message in $conversation.messages )

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css	2013-08-30 10:47:06 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css	2013-09-04 13:10:49 +0000
@@ -381,6 +381,11 @@
   background-color: #ebf0f6;
 }
 
+.recipientsDiv
+{ 
+  padding-left: 38px;
+}
+
 .messageDiv
 {
   width: 700px;