dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19648
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8663: Mobile: added a simple marker for indicating unread messages.
------------------------------------------------------------
revno: 8663
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-10-23 14:20:27 +0200
message:
Mobile: added a simple marker for indicating unread messages.
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/message.vm
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/messages.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-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java 2012-10-22 10:53:03 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java 2012-10-23 12:20:27 +0000
@@ -122,8 +122,8 @@
}
Inbox inbox = new Inbox();
- inbox.setMessageConversations( new ArrayList<MessageConversation>( messageService.getMessageConversations( 0, Integer.MAX_VALUE ) ) );
- inbox.setInterpretations( new ArrayList<Interpretation>( interpretationService.getInterpretations( 0, Integer.MAX_VALUE ) ) );
+ inbox.setMessageConversations( new ArrayList<MessageConversation>( messageService.getMessageConversations( 0, MAX_OBJECTS ) ) );
+ inbox.setInterpretations( new ArrayList<Interpretation>( interpretationService.getInterpretations( 0, MAX_OBJECTS ) ) );
JacksonUtils.toJson( response.getOutputStream(), inbox );
}
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm 2012-10-22 09:18:33 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm 2012-10-23 12:20:27 +0000
@@ -1,11 +1,14 @@
<!DOCTYPE html>
-<html manifest="app-cache">
-<!-- <html> -->
+<!-- <html manifest="app-cache"> -->
+<html>
<head>
<title>DHIS2</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta charset="UTF-8">
+
<link rel="stylesheet" href="$baseUrl/../dhis-web-mobile-resources/css/jquery.mobile.min.css?v=1.1.1" />
+
<script src="$baseUrl/../dhis-web-commons/javascripts/jQuery/jquery.min.js?v=1.7.1"></script>
<script src="$baseUrl/../dhis-web-mobile-resources/js/underscore.min.js?v=1.3.3"></script>
<script src="$baseUrl/../dhis-web-mobile-resources/js/jquery.mobile.min.js?v=1.1.1"></script>
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/message.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/message.vm 2012-10-21 15:30:15 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/message.vm 2012-10-23 12:20:27 +0000
@@ -30,7 +30,7 @@
$(document).bind('pageinit', function() {
$.ajax({
- url : '$baseUrl/../api/messageConversations/${messageId}.json',
+ url : '$baseUrl/../api/messageConversations/${messageId}?markRead=true',
dataType: 'json'
}).success(function ( data ) {
var tmpl = jQuery('#message-template').html();
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/messages.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/messages.vm 2012-10-10 17:14:33 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/messages.vm 2012-10-23 12:20:27 +0000
@@ -1,16 +1,25 @@
<script>
- jQuery(document).bind('pagebeforecreate',function(){
- jQuery.ajax({
+ $(document).bind('pagebeforecreate',function(){
+ $.ajax({
url: '../api/currentUser/inbox',
dataType: 'json',
async: false
}).success(function(data) {
- jQuery.each(data.messageConversations, function(i, item) {
- jQuery('#messageList').append('<li><a href="messages/' + item.id + '">' + item.name + '</a></li>');
- });
+ if( data['messageConversations'] !== undefined ) {
+ $.each(data.messageConversations, function(i, item) {
+ if(item.read) {
+ $('#messageList').append('<li><a href="messages/' + item.id + '">' + item.name + '</a></li>');
+ } else {
+ $('#messageList').append('<li><a href="messages/' + item.id + '">' + item.name + '<span class="ui-li-count">Unread</span></a></li>');
+ }
+ });
+ } else {
+ $('#messageList').append('<li>No messages</li>');
+ }
}).error(function() {
- console.log("error fetching inbox");
+ $.mobile.showPageLoadingMsg($.mobile.pageLoadErrorMessageTheme, "Unable to get inbox, please try again later", true);
+ setTimeout($.mobile.hidePageLoadingMsg, 1500);
});
});
</script>
@@ -24,7 +33,7 @@
</header>
<section data-role="content">
- <ul id="messageList" data-role="listview" data-inset="true">
+ <ul id="messageList" data-role="listview" data-inset="true" data-count-theme="b">
<li data-role="list-divider">Messages</li>
</ul>
</section>