dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20490
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9365: more fixes to path generation in mobile
------------------------------------------------------------
revno: 9365
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-12-19 12:22:35 +0100
message:
more fixes to path generation in mobile
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/base.vm
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm
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/new-message.vm
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/user-account.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-12-19 11:05:00 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/java/org/hisp/dhis/web/mobile/controller/MobileController.java 2012-12-19 11:22:35 +0000
@@ -28,12 +28,13 @@
*/
import org.apache.commons.io.IOUtils;
-import org.hisp.dhis.api.utils.ContextUtils;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
+import org.springframework.web.util.UriComponents;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -61,8 +62,8 @@
@RequestMapping(value = "/index")
public String index( Model model, HttpServletRequest request )
{
- // model.addAttribute( "baseUrl", ContextUtils.getRootPath( request ) );
- model.addAttribute( "baseUrl", request.getContextPath() + request.getServletPath() );
+ UriComponents contextPath = ServletUriComponentsBuilder.fromContextPath( request ).build();
+ model.addAttribute( "contextPath", contextPath.toString() );
model.addAttribute( "page", "index.vm" );
return "base";
@@ -71,7 +72,8 @@
@RequestMapping(value = "/messages")
public String messages( Model model, HttpServletRequest request )
{
- model.addAttribute( "baseUrl", request.getContextPath() + request.getServletPath() );
+ UriComponents contextPath = ServletUriComponentsBuilder.fromContextPath( request ).build();
+ model.addAttribute( "contextPath", contextPath.toString() );
model.addAttribute( "page", "messages.vm" );
return "base";
@@ -80,7 +82,8 @@
@RequestMapping(value = "/messages/new-message")
public String newMessage( Model model, HttpServletRequest request )
{
- model.addAttribute( "baseUrl", request.getContextPath() + request.getServletPath() );
+ UriComponents contextPath = ServletUriComponentsBuilder.fromContextPath( request ).build();
+ model.addAttribute( "contextPath", contextPath.toString() );
model.addAttribute( "page", "new-message.vm" );
return "base";
@@ -89,7 +92,8 @@
@RequestMapping(value = "/messages/{uid}")
public String message( @PathVariable("uid") String uid, Model model, HttpServletRequest request )
{
- model.addAttribute( "baseUrl", request.getContextPath() + request.getServletPath() );
+ UriComponents contextPath = ServletUriComponentsBuilder.fromContextPath( request ).build();
+ model.addAttribute( "contextPath", contextPath.toString() );
model.addAttribute( "page", "message.vm" );
model.addAttribute( "messageId", uid );
@@ -99,7 +103,8 @@
@RequestMapping(value = "/interpretations")
public String interpretations( Model model, HttpServletRequest request )
{
- model.addAttribute( "baseUrl", request.getContextPath() + request.getServletPath() );
+ UriComponents contextPath = ServletUriComponentsBuilder.fromContextPath( request ).build();
+ model.addAttribute( "contextPath", contextPath.toString() );
model.addAttribute( "page", "interpretations.vm" );
return "base";
@@ -108,7 +113,8 @@
@RequestMapping(value = "/user-account")
public String settings( Model model, HttpServletRequest request )
{
- model.addAttribute( "baseUrl", request.getContextPath() + request.getServletPath() );
+ UriComponents contextPath = ServletUriComponentsBuilder.fromContextPath( request ).build();
+ model.addAttribute( "contextPath", contextPath.toString() );
model.addAttribute( "page", "user-account.vm" );
return "base";
@@ -118,7 +124,8 @@
@RequestMapping(value = "/data-entry")
public String dataEntry( Model model, HttpServletRequest request )
{
- model.addAttribute( "baseUrl", request.getContextPath() + request.getServletPath() );
+ UriComponents contextPath = ServletUriComponentsBuilder.fromContextPath( request ).build();
+ model.addAttribute( "contextPath", contextPath.toString() );
model.addAttribute( "page", "data-entry.vm" );
return "base";
=== 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-12-19 11:06:08 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm 2012-12-19 11:22:35 +0000
@@ -7,14 +7,14 @@
<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.2.0" />
+ <link rel="stylesheet" href="$contextPath/dhis-web-mobile-resources/css/jquery.mobile.min.css?v=1.2.0" />
- <script src="$baseUrl/../dhis-web-commons/javascripts/jQuery/jquery.min.js?v=1.8.2"></script>
- <script src="$baseUrl/../dhis-web-commons/javascripts/dhis2/dhis2.util.js"></script>
- <script src="$baseUrl/../dhis-web-commons/javascripts/dhis2/dhis2.array.js"></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.2.0"></script>
- <script src="$baseUrl/../dhis-web-mobile-resources/js/dhis2.storage.js"></script>
+ <script src="$contextPath/dhis-web-commons/javascripts/jQuery/jquery.min.js?v=1.8.2"></script>
+ <script src="$contextPath/dhis-web-commons/javascripts/dhis2/dhis2.util.js"></script>
+ <script src="$contextPath/dhis-web-commons/javascripts/dhis2/dhis2.array.js"></script>
+ <script src="$contextPath/dhis-web-mobile-resources/js/underscore.min.js?v=1.3.3"></script>
+ <script src="$contextPath/dhis-web-mobile-resources/js/jquery.mobile.min.js?v=1.2.0"></script>
+ <script src="$contextPath/dhis-web-mobile-resources/js/dhis2.storage.js"></script>
<script>
$(document).bind('pageinit',function(){
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm 2012-11-05 16:44:03 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm 2012-12-19 11:22:35 +0000
@@ -1,10 +1,10 @@
-<script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.validate.js"></script>
-<script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js"></script>
-<script type="text/javascript" src="../dhis-web-commons/i18nJavaScript.action"></script>
-<script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.glob.js"></script>
-<script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.date.js"></script>
-<script type="text/javascript" src="../dhis-web-commons/javascripts/date.js"></script>
-<script type="text/javascript" src="../dhis-web-commons/javascripts/periodType.js"></script>
+<script type="text/javascript" src="$contextPath/dhis-web-commons/javascripts/jQuery/jquery.validate.js"></script>
+<script type="text/javascript" src="$contextPath/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js"></script>
+<script type="text/javascript" src="$contextPath/dhis-web-commons/i18nJavaScript.action"></script>
+<script type="text/javascript" src="$contextPath/dhis-web-commons/javascripts/jQuery/jquery.glob.js"></script>
+<script type="text/javascript" src="$contextPath/dhis-web-commons/javascripts/jQuery/jquery.date.js"></script>
+<script type="text/javascript" src="$contextPath/dhis-web-commons/javascripts/date.js"></script>
+<script type="text/javascript" src="$contextPath/dhis-web-commons/javascripts/periodType.js"></script>
<script>
var Selected = {};
@@ -188,7 +188,7 @@
$.mobile.loading( 'hide' );
} else {
$.ajax({
- url: '../api/dataSets/' + Selected.dataSet + '/form',
+ url: '$contextPath/api/dataSets/' + Selected.dataSet + '/form',
cache: false,
data: {
ou: Selected.orgUnit,
@@ -350,7 +350,7 @@
<section data-role="page" id="organisation-units-page" data-theme="c">
<header data-role="header" data-theme="b">
- <h1 align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
+ <h1 align="center"><img src="$contextPath/dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
<a href="index" data-icon="back">Back</a>
</header>
@@ -366,7 +366,7 @@
<section data-role="page" id="data-sets-page" data-theme="c">
<header data-role="header" data-theme="b">
- <h1 align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
+ <h1 align="center"><img src="$contextPath/dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
<a href="#organisation-units-page" data-icon="back">Back</a>
</header>
@@ -382,7 +382,7 @@
<section data-role="page" id="period-page" data-theme="c">
<header data-role="header" data-theme="b">
- <h1 align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
+ <h1 align="center"><img src="$contextPath/dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
<a href="#data-sets-page" data-icon="back">Back</a>
</header>
@@ -398,7 +398,7 @@
<section data-role="page" id="data-entry-page" data-theme="c">
<header data-role="header" data-theme="b">
- <h1 align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
+ <h1 align="center"><img src="$contextPath/dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
<a href="#period-page" data-icon="back">Back</a>
</header>
=== 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-11-05 16:54:08 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm 2012-12-19 11:22:35 +0000
@@ -7,7 +7,7 @@
function checkOnlineStatus() {
return $.ajax({
- url: '../mobile',
+ url: '$contextPath/mobile',
async: false
}).error(function() {
onlineStatus = false;
@@ -26,7 +26,7 @@
function getDashboard() {
return $.ajax({
- url: '../api/currentUser/dashboard',
+ url: '$contextPath/api/currentUser/dashboard',
dataType: 'json'
}).success(function(data) {
if( data.unreadMessageConversation > 0 ) {
@@ -124,7 +124,7 @@
<section data-role="page" id="index-page" data-theme="c">
<header data-role="header" data-theme="b">
- <h1 align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
+ <h1 align="center"><img src="$contextPath/dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
</header>
<section data-role="content">
=== 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-11-06 10:40:27 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/message.vm 2012-12-19 11:22:35 +0000
@@ -23,7 +23,7 @@
$.mobile.loading( 'show' );
$.ajax({
- url : '$baseUrl/../api/messageConversations/${messageId}',
+ url : '$contextPath/api/messageConversations/${messageId}',
type : 'post',
contentType : 'text/plain; charset=UTF-8',
data : msg
@@ -47,7 +47,7 @@
$(document).bind('pageinit', function() {
$.ajax({
- url : '$baseUrl/../api/messageConversations/${messageId}?markRead=true',
+ url : '$contextPath/api/messageConversations/${messageId}?markRead=true',
dataType: 'json'
}).success(function ( data ) {
var tmpl = jQuery('#message-template').html();
@@ -96,7 +96,7 @@
<section data-role="page" id="message-page" data-theme="c">
<header data-role="header" data-theme="b">
- <h1 align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
+ <h1 align="center"><img src="$contextPath/dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
<a href="../messages" data-icon="back">Back</a>
</header>
=== 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-30 15:35:11 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/messages.vm 2012-12-19 11:22:35 +0000
@@ -4,7 +4,7 @@
$.mobile.loading( 'show' );
$.ajax({
- url: '../api/currentUser/inbox',
+ url: '$contextPath/api/currentUser/inbox',
dataType: 'json'
}).success(function(data) {
if( data['messageConversations'] !== undefined ) {
@@ -37,7 +37,7 @@
<section data-role="page" id="messages-page" data-theme="c">
<header data-role="header" data-theme="b">
- <h1 align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
+ <h1 align="center"><img src="$contextPath/dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
<a href="index" data-icon="back">Back</a>
<a href="messages/new-message" data-icon="plus">New</a>
</header>
=== modified 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 2012-11-26 18:11:17 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm 2012-12-19 11:22:35 +0000
@@ -111,7 +111,7 @@
$.mobile.loading( 'show' );
$.ajax({
- url : '$baseUrl/../api/currentUser/recipients',
+ url : '$contextPath/api/currentUser/recipients',
type : 'get',
dataType: 'json',
data : {
@@ -270,7 +270,7 @@
}
$.ajax({
- url: "$baseUrl/../api/messageConversations",
+ url: "$contextPath/api/messageConversations",
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(message),
@@ -317,7 +317,7 @@
<section data-role="page" id="new-message-page" data-theme="c">
<header data-role="header" data-theme="b">
- <h1 align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
+ <h1 align="center"><img src="$contextPath/dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
<a href="../messages" data-icon="delete" class="ui-btn-right">Discard</a>
</header>
@@ -347,7 +347,7 @@
<section data-role="page" id="manage-recipients-page" data-theme="c">
<header data-role="header" data-theme="b">
- <h1 align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
+ <h1 align="center"><img src="$contextPath/dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
<a href="#new-message-page" data-icon="delete" class="ui-btn-right">Finish</a>
</header>
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/user-account.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/user-account.vm 2012-11-13 13:15:01 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/user-account.vm 2012-12-19 11:22:35 +0000
@@ -4,7 +4,7 @@
$.mobile.loading( 'show' );
$.ajax({
- url: '../api/currentUser/user-account',
+ url: '$contextPath/api/currentUser/user-account',
dataType: 'json'
}).success(function(data) {
// user account
@@ -44,7 +44,7 @@
$.mobile.loading( 'show' );
$.ajax({
- url: '../api/currentUser/user-account',
+ url: '$contextPath/api/currentUser/user-account',
contentType: 'application/json',
data: JSON.stringify( settings ),
type: 'POST'
@@ -61,7 +61,7 @@
<section data-role="page" id="settings-page" data-theme="c">
<header data-role="header" data-theme="b">
- <h1 align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
+ <h1 align="center"><img src="$contextPath/dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
<a href="index" data-icon="back">Back</a>
</header>