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

@@ -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;

View File

@@ -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();
}
}