From 84d30e9895ef9a3bd7dd59d2331d78c9baed28eb Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Fri, 30 Nov 2007 12:11:29 +0000 Subject: [PATCH] Custom property (UIPropertySheet) support added to User Profile/Edit User Profile screens, New/Edit User summary screen improvements git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7486 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/messages/webclient.properties | 3 +- .../web/bean/users/CreateUserWizard.java | 88 ++++++++++++++++++- .../web/bean/users/EditUserDetailsDialog.java | 2 +- .../web/bean/users/EditUserWizard.java | 10 +++ .../alfresco/web/bean/users/UsersDialog.java | 9 ++ source/web/jsp/users/edit-user-details.jsp | 9 +- source/web/jsp/users/person-properties.jsp | 9 ++ source/web/jsp/users/user-console.jsp | 9 +- source/web/jsp/users/users.jsp | 4 +- 9 files changed, 132 insertions(+), 11 deletions(-) diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 376901d561..41ae00acf3 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -304,7 +304,6 @@ date=Date mimetype=Format modifier=Modifier locale=Locale - quota=Quota sizeCurrent=Usage sizeQuota=Quota @@ -731,7 +730,7 @@ show_details=Show Details user_search_info=To find a user search for them using their first name, last name and/or user name. Alternatively to see all users click 'Show All', however, this may take some time if there are a lot of users in the system. user_change_homespace_info=Selecting a new home space for a user will not remove the existing permissions on the original home space. You may wish to use the Manage Space Users dialog to modify permissions if they are no longer required on the original home space. quota_totalusage=Total Usage (for this search) -quote_totalquota=Total Quota (for this search) +quota_totalquota=Total Quota (for this search) # Content Wizard messages add_content_dialog_title=Add Content Dialog diff --git a/source/java/org/alfresco/web/bean/users/CreateUserWizard.java b/source/java/org/alfresco/web/bean/users/CreateUserWizard.java index 2e96c58cf7..0223c4cf31 100644 --- a/source/java/org/alfresco/web/bean/users/CreateUserWizard.java +++ b/source/java/org/alfresco/web/bean/users/CreateUserWizard.java @@ -83,6 +83,9 @@ public class CreateUserWizard extends BaseWizardBean protected NodeRef homeSpaceLocation = null; protected String presenceProvider = null; protected String presenceUsername = null; + protected String organisation = null; + protected String jobtitle = null; + protected String location = null; protected Long sizeQuota = null; // null is also equivalent to -1 (ie. no quota limit set) protected String sizeQuotaUnits = null; @@ -169,6 +172,9 @@ public class CreateUserWizard extends BaseWizardBean this.homeSpaceLocation = getDefaultHomeSpace(); this.presenceProvider = ""; this.presenceUsername = ""; + this.organisation = ""; + this.jobtitle = ""; + this.location = ""; this.sizeQuota = null; this.sizeQuotaUnits = ""; @@ -179,16 +185,39 @@ public class CreateUserWizard extends BaseWizardBean */ public String getSummary() { + ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); + String homeSpaceLabel = this.homeSpaceName; if (this.homeSpaceName.length() == 0 && this.homeSpaceLocation != null) { homeSpaceLabel = Repository.getNameForNode(this.nodeService, this.homeSpaceLocation); } + + String quotaLabel = ""; + if (this.sizeQuota != null && this.sizeQuota != -1L) + { + quotaLabel = Long.toString(this.sizeQuota) + bundle.getString(this.sizeQuotaUnits); + } + + String presenceLabel = ""; + if (this.presenceProvider != null && this.presenceProvider.length() != 0) + { + presenceLabel = this.presenceUsername + " (" + presenceProvider + ")"; + } - ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance()); - - return buildSummary(new String[] { bundle.getString("name"), bundle.getString("username"), bundle.getString("password"), bundle.getString("homespace") }, new String[] { - this.firstName + " " + this.lastName, this.userName, "********", homeSpaceLabel }); + return buildSummary( + new String[] { + bundle.getString("name"), bundle.getString("username"), + bundle.getString("password"), bundle.getString("homespace"), + bundle.getString("email"), bundle.getString("user_organization"), + bundle.getString("user_jobtitle"), bundle.getString("user_location"), + bundle.getString("presence_username"), bundle.getString("quota")}, + new String[] { + this.firstName + " " + this.lastName, this.userName, + "********", homeSpaceLabel, + this.email, this.organisation, + this.jobtitle, this.location, + presenceLabel, quotaLabel}); } /** @@ -377,6 +406,54 @@ public class CreateUserWizard extends BaseWizardBean this.confirm = confirm; } + /** + * @return the jobtitle + */ + public String getJobtitle() + { + return this.jobtitle; + } + + /** + * @param jobtitle the jobtitle to set + */ + public void setJobtitle(String jobtitle) + { + this.jobtitle = jobtitle; + } + + /** + * @return the location + */ + public String getLocation() + { + return this.location; + } + + /** + * @param location the location to set + */ + public void setLocation(String location) + { + this.location = location; + } + + /** + * @return the organisation + */ + public String getOrganization() + { + return this.organisation; + } + + /** + * @param organisation the organisation to set + */ + public void setOrganization(String organisation) + { + this.organisation = organisation; + } + public Long getSizeQuota() { return sizeQuota; @@ -630,6 +707,9 @@ public class CreateUserWizard extends BaseWizardBean props.put(ContentModel.PROP_HOMEFOLDER, homeSpaceNodeRef); props.put(ContentModel.PROP_EMAIL, this.email); props.put(ContentModel.PROP_ORGID, this.companyId); + props.put(ContentModel.PROP_ORGANIZATION, this.organisation); + props.put(ContentModel.PROP_JOBTITLE, this.jobtitle); + props.put(ContentModel.PROP_LOCATION, this.location); props.put(ContentModel.PROP_PRESENCEPROVIDER, this.presenceProvider); props.put(ContentModel.PROP_PRESENCEUSERNAME, this.presenceUsername); diff --git a/source/java/org/alfresco/web/bean/users/EditUserDetailsDialog.java b/source/java/org/alfresco/web/bean/users/EditUserDetailsDialog.java index 8294d7e915..f3515d0dfd 100644 --- a/source/java/org/alfresco/web/bean/users/EditUserDetailsDialog.java +++ b/source/java/org/alfresco/web/bean/users/EditUserDetailsDialog.java @@ -118,7 +118,7 @@ public class EditUserDetailsDialog extends BaseDialogBean return outcome; } - private Node getPerson() + public Node getPerson() { return person; } diff --git a/source/java/org/alfresco/web/bean/users/EditUserWizard.java b/source/java/org/alfresco/web/bean/users/EditUserWizard.java index 04991c3ef9..d2d6f72b81 100644 --- a/source/java/org/alfresco/web/bean/users/EditUserWizard.java +++ b/source/java/org/alfresco/web/bean/users/EditUserWizard.java @@ -71,9 +71,16 @@ public class EditUserWizard extends CreateUserWizard this.userName = (String) props.get("userName"); this.email = (String) props.get("email"); this.companyId = (String) props.get("organizationId"); + this.organisation = (String) props.get("organization"); + this.jobtitle = (String) props.get("jobtitle"); + this.location = (String) props.get("location"); this.presenceProvider = (String) props.get("presenceProvider"); this.presenceUsername = (String) props.get("presenceUsername"); this.sizeQuota = (Long) props.get("sizeQuota"); + if (this.sizeQuota != null && this.sizeQuota == -1L) + { + this.sizeQuota = null; + } if (this.sizeQuota != null) { @@ -188,6 +195,9 @@ public class EditUserWizard extends CreateUserWizard props.put(ContentModel.PROP_HOMEFOLDER, newHomeFolderRef); props.put(ContentModel.PROP_EMAIL, this.email); props.put(ContentModel.PROP_ORGID, this.companyId); + props.put(ContentModel.PROP_ORGANIZATION, this.organisation); + props.put(ContentModel.PROP_JOBTITLE, this.jobtitle); + props.put(ContentModel.PROP_LOCATION, this.location); props.put(ContentModel.PROP_PRESENCEPROVIDER, this.presenceProvider); props.put(ContentModel.PROP_PRESENCEUSERNAME, this.presenceUsername); this.nodeService.setProperties(nodeRef, props); diff --git a/source/java/org/alfresco/web/bean/users/UsersDialog.java b/source/java/org/alfresco/web/bean/users/UsersDialog.java index 84cbc34744..885ba1523d 100644 --- a/source/java/org/alfresco/web/bean/users/UsersDialog.java +++ b/source/java/org/alfresco/web/bean/users/UsersDialog.java @@ -342,6 +342,7 @@ public class UsersDialog extends BaseDialogBean implements IContextListener } node.addPropertyResolver("sizeLatest", this.resolverUserSizeLatest); + node.addPropertyResolver("quota", this.resolverUserQuota); this.users.add(node); } @@ -375,6 +376,13 @@ public class UsersDialog extends BaseDialogBean implements IContextListener } }; + public NodePropertyResolver resolverUserQuota = new NodePropertyResolver() { + public Object get(Node personNode) { + Long quota = (Long)personNode.getProperties().get("sizeQuota"); + return (quota != null && quota != -1L) ? quota : null; + } + }; + /** * Action handler to show all the users currently in the system * @@ -390,6 +398,7 @@ public class UsersDialog extends BaseDialogBean implements IContextListener for (Node node : this.users) { node.addPropertyResolver("sizeLatest", this.resolverUserSizeLatest); + node.addPropertyResolver("quota", this.resolverUserQuota); } // return null to stay on the same page diff --git a/source/web/jsp/users/edit-user-details.jsp b/source/web/jsp/users/edit-user-details.jsp index bbf38c8992..c919c0eb20 100644 --- a/source/web/jsp/users/edit-user-details.jsp +++ b/source/web/jsp/users/edit-user-details.jsp @@ -75,7 +75,7 @@ function updateButtonState() - + @@ -99,6 +99,13 @@ function updateButtonState() + + + + + +