dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19781
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8770: mobile: renamed settings => user account
------------------------------------------------------------
revno: 8770
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-10-30 12:56:01 +0100
message:
mobile: renamed settings => user account
removed:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/user/Settings.java
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/settings.vm
added:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/user/UserAccount.java
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/user-account.vm
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/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
--
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-23 12:20:27 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java 2012-10-30 11:56:01 +0000
@@ -45,7 +45,7 @@
import org.hisp.dhis.api.webdomain.user.Dashboard;
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.api.webdomain.user.UserAccount;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dxf2.utils.JacksonUtils;
import org.hisp.dhis.interpretation.Interpretation;
@@ -146,8 +146,8 @@
JacksonUtils.toJson( response.getOutputStream(), dashboard );
}
- @RequestMapping( value = "/settings", produces = {"application/json", "text/*"} )
- public void getSettings( HttpServletResponse response ) throws Exception
+ @RequestMapping( value = "/user-account", produces = {"application/json", "text/*"} )
+ public void getUserAccount( HttpServletResponse response ) throws Exception
{
User currentUser = currentUserService.getCurrentUser();
@@ -157,19 +157,19 @@
return;
}
- Settings settings = new Settings();
- settings.setFirstName( currentUser.getFirstName() );
- settings.setSurname( currentUser.getSurname() );
- settings.setEmail( currentUser.getEmail() );
- settings.setPhoneNumber( currentUser.getPhoneNumber() );
+ UserAccount userAccount = new UserAccount();
+ userAccount.setFirstName( currentUser.getFirstName() );
+ userAccount.setSurname( currentUser.getSurname() );
+ userAccount.setEmail( currentUser.getEmail() );
+ userAccount.setPhoneNumber( currentUser.getPhoneNumber() );
- JacksonUtils.toJson( response.getOutputStream(), settings );
+ JacksonUtils.toJson( response.getOutputStream(), userAccount );
}
- @RequestMapping( value = "/settings", method = RequestMethod.POST, consumes = "application/xml" )
- public void postSettingsXml( HttpServletResponse response, HttpServletRequest request ) throws Exception
+ @RequestMapping( value = "/user-account", method = RequestMethod.POST, consumes = "application/xml" )
+ public void postUserAccountXml( HttpServletResponse response, HttpServletRequest request ) throws Exception
{
- Settings settings = JacksonUtils.fromXml( request.getInputStream(), Settings.class );
+ UserAccount userAccount = JacksonUtils.fromXml( request.getInputStream(), UserAccount.class );
User currentUser = currentUserService.getCurrentUser();
if ( currentUser == null )
@@ -178,18 +178,18 @@
return;
}
- currentUser.setFirstName( settings.getFirstName() );
- currentUser.setSurname( settings.getSurname() );
- currentUser.setEmail( settings.getEmail() );
- currentUser.setPhoneNumber( settings.getPhoneNumber() );
+ currentUser.setFirstName( userAccount.getFirstName() );
+ currentUser.setSurname( userAccount.getSurname() );
+ currentUser.setEmail( userAccount.getEmail() );
+ currentUser.setPhoneNumber( userAccount.getPhoneNumber() );
userService.updateUser( currentUser );
}
- @RequestMapping( value = "/settings", method = RequestMethod.POST, consumes = "application/json" )
- public void postSettingsJson( HttpServletResponse response, HttpServletRequest request ) throws Exception
+ @RequestMapping( value = "/user-account", method = RequestMethod.POST, consumes = "application/json" )
+ public void postUserAccountJson( HttpServletResponse response, HttpServletRequest request ) throws Exception
{
- Settings settings = JacksonUtils.fromJson( request.getInputStream(), Settings.class );
+ UserAccount userAccount = JacksonUtils.fromJson( request.getInputStream(), UserAccount.class );
User currentUser = currentUserService.getCurrentUser();
if ( currentUser == null )
@@ -198,10 +198,10 @@
return;
}
- currentUser.setFirstName( settings.getFirstName() );
- currentUser.setSurname( settings.getSurname() );
- currentUser.setEmail( settings.getEmail() );
- currentUser.setPhoneNumber( settings.getPhoneNumber() );
+ currentUser.setFirstName( userAccount.getFirstName() );
+ currentUser.setSurname( userAccount.getSurname() );
+ currentUser.setEmail( userAccount.getEmail() );
+ currentUser.setPhoneNumber( userAccount.getPhoneNumber() );
userService.updateUser( currentUser );
}
=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/user/Settings.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/user/Settings.java 2012-09-27 09:38:59 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/user/Settings.java 1970-01-01 00:00:00 +0000
@@ -1,115 +0,0 @@
-package org.hisp.dhis.api.webdomain.user;
-
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.hisp.dhis.common.Dxf2Namespace;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-@JacksonXmlRootElement( localName = "settings", namespace = Dxf2Namespace.NAMESPACE )
-public class Settings
-{
- private String firstName;
-
- private String surname;
-
- private String email;
-
- private String phoneNumber;
-
- private String jobTitle;
-
- public Settings()
- {
- }
-
- @JsonProperty(required = true)
- @JacksonXmlProperty(namespace = Dxf2Namespace.NAMESPACE)
- public String getFirstName()
- {
- return firstName;
- }
-
- public void setFirstName( String firstName )
- {
- this.firstName = firstName;
- }
-
- @JsonProperty(required = true)
- @JacksonXmlProperty(namespace = Dxf2Namespace.NAMESPACE)
- public String getSurname()
- {
- return surname;
- }
-
- public void setSurname( String surname )
- {
- this.surname = surname;
- }
-
- @JsonProperty
- @JacksonXmlProperty(namespace = Dxf2Namespace.NAMESPACE)
- public String getEmail()
- {
- return email;
- }
-
- public void setEmail( String email )
- {
- this.email = email;
- }
-
- @JsonProperty
- @JacksonXmlProperty(namespace = Dxf2Namespace.NAMESPACE)
- public String getPhoneNumber()
- {
- return phoneNumber;
- }
-
- public void setPhoneNumber( String phoneNumber )
- {
- this.phoneNumber = phoneNumber;
- }
-
- @JsonProperty
- @JacksonXmlProperty(namespace = Dxf2Namespace.NAMESPACE)
- public String getJobTitle()
- {
- return jobTitle;
- }
-
- public void setJobTitle( String jobTitle )
- {
- this.jobTitle = jobTitle;
- }
-}
=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/user/UserAccount.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/user/UserAccount.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/webdomain/user/UserAccount.java 2012-10-30 11:56:01 +0000
@@ -0,0 +1,101 @@
+package org.hisp.dhis.api.webdomain.user;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.common.Dxf2Namespace;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@JacksonXmlRootElement( localName = "settings", namespace = Dxf2Namespace.NAMESPACE )
+public class UserAccount
+{
+ private String firstName;
+
+ private String surname;
+
+ private String email;
+
+ private String phoneNumber;
+
+ public UserAccount()
+ {
+ }
+
+ @JsonProperty(required = true)
+ @JacksonXmlProperty(namespace = Dxf2Namespace.NAMESPACE)
+ public String getFirstName()
+ {
+ return firstName;
+ }
+
+ public void setFirstName( String firstName )
+ {
+ this.firstName = firstName;
+ }
+
+ @JsonProperty(required = true)
+ @JacksonXmlProperty(namespace = Dxf2Namespace.NAMESPACE)
+ public String getSurname()
+ {
+ return surname;
+ }
+
+ public void setSurname( String surname )
+ {
+ this.surname = surname;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty(namespace = Dxf2Namespace.NAMESPACE)
+ public String getEmail()
+ {
+ return email;
+ }
+
+ public void setEmail( String email )
+ {
+ this.email = email;
+ }
+
+ @JsonProperty
+ @JacksonXmlProperty(namespace = Dxf2Namespace.NAMESPACE)
+ public String getPhoneNumber()
+ {
+ return phoneNumber;
+ }
+
+ public void setPhoneNumber( String phoneNumber )
+ {
+ this.phoneNumber = phoneNumber;
+ }
+}
=== 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-10-22 09:18:33 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/java/org/hisp/dhis/web/mobile/controller/MobileController.java 2012-10-30 11:56:01 +0000
@@ -105,11 +105,11 @@
return "base";
}
- @RequestMapping( value = "/settings" )
+ @RequestMapping( value = "/user-account" )
public String settings( Model model, HttpServletRequest request )
{
model.addAttribute( "baseUrl", ContextUtils.getRootPath( request ) );
- model.addAttribute( "page", "settings.vm" );
+ model.addAttribute( "page", "user-account.vm" );
return "base";
}
=== 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-30 11:40:19 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/index.vm 2012-10-30 11:56:01 +0000
@@ -72,10 +72,10 @@
function updateMenu() {
if( onlineStatus ) {
$( '#messages').removeClass('ui-disabled');
- $( '#settings').removeClass('ui-disabled');
+ $( '#user-account').removeClass('ui-disabled');
} else {
$( '#messages').addClass('ui-disabled');
- $( '#settings').addClass('ui-disabled');
+ $( '#user-account').addClass('ui-disabled');
}
}
@@ -132,7 +132,7 @@
<ul data-role="listview" data-inset="true">
<li id="data-entry"><a href="data-entry">Aggregate Reporting</a></li>
<li id="messages"><a href="messages">Messages</a></li>
- <li id="settings"><a href="settings">User Account</a></li>
+ <li id="user-account"><a href="user-account">User Account</a></li>
<li id="offline-status">
<h3></h3>
<p> </p>
=== removed 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-18 08:27:37 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/settings.vm 1970-01-01 00:00:00 +0000
@@ -1,69 +0,0 @@
-
-<script>
- $(document).bind('pageinit',function(){
- $.ajax({
- url: '../api/currentUser',
- dataType: 'json',
- async: false
- }).success(function(data) {
- $('#firstNameInput').val(data.firstName);
- $('#surnameInput').val(data.surname);
- $('#emailInput').val(data.email);
- $('#phoneNumberInput').val(data.phoneNumber);
- });
-
- $('input:submit').bind('click', function(e) {
- var settings = $('#settings-form').serializeArray();
-
- settings = _(settings).reduce(function(acc, field) {
- acc[field.name] = field.value;
- return acc;
- }, {});
-
- $.mobile.showPageLoadingMsg();
-
- $.ajax({
- url: '../api/currentUser/settings.json',
- contentType: 'application/json',
- data: JSON.stringify( settings ),
- type: 'POST'
- }).complete(function() {
- $.mobile.hidePageLoadingMsg();
- window.location.href = '../mobile';
- });
-
- e.preventDefault();
- })
- });
-</script>
-
-<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>
- <a href="index" data-icon="back">Back</a>
- </header>
-
- <section data-role="content">
- <form id="settings-form" method="POST">
- <label for="firstNameInput">First Name:</label>
- <input id="firstNameInput" name="firstName" type="text" placeholder="Enter first name.." />
-
- <label for="surnameInput">Surname:</label>
- <input id="surnameInput" name="surname" type="text" placeholder="Enter surname.." />
-
- <label for="emailInput">E-mail:</label>
- <input id="emailInput" name="email" type="text" placeholder="Enter e-mail.." />
-
- <label for="phoneNumberInput">Phone Number:</label>
- <input id="phoneNumberInput" name="phoneNumber" type="text" placeholder="Enter phone number.." />
-
- <input type="submit" value="Save" />
- </form>
- </section>
-
- <footer data-role="footer" data-theme="b">
- <h1></h1>
- </footer>
-
-</section>
=== added 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 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/user-account.vm 2012-10-30 11:56:01 +0000
@@ -0,0 +1,69 @@
+
+<script>
+ $(document).bind('pageinit',function(){
+ $.ajax({
+ url: '../api/currentUser',
+ dataType: 'json',
+ async: false
+ }).success(function(data) {
+ $('#firstNameInput').val(data.firstName);
+ $('#surnameInput').val(data.surname);
+ $('#emailInput').val(data.email);
+ $('#phoneNumberInput').val(data.phoneNumber);
+ });
+
+ $('input:submit').bind('click', function(e) {
+ var settings = $('#settings-form').serializeArray();
+
+ settings = _(settings).reduce(function(acc, field) {
+ acc[field.name] = field.value;
+ return acc;
+ }, {});
+
+ $.mobile.showPageLoadingMsg();
+
+ $.ajax({
+ url: '../api/currentUser/user-account.json',
+ contentType: 'application/json',
+ data: JSON.stringify( settings ),
+ type: 'POST'
+ }).complete(function() {
+ $.mobile.hidePageLoadingMsg();
+ window.location.href = '../mobile';
+ });
+
+ e.preventDefault();
+ })
+ });
+</script>
+
+<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>
+ <a href="index" data-icon="back">Back</a>
+ </header>
+
+ <section data-role="content">
+ <form id="settings-form" method="POST">
+ <label for="firstNameInput">First Name:</label>
+ <input id="firstNameInput" name="firstName" type="text" placeholder="Enter first name.." />
+
+ <label for="surnameInput">Surname:</label>
+ <input id="surnameInput" name="surname" type="text" placeholder="Enter surname.." />
+
+ <label for="emailInput">E-mail:</label>
+ <input id="emailInput" name="email" type="text" placeholder="Enter e-mail.." />
+
+ <label for="phoneNumberInput">Phone Number:</label>
+ <input id="phoneNumberInput" name="phoneNumber" type="text" placeholder="Enter phone number.." />
+
+ <input type="submit" value="Save" />
+ </form>
+ </section>
+
+ <footer data-role="footer" data-theme="b">
+ <h1></h1>
+ </footer>
+
+</section>