diff --git a/source/java/org/alfresco/web/bean/generator/AssociationGenerator.java b/source/java/org/alfresco/web/bean/generator/AssociationGenerator.java index 572a44198b..c6bc075d84 100644 --- a/source/java/org/alfresco/web/bean/generator/AssociationGenerator.java +++ b/source/java/org/alfresco/web/bean/generator/AssociationGenerator.java @@ -39,12 +39,31 @@ import org.alfresco.web.ui.repo.component.property.UIPropertySheet; */ public class AssociationGenerator extends BaseComponentGenerator { + protected String optionsSize = null; + + public String getAvailableOptionsSize() + { + return this.optionsSize; + } + + public void setAvailableOptionsSize(String optionsSize) + { + this.optionsSize = optionsSize; + } + + @SuppressWarnings("unchecked") public UIComponent generate(FacesContext context, String id) { UIComponent component = context.getApplication(). createComponent(RepoConstants.ALFRESCO_FACES_ASSOC_EDITOR); FacesHelper.setupComponentId(context, component, id); + // set the size of the list (if provided) + if (this.optionsSize != null) + { + component.getAttributes().put("availableOptionsSize", this.optionsSize); + } + return component; } diff --git a/source/java/org/alfresco/web/bean/generator/ChildAssociationGenerator.java b/source/java/org/alfresco/web/bean/generator/ChildAssociationGenerator.java index 83fb88255b..dc4200f87f 100644 --- a/source/java/org/alfresco/web/bean/generator/ChildAssociationGenerator.java +++ b/source/java/org/alfresco/web/bean/generator/ChildAssociationGenerator.java @@ -39,12 +39,31 @@ import org.alfresco.web.ui.repo.component.property.UIPropertySheet; */ public class ChildAssociationGenerator extends BaseComponentGenerator { + protected String optionsSize = null; + + public String getAvailableOptionsSize() + { + return this.optionsSize; + } + + public void setAvailableOptionsSize(String optionsSize) + { + this.optionsSize = optionsSize; + } + + @SuppressWarnings("unchecked") public UIComponent generate(FacesContext context, String id) { UIComponent component = context.getApplication(). createComponent(RepoConstants.ALFRESCO_FACES_CHILD_ASSOC_EDITOR); FacesHelper.setupComponentId(context, component, id); + // set the size of the list (if provided) + if (this.optionsSize != null) + { + component.getAttributes().put("availableOptionsSize", this.optionsSize); + } + return component; } diff --git a/source/java/org/alfresco/web/bean/repository/Repository.java b/source/java/org/alfresco/web/bean/repository/Repository.java index e67c882393..c98235516e 100644 --- a/source/java/org/alfresco/web/bean/repository/Repository.java +++ b/source/java/org/alfresco/web/bean/repository/Repository.java @@ -47,6 +47,7 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.repo.tenant.TenantService; import org.alfresco.repo.transaction.RetryingTransactionHelper; import org.alfresco.service.ServiceRegistry; +import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.lock.LockService; import org.alfresco.service.cmr.lock.LockStatus; import org.alfresco.service.cmr.repository.ChildAssociationRef; @@ -66,7 +67,6 @@ import org.alfresco.service.namespace.QName; import org.alfresco.service.transaction.TransactionService; import org.alfresco.web.app.Application; import org.alfresco.web.bean.NavigationBean; -import org.alfresco.web.bean.NavigationBean.NavigationBreadcrumbHandler; import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.component.IBreadcrumbHandler; import org.apache.commons.logging.Log; @@ -437,6 +437,7 @@ public final class Repository // get required services NodeService nodeService = Repository.getServiceRegistry(context).getNodeService(); + DictionaryService dictionaryService = Repository.getServiceRegistry(context).getDictionaryService(); PermissionService permsService = Repository.getServiceRegistry(context).getPermissionService(); // add the given node to start @@ -455,9 +456,14 @@ public final class Repository if (grandParent != null) { - // current node is not the root node so add it to the breadcrumb - String parentName = Repository.getNameForNode(nodeService, parent); - location.add(0, navBean.new NavigationBreadcrumbHandler(parent, parentName)); + // check that the node is actually a folder type, content can have children! + QName parentType = nodeService.getType(parent); + if (dictionaryService.isSubClass(parentType, ContentModel.TYPE_FOLDER)) + { + // if it's a folder add the location to the breadcrumb + String parentName = Repository.getNameForNode(nodeService, parent); + location.add(0, navBean.new NavigationBreadcrumbHandler(parent, parentName)); + } } parent = grandParent; diff --git a/source/java/org/alfresco/web/bean/repository/User.java b/source/java/org/alfresco/web/bean/repository/User.java index 85650519b8..cc52c35247 100644 --- a/source/java/org/alfresco/web/bean/repository/User.java +++ b/source/java/org/alfresco/web/bean/repository/User.java @@ -290,4 +290,30 @@ public final class User implements Serializable return fullName; } + + /** + * Returns the full name of the user plus their userid in the form [id] + * + * @param nodeService The node service instance + * @param user The user to get the full name for + * @return The full name and userid + */ + public static String getFullNameAndUserId(NodeService nodeService, NodeRef user) + { + String fullName = getFullName(nodeService, user); + String userId = (String)nodeService.getProperties(user).get(ContentModel.PROP_USERNAME); + + StringBuilder nameAndId = new StringBuilder(); + if (fullName != null && fullName.length() > 0 && fullName.equals("null") == false) + { + nameAndId.append(fullName); + nameAndId.append(" "); + } + + nameAndId.append("["); + nameAndId.append(userId); + nameAndId.append("]"); + + return nameAndId.toString(); + } } diff --git a/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java b/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java index df9a7a4fbf..4f9ce4ccbd 100644 --- a/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java +++ b/source/java/org/alfresco/web/ui/repo/component/property/BaseAssociationEditor.java @@ -718,7 +718,7 @@ public abstract class BaseAssociationEditor extends UIInput if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetRef))) { - out.write(Utils.encode(User.getFullName(nodeService, targetRef))); + out.write(Utils.encode(User.getFullNameAndUserId(nodeService, targetRef))); } else if (ContentModel.TYPE_AUTHORITY_CONTAINER.equals(nodeService.getType(targetRef))) { @@ -843,14 +843,14 @@ public abstract class BaseAssociationEditor extends UIInput { if (ContentModel.TYPE_PERSON.equals(nodeService.getType(item))) { - // if the node represents a person, show the username instead of the name + // if the node represents a person, show the full name and userid instead of the name String userName = (String)nodeService.getProperty(item, ContentModel.PROP_USERNAME); if (userName != null && (userName.equals(PermissionService.GUEST_AUTHORITY) == false)) { out.write(""); } } diff --git a/source/java/org/alfresco/web/ui/repo/component/property/UIAssociationEditor.java b/source/java/org/alfresco/web/ui/repo/component/property/UIAssociationEditor.java index da382e09b2..e1029f5240 100644 --- a/source/java/org/alfresco/web/ui/repo/component/property/UIAssociationEditor.java +++ b/source/java/org/alfresco/web/ui/repo/component/property/UIAssociationEditor.java @@ -171,7 +171,7 @@ public class UIAssociationEditor extends BaseAssociationEditor if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetNode))) { // if the node represents a person, show the username instead of the name - out.write(Utils.encode(User.getFullName(nodeService, targetNode))); + out.write(Utils.encode(User.getFullNameAndUserId(nodeService, targetNode))); } else if (ContentModel.TYPE_AUTHORITY_CONTAINER.equals(nodeService.getType(targetNode))) {