From f3c54dc42f11c40dc017e0fef7560778dd23852b Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Mon, 14 Aug 2006 13:28:08 +0000 Subject: [PATCH] . Added ability to change the users Name and Email to the User Options page. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3493 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/messages/webclient.properties | 3 + .../alfresco/web/bean/repository/User.java | 11 +- .../alfresco/web/bean/users/UsersBean.java | 40 +++- .../web/WEB-INF/faces-config-navigation.xml | 4 + source/web/jsp/users/edit-user-details.jsp | 196 ++++++++++++++++++ source/web/jsp/users/user-console.jsp | 16 +- 6 files changed, 258 insertions(+), 12 deletions(-) create mode 100644 source/web/jsp/users/edit-user-details.jsp diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 8a4818dddf..59326d4573 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -890,6 +890,7 @@ dashlet_gettingstarted_desc=Displays helpful information for getting started wit # User Console and Settings messages title_user_console=User Options +title_edit_user_details=Edit User Details user_console=User Options user_console_info=User Options user_console_description=Use this page to change your options and settings @@ -899,6 +900,8 @@ change_my_password_description=Use this view to change your password change_my_password_instructions=Enter your new password. old_password=Old Password new_password=New Password +edit_user_details=Edit User Details +edit_user_details_description=Use this view to change your user details and email address # Workflow messages start_workflow=Start Workflow diff --git a/source/java/org/alfresco/web/bean/repository/User.java b/source/java/org/alfresco/web/bean/repository/User.java index cfcb58a2bb..99bbd61bc3 100644 --- a/source/java/org/alfresco/web/bean/repository/User.java +++ b/source/java/org/alfresco/web/bean/repository/User.java @@ -64,6 +64,16 @@ public final class User this.person = person; } + /** + * Forces a clear of any cached or calcluated values + */ + public void reset() + { + this.fullName = null; + this.administrator = null; + this.preferences = null; + } + /** * @return The user name */ @@ -114,7 +124,6 @@ public final class User { return this.ticket; } - /** * @return Returns the person NodeRef diff --git a/source/java/org/alfresco/web/bean/users/UsersBean.java b/source/java/org/alfresco/web/bean/users/UsersBean.java index 5e6ee539d3..5653d090f0 100644 --- a/source/java/org/alfresco/web/bean/users/UsersBean.java +++ b/source/java/org/alfresco/web/bean/users/UsersBean.java @@ -16,6 +16,7 @@ */ package org.alfresco.web.bean.users; +import java.io.Serializable; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; @@ -35,6 +36,7 @@ import org.alfresco.service.cmr.search.SearchParameters; import org.alfresco.service.cmr.search.SearchService; import org.alfresco.service.cmr.security.AuthenticationService; import org.alfresco.service.cmr.security.PersonService; +import org.alfresco.service.namespace.QName; import org.alfresco.util.ISO9075; import org.alfresco.web.app.Application; import org.alfresco.web.app.context.IContextListener; @@ -265,10 +267,10 @@ public class UsersBean implements IContextListener // create the node ref, then our node representation NodeRef ref = new NodeRef(Repository.getStoreRef(), id); Node node = new Node(ref); - + // remember the Person node setPerson(node); - + // clear the UI state in preparation for finishing the action // and returning to the main page contextUpdated(); @@ -388,7 +390,39 @@ public class UsersBean implements IContextListener return outcome; } - + + /** + * Action handler called for the OK button press + */ + public String changeUserDetails() + { + String outcome = DIALOG_CLOSE; + + FacesContext context = FacesContext.getCurrentInstance(); + try + { + Map props = this.nodeService.getProperties(getPerson().getNodeRef()); + props.put(ContentModel.PROP_FIRSTNAME, + (String)getPerson().getProperties().get(ContentModel.PROP_FIRSTNAME)); + props.put(ContentModel.PROP_LASTNAME, + (String)getPerson().getProperties().get(ContentModel.PROP_LASTNAME)); + props.put(ContentModel.PROP_EMAIL, + (String)getPerson().getProperties().get(ContentModel.PROP_EMAIL)); + + // persist changes + this.nodeService.setProperties(getPerson().getNodeRef(), props); + + // if the above call was successful, then reset Person Node in the session + Application.getCurrentUser(context).reset(); + } + catch (Throwable err) + { + Utils.addErrorMessage(MessageFormat.format(Application.getMessage( + context, Repository.ERROR_GENERIC), err.getMessage()), err ); + } + + return outcome; + } /** * Event handler called when the user wishes to search for a user diff --git a/source/web/WEB-INF/faces-config-navigation.xml b/source/web/WEB-INF/faces-config-navigation.xml index 5ca6e3a9c2..14e5b68b48 100644 --- a/source/web/WEB-INF/faces-config-navigation.xml +++ b/source/web/WEB-INF/faces-config-navigation.xml @@ -603,6 +603,10 @@ changePassword /jsp/users/change-my-password.jsp + + editUserDetails + /jsp/users/edit-user-details.jsp + diff --git a/source/web/jsp/users/edit-user-details.jsp b/source/web/jsp/users/edit-user-details.jsp new file mode 100644 index 0000000000..788e08fcd0 --- /dev/null +++ b/source/web/jsp/users/edit-user-details.jsp @@ -0,0 +1,196 @@ +<%-- + Copyright (C) 2005 Alfresco, Inc. + + Licensed under the Mozilla Public License version 1.1 + with a permitted attribution clause. You may obtain a + copy of the License at + + http://www.alfresco.org/legal/license.txt + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + either express or implied. See the License for the specific + language governing permissions and limitations under the + License. +--%> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> + +<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> +<%@ page isELIgnored="false" %> +<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %> + + + + + + + + <%-- load a bundle of properties with I18N strings --%> + + + <%-- set the form name here --%> + + + <%-- Main outer table --%> + + + <%-- Title bar --%> + + + + + <%-- Main area --%> + + <%-- Shelf --%> + + + <%-- Work Area --%> + + +
+ <%@ include file="../parts/titlebar.jsp" %> +
+ <%@ include file="../parts/shelf.jsp" %> + + + <%-- Breadcrumb --%> + <%@ include file="../parts/breadcrumb.jsp" %> + + <%-- Status and Actions --%> + + + + + + + <%-- separator row with gradient shadow --%> + + + + + + + <%-- Details --%> + + + + + + + <%-- separator row with bottom panel graphics --%> + + + + + + +
+ + <%-- Status and Actions inner contents table --%> + <%-- Generally this consists of an icon, textual summary and actions for the current object --%> + + + + + +
+ +
+
+
+ +
+ + + + + + +
+ + + + <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %> + + + + + + + + + + + + + + + + + +
: +  * +
: +  * +
: +  * +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %> +
+ <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> + + + + + + + + +
+ +
+ +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> +
+
+
+ +
+ +
+ + + +
\ No newline at end of file diff --git a/source/web/jsp/users/user-console.jsp b/source/web/jsp/users/user-console.jsp index 877c84bf6d..d28ea9073f 100644 --- a/source/web/jsp/users/user-console.jsp +++ b/source/web/jsp/users/user-console.jsp @@ -97,12 +97,12 @@ <%-- wrapper comment used by the panel to add additional component facets --%> - <%----%> - - <%----%> + + + - @@ -138,12 +138,12 @@ - <%----%> - - <%----%> + + + -