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
This commit is contained in:
Kevin Roast
2007-11-30 12:11:29 +00:00
parent 9a48f004fd
commit 84d30e9895
9 changed files with 132 additions and 11 deletions

View File

@@ -304,7 +304,6 @@ date=Date
mimetype=Format mimetype=Format
modifier=Modifier modifier=Modifier
locale=Locale locale=Locale
quota=Quota quota=Quota
sizeCurrent=Usage sizeCurrent=Usage
sizeQuota=Quota 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_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. 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) quota_totalusage=Total Usage (for this search)
quote_totalquota=Total Quota (for this search) quota_totalquota=Total Quota (for this search)
# Content Wizard messages # Content Wizard messages
add_content_dialog_title=Add Content Dialog add_content_dialog_title=Add Content Dialog

View File

@@ -83,6 +83,9 @@ public class CreateUserWizard extends BaseWizardBean
protected NodeRef homeSpaceLocation = null; protected NodeRef homeSpaceLocation = null;
protected String presenceProvider = null; protected String presenceProvider = null;
protected String presenceUsername = 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 Long sizeQuota = null; // null is also equivalent to -1 (ie. no quota limit set)
protected String sizeQuotaUnits = null; protected String sizeQuotaUnits = null;
@@ -169,6 +172,9 @@ public class CreateUserWizard extends BaseWizardBean
this.homeSpaceLocation = getDefaultHomeSpace(); this.homeSpaceLocation = getDefaultHomeSpace();
this.presenceProvider = ""; this.presenceProvider = "";
this.presenceUsername = ""; this.presenceUsername = "";
this.organisation = "";
this.jobtitle = "";
this.location = "";
this.sizeQuota = null; this.sizeQuota = null;
this.sizeQuotaUnits = ""; this.sizeQuotaUnits = "";
@@ -179,16 +185,39 @@ public class CreateUserWizard extends BaseWizardBean
*/ */
public String getSummary() public String getSummary()
{ {
ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
String homeSpaceLabel = this.homeSpaceName; String homeSpaceLabel = this.homeSpaceName;
if (this.homeSpaceName.length() == 0 && this.homeSpaceLocation != null) if (this.homeSpaceName.length() == 0 && this.homeSpaceLocation != null)
{ {
homeSpaceLabel = Repository.getNameForNode(this.nodeService, this.homeSpaceLocation); 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[] {
return buildSummary(new String[] { bundle.getString("name"), bundle.getString("username"), bundle.getString("password"), bundle.getString("homespace") }, new String[] { bundle.getString("name"), bundle.getString("username"),
this.firstName + " " + this.lastName, this.userName, "********", homeSpaceLabel }); 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; 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() public Long getSizeQuota()
{ {
return sizeQuota; return sizeQuota;
@@ -630,6 +707,9 @@ public class CreateUserWizard extends BaseWizardBean
props.put(ContentModel.PROP_HOMEFOLDER, homeSpaceNodeRef); props.put(ContentModel.PROP_HOMEFOLDER, homeSpaceNodeRef);
props.put(ContentModel.PROP_EMAIL, this.email); props.put(ContentModel.PROP_EMAIL, this.email);
props.put(ContentModel.PROP_ORGID, this.companyId); 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_PRESENCEPROVIDER, this.presenceProvider);
props.put(ContentModel.PROP_PRESENCEUSERNAME, this.presenceUsername); props.put(ContentModel.PROP_PRESENCEUSERNAME, this.presenceUsername);

View File

@@ -118,7 +118,7 @@ public class EditUserDetailsDialog extends BaseDialogBean
return outcome; return outcome;
} }
private Node getPerson() public Node getPerson()
{ {
return person; return person;
} }

View File

@@ -71,9 +71,16 @@ public class EditUserWizard extends CreateUserWizard
this.userName = (String) props.get("userName"); this.userName = (String) props.get("userName");
this.email = (String) props.get("email"); this.email = (String) props.get("email");
this.companyId = (String) props.get("organizationId"); 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.presenceProvider = (String) props.get("presenceProvider");
this.presenceUsername = (String) props.get("presenceUsername"); this.presenceUsername = (String) props.get("presenceUsername");
this.sizeQuota = (Long) props.get("sizeQuota"); this.sizeQuota = (Long) props.get("sizeQuota");
if (this.sizeQuota != null && this.sizeQuota == -1L)
{
this.sizeQuota = null;
}
if (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_HOMEFOLDER, newHomeFolderRef);
props.put(ContentModel.PROP_EMAIL, this.email); props.put(ContentModel.PROP_EMAIL, this.email);
props.put(ContentModel.PROP_ORGID, this.companyId); 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_PRESENCEPROVIDER, this.presenceProvider);
props.put(ContentModel.PROP_PRESENCEUSERNAME, this.presenceUsername); props.put(ContentModel.PROP_PRESENCEUSERNAME, this.presenceUsername);
this.nodeService.setProperties(nodeRef, props); this.nodeService.setProperties(nodeRef, props);

View File

@@ -342,6 +342,7 @@ public class UsersDialog extends BaseDialogBean implements IContextListener
} }
node.addPropertyResolver("sizeLatest", this.resolverUserSizeLatest); node.addPropertyResolver("sizeLatest", this.resolverUserSizeLatest);
node.addPropertyResolver("quota", this.resolverUserQuota);
this.users.add(node); 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 * 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) for (Node node : this.users)
{ {
node.addPropertyResolver("sizeLatest", this.resolverUserSizeLatest); node.addPropertyResolver("sizeLatest", this.resolverUserSizeLatest);
node.addPropertyResolver("quota", this.resolverUserQuota);
} }
// return null to stay on the same page // return null to stay on the same page

View File

@@ -75,7 +75,7 @@ function updateButtonState()
<f:verbatim/> <f:verbatim/>
<h:outputText value="#{msg.user_organization}:"/> <h:outputText value="#{msg.user_organization}:"/>
<h:inputText id="organsiation" value="#{DialogManager.bean.personProperties.organization}" size="35" maxlength="1024" /> <h:inputText id="organisation" value="#{DialogManager.bean.personProperties.organization}" size="35" maxlength="1024" />
<f:verbatim/> <f:verbatim/>
<h:outputText value="#{msg.user_jobtitle}:"/> <h:outputText value="#{msg.user_jobtitle}:"/>
@@ -99,6 +99,13 @@ function updateButtonState()
</h:panelGrid> </h:panelGrid>
<h:panelGrid columns="2" cellpadding="2" cellspacing="0" width="100%" style="padding-top:8px">
<!-- custom properties for cm:person type -->
<f:verbatim/>
<r:propertySheetGrid id="person-props" value="#{DialogManager.bean.person}"
var="personProps" columns="1" externalConfig="true" />
</h:panelGrid>
<f:verbatim> <f:verbatim>
<script> <script>
updateButtonState(); updateButtonState();

View File

@@ -79,6 +79,15 @@
<h:outputText value="#{msg.company_id}:"/> <h:outputText value="#{msg.company_id}:"/>
<h:inputText value="#{WizardManager.bean.companyId}" size="35" maxlength="1024" /> <h:inputText value="#{WizardManager.bean.companyId}" size="35" maxlength="1024" />
<h:outputText value="#{msg.user_organization}:"/>
<h:inputText id="organisation" value="#{WizardManager.bean.organization}" size="35" maxlength="1024" />
<h:outputText value="#{msg.user_jobtitle}:"/>
<h:inputText id="jobtitle" value="#{WizardManager.bean.jobtitle}" size="35" maxlength="1024" />
<h:outputText value="#{msg.user_location}:"/>
<h:inputText id="location" value="#{WizardManager.bean.location}" size="35" maxlength="1024" />
<h:outputText value="#{msg.presence_provider}:"/> <h:outputText value="#{msg.presence_provider}:"/>
<h:selectOneMenu value="#{WizardManager.bean.presenceProvider}"> <h:selectOneMenu value="#{WizardManager.bean.presenceProvider}">
<f:selectItem itemValue="" itemLabel="(#{msg.none})"/> <f:selectItem itemValue="" itemLabel="(#{msg.none})"/>

View File

@@ -84,9 +84,16 @@
</h:panelGrid> </h:panelGrid>
</h:panelGrid> </h:panelGrid>
<!-- custom properties for cm:person type -->
<f:verbatim><div style="padding-bottom:12px"></f:verbatim>
<r:propertySheetGrid id="person-props" value="#{UsersBeanProperties.person}"
var="personProps" columns="1" mode="view" labelStyleClass="propertiesLabel"
externalConfig="true" />
<f:verbatim></div></f:verbatim>
<%-- context for current user is setup on entry to user console --%> <%-- context for current user is setup on entry to user console --%>
<a:actionLink id="change-password" value="#{msg.change_password}" <a:actionLink id="change-password" value="#{msg.change_password}"
action="dialog:changeMyPassword" style="padding-top:6px" action="dialog:changeMyPassword"
image="/images/icons/change_password.gif" image="/images/icons/change_password.gif"
rendered="#{NavigationBean.isGuest == false}" /> rendered="#{NavigationBean.isGuest == false}" />
</a:panel> </a:panel>

View File

@@ -204,7 +204,7 @@
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{msg.sizeQuota}" rendered="#{UsersBeanProperties.usagesEnabled == true}"/> <h:outputText value="#{msg.sizeQuota}" rendered="#{UsersBeanProperties.usagesEnabled == true}"/>
</f:facet> </f:facet>
<h:outputText value="#{r.sizeQuota}" rendered="#{UsersBeanProperties.usagesEnabled == true}"> <h:outputText value="#{r.quota}" rendered="#{UsersBeanProperties.usagesEnabled == true}">
<a:convertSize /> <a:convertSize />
</h:outputText> </h:outputText>
</a:column> </a:column>
@@ -237,7 +237,7 @@
<td><h:outputText value="#{UsersDialog.usersTotalUsage}"><a:convertSize/></h:outputText></td> <td><h:outputText value="#{UsersDialog.usersTotalUsage}"><a:convertSize/></h:outputText></td>
</tr> </tr>
<tr> <tr>
<td><h:outputText value="#{msg.quote_totalquota}:" /></td> <td><h:outputText value="#{msg.quota_totalquota}:" /></td>
<td><h:outputText value="#{UsersDialog.usersTotalQuota}"><a:convertSize/></h:outputText></td> <td><h:outputText value="#{UsersDialog.usersTotalQuota}"><a:convertSize/></h:outputText></td>
</tr> </tr>
</table> </table>