dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24731
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12176: Dashboard, supporting messages item
------------------------------------------------------------
revno: 12176
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-09-19 18:35:34 +0200
message:
Dashboard, supporting messages item
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java
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/resources/org/hisp/dhis/dashboard/hibernate/DashboardItem.hbm.xml
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/resources/org/hisp/dhis/dashboard/i18n_module.properties
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/javascript/dashboard.js
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/message.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-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<PatientTabularReport> patientTabularReports = new ArrayList<PatientTabularReport>();
+ 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 @@
<key column="dashboarditemid" foreign-key="fk_dashboarditem_reporttables_dashboardid" />
<list-index column="sort_order" base="0" />
<many-to-many column="reporttableid" class="org.hisp.dhis.reporttable.ReportTable" foreign-key="fk_dashboarditem_reporttables_reporttableid" />
- </list>
+ </list>
<list name="reports" table="dashboarditem_reports">
<key column="dashboarditemid" foreign-key="fk_dashboarditem_reports_dashboardid" />
@@ -50,6 +50,8 @@
<list-index column="sort_order" base="0" />
<many-to-many column="patienttabularreportid" class="org.hisp.dhis.patientreport.PatientTabularReport" foreign-key="fk_dashboarditem_patienttabularreports_patienttabularreportid" />
</list>
+
+ <property name="messages" />
</class>
</hibernate-mapping>
\ 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 @@
<h4>$i18n.getString( "rename_current_dashboard" )</h4>
<div><label style="margin-right: 10px">$i18n.getString( "name" )</label><input type="text" id="dashboardRename" style="width: 230px; padding: 5px; margin-right: 10px;">
<a class="greyButtonLink" href="javascript:dhis2.db.renameDashboard()" style="margin-top: 1px">$i18n.getString( "rename" )</a></div>
+ <h4>$i18n.getString( "add_items_to_current_dashboard" )</h4>
+ <div><a class="greyButtonLink" href="javascript:dhis2.db.addItemContent( 'messages', '' )">$i18n.getString( "messages" )</a></div>
<h4>$i18n.getString( "delete_current_dashboard" )</h4>
<div><a class="greyButtonLink" href="javascript:dhis2.db.removeDashboard()">$i18n.getString( "delete" )</a></div>
</div>
=== 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 =
"<li id='liDrop-" + itemId + "' class='liDropItem'><div class='dropItem' id='drop-" + itemId + "' data-item='" + itemId + "'></div></li>" +
"<li id='li-" + itemId + "' class='liItem'><div class='item' id='" + itemId + "'><div class='itemHeader'><a href='javascript:dhis2.db.removeItem( \"" + itemId + "\" )'>" + i18n_remove + "</a></div>" +
- "<ul class='itemList'><li class='itemTitle' title='" + i18n_drag_to_new_position + "'>" + title + "</li>";
+ "<ul id='ul-" + itemId + "' class='itemList'><li class='itemTitle' title='" + i18n_drag_to_new_position + "'>" + title + "</li>";
+
+ return html;
+}
+
+dhis2.db.renderMessagesItem = function( $d, itemId )
+{
+ var html = dhis2.db.linkItemHeaderHtml( itemId, "Messages" ) + "</ul></div></li>";
+
+ $d.append( html );
+
+ $ul = $( "#ul-" + itemId );
+
+ $.get( "../api/messageConversations.json?pageSize=8", function( json )
+ {
+ $.each( json.messageConversations, function( index, message )
+ {
+ $ul.append( "<li><a href='readMessage.action?id=" + message.id + "'>" + message.name + "</a></li>" );
+ } );
+
+ } );
+}
+
+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 @@
<tr id="tr${conversation.id}" #if( !$conversation.read )class="unread bold"#end>
<td style="width:40px;padding-left:5px;" onclick="toggleFollowUp( '${conversation.id}' )">
<img id="followUp${conversation.id}" #if( $conversation.followUp ) src="../images/marked.png"#else src="../images/unmarked.png"#end></td>
- <td style="width:200px" onclick="read( '${conversation.id}' )">
+ <td style="width:200px" onclick="read( '${conversation.uid}' )">
#if( $conversation.lastSenderName )$!encoder.htmlEncode( $conversation.lastSenderName )#else$i18n.getString( "system_notification" )#end
#if( $conversation.messageCount > 1 ) <span class="normal">(${conversation.messageCount})</span>#end
</td>
- <td onclick="read( '${conversation.id}' )">$!encoder.htmlEncode( $conversation.subject )</td>
- <td onclick="read( '${conversation.id}' )" style="width:80px">$!format.formatDate( $conversation.lastMessage )</td>
+ <td onclick="read( '${conversation.uid}' )">$!encoder.htmlEncode( $conversation.subject )</td>
+ <td onclick="read( '${conversation.uid}' )" style="width:80px">$!format.formatDate( $conversation.lastMessage )</td>
<td style="width:70px; text-align:center;">
<a href="readMessage.action?id=${conversation.id}"><img src="../images/read.png" title="$i18n.getString( 'read' )"></a>
<a href="javascript:removeMessage( '${conversation.id}' )"><img src="../images/delete.png" title="$i18n.getString( 'delete' )"></a>