Merged V2.1-A to HEAD

8289: Added jpeg2000 mimetype
   8302: Fix for Adobe (ACT 1487)
   8306: Solution for Adobe raised ticket ACT 1384
   8310: Fix for location based breadcrumb when navigating discussions
   8432: ADB-48 - in case of multi-domain lookup, also consistent with AWC LoginBean


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9163 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-05-19 14:09:30 +00:00
parent bf1525088b
commit 7eaddae91f
6 changed files with 78 additions and 8 deletions

View File

@@ -39,12 +39,31 @@ import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
*/ */
public class AssociationGenerator extends BaseComponentGenerator 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) public UIComponent generate(FacesContext context, String id)
{ {
UIComponent component = context.getApplication(). UIComponent component = context.getApplication().
createComponent(RepoConstants.ALFRESCO_FACES_ASSOC_EDITOR); createComponent(RepoConstants.ALFRESCO_FACES_ASSOC_EDITOR);
FacesHelper.setupComponentId(context, component, id); 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; return component;
} }

View File

@@ -39,12 +39,31 @@ import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
*/ */
public class ChildAssociationGenerator extends BaseComponentGenerator 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) public UIComponent generate(FacesContext context, String id)
{ {
UIComponent component = context.getApplication(). UIComponent component = context.getApplication().
createComponent(RepoConstants.ALFRESCO_FACES_CHILD_ASSOC_EDITOR); createComponent(RepoConstants.ALFRESCO_FACES_CHILD_ASSOC_EDITOR);
FacesHelper.setupComponentId(context, component, id); 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; return component;
} }

View File

@@ -47,6 +47,7 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.tenant.TenantService; import org.alfresco.repo.tenant.TenantService;
import org.alfresco.repo.transaction.RetryingTransactionHelper; import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.service.ServiceRegistry; 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.LockService;
import org.alfresco.service.cmr.lock.LockStatus; import org.alfresco.service.cmr.lock.LockStatus;
import org.alfresco.service.cmr.repository.ChildAssociationRef; 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.service.transaction.TransactionService;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.bean.NavigationBean; 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.Utils;
import org.alfresco.web.ui.common.component.IBreadcrumbHandler; import org.alfresco.web.ui.common.component.IBreadcrumbHandler;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@@ -437,6 +437,7 @@ public final class Repository
// get required services // get required services
NodeService nodeService = Repository.getServiceRegistry(context).getNodeService(); NodeService nodeService = Repository.getServiceRegistry(context).getNodeService();
DictionaryService dictionaryService = Repository.getServiceRegistry(context).getDictionaryService();
PermissionService permsService = Repository.getServiceRegistry(context).getPermissionService(); PermissionService permsService = Repository.getServiceRegistry(context).getPermissionService();
// add the given node to start // add the given node to start
@@ -455,10 +456,15 @@ public final class Repository
if (grandParent != null) if (grandParent != null)
{ {
// current node is not the root node so add it to the breadcrumb // 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); String parentName = Repository.getNameForNode(nodeService, parent);
location.add(0, navBean.new NavigationBreadcrumbHandler(parent, parentName)); location.add(0, navBean.new NavigationBreadcrumbHandler(parent, parentName));
} }
}
parent = grandParent; parent = grandParent;
} }

View File

@@ -290,4 +290,30 @@ public final class User implements Serializable
return fullName; 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();
}
} }

View File

@@ -718,7 +718,7 @@ public abstract class BaseAssociationEditor extends UIInput
if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetRef))) 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))) 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 (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); String userName = (String)nodeService.getProperty(item, ContentModel.PROP_USERNAME);
if (userName != null && (userName.equals(PermissionService.GUEST_AUTHORITY) == false)) if (userName != null && (userName.equals(PermissionService.GUEST_AUTHORITY) == false))
{ {
out.write("<option value='"); out.write("<option value='");
out.write(item.toString()); out.write(item.toString());
out.write("'>"); out.write("'>");
out.write(Utils.encode(User.getFullName(nodeService, item))); out.write(Utils.encode(User.getFullNameAndUserId(nodeService, item)));
out.write("</option>"); out.write("</option>");
} }
} }

View File

@@ -171,7 +171,7 @@ public class UIAssociationEditor extends BaseAssociationEditor
if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetNode))) if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetNode)))
{ {
// if the node represents a person, show the username instead of the name // 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))) else if (ContentModel.TYPE_AUTHORITY_CONTAINER.equals(nodeService.getType(targetNode)))
{ {