← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12177: Messages in dashboard refinement

 

------------------------------------------------------------
revno: 12177
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-09-19 19:34:52 +0200
message:
  Messages in dashboard refinement
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageConversation.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/hibernate/HibernateMessageConversationStore.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.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/MessageConversation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageConversation.java	2013-09-11 15:26:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/message/MessageConversation.java	2013-09-19 17:34:52 +0000
@@ -80,7 +80,7 @@
     private transient String lastSenderSurname;
 
     private transient String lastSenderFirstname;
-
+    
     private transient int messageCount;
 
     // --------------------------------------------------------------------------
@@ -375,6 +375,8 @@
         this.followUp = followUp;
     }
 
+    @JsonProperty
+    @JacksonXmlProperty( isAttribute = true )
     public String getLastSenderSurname()
     {
         return lastSenderSurname;
@@ -385,6 +387,8 @@
         this.lastSenderSurname = lastSenderSurname;
     }
 
+    @JsonProperty
+    @JacksonXmlProperty( isAttribute = true )
     public String getLastSenderFirstname()
     {
         return lastSenderFirstname;
@@ -395,6 +399,8 @@
         this.lastSenderFirstname = lastSenderFirstname;
     }
 
+    @JsonProperty
+    @JacksonXmlProperty( isAttribute = true )
     public int getMessageCount()
     {
         return messageCount;

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/hibernate/HibernateMessageConversationStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/hibernate/HibernateMessageConversationStore.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/hibernate/HibernateMessageConversationStore.java	2013-09-19 17:34:52 +0000
@@ -69,12 +69,12 @@
     {
         SqlHelper sh = new SqlHelper();
 
-        String sql = "select mc.messageconversationid, mc.uid, mc.subject, mc.lastmessage, ui.surname, ui.firstname, um.isread, um.isfollowup, ("
-            + "select count(messageconversationid) from messageconversation_messages mcm where mcm.messageconversationid=mc.messageconversationid) as messagecount "
-            + "from messageconversation mc "
-            + "left join messageconversation_usermessages mu on mc.messageconversationid=mu.messageconversationid "
-            + "left join usermessage um on mu.usermessageid=um.usermessageid "
-            + "left join userinfo ui on mc.lastsenderid=ui.userinfoid ";
+        String sql = "select mc.messageconversationid, mc.uid, mc.subject, mc.lastmessage, ui.surname, ui.firstname, um.isread, um.isfollowup, (" +
+            "select count(messageconversationid) from messageconversation_messages mcm where mcm.messageconversationid=mc.messageconversationid) as messagecount " +
+            "from messageconversation mc " +
+            "inner join messageconversation_usermessages mu on mc.messageconversationid=mu.messageconversationid " +
+            "inner join usermessage um on mu.usermessageid=um.usermessageid " +
+            "inner join userinfo ui on mc.lastsenderid=ui.userinfoid ";
 
         if ( user != null )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2013-09-19 16:35:34 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2013-09-19 17:34:52 +0000
@@ -436,13 +436,19 @@
 	
 	$ul = $( "#ul-" + itemId );
 	
-	$.get( "../api/messageConversations.json?pageSize=8", function( json )
+	$.get( "../api/messageConversations.json?viewClass=detailed&pageSize=5", function( json )
 	{
 		$.each( json.messageConversations, function( index, message )
 		{
-			$ul.append( "<li><a href='readMessage.action?id=" + message.id + "'>" + message.name + "</a></li>" );
+			var sender = message.lastSenderFirstname + " " + message.lastSenderSurname;
+			var count = message.messageCount > 1 ? ( " (" + message.messageCount + ")" ) : "";			
+			var readSpan = message.read ? "" : " class='bold'";
+			
+			$ul.append( 
+				"<li><a href='readMessage.action?id=" + message.id + "'>" + 
+				"<span" + readSpan + ">" + sender + count + " <span class='tipText'>" + message.lastMessage + "</span><br>" 
+				+ message.name + "</span></a></li>" );
 		} );
-		
 	} );
 }