dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19421
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8459: mobile: logo fixes, also added /api/currentUser/organisationUnits(?withChildren=true/false).
------------------------------------------------------------
revno: 8459
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-10-10 11:29:10 +0200
message:
mobile: logo fixes, also added /api/currentUser/organisationUnits(?withChildren=true/false).
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/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/interpretations.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/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-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-06 10:40:16 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java 2012-10-10 09:29:10 +0000
@@ -34,6 +34,7 @@
import org.hisp.dhis.api.webdomain.user.Inbox;
import org.hisp.dhis.api.webdomain.user.Recipients;
import org.hisp.dhis.api.webdomain.user.Settings;
+import org.hisp.dhis.common.view.BasicView;
import org.hisp.dhis.dxf2.utils.JacksonUtils;
import org.hisp.dhis.interpretation.Interpretation;
import org.hisp.dhis.interpretation.InterpretationService;
@@ -82,9 +83,9 @@
@Autowired
private OrganisationUnitService organisationUnitService;
- @RequestMapping
+ @RequestMapping( produces = {"application/json", "text/*"} )
public String getCurrentUser( @RequestParam Map<String, String> parameters,
- Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
WebOptions options = new WebOptions( parameters );
User currentUser = currentUserService.getCurrentUser();
@@ -106,9 +107,9 @@
return StringUtils.uncapitalize( "user" );
}
- @RequestMapping( value = "/inbox" )
+ @RequestMapping( value = "/inbox", produces = {"application/json", "text/*"} )
public String getInbox( @RequestParam Map<String, String> parameters,
- Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
WebOptions options = new WebOptions( parameters );
User currentUser = currentUserService.getCurrentUser();
@@ -134,9 +135,9 @@
return StringUtils.uncapitalize( "inbox" );
}
- @RequestMapping( value = "/dashboard" )
+ @RequestMapping( value = "/dashboard", produces = {"application/json", "text/*"} )
public String getDashboard( @RequestParam Map<String, String> parameters,
- Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
WebOptions options = new WebOptions( parameters );
User currentUser = currentUserService.getCurrentUser();
@@ -162,9 +163,9 @@
return StringUtils.uncapitalize( "dashboard" );
}
- @RequestMapping( value = "/settings" )
+ @RequestMapping( value = "/settings", produces = {"application/json", "text/*"} )
public String getSettings( @RequestParam Map<String, String> parameters,
- Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception
+ Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception
{
WebOptions options = new WebOptions( parameters );
User currentUser = currentUserService.getCurrentUser();
@@ -234,8 +235,9 @@
userService.updateUser( currentUser );
}
- @RequestMapping( value = "/recipients", produces = "application/json" )
- public void recipientsJson( HttpServletResponse response, @RequestParam( value = "filter", required = false ) String filter ) throws IOException
+ @RequestMapping( value = "/recipients", produces = {"application/json", "text/*"} )
+ public void recipientsJson( HttpServletResponse response,
+ @RequestParam( value = "filter", required = false ) String filter ) throws IOException
{
User currentUser = currentUserService.getCurrentUser();
@@ -262,6 +264,31 @@
JacksonUtils.toJson( response.getOutputStream(), recipients );
}
+ @RequestMapping( value = "/organisationUnits", produces = {"application/json", "text/*"} )
+ public void getOrganisationUnitsJson( HttpServletResponse response,
+ @RequestParam( value = "withChildren", required = false ) boolean withChildren ) throws IOException
+ {
+ User currentUser = currentUserService.getCurrentUser();
+
+ if ( currentUser == null )
+ {
+ ContextUtils.notFoundResponse( response, "User object is null, user is not authenticated." );
+ return;
+ }
+
+ Collection<OrganisationUnit> organisationUnits = currentUser.getOrganisationUnits();
+
+ if ( withChildren )
+ {
+ for ( OrganisationUnit ou : organisationUnits )
+ {
+ organisationUnits.addAll( ou.getChildren() );
+ }
+ }
+
+ JacksonUtils.toJsonWithView( response.getOutputStream(), organisationUnits, BasicView.class );
+ }
+
private Set<OrganisationUnit> getOrganisationUnitsForUser( User user, String filter )
{
Set<OrganisationUnit> organisationUnits = new HashSet<OrganisationUnit>();
=== 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-10-10 07:42:55 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/data-entry.vm 2012-10-10 09:29:10 +0000
@@ -2,7 +2,7 @@
<section data-role="page" id="data-entry-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>
+ <h1 align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
<a href="index" 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-10-10 07:42:55 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm 2012-10-10 09:29:10 +0000
@@ -22,7 +22,7 @@
<section data-role="page" id="index-page" data-theme="c">
<header data-role="header" data-theme="b">
- <h1><div align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></div></h1>
+ <h1 align="center"><img src="$baseUrl/../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/interpretations.vm'
--- 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
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/interpretations.vm 2012-10-10 09:29:10 +0000
@@ -2,7 +2,7 @@
<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>
+ <h1 align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
<a href="index" data-icon="back">Back</a>
</header>
=== 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-02 07:20:25 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/message.vm 2012-10-10 09:29:10 +0000
@@ -72,7 +72,7 @@
<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>
+ <h1 align="center"><img src="$baseUrl/../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-01 20:06:55 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/messages.vm 2012-10-10 09:29:10 +0000
@@ -17,7 +17,7 @@
<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>
+ <h1 align="center"><img src="$baseUrl/../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-10-02 07:20:25 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm 2012-10-10 09:29:10 +0000
@@ -215,7 +215,7 @@
<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>
+ <h1 align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
<a href="../messages" data-icon="delete" class="ui-btn-right">Discard</a>
</header>
@@ -245,7 +245,7 @@
<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>
+ <h1 align="center"><img src="$baseUrl/../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/settings.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/settings.vm 2012-10-02 07:46:54 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/settings.vm 2012-10-10 09:29:10 +0000
@@ -40,7 +40,7 @@
<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>
+ <h1 align="center"><img src="$baseUrl/../dhis-web-commons/css/light_blue/logo_banner.png" /></h1>
<a href="index" data-icon="back">Back</a>
</header>