=== 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 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 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 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 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 organisationUnits = currentUser.getOrganisationUnits(); + + if ( withChildren ) + { + for ( OrganisationUnit ou : organisationUnits ) + { + organisationUnits.addAll( ou.getChildren() ); + } + } + + JacksonUtils.toJsonWithView( response.getOutputStream(), organisationUnits, BasicView.class ); + } + private Set getOrganisationUnitsForUser( User user, String filter ) { Set organisationUnits = new HashSet(); === 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 @@
-
+

Back
=== 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 @@
-

+

=== 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 @@
-
+

Back
=== 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 @@
-
+

Back
=== 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 @@
-
+

Back New
=== 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 @@
-
+

Discard
@@ -245,7 +245,7 @@
-
+

Finish
=== 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 @@
-
+

Back