=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java 2013-09-10 11:58:08 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java 2013-09-19 16:35:34 +0000 @@ -71,6 +71,7 @@ public static final String TYPE_REPORTS = "reports"; public static final String TYPE_RESOURCES = "resources"; public static final String TYPE_PATIENT_TABULAR_REPORTS = "patientTabularReports"; + public static final String TYPE_MESSAGES = "messages"; private Chart chart; @@ -88,6 +89,8 @@ private List patientTabularReports = new ArrayList(); + private Boolean messages; + // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- @@ -142,6 +145,10 @@ { return TYPE_PATIENT_TABULAR_REPORTS; } + else if ( messages != null ) + { + return TYPE_MESSAGES; + } return null; } @@ -211,6 +218,7 @@ count += reports.size(); count += resources.size(); count += patientTabularReports.size(); + count += messages != null ? 1 : 0; return count; } @@ -382,6 +390,19 @@ this.patientTabularReports = patientTabularReports; } + @JsonProperty + @JsonView( { DetailedView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public Boolean getMessages() + { + return messages; + } + + public void setMessages( Boolean messages ) + { + this.messages = messages; + } + // ------------------------------------------------------------------------- // Merge with // ------------------------------------------------------------------------- @@ -403,6 +424,7 @@ reports = item.getReports() == null ? reports : item.getReports(); resources = item.getResources() == null ? resources : item.getResources(); patientTabularReports = item.getPatientTabularReports() == null ? patientTabularReports : item.getPatientTabularReports(); + messages = item.getMessages() == null ? messages : item.getMessages(); } } } === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java' --- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java 2013-09-12 08:13:03 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java 2013-09-19 16:35:34 +0000 @@ -37,6 +37,7 @@ import static org.hisp.dhis.dashboard.DashboardItem.TYPE_REPORT_TABLES; import static org.hisp.dhis.dashboard.DashboardItem.TYPE_RESOURCES; import static org.hisp.dhis.dashboard.DashboardItem.TYPE_USERS; +import static org.hisp.dhis.dashboard.DashboardItem.TYPE_MESSAGES; import java.util.HashSet; import java.util.List; @@ -138,6 +139,12 @@ item.setReportTable( objectManager.get( ReportTable.class, contentUid ) ); dashboard.getItems().add( 0, item ); } + else if ( TYPE_MESSAGES.equals( type ) ) + { + DashboardItem item = new DashboardItem(); + item.setMessages( true ); + dashboard.getItems().add( 0, item ); + } else // Link item { DashboardItem availableItem = dashboard.getAvailableItemByType( type ); @@ -164,6 +171,7 @@ { item.getPatientTabularReports().add( objectManager.get( PatientTabularReport.class, contentUid ) ); } + if ( availableItem == null ) { dashboard.getItems().add( 0, item ); === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardItem.hbm.xml' --- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardItem.hbm.xml 2013-08-25 13:14:37 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/dashboard/hibernate/DashboardItem.hbm.xml 2013-09-19 16:35:34 +0000 @@ -31,7 +31,7 @@ - + @@ -50,6 +50,8 @@ + + \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/ReadMessageAction.java' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/ReadMessageAction.java 2013-08-23 16:05:01 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/message/action/ReadMessageAction.java 2013-09-19 16:35:34 +0000 @@ -63,9 +63,9 @@ // Input // ------------------------------------------------------------------------- - private Integer id; + private String id; - public void setId( Integer id ) + public void setId( String id ) { this.id = id; } === 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-10 07:40:25 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2013-09-19 16:35:34 +0000 @@ -121,4 +121,5 @@ more=more see_more_hits=See more hits see_fewer_hits=See fewer hits -add=Add \ No newline at end of file +add=Add +add_items_to_current_dashboard=Add items to current dashboard \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm 2013-09-10 07:40:25 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm 2013-09-19 16:35:34 +0000 @@ -90,6 +90,8 @@

$i18n.getString( "rename_current_dashboard" )

$i18n.getString( "rename" )
+

$i18n.getString( "add_items_to_current_dashboard" )

+

$i18n.getString( "delete_current_dashboard" )

=== 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-12 08:13:03 +0000 +++ 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 @@ -192,7 +192,7 @@ autoOpen: true, modal: true, width: 405, - height: 275, + height: 345, resizable: false, title: name } ); @@ -401,6 +401,10 @@ { dhis2.db.renderLinkItem( $d, item.id, item.patientTabularReports, "Person tabular reports", position, "../dhis-web-caseentry/app/index.html?type=patientTabularReport&id=", "" ); } + else if ( "messages" == item.type ) + { + dhis2.db.renderMessagesItem( $d, item.id ); + } } ); dhis2.db.renderLastDropItem( $d, parseInt( data.items.length - 1 ) ); @@ -414,12 +418,37 @@ } ); } -dhis2.db.renderLinkItem = function( $d, itemId, contents, title, position, baseUrl, urlSuffix ) +dhis2.db.linkItemHeaderHtml = function( itemId, title ) { - var html = + var html = "
  • " + "
  • " + - "
    • " + title + "
    • "; + "
      • " + title + "
      • "; + + return html; +} + +dhis2.db.renderMessagesItem = function( $d, itemId ) +{ + var html = dhis2.db.linkItemHeaderHtml( itemId, "Messages" ) + "
  • "; + + $d.append( html ); + + $ul = $( "#ul-" + itemId ); + + $.get( "../api/messageConversations.json?pageSize=8", function( json ) + { + $.each( json.messageConversations, function( index, message ) + { + $ul.append( "
  • " + message.name + "
  • " ); + } ); + + } ); +} + +dhis2.db.renderLinkItem = function( $d, itemId, contents, title, position, baseUrl, urlSuffix ) +{ + var html = dhis2.db.linkItemHeaderHtml( itemId, title ); $.each( contents, function( index, content ) { === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/message.vm' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/message.vm 2013-09-04 07:35:34 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/message.vm 2013-09-19 16:35:34 +0000 @@ -28,12 +28,12 @@ - + #if( $conversation.lastSenderName )$!encoder.htmlEncode( $conversation.lastSenderName )#else$i18n.getString( "system_notification" )#end #if( $conversation.messageCount > 1 ) (${conversation.messageCount})#end - $!encoder.htmlEncode( $conversation.subject ) - $!format.formatDate( $conversation.lastMessage ) + $!encoder.htmlEncode( $conversation.subject ) + $!format.formatDate( $conversation.lastMessage )