diff --git a/config/alfresco/extension/web-client-config-custom.xml.unicode.sample b/config/alfresco/extension/web-client-config-custom.xml.unicode.sample index 8aa340cb4a..62cb6cdfa0 100644 Binary files a/config/alfresco/extension/web-client-config-custom.xml.unicode.sample and b/config/alfresco/extension/web-client-config-custom.xml.unicode.sample differ diff --git a/source/java/org/alfresco/web/app/AlfrescoNavigationHandler.java b/source/java/org/alfresco/web/app/AlfrescoNavigationHandler.java index 56c7edf23d..7fc1831caf 100644 --- a/source/java/org/alfresco/web/app/AlfrescoNavigationHandler.java +++ b/source/java/org/alfresco/web/app/AlfrescoNavigationHandler.java @@ -33,6 +33,7 @@ import javax.faces.context.FacesContext; import org.alfresco.config.Config; import org.alfresco.config.ConfigService; +import org.alfresco.service.cmr.repository.InvalidNodeRefException; import org.alfresco.web.app.servlet.FacesHelper; import org.alfresco.web.bean.NavigationBean; import org.alfresco.web.bean.dialog.DialogManager; @@ -536,9 +537,17 @@ public class AlfrescoNavigationHandler extends NavigationHandler // see if there is any navigation config for the node type ConfigService configSvc = Application.getConfigService(context); + NavigationConfigElement navigationCfg = null; + try + { Config nodeConfig = configSvc.getConfig(dispatchNode); - NavigationConfigElement navigationCfg = (NavigationConfigElement)nodeConfig. + navigationCfg = (NavigationConfigElement)nodeConfig. getConfigElement(NavigationElementReader.ELEMENT_NAVIGATION); + } + catch (InvalidNodeRefException e) + { + if (logger.isDebugEnabled()) logger.debug("Invalid node reference: " + dispatchNode); + } if (navigationCfg != null) { diff --git a/source/java/org/alfresco/web/bean/content/DocumentDetailsDialog.java b/source/java/org/alfresco/web/bean/content/DocumentDetailsDialog.java index 6540c7c9dd..8eac764bfb 100644 --- a/source/java/org/alfresco/web/bean/content/DocumentDetailsDialog.java +++ b/source/java/org/alfresco/web/bean/content/DocumentDetailsDialog.java @@ -33,6 +33,7 @@ import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Stack; import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; @@ -97,6 +98,8 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio private static final String ML_VERSION_PANEL_ID = "ml-versions-panel"; + private final static String DOC_DETAILS_STACK = "_alfDocDetailsStack"; + transient protected LockService lockService; transient protected VersionService versionService; transient protected CheckOutCheckInService cociService; @@ -140,6 +143,53 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio this.workflowProperties = null; } + @Override + @SuppressWarnings("unchecked") + public void init(Map parameters) + { + super.init(parameters); + //Remember active node. + Stack stack = getRecentNodeRefsStack(); + stack.push(getNode().getNodeRef().getId()); + } + + @Override + @SuppressWarnings("unchecked") + public void restored() + { + super.restored(); + Stack stack = getRecentNodeRefsStack(); + if (stack.isEmpty() == false) + { + browseBean.setupContentAction((String) stack.peek(), true); + } + } + + @Override + @SuppressWarnings("unchecked") + public String cancel() + { + Stack stack = getRecentNodeRefsStack(); + if (stack.isEmpty() == false) + { + stack.pop(); + } + return super.cancel(); + } + + @SuppressWarnings("unchecked") + private Stack getRecentNodeRefsStack() + { + FacesContext fc = FacesContext.getCurrentInstance(); + Stack stack = (Stack) fc.getExternalContext().getSessionMap().get(DOC_DETAILS_STACK); + if (stack == null) + { + stack = new Stack(); + fc.getExternalContext().getSessionMap().put(DOC_DETAILS_STACK, stack); + } + return stack; + } + /** * Returns the URL to download content for the current document * @@ -692,6 +742,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio } // prepare for showing details for this node + getRecentNodeRefsStack().clear(); this.browseBean.setupContentAction(next.getId(), false); break; } @@ -731,6 +782,7 @@ public class DocumentDetailsDialog extends BaseDetailsBean implements Navigatio } // prepare for showing details for this node + getRecentNodeRefsStack().clear(); this.browseBean.setupContentAction(previous.getId(), false); break; } diff --git a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java index 5ea257a0d7..9e1a2d51f6 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java @@ -1060,9 +1060,9 @@ public class AVMBrowseBean implements IContextListener public boolean getIsManagerRole() { Node wpNode = getWebsite(); - if (wpNode != null) + if (wpNode != null && nodeService.exists(wpNode.getNodeRef())) { - return getWebProjectService().isContentManager(wpNode.getNodeRef()); + return getWebProjectService().isContentManager(wpNode.getNodeRef()); } return false; } @@ -1070,7 +1070,7 @@ public class AVMBrowseBean implements IContextListener public boolean getIsManagerOrPublisherRole() { Node wpNode = getWebsite(); - if (wpNode != null) + if (wpNode != null && nodeService.exists(wpNode.getNodeRef())) { User user = Application.getCurrentUser(FacesContext.getCurrentInstance()); String userRole = getWebProjectService().getWebUserRole(wpNode.getNodeRef(), user.getUserName()); @@ -1095,7 +1095,6 @@ public class AVMBrowseBean implements IContextListener this.showAllSandboxes = value; } - /** * @return true if the website has had a deployment attempt */ @@ -1112,14 +1111,21 @@ public class AVMBrowseBean implements IContextListener Map request = context.getExternalContext().getRequestMap(); if (request.get(REQUEST_BEEN_DEPLOYED_RESULT) == null) { - // see if there are any deployment attempts for the staging area - NodeRef webProjectRef = this.getWebsite().getNodeRef(); - String store = (String)getNodeService().getProperty(webProjectRef, + if (!nodeService.exists(this.getWebsite().getNodeRef())) + { + result = false; + } + else + { + // see if there are any deployment attempts for the staging area + NodeRef webProjectRef = this.getWebsite().getNodeRef(); + String store = (String)getNodeService().getProperty(webProjectRef, WCMAppModel.PROP_AVMSTORE); - List deployAttempts = DeploymentUtil.findDeploymentAttempts(store); - - // add a placeholder object in the request so we don't evaluate this again for this request - result = new Boolean(deployAttempts != null && deployAttempts.size() > 0); + List deployAttempts = DeploymentUtil.findDeploymentAttempts(store); + + // add a placeholder object in the request so we don't evaluate this again for this request + result = new Boolean(deployAttempts != null && deployAttempts.size() > 0); + } request.put(REQUEST_BEEN_DEPLOYED_RESULT, result); } else 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 179bff21cc..e4208d064f 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 @@ -317,7 +317,7 @@ public abstract class BaseAssociationEditor extends UIInput String targetType = assocDef.getTargetClass().getName().toString(); boolean allowMany = assocDef.isTargetMany(); - populateAssocationMaps((Node)getValue()); + populateAssocationMaps((Node)getValue(), nodeService); if (isDisabled()) { @@ -655,8 +655,9 @@ public abstract class BaseAssociationEditor extends UIInput * Populates all the internal Maps with the appropriate association reference objects * * @param node The Node we are dealing with + * @param nodeService The NodeService */ - protected abstract void populateAssocationMaps(Node node); + protected abstract void populateAssocationMaps(Node node, NodeService nodeService); /** * Renders the existing associations in a read-only form 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 e338759cf7..3d921e65ed 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 @@ -73,10 +73,10 @@ public class UIAssociationEditor extends BaseAssociationEditor } /** - * @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#populateAssocationMaps(org.alfresco.web.bean.repository.Node) + * @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#populateAssocationMaps(org.alfresco.web.bean.repository.Node, org.alfresco.service.cmr.repository.NodeService) */ @SuppressWarnings("unchecked") - protected void populateAssocationMaps(Node node) + protected void populateAssocationMaps(Node node, NodeService nodeService) { // we need to remember the original set of associations (if there are any) // and place them in a map keyed by the noderef of the child node @@ -92,8 +92,11 @@ public class UIAssociationEditor extends BaseAssociationEditor { AssociationRef assoc = (AssociationRef)iter.next(); - // add the association to the map - this.originalAssocs.put(assoc.getTargetRef().toString(), assoc); + if (nodeService.exists(assoc.getTargetRef())) + { + // add the association to the map + this.originalAssocs.put(assoc.getTargetRef().toString(), assoc); + } } } } diff --git a/source/java/org/alfresco/web/ui/repo/component/property/UIChildAssociationEditor.java b/source/java/org/alfresco/web/ui/repo/component/property/UIChildAssociationEditor.java index 1ca20b3d54..00867ab397 100644 --- a/source/java/org/alfresco/web/ui/repo/component/property/UIChildAssociationEditor.java +++ b/source/java/org/alfresco/web/ui/repo/component/property/UIChildAssociationEditor.java @@ -70,10 +70,10 @@ public class UIChildAssociationEditor extends BaseAssociationEditor } /** - * @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#populateAssocationMaps(org.alfresco.web.bean.repository.Node) + * @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#populateAssocationMaps(org.alfresco.web.bean.repository.Node, org.alfresco.service.cmr.repository.NodeService) */ @SuppressWarnings("unchecked") - protected void populateAssocationMaps(Node node) + protected void populateAssocationMaps(Node node, NodeService nodeService) { // we need to remember the original set of associations (if there are any) // and place them in a map keyed by the noderef of the child node