diff --git a/source/java/org/alfresco/web/app/servlet/ExternalAccessServlet.java b/source/java/org/alfresco/web/app/servlet/ExternalAccessServlet.java index 8b9e15aa72..f297ee26a4 100644 --- a/source/java/org/alfresco/web/app/servlet/ExternalAccessServlet.java +++ b/source/java/org/alfresco/web/app/servlet/ExternalAccessServlet.java @@ -42,6 +42,7 @@ import org.alfresco.web.bean.NavigationBean; import org.alfresco.web.bean.dashboard.DashboardManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.myfaces.shared_impl.renderkit.ViewSequenceUtils; /** * Servlet allowing external URL access to various global JSF views in the Web Client. @@ -171,11 +172,6 @@ public class ExternalAccessServlet extends BaseServlet // perform the appropriate JSF navigation outcome NavigationHandler navigationHandler = fc.getApplication().getNavigationHandler(); navigationHandler.handleNavigation(fc, null, "dialog:" + OUTCOME_DOCDETAILS); - - // Do not forward via faces context when AlfrescoNavigationHandler has already called render response phase - String viewId = fc.getViewRoot().getViewId(); - getServletContext().getRequestDispatcher(viewId).forward(req, res); - return; } else if (OUTCOME_SPACEDETAILS.equals(outcome)) { @@ -209,11 +205,6 @@ public class ExternalAccessServlet extends BaseServlet // perform the appropriate JSF navigation outcome NavigationHandler navigationHandler = fc.getApplication().getNavigationHandler(); navigationHandler.handleNavigation(fc, null, "dialog:" + OUTCOME_SPACEDETAILS); - - // Do not forward via faces context when AlfrescoNavigationHandler has already called render response phase - String viewId = fc.getViewRoot().getViewId(); - getServletContext().getRequestDispatcher(viewId).forward(req, res); - return; } else if (OUTCOME_BROWSE.equals(outcome)) { @@ -343,6 +334,7 @@ public class ExternalAccessServlet extends BaseServlet // perform the forward to the page processed by the Faces servlet String viewId = fc.getViewRoot().getViewId(); + ViewSequenceUtils.nextViewSequence(fc); getServletContext().getRequestDispatcher(FACES_SERVLET + viewId).forward(req, res); } diff --git a/source/java/org/alfresco/web/bean/categories/EditCategoryDialog.java b/source/java/org/alfresco/web/bean/categories/EditCategoryDialog.java index fe1626c1fc..3002ba1c2c 100644 --- a/source/java/org/alfresco/web/bean/categories/EditCategoryDialog.java +++ b/source/java/org/alfresco/web/bean/categories/EditCategoryDialog.java @@ -253,6 +253,17 @@ public class EditCategoryDialog extends BaseDialogBean NodeRef nodeRef = getActionCategory().getNodeRef(); getNodeService().setProperty(nodeRef, ContentModel.PROP_NAME, getName()); + // ALF-1788 Need to rename the association + ChildAssociationRef assocRef = getNodeService().getPrimaryParent(nodeRef); + QName qname = QName.createQName( + assocRef.getQName().getNamespaceURI(), + QName.createValidLocalName(name)); + getNodeService().moveNode( + assocRef.getChildRef(), + assocRef.getParentRef(), + assocRef.getTypeQName(), + qname); + // apply the titled aspect - for description if (getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_TITLED) == false) { diff --git a/source/java/org/alfresco/web/bean/groups/GroupsDialog.java b/source/java/org/alfresco/web/bean/groups/GroupsDialog.java index c9120af3d6..c45a06fe2e 100644 --- a/source/java/org/alfresco/web/bean/groups/GroupsDialog.java +++ b/source/java/org/alfresco/web/bean/groups/GroupsDialog.java @@ -490,7 +490,7 @@ public class GroupsDialog extends BaseDialogBean final String userName = this.getAuthorityService().getShortName(authority); authMap.put("userName", userName); - authMap.put("id", authority); + authMap.put("id", Utils.encode(authority)); authMap.put("name", new AuthorityNamePropertyResolver(userName)); authMap.put("firstName", new AuthorityPropertyResolver(userName, ContentModel.PROP_FIRSTNAME)); authMap.put("lastName", new AuthorityPropertyResolver(userName, ContentModel.PROP_LASTNAME)); diff --git a/source/java/org/alfresco/web/bean/search/AdvancedSearchDialog.java b/source/java/org/alfresco/web/bean/search/AdvancedSearchDialog.java index be5385b387..da5cf6e891 100644 --- a/source/java/org/alfresco/web/bean/search/AdvancedSearchDialog.java +++ b/source/java/org/alfresco/web/bean/search/AdvancedSearchDialog.java @@ -421,33 +421,30 @@ public class AdvancedSearchDialog extends BaseDialogBean search.addFixedValueQuery(QName.createQName(qname), value.toString()); } } - else if (DataTypeDefinition.INT.equals(typeName) || DataTypeDefinition.LONG.equals(typeName) || - DataTypeDefinition.FLOAT.equals(typeName) || DataTypeDefinition.DOUBLE.equals(typeName)) - { - String strVal = value.toString(); - if (strVal != null && strVal.length() != 0) - { - search.addFixedValueQuery(QName.createQName(qname), strVal); - } - } else if (value != null) { + // is the value from a list? + String strVal = value.toString(); Object item = properties.getCustomProperties().get( UISearchCustomProperties.PREFIX_LOV_ITEM + qname); if (item != null) { - // ListOfValues + // ListOfValues custom property - use a fixed value query if set if (((Boolean)value) == true) { search.addFixedValueQuery(QName.createQName(qname), item.toString()); } } - else + else if (strVal != null && strVal.length() != 0) { - // by default use toString() value - this is for text fields and unknown types - String strVal = value.toString(); - if (strVal != null && strVal.length() != 0) + if (DataTypeDefinition.INT.equals(typeName) || DataTypeDefinition.LONG.equals(typeName) || + DataTypeDefinition.FLOAT.equals(typeName) || DataTypeDefinition.DOUBLE.equals(typeName)) { + search.addFixedValueQuery(QName.createQName(qname), strVal); + } + else + { + // by default use toString() value - this is for text fields and unknown types search.addAttributeQuery(QName.createQName(qname), strVal); } } diff --git a/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java b/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java index 073d031bf1..b0c369bf3b 100644 --- a/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java +++ b/source/java/org/alfresco/web/bean/workflow/ManageTaskDialog.java @@ -233,8 +233,11 @@ public class ManageTaskDialog extends BaseDialogBean .equals(trans.id)) || (hiddenTransitions instanceof List) && !((List) hiddenTransitions).contains(trans.id)) { - buttons.add(new DialogButtonConfig(ID_PREFIX + trans.title, trans.title, null, + if (this.taskNode.getProperties().get(ContentModel.PROP_OWNER) != null) + { + buttons.add(new DialogButtonConfig(ID_PREFIX + trans.title, trans.title, null, "#{DialogManager.bean.transition}", "false", null)); + } } } } diff --git a/source/java/org/alfresco/web/config/WebClientConfigBootstrap.java b/source/java/org/alfresco/web/config/WebClientConfigBootstrap.java index c88266068f..b8065765f9 100644 --- a/source/java/org/alfresco/web/config/WebClientConfigBootstrap.java +++ b/source/java/org/alfresco/web/config/WebClientConfigBootstrap.java @@ -14,6 +14,7 @@ * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License + * FLOSS exception. You should have recieved a copy of the text describing * along with Alfresco. If not, see . */ package org.alfresco.web.config; @@ -26,6 +27,7 @@ import org.springframework.extensions.config.ConfigService; import org.springframework.extensions.config.source.UrlConfigSource; import org.alfresco.error.AlfrescoRuntimeException; import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanNameAware; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; @@ -35,8 +37,12 @@ import org.springframework.context.ApplicationContextAware; * * @author Roy Wetherall */ -public class WebClientConfigBootstrap implements ApplicationContextAware, ConfigDeployer +public class WebClientConfigBootstrap implements ApplicationContextAware, BeanNameAware, ConfigDeployer { + + /** The bean name. */ + private String beanName; + /** The application context */ private ApplicationContext applicationContext; @@ -76,6 +82,15 @@ public class WebClientConfigBootstrap implements ApplicationContextAware, Config } } + + /* (non-Javadoc) + * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String) + */ + public void setBeanName(String name) + { + this.beanName = name; + } + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; @@ -86,6 +101,14 @@ public class WebClientConfigBootstrap implements ApplicationContextAware, Config this.configService = configService; } + /* (non-Javadoc) + * @see org.alfresco.config.ConfigDeployer#getSortKey() + */ + public String getSortKey() + { + return this.beanName; + } + public void register() { if (configService == null) @@ -109,4 +132,5 @@ public class WebClientConfigBootstrap implements ApplicationContextAware, Config return null; } + } diff --git a/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java b/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java index 0d2e46eb88..e3d80434f2 100644 --- a/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java +++ b/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java @@ -234,16 +234,15 @@ public class Schema2XForms implements Serializable { continue; } - final String prefix = schemaDocument.lookupPrefix(schemaNamespaces.item(i)); + final String prefix = this.addNamespace(xformsDocument.getDocumentElement(), + schemaDocument.lookupPrefix(schemaNamespaces.item(i)), + schemaNamespaces.item(i)); if (LOGGER.isDebugEnabled()) { LOGGER.debug("[buildXForm] adding namespace " + schemaNamespaces.item(i) + " with prefix " + prefix + " to xform and default instance element"); } - this.addNamespace(xformsDocument.getDocumentElement(), - prefix, - schemaNamespaces.item(i)); schemaNamespacesMap.put(prefix, schemaNamespaces.item(i)); } } @@ -352,6 +351,9 @@ public class Schema2XForms implements Serializable if (importedInstanceDocumentElement != null) { + Schema2XForms.removeRemovedNodes(importedInstanceDocumentElement, + defaultInstanceDocumentElement, + schemaNamespacesMap); Schema2XForms.insertUpdatedNodes(importedInstanceDocumentElement, defaultInstanceDocumentElement, schemaNamespacesMap); @@ -507,6 +509,65 @@ public class Schema2XForms implements Serializable } } + @SuppressWarnings("unchecked") + public static void removeRemovedNodes(final Element instanceDocumentElement, final Element prototypeDocumentElement, + final HashMap schemaNamespaces) + { + if (LOGGER.isDebugEnabled()) + LOGGER.debug("[removeRemovedNodes] updating imported instance document"); + + final JXPathContext prototypeContext = JXPathContext.newContext(prototypeDocumentElement); + prototypeContext.registerNamespace(NamespaceService.ALFRESCO_PREFIX, NamespaceService.ALFRESCO_URI); + final JXPathContext instanceContext = JXPathContext.newContext(instanceDocumentElement); + instanceContext.registerNamespace(NamespaceService.ALFRESCO_PREFIX, NamespaceService.ALFRESCO_URI); + + for (final String prefix : schemaNamespaces.keySet()) + { + prototypeContext.registerNamespace(prefix, schemaNamespaces.get(prefix)); + instanceContext.registerNamespace(prefix, schemaNamespaces.get(prefix)); + } + + // Check all elements and attributes in the instance document + OUTER: for (;;) + { + final Iterator it = instanceContext.iteratePointers("//* | //@*"); + while (it.hasNext()) + { + final Pointer p = it.next(); + String path = p.asPath().replaceAll("\\[\\d+\\]", ""); + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("[removeRemovedNodes] evaluating instance node " + p.asPath() + " normalized " + + path + " in prototype document"); + } + + final List l = (List) prototypeContext.selectNodes(path); + if (l.isEmpty()) + { + final Node node = (Node) p.getNode(); + if (LOGGER.isDebugEnabled()) + { + LOGGER.debug("[removeRemovedNodes] removing instance node " + node.getNodeName() +" with no prototype nodes matching path " + path); + } + if (node instanceof Attr) + { + ((Attr) node).getOwnerElement().removeAttributeNode((Attr) node); + } + else + { + node.getParentNode().removeChild(node); + } + + // We have removed a node and potentially an entire sub-tree of paths. Restart the search + continue OUTER; + } + } + // We completed the search + break OUTER; + } + + } + /** * Inserts prototype nodes into the provided instance document by aggregating insertion * points from the generated prototype instance docment. @@ -3103,20 +3164,34 @@ public class Schema2XForms implements Serializable return elementName; } - private void addNamespace(final Element e, - final String nsPrefix, - final String ns) + private String addNamespace(final Element e, + String nsPrefix, + final String ns) { - - if (!e.hasAttributeNS(NamespaceConstants.XMLNS_NS, nsPrefix)) + String prefix; + if ((prefix = NamespaceResolver.getPrefix(e, ns)) != null) { - if (LOGGER.isDebugEnabled()) - LOGGER.debug("[addNamespace] adding namespace " + ns + " with prefix " + nsPrefix + " to " + e.getNodeName()); - - e.setAttributeNS(NamespaceConstants.XMLNS_NS, - NamespaceConstants.XMLNS_PREFIX + ':' + nsPrefix, - ns); + return prefix; } + + if (nsPrefix == null || e.hasAttributeNS(NamespaceConstants.XMLNS_NS, nsPrefix)) + { + // Generate a unique prefix + int suffix = 1; + while (e.hasAttributeNS(NamespaceConstants.XMLNS_NS, nsPrefix = "ns" + suffix)) + { + suffix++; + } + } + + if (LOGGER.isDebugEnabled()) + LOGGER.debug("[addNamespace] adding namespace " + ns + " with prefix " + nsPrefix + " to " + e.getNodeName()); + + e.setAttributeNS(NamespaceConstants.XMLNS_NS, + NamespaceConstants.XMLNS_PREFIX + ':' + nsPrefix, + ns); + + return nsPrefix; } private void createTriggersForRepeats(final Document xformsDocument, final Element rootGroup) diff --git a/source/web/jsp/groups/groups.jsp b/source/web/jsp/groups/groups.jsp index 9b401ca675..145dc2a85d 100644 --- a/source/web/jsp/groups/groups.jsp +++ b/source/web/jsp/groups/groups.jsp @@ -15,7 +15,8 @@ * * You should have received a copy of the GNU Lesser General Public License * along with Alfresco. If not, see . ---%><%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +--%> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> @@ -47,7 +48,7 @@ - + <%-- Group Path Breadcrumb --%>