Merged V3.2 to HEAD

16725: Merged V3.1 to V3.2
      16721: Merged DEV/BELARUS/V3.1 to V3.1 
         16483: Fix for ETHREEOH-2728 : WCM - Forms rendering issue using IE6
   16889: Merged V3.1 to V3.2
      16888: Merged V2.2 to V3.1 
         16694: Fix for ETHREEOH-1384/ACT 11135: Poor performance when using webscript based web forms 
         16787: Fixed Web-Client Eclipse project after recent chiba JAR file name change 
         16840: Resolution to issue in ETHREEOH-2633: Change to Common.js function implemented in CHK-5134 causes problems with missing icons in Navigator panel. Implemented configuration approach so that both modes can be supported. 
         16870: Fix for ETWOTWO-119 & ALFCOM-332: WCM config override issues where the OOTB web-client-config-wcm.xml file needed to be changed and the ability to define custom scripts to load to avoid the need to edit xforms.js or XFormsProcessor.java

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16913 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2009-10-14 11:37:27 +00:00
parent ba3f9629b5
commit b1e86e69f2
21 changed files with 1103 additions and 100 deletions

View File

@@ -23,6 +23,11 @@
*/
package org.alfresco.web.bean.wcm;
import static org.alfresco.web.bean.wcm.DescriptionAttributeHelper.getDescriptionNotEmpty;
import static org.alfresco.web.bean.wcm.DescriptionAttributeHelper.getTableBegin;
import static org.alfresco.web.bean.wcm.DescriptionAttributeHelper.getTableEnd;
import static org.alfresco.web.bean.wcm.DescriptionAttributeHelper.getTableLine;
import java.io.File;
import java.io.Serializable;
import java.text.MessageFormat;
@@ -65,8 +70,6 @@ import org.alfresco.web.forms.RenderingEngine;
import org.alfresco.web.forms.RenderingEngineTemplate;
import org.alfresco.web.forms.RenderingEngineTemplateImpl;
import org.alfresco.web.forms.XMLUtil;
import org.alfresco.web.forms.xforms.FormBuilderException;
import org.alfresco.web.forms.xforms.SchemaUtil;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIListItem;
import org.alfresco.web.ui.wcm.WebResources;
@@ -74,11 +77,10 @@ import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.xerces.xs.XSConstants;
import org.apache.xerces.xs.XSElementDeclaration;
import org.apache.xerces.xs.XSModel;
import org.apache.xerces.xs.XSNamedMap;
import org.chiba.xml.ns.NamespaceConstants;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* Bean implementation for the "Create XML Form" dialog
@@ -238,7 +240,7 @@ public class CreateFormWizard extends BaseWizardBean
protected String defaultWorkflowName = null;
protected boolean applyDefaultWorkflow = true;
protected List<RenderingEngineTemplateData> renderingEngineTemplates = null;
protected transient XSModel schema;
transient protected Document schema;
protected String schemaFileName;
protected transient ContentService contentService;
protected transient MimetypeService mimetypeService;
@@ -773,17 +775,7 @@ public class CreateFormWizard extends BaseWizardBean
{
try
{
final Document d = XMLUtil.parse(this.getSchemaFile());
try
{
this.schema = SchemaUtil.parseSchema(d, true);
}
catch (FormBuilderException fbe)
{
this.schema = SchemaUtil.parseSchema(d, false);
LOGGER.warn("non fatal errors encountered parsing schema " + this.getFileName(FILE_SCHEMA) +
"\n " + fbe.getMessage());
}
this.schema = XMLUtil.parse(this.getSchemaFile());
}
catch (Exception e)
{
@@ -999,11 +991,16 @@ public class CreateFormWizard extends BaseWizardBean
if (this.schemaRootElementNameChoices == null)
{
this.schemaRootElementNameChoices = new LinkedList<SelectItem>();
final XSNamedMap elementsMap = this.schema.getComponents(XSConstants.ELEMENT_DECLARATION);
for (int i = 0; i < elementsMap.getLength(); i++)
NodeList elements = this.schema.getElementsByTagNameNS(NamespaceConstants.XMLSCHEMA_NS, "element");
for (int i = 0; i < elements.getLength(); i++)
{
final XSElementDeclaration e = (XSElementDeclaration)elementsMap.item(i);
this.schemaRootElementNameChoices.add(new SelectItem(e.getName(), e.getName()));
Node current = elements.item(i);
if (current.getParentNode().equals(this.schema.getDocumentElement()))
{
this.schemaRootElementNameChoices.add(new SelectItem(current.getAttributes().getNamedItem("name").getNodeValue(),
current.getAttributes().getNamedItem("name").getNodeValue()));
}
}
}
result = this.schemaRootElementNameChoices;

View File

@@ -48,7 +48,6 @@ import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.forms.Form;
import org.alfresco.web.forms.RenderingEngineTemplate;
import org.alfresco.web.forms.xforms.SchemaUtil;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -122,7 +121,7 @@ public class EditFormWizard
ContentModel.PROP_NAME));
try
{
this.schema = SchemaUtil.parseSchema(form.getSchema(), false);
this.schema = form.getSchema();
}
catch (Throwable t)
{

View File

@@ -88,6 +88,7 @@ public class ClientConfigElement extends ConfigElementAdapter
private boolean userGroupAdmin = true;
private boolean allowUserConfig = true;
private int pickerSearchMinimum = 2;
private boolean checkContextAgainstPath = false;
/**
@@ -313,7 +314,12 @@ public class ClientConfigElement extends ConfigElementAdapter
{
combinedElement.setPickerSearchMinimum(newElement.getPickerSearchMinimum());
}
if (newElement.getCheckContextAgainstPath() != combinedElement.getCheckContextAgainstPath())
{
combinedElement.setCheckContextAgainstPath(newElement.getCheckContextAgainstPath());
}
return combinedElement;
}
@@ -875,4 +881,20 @@ public class ClientConfigElement extends ConfigElementAdapter
{
this.pickerSearchMinimum = searchMinimum;
}
/**
* @return true if the context path should be checked against the path in the current URL
*/
public boolean getCheckContextAgainstPath()
{
return this.checkContextAgainstPath;
}
/**
* @param checkContextAgainstPath true to check the context path against the path in the current URL
*/
/*package*/ void setCheckContextAgainstPath(boolean checkContextAgainstPath)
{
this.checkContextAgainstPath = checkContextAgainstPath;
}
}

View File

@@ -72,6 +72,7 @@ public class ClientElementReader implements ConfigElementReader
public static final String ELEMENT_USERGROUPADMIN = "user-group-admin";
public static final String ELEMENT_ALLOWUSERCONFIG = "allow-user-config";
public static final String ELEMENT_PICKERSEARCHMINIMUM = "picker-search-minimum";
public static final String ELEMENT_CHECKCONTEXTPATH = "check-context-against-path";
/**
@@ -323,6 +324,14 @@ public class ClientElementReader implements ConfigElementReader
{
configElement.setPickerSearchMinimum(Integer.parseInt(pickerSearchMin.getTextTrim()));
}
// determine whether the JavaScript setContextPath method should
// check the path of the current URL
Element checkContextAgainstPath = element.element(ELEMENT_CHECKCONTEXTPATH);
if (checkContextAgainstPath != null)
{
configElement.setCheckContextAgainstPath(Boolean.parseBoolean(checkContextAgainstPath.getTextTrim()));
}
}
return configElement;

View File

@@ -0,0 +1,148 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.web.config;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.alfresco.config.ConfigElement;
import org.alfresco.config.element.GenericConfigElement;
/**
* Custom config element that represents the config data for WCM
*
* @author gavinc
*/
public class WCMConfigElement extends GenericConfigElement
{
private static final long serialVersionUID = -4906603037550877971L;
protected Map<String, GenericConfigElement> childrenMap;
public static final String CONFIG_ELEMENT_ID = "wcm";
/**
* Default constructor
*/
public WCMConfigElement()
{
super(CONFIG_ELEMENT_ID);
}
/**
* Constructor
*
* @param name Name of the element this config element represents
*/
public WCMConfigElement(String name)
{
super(name);
this.childrenMap = new HashMap<String, GenericConfigElement>(8);
}
@Override
public ConfigElement combine(ConfigElement configElement)
{
WCMConfigElement combined = new WCMConfigElement(this.name);
WCMConfigElement toCombineElement = (WCMConfigElement)configElement;
// work out which child element to add
Map<String, GenericConfigElement> toCombineKids = toCombineElement.getChildrenAsMap();
List<ConfigElement> kids = this.getChildren();
if (kids != null)
{
for (ConfigElement child : kids)
{
String childName = child.getName();
if (toCombineKids.containsKey(childName))
{
// check for the 'xforms' child element
if (childName.equals("xforms"))
{
// add the widgets from the 'to combine' element to
// this one and then add to the new combined element
for (ConfigElement widget : toCombineKids.get("xforms").getChildren())
{
((GenericConfigElement)child).addChild(widget);
}
// add the current child to the combined one
combined.addChild(child);
}
else
{
// use the overridden child element
combined.addChild(toCombineKids.get(childName));
}
}
else
{
// the current child has not be overridden so
// just add the current child
combined.addChild(child);
}
}
}
// make sure any children only present in the 'to combine' element
// are added
kids = toCombineElement.getChildren();
if (kids != null)
{
Map<String, GenericConfigElement> combinedKids = combined.getChildrenAsMap();
for (ConfigElement child : kids)
{
if (!combinedKids.containsKey(child.getName()))
{
combined.addChild(child);
}
}
}
return combined;
}
@Override
public void addChild(ConfigElement configElement)
{
super.addChild(configElement);
// also add the child element to our map
this.childrenMap.put(configElement.getName(), (GenericConfigElement)configElement);
}
/**
* Returns the children in a Map
*
* @return Child elements as a Map
*/
public Map<String, GenericConfigElement> getChildrenAsMap()
{
return this.childrenMap;
}
}

View File

@@ -0,0 +1,67 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.web.config;
import org.alfresco.config.ConfigElement;
import org.alfresco.config.xml.elementreader.GenericElementReader;
import org.dom4j.Element;
/**
* Custom element reader to parse config for WCM
*
* @author gavinc
*/
public class WCMElementReader extends GenericElementReader
{
public static final String ELEMENT_WCM = "wcm";
/**
* Default constructor
*/
public WCMElementReader()
{
super(null);
}
/**
* @see org.alfresco.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element)
*/
public ConfigElement parse(Element element)
{
WCMConfigElement wcmConfigElement = null;
if (element != null)
{
// create the config element object
wcmConfigElement = new WCMConfigElement(ELEMENT_WCM);
// we know there are no attributes or values for the root element
// so just process the children
processChildren(element, wcmConfigElement);
}
return wcmConfigElement;
}
}

View File

@@ -26,8 +26,11 @@ package org.alfresco.web.config;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import org.alfresco.config.Config;
import org.alfresco.config.ConfigElement;
@@ -842,7 +845,7 @@ public class WebClientConfigTest extends BaseTest
public void testActionsOverriding()
{
XMLConfigService svc = initXMLConfigService("test-config.xml", "test-config-override.xml");
XMLConfigService svc = initXMLConfigService("test-config.xml", "test-config-override.xml");
// get the "Actions" config
Config cfg = svc.getConfig("Actions Override");
@@ -921,4 +924,142 @@ public class WebClientConfigTest extends BaseTest
assertNotNull("Expecting a list of search attributes", attrs);
assertEquals("Expecting 2 search attributes", 2, attrs.size());
}
public void testWCM()
{
// setup the config service
XMLConfigService svc = initXMLConfigService("test-config.xml");
// get the global config object
Config global = svc.getGlobalConfig();
assertNotNull(global);
// get the wcm config
ConfigElement wcmConfig = global.getConfigElement("wcm");
assertNotNull(wcmConfig);
// get the workflows config
ConfigElement workflows = wcmConfig.getChild("workflows");
assertNotNull(workflows);
assertEquals("wcmwf:submit", workflows.getValue());
// get the admin workflows config
ConfigElement adminWorkflows = wcmConfig.getChild("admin-workflows");
assertNotNull(adminWorkflows);
assertEquals("wcmwf:changerequest", adminWorkflows.getValue());
// get the browse page size config
ConfigElement viewsConfig = wcmConfig.getChild("views");
assertNotNull(viewsConfig);
ConfigElement browsePageSizeConfig = viewsConfig.getChild("browse-page-size");
assertNotNull(browsePageSizeConfig);
assertEquals("25", browsePageSizeConfig.getValue());
// get the deployment polling frequency
ConfigElement deploymentConfig = wcmConfig.getChild("deployment");
assertNotNull(deploymentConfig);
ConfigElement pollingConfig = deploymentConfig.getChild("progress-polling-frequency");
assertNotNull(pollingConfig);
assertEquals("2", pollingConfig.getValue());
// get the link validation polling frequency
ConfigElement linksConfig = wcmConfig.getChild("links-management");
assertNotNull(linksConfig);
pollingConfig = linksConfig.getChild("progress-polling-frequency");
assertNotNull(pollingConfig);
assertEquals("2", pollingConfig.getValue());
// get the widget config
ConfigElement xformsConfig = wcmConfig.getChild("xforms");
assertNotNull(xformsConfig);
List<ConfigElement> widgetConfig = xformsConfig.getChildren("widget");
assertEquals(2, widgetConfig.size());
// make sure the xforms-scripts config is NOT present
ConfigElement scriptsConfig = wcmConfig.getChild("xforms-scripts");
assertNull(scriptsConfig);
// make sure the custom config element is NOT present
ConfigElement customConfig = wcmConfig.getChild("custom-config");
assertNull(customConfig);
}
public void testWCMOverride()
{
// setup the config service
XMLConfigService svc = initXMLConfigService("test-config.xml", "test-config-override.xml");
// get the global config object
Config global = svc.getGlobalConfig();
assertNotNull(global);
// get the wcm config
ConfigElement wcmConfig = global.getConfigElement("wcm");
assertNotNull(wcmConfig);
// get the workflows config
ConfigElement workflows = wcmConfig.getChild("workflows");
assertNotNull(workflows);
assertEquals("custom:submit", workflows.getValue().trim());
StringTokenizer t = new StringTokenizer(workflows.getValue().trim(), ", ");
while (t.hasMoreTokens())
{
System.out.println("workflow = '" + t.nextToken() + "'");
}
// get the admin workflows config
ConfigElement adminWorkflows = wcmConfig.getChild("admin-workflows");
assertNotNull(adminWorkflows);
assertEquals("custom:changerequest, custom:somejob", adminWorkflows.getValue());
t = new StringTokenizer(adminWorkflows.getValue().trim(), ", ");
while (t.hasMoreTokens())
{
System.out.println("admin workflow = '" + t.nextToken() + "'");
}
// get the browse page size config
ConfigElement viewsConfig = wcmConfig.getChild("views");
assertNotNull(viewsConfig);
ConfigElement browsePageSizeConfig = viewsConfig.getChild("browse-page-size");
assertNotNull(browsePageSizeConfig);
assertEquals("50", browsePageSizeConfig.getValue());
// get the deployment polling frequency
ConfigElement deploymentConfig = wcmConfig.getChild("deployment");
assertNotNull(deploymentConfig);
ConfigElement pollingConfig = deploymentConfig.getChild("progress-polling-frequency");
assertNotNull(pollingConfig);
assertEquals("10", pollingConfig.getValue());
// get the link validation polling frequency
ConfigElement linksConfig = wcmConfig.getChild("links-management");
assertNotNull(linksConfig);
pollingConfig = linksConfig.getChild("progress-polling-frequency");
assertNotNull(pollingConfig);
assertEquals("15", pollingConfig.getValue());
// get the widget config
ConfigElement xformsConfig = wcmConfig.getChild("xforms");
assertNotNull(xformsConfig);
List<ConfigElement> widgetConfig = xformsConfig.getChildren("widget");
assertEquals(3, widgetConfig.size());
// make sure the xforms-scripts config is present
ConfigElement scriptsConfig = wcmConfig.getChild("xforms-scripts");
assertNotNull(scriptsConfig);
assertEquals("/custom/custom-xforms.js, /custom/another-custom-xforms.js", scriptsConfig.getValue());
t = new StringTokenizer(scriptsConfig.getValue().trim(), ", ");
while (t.hasMoreTokens())
{
System.out.println("custom script = '" + t.nextToken() + "'");
}
// make sure the custom config element is present
ConfigElement customConfig = wcmConfig.getChild("custom-config");
assertNotNull(customConfig);
assertEquals("50", customConfig.getValue());
}
}

View File

@@ -32,6 +32,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
import javax.xml.transform.*;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.util.Pair;
import org.alfresco.web.forms.XMLUtil;
import org.apache.commons.jxpath.JXPathContext;
import org.apache.commons.jxpath.Pointer;
@@ -139,7 +140,7 @@ public class Schema2XForms implements Serializable
* @throws org.chiba.tools.schemabuilder.FormBuilderException
* If an error occurs building the XForm.
*/
public Document buildXForm(final Document instanceDocument,
public Pair<Document, XSModel> buildXForm(final Document instanceDocument,
final Document schemaDocument,
String rootElementName,
final ResourceBundle resourceBundle)
@@ -160,12 +161,26 @@ public class Schema2XForms implements Serializable
xformsDocument.getDocumentElement().getElementsByTagNameNS(NamespaceConstants.XFORMS_NS,
"model").item(0);
//add XMLSchema if we use schema types
modelSection.setAttributeNS(NamespaceConstants.XFORMS_NS, "schema", "#schema-1");
//add XMLSchema if we use schema types
final Element importedSchemaDocumentElement = (Element)
xformsDocument.importNode(schemaDocument.getDocumentElement(), true);
importedSchemaDocumentElement.setAttributeNS(null, "id", "schema-1");
NodeList nl = importedSchemaDocumentElement.getChildNodes();
for (int i = 0; i < nl.getLength(); i++)
{
Node current = nl.item(i);
if (current.getNamespaceURI() != null && current.getNamespaceURI().equals(NamespaceConstants.XMLSCHEMA_NS))
{
String localName = current.getLocalName();
if (localName.equals("include") || localName.equals("import"))
{
importedSchemaDocumentElement.removeChild(current);
}
}
}
modelSection.appendChild(importedSchemaDocumentElement);
//check if target namespace
@@ -312,7 +327,7 @@ public class Schema2XForms implements Serializable
xformsDocument.getDocumentElement().insertBefore(comment,
xformsDocument.getDocumentElement().getFirstChild());
xformsDocument.normalizeDocument();
return xformsDocument;
return new Pair<Document, XSModel>(xformsDocument, schema);
}
/**

View File

@@ -668,7 +668,7 @@ public class Schema2XFormsTest
{
return new Vector<String>().elements();
}
});
}).getFirst();
}
private static SchemaUtil.Occurrence occuranceFromBind(final Element bindElement)

View File

@@ -41,6 +41,7 @@ import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.util.Pair;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.NavigationBean;
@@ -52,6 +53,7 @@ import org.alfresco.web.forms.FormProcessor;
import org.alfresco.web.forms.XMLUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.xerces.xs.XSModel;
import org.chiba.xml.events.ChibaEventNames;
import org.chiba.xml.events.DOMEventNames;
import org.chiba.xml.events.XFormsEventNames;
@@ -226,7 +228,8 @@ public class XFormsBean implements Serializable
final ChibaBean chibaBean = new ChibaBean();
chibaBean.setConfig(servletContext.getRealPath("/WEB-INF/chiba.xml"));
chibaBean.setXMLContainer(this.getXFormsDocument());
Pair<Document, XSModel> chibaPair = this.getXFormsDocument();
chibaBean.setXMLContainer(chibaPair.getFirst(), chibaPair.getSecond());
final EventTarget et = (EventTarget)
chibaBean.getXMLContainer().getDocumentElement();
@@ -726,7 +729,7 @@ public class XFormsBean implements Serializable
// }
// }
private Document getXFormsDocument()
private Pair<Document, XSModel> getXFormsDocument()
throws FormBuilderException
{
String path = null;
@@ -756,14 +759,14 @@ public class XFormsBean implements Serializable
final Document schemaDocument = this.xformsSession.form.getSchema();
XFormsBean.rewriteInlineURIs(schemaDocument, path);
final String rootElementName = this.xformsSession.form.getSchemaRootElementName();
final Document result =
final Pair<Document, XSModel> result =
this.xformsSession.schema2XForms.buildXForm(this.xformsSession.formInstanceData,
schemaDocument,
rootElementName,
resourceBundle);
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("generated xform: " + XMLUtil.toString(result));
LOGGER.debug("generated xform: " + XMLUtil.toString(result.getFirst()));
}
return result;
}

View File

@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
import java.util.TreeSet;
import javax.faces.context.FacesContext;
@@ -297,6 +298,26 @@ public class XFormsProcessor implements FormProcessor
e.appendChild(result.createTextNode("\n"));
div.appendChild(e);
}
// output any custom scripts
ConfigElement config = Application.getConfigService(fc).getGlobalConfig().getConfigElement("wcm");
if (config != null)
{
// get the custom scripts to include
ConfigElement xformsScriptsConfig = config.getChild("xforms-scripts");
if (xformsScriptsConfig != null)
{
StringTokenizer t = new StringTokenizer(xformsScriptsConfig.getValue().trim(), ", ");
while (t.hasMoreTokens())
{
e = result.createElement("script");
e.setAttribute("type", "text/javascript");
e.setAttribute("src", contextPath + t.nextToken());
e.appendChild(result.createTextNode("\n"));
div.appendChild(e);
}
}
}
XMLUtil.print(result, out);
}

View File

@@ -35,6 +35,7 @@ import javax.servlet.jsp.tagext.TagSupport;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.coci.CCProperties;
import org.alfresco.web.config.ClientConfigElement;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -255,7 +256,14 @@ public class PageTag extends TagSupport
out.write("<script type=\"text/javascript\">"); // start - generate naked javascript code
// get client config to determine how the JavaScript setContextPath should behave
ClientConfigElement clientConfig = Application.getClientConfig(pageContext.getServletContext());
// set the context path used by some Alfresco script objects
if (clientConfig != null && clientConfig.getCheckContextAgainstPath())
{
out.write("setCheckContextAgainstPath(true);");
}
out.write("setContextPath('");
out.write(reqPath);
out.write("');");