← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8310: mobile: minor changes, also working on new-message ui (work in progress, unsure how to handle mul...

 

------------------------------------------------------------
revno: 8310
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-10-01 11:01:22 +0700
message:
  mobile: minor changes, also working on new-message ui (work in progress, unsure how to handle multiple orgunits/user/usergroups..)
added:
  dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/interpretations.vm
  dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm
modified:
  dhis-2/dhis-web/dhis-web-mobile/src/main/java/org/hisp/dhis/web/mobile/controller/MobileController.java
  dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.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
  dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/settings.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-mobile/src/main/java/org/hisp/dhis/web/mobile/controller/MobileController.java'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/java/org/hisp/dhis/web/mobile/controller/MobileController.java	2012-09-29 03:50:36 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/java/org/hisp/dhis/web/mobile/controller/MobileController.java	2012-10-01 04:01:22 +0000
@@ -71,6 +71,15 @@
         return "base";
     }
 
+    @RequestMapping( value = "/messages/new-message" )
+    public String newMessage( Model model, HttpServletRequest request )
+    {
+        model.addAttribute( "baseUrl", ContextUtils.getRootPath( request ) );
+        model.addAttribute( "page", "new-message.vm" );
+
+        return "base";
+    }
+
     @RequestMapping( value = "/messages/{uid}" )
     public String message( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request )
     {
@@ -81,6 +90,15 @@
         return "base";
     }
 
+    @RequestMapping( value = "/interpretations" )
+    public String interpretations( Model model, HttpServletRequest request )
+    {
+        model.addAttribute( "baseUrl", ContextUtils.getRootPath( request ) );
+        model.addAttribute( "page", "interpretations.vm" );
+
+        return "base";
+    }
+
     @RequestMapping( value = "/settings" )
     public String settings( Model model, HttpServletRequest request )
     {

=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm	2012-09-29 03:50:36 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm	2012-10-01 04:01:22 +0000
@@ -5,8 +5,13 @@
             url: '../api/currentUser/dashboard.json',
             async: false
         }).success(function(data) {
-            $('#messages a').append("<span class='ui-li-count'>" + data.unreadMessageConversation + "</span>");
-            $('#interpretations a').append("<span class='ui-li-count'>" + data.unreadInterpretations + "</span>");
+            if( data.unreadMessageConversation > 0 ) {
+                $('#messages a').append("<span class='ui-li-count'>" + data.unreadMessageConversation + "</span>");
+            }
+
+            if( data.unreadInterpretations > 0 ) {
+                $('#interpretations a').append("<span class='ui-li-count'>" + data.unreadInterpretations + "</span>");
+            }
         }).error(function() {
             $('#messages a').append("<span class='ui-li-count'>Offline</span>")
             $('#interpretations a').append("<span class='ui-li-count'>Offline</span>")
@@ -14,7 +19,7 @@
     });
 </script>
 
-<section data-role="page" id="mainPage" data-theme="c">
+<section data-role="page" id="index-page" data-theme="c">
 
 	<header data-role="header" data-theme="b">
 		<div align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></div>

=== added file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/interpretations.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/interpretations.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/interpretations.vm	2012-10-01 04:01:22 +0000
@@ -0,0 +1,16 @@
+
+<section data-role="page" id="interpretations-page" data-theme="c">
+
+	<header data-role="header" data-theme="b">
+		<div align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></div>
+        <a href="index" data-icon="back">Back</a>
+	</header>
+
+	<section data-role="content">
+	</section>
+
+    <footer data-role="footer" data-theme="b">
+        <h1></h1>
+   	</footer>
+
+</section>

=== 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-09-30 17:01:41 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/message.vm	2012-10-01 04:01:22 +0000
@@ -1,18 +1,18 @@
 
 <script>
-    jQuery(document).bind('pagebeforecreate',function(){
+    jQuery(document).bind('pagebeforecreate', function () {
         jQuery.ajax({
-            url: '$baseUrl/../api/messageConversations/${messageId}.json',
-            async: false
-        }).success(function(data) {
+            url   : '$baseUrl/../api/messageConversations/${messageId}.json',
+            async : false
+        }).success(function ( data ) {
             var tmpl = jQuery('#message-template').html();
 
             jQuery('section[data-role="content"]').html(
-                _.template( tmpl, data )
+                _.template(tmpl, data)
             );
 
             console.log(data);
-        }).error(function() {
+        }).error(function () {
             console.log('error fetching message')
         });
     });
@@ -25,14 +25,19 @@
                return false;
            }
 
+           $.mobile.showPageLoadingMsg();
+
            $.ajax({
                url         : '$baseUrl/../api/messageConversations/${messageId}',
                type        : 'post',
                contentType : 'text/plain',
                data        : msg
            }).success(function () {
+               $.mobile.hidePageLoadingMsg();
                location.reload(true);
            }).error(function () {
+               $.mobile.showPageLoadingMsg( $.mobile.pageLoadErrorMessageTheme, "Unable to send reply, please try again later", true );
+               setTimeout( $.mobile.hidePageLoadingMsg, 1500 );
                console.log("failed to send message");
            });
 
@@ -63,7 +68,7 @@
     </ul>
 </script>
 
-<section data-role="page" id="messagePage" data-theme="c">
+<section data-role="page" id="message-page" data-theme="c">
 
 	<header data-role="header" data-theme="b">
 		<div align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></div>

=== 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-09-30 14:58:00 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/messages.vm	2012-10-01 04:01:22 +0000
@@ -16,12 +16,13 @@
     });
 </script>
 
-<section data-role="page" id="messagesPage" data-theme="c">
+<section data-role="page" id="messages-page" data-theme="c">
 
 	<header data-role="header" data-theme="b">
 		<div align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></div>
         <a href="index" data-icon="back">Back</a>
-	</header>
+        <a href="messages/new-message" data-icon="plus">New</a>
+    </header>
 
 	<section data-role="content">
         <ul id="messageList" data-role="listview" data-inset="true">

=== added file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm	2012-10-01 04:01:22 +0000
@@ -0,0 +1,71 @@
+<script>
+    var selected = {};
+
+    jQuery(document).bind('pageinit', function() {
+       $('#new-message-form input:submit').bind('click', function() {
+           var subject = jQuery('#new-message-subject').val();
+           var text = jQuery('#new-message-text').val();
+
+           console.log(subject);
+           console.log(text);
+
+           return false;
+       });
+    });
+</script>
+
+<section data-role="page" id="new-message-page" data-theme="c">
+
+	<header data-role="header" data-theme="b">
+		<div align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></div>
+        <a href="messages" data-icon="delete" class="ui-btn-right">Discard</a>
+    </header>
+
+	<section data-role='content'>
+        <ul data-role="listview" data-inset="true">
+            <li>
+                <form id="new-message-form">
+                    <label for='new-message-subject'>Subject</label>
+                    <input type="text" id='new-message-subject' />
+                    <label for='new-message-body'>Text</label>
+                    <textarea id='new-message-body'></textarea>
+                    <input type="submit" value="Send message" />
+                </form>
+
+            </li>
+            <li data-icon="gear"><a href="#manage-recipients-page" data-icon="plus">Manage recipients</a> <span class='ui-li-count'>1</a></li>
+        </ul>
+
+	</section>
+
+    <footer data-role="footer" data-theme="b">
+        <h1></h1>
+   	</footer>
+
+</section>
+
+<section data-role="page" id="manage-recipients-page" data-theme="c">
+
+	<header data-role="header" data-theme="b">
+		<div align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></div>
+        <a href="#new-message-page" data-icon="delete" class="ui-btn-right">Finish</a>
+    </header>
+
+	<section data-role="content">
+        <ul data-role="listview" data-inset="true" data-filter="true" data-filter-placeholder="Search for recipients..">
+            <li data-role="list-divider">Organisation Units</li>
+            <li>Not implemented.</li>
+
+            <li data-role="list-divider">Users</li>
+            <li>Not implemented.</li>
+
+            <li data-role="list-divider">User groups</li>
+            <li>Not implemented.</li>
+        </ul>
+	</section>
+
+    <footer data-role="footer" data-theme="b">
+        <h1></h1>
+   	</footer>
+
+</section>

=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/settings.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/settings.vm	2012-09-30 14:58:00 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/settings.vm	2012-10-01 04:01:22 +0000
@@ -13,7 +13,7 @@
         });
 
         $('input:submit').bind('click', function() {
-            var settings = $('#settingsForm').serializeArray();
+            var settings = $('#settings-form').serializeArray();
 
             settings = _(settings).reduce(function(acc, field) {
                acc[field.name] = field.value;
@@ -37,7 +37,7 @@
     });
 </script>
 
-<section data-role="page" id="settingsPage" data-theme="c">
+<section data-role="page" id="settings-page" data-theme="c">
 
 	<header data-role="header" data-theme="b">
 		<div align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></div>
@@ -45,7 +45,7 @@
 	</header>
 
     <section data-role="content">
-       <form id="settingsForm" method="POST">
+       <form id="settings-form" method="POST">
            <label for="firstNameInput">First Name</label>
            <input id="firstNameInput" name="firstName" type="text" placeholder="Enter first name.." />