mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- terminology changes to wcmModel (needs to be propogated to java classes as well). template is now form. template output method is now form transformer.
- added an aspect to differentiate form derived from form transformer derived (allowed removing some workarounds from XSLTOutputMethod) - namespacing variables passed to the xsl processor with alfresco: git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4154 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -310,7 +310,7 @@ public class AVMEditBean
|
|||||||
tx.commit();
|
tx.commit();
|
||||||
|
|
||||||
// TODO: regenerate template content
|
// TODO: regenerate template content
|
||||||
if (nodeService.getProperty(avmRef, WCMModel.PROP_TEMPLATE_DERIVED_FROM) != null)
|
if (nodeService.getProperty(avmRef, WCMModel.PROP_FORM_DERIVED_FROM) != null)
|
||||||
{
|
{
|
||||||
OutputUtil.regenerate(avmRef,
|
OutputUtil.regenerate(avmRef,
|
||||||
this.contentService,
|
this.contentService,
|
||||||
|
@@ -166,7 +166,7 @@ public class CreateFormWizard extends BaseWizardBean
|
|||||||
|
|
||||||
props = new HashMap<QName, Serializable>(1, 1.0f);
|
props = new HashMap<QName, Serializable>(1, 1.0f);
|
||||||
props.put(WCMModel.PROP_SCHEMA_ROOT_TAG_NAME, this.getSchemaRootTagName());
|
props.put(WCMModel.PROP_SCHEMA_ROOT_TAG_NAME, this.getSchemaRootTagName());
|
||||||
this.nodeService.addAspect(schemaNodeRef, WCMModel.ASPECT_TEMPLATE, props);
|
this.nodeService.addAspect(schemaNodeRef, WCMModel.ASPECT_FORM, props);
|
||||||
|
|
||||||
for (TemplateOutputMethodData tomd : this.templateOutputMethods)
|
for (TemplateOutputMethodData tomd : this.templateOutputMethods)
|
||||||
{
|
{
|
||||||
@@ -189,13 +189,17 @@ public class CreateFormWizard extends BaseWizardBean
|
|||||||
|
|
||||||
this.nodeService.createAssociation(schemaNodeRef,
|
this.nodeService.createAssociation(schemaNodeRef,
|
||||||
templateOutputMethodNodeRef,
|
templateOutputMethodNodeRef,
|
||||||
WCMModel.ASSOC_TEMPLATE_OUTPUT_METHODS);
|
WCMModel.ASSOC_FORM_TRANSFORMERS);
|
||||||
|
|
||||||
props = new HashMap<QName, Serializable>(3, 1.0f);
|
props = new HashMap<QName, Serializable>(3, 1.0f);
|
||||||
props.put(WCMModel.PROP_TEMPLATE_OUTPUT_METHOD_TYPE, tomd.getTemplateOutputMethodType().getName());
|
props.put(WCMModel.PROP_FORM_TRANSFORMER_TYPE,
|
||||||
props.put(WCMModel.PROP_TEMPLATE_SOURCE, schemaNodeRef);
|
tomd.getTemplateOutputMethodType().getName());
|
||||||
props.put(WCMModel.PROP_TEMPLATE_OUTPUT_METHOD_DERIVED_FILE_EXTENSION, tomd.getFileExtension());
|
props.put(WCMModel.PROP_FORM_SOURCE, schemaNodeRef);
|
||||||
this.nodeService.addAspect(templateOutputMethodNodeRef, WCMModel.ASPECT_TEMPLATE_OUTPUT_METHOD, props);
|
props.put(WCMModel.PROP_FORM_TRANSFORMER_DERIVED_FILE_EXTENSION,
|
||||||
|
tomd.getFileExtension());
|
||||||
|
this.nodeService.addAspect(templateOutputMethodNodeRef,
|
||||||
|
WCMModel.ASPECT_FORM_TRANSFORMER,
|
||||||
|
props);
|
||||||
}
|
}
|
||||||
// return the default outcome
|
// return the default outcome
|
||||||
return outcome;
|
return outcome;
|
||||||
|
@@ -106,11 +106,11 @@ public class CreateWebContentWizard extends BaseContentWizard
|
|||||||
final TemplateType tt = this.getTemplateType();
|
final TemplateType tt = this.getTemplateType();
|
||||||
final TemplatingService ts = TemplatingService.getInstance();
|
final TemplatingService ts = TemplatingService.getInstance();
|
||||||
|
|
||||||
final Map<QName, Serializable> props = new HashMap<QName, Serializable>();
|
final Map<QName, Serializable> props = new HashMap<QName, Serializable>(1, 1.0f);
|
||||||
props.put(WCMModel.PROP_TEMPLATE_DERIVED_FROM, tt.getNodeRef());
|
props.put(WCMModel.PROP_FORM_DERIVED_FROM, tt.getNodeRef());
|
||||||
props.put(WCMModel.PROP_TEMPLATE_DERIVED_FROM_NAME, tt.getName());
|
props.put(WCMModel.PROP_FORM_DERIVED_FROM_NAME, tt.getName());
|
||||||
this.nodeService.addAspect(AVMNodeConverter.ToNodeRef(-1, this.createdPath),
|
this.nodeService.addAspect(AVMNodeConverter.ToNodeRef(-1, this.createdPath),
|
||||||
WCMModel.ASPECT_TEMPLATE_DERIVED,
|
WCMModel.ASPECT_FORM_DERIVED,
|
||||||
props);
|
props);
|
||||||
|
|
||||||
OutputUtil.generate(this.createdPath.substring(0, this.createdPath.lastIndexOf('/')),
|
OutputUtil.generate(this.createdPath.substring(0, this.createdPath.lastIndexOf('/')),
|
||||||
|
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2005 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
package org.alfresco.web.templating;
|
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An abstraction layer around the xml content which allows
|
|
||||||
* for reseting the xml content being collected by the input method.
|
|
||||||
*/
|
|
||||||
public interface InstanceData
|
|
||||||
{
|
|
||||||
public Document getContent();
|
|
||||||
|
|
||||||
public void setContent(final Document d);
|
|
||||||
}
|
|
@@ -83,10 +83,17 @@ public class OutputUtil
|
|||||||
out.close();
|
out.close();
|
||||||
|
|
||||||
NodeRef outputNodeRef = AVMNodeConverter.ToNodeRef(-1, fullAvmPath);
|
NodeRef outputNodeRef = AVMNodeConverter.ToNodeRef(-1, fullAvmPath);
|
||||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>();
|
|
||||||
props.put(WCMModel.PROP_TEMPLATE_DERIVED_FROM, tt.getNodeRef());
|
Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
|
||||||
props.put(WCMModel.PROP_TEMPLATE_DERIVED_FROM_NAME, tt.getName());
|
props.put(WCMModel.PROP_FORM_DERIVED_FROM, tt.getNodeRef());
|
||||||
nodeService.addAspect(outputNodeRef, WCMModel.ASPECT_TEMPLATE_DERIVED, props);
|
props.put(WCMModel.PROP_FORM_DERIVED_FROM_NAME, tt.getName());
|
||||||
|
nodeService.addAspect(outputNodeRef, WCMModel.ASPECT_FORM_DERIVED, props);
|
||||||
|
|
||||||
|
props = new HashMap<QName, Serializable>(2, 1.0f);
|
||||||
|
props.put(WCMModel.PROP_FORM_TRANSFORMER_DERIVED_FROM, tom.getNodeRef());
|
||||||
|
props.put(WCMModel.PROP_PRIMARY_FORM_DERIVED,
|
||||||
|
AVMNodeConverter.ToNodeRef(-1, parentPath + fileName));
|
||||||
|
nodeService.addAspect(outputNodeRef, WCMModel.ASPECT_FORM_TRANSFORMER_DERIVED, props);
|
||||||
|
|
||||||
props = new HashMap<QName, Serializable>(1, 1.0f);
|
props = new HashMap<QName, Serializable>(1, 1.0f);
|
||||||
props.put(ContentModel.PROP_TITLE, fileName);
|
props.put(ContentModel.PROP_TITLE, fileName);
|
||||||
@@ -113,7 +120,7 @@ public class OutputUtil
|
|||||||
{
|
{
|
||||||
final TemplatingService ts = TemplatingService.getInstance();
|
final TemplatingService ts = TemplatingService.getInstance();
|
||||||
final NodeRef templateTypeNodeRef = (NodeRef)
|
final NodeRef templateTypeNodeRef = (NodeRef)
|
||||||
nodeService.getProperty(nodeRef, WCMModel.PROP_TEMPLATE_DERIVED_FROM);
|
nodeService.getProperty(nodeRef, WCMModel.PROP_FORM_DERIVED_FROM);
|
||||||
|
|
||||||
final TemplateType tt = ts.getTemplateType(templateTypeNodeRef);
|
final TemplateType tt = ts.getTemplateType(templateTypeNodeRef);
|
||||||
|
|
||||||
|
@@ -26,15 +26,30 @@ import java.io.Writer;
|
|||||||
public interface TemplateInputMethod
|
public interface TemplateInputMethod
|
||||||
extends Serializable
|
extends Serializable
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An abstraction layer around the xml content which allows
|
||||||
|
* for reseting the xml content being collected by the input method.
|
||||||
|
*/
|
||||||
|
public interface InstanceData
|
||||||
|
{
|
||||||
|
public Document getContent();
|
||||||
|
|
||||||
|
public void setContent(final Document d);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
* Generates a user interface for inputing data into this template.
|
|
||||||
*
|
/**
|
||||||
* @param instanceData provides the xml instance data if available.
|
* Generates a user interface for inputing data into this template.
|
||||||
* @param tt the template type to generate for
|
*
|
||||||
* @param out the writer to write the output to.
|
* @param instanceData provides the xml instance data if available.
|
||||||
*/
|
* @param tt the template type to generate for
|
||||||
public void generate(final InstanceData instanceData,
|
* @param out the writer to write the output to.
|
||||||
final TemplateType tt,
|
*/
|
||||||
final Writer out);
|
public void generate(final TemplateInputMethod.InstanceData instanceData,
|
||||||
|
final TemplateType tt,
|
||||||
|
final Writer out);
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.web.templating;
|
package org.alfresco.web.templating;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -27,6 +28,8 @@ import org.w3c.dom.Document;
|
|||||||
public interface TemplateOutputMethod
|
public interface TemplateOutputMethod
|
||||||
extends Serializable
|
extends Serializable
|
||||||
{
|
{
|
||||||
|
/** the noderef associated with this output method */
|
||||||
|
public NodeRef getNodeRef();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serializes the xml data in to a presentation format.
|
* Serializes the xml data in to a presentation format.
|
||||||
|
@@ -128,7 +128,7 @@ public final class TemplatingService implements Serializable
|
|||||||
final SearchParameters sp = new SearchParameters();
|
final SearchParameters sp = new SearchParameters();
|
||||||
sp.addStore(Repository.getStoreRef());
|
sp.addStore(Repository.getStoreRef());
|
||||||
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
|
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
|
||||||
sp.setQuery("ASPECT:\"" + WCMModel.ASPECT_TEMPLATE + "\"");
|
sp.setQuery("ASPECT:\"" + WCMModel.ASPECT_FORM + "\"");
|
||||||
LOGGER.debug("running query [" + sp.getQuery() + "]");
|
LOGGER.debug("running query [" + sp.getQuery() + "]");
|
||||||
final ResultSet rs = this.searchService.query(sp);
|
final ResultSet rs = this.searchService.query(sp);
|
||||||
LOGGER.debug("received " + rs.length() + " results");
|
LOGGER.debug("received " + rs.length() + " results");
|
||||||
@@ -155,7 +155,7 @@ public final class TemplatingService implements Serializable
|
|||||||
final SearchParameters sp = new SearchParameters();
|
final SearchParameters sp = new SearchParameters();
|
||||||
sp.addStore(Repository.getStoreRef());
|
sp.addStore(Repository.getStoreRef());
|
||||||
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
|
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
|
||||||
sp.setQuery("ASPECT:\"" + WCMModel.ASPECT_TEMPLATE +
|
sp.setQuery("ASPECT:\"" + WCMModel.ASPECT_FORM +
|
||||||
"\" AND @" + Repository.escapeQName(ContentModel.PROP_TITLE) +
|
"\" AND @" + Repository.escapeQName(ContentModel.PROP_TITLE) +
|
||||||
":\"" + name + "\"");
|
":\"" + name + "\"");
|
||||||
LOGGER.debug("running query [" + sp.getQuery() + "]");
|
LOGGER.debug("running query [" + sp.getQuery() + "]");
|
||||||
@@ -203,14 +203,14 @@ public final class TemplatingService implements Serializable
|
|||||||
LOGGER.debug("root tag name is " + schemaRootTagName);
|
LOGGER.debug("root tag name is " + schemaRootTagName);
|
||||||
final TemplateType tt = new TemplateTypeImpl(title, schemaNodeRef, schemaRootTagName);
|
final TemplateType tt = new TemplateTypeImpl(title, schemaNodeRef, schemaRootTagName);
|
||||||
for (AssociationRef assoc : this.nodeService.getTargetAssocs(schemaNodeRef,
|
for (AssociationRef assoc : this.nodeService.getTargetAssocs(schemaNodeRef,
|
||||||
WCMModel.ASSOC_TEMPLATE_OUTPUT_METHODS))
|
WCMModel.ASSOC_FORM_TRANSFORMERS))
|
||||||
{
|
{
|
||||||
final NodeRef tomNodeRef = assoc.getTargetRef();
|
final NodeRef tomNodeRef = assoc.getTargetRef();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final Class templateOutputMethodType =
|
final Class templateOutputMethodType =
|
||||||
Class.forName((String)this.nodeService.getProperty(tomNodeRef,
|
Class.forName((String)this.nodeService.getProperty(tomNodeRef,
|
||||||
WCMModel.PROP_TEMPLATE_OUTPUT_METHOD_TYPE));
|
WCMModel.PROP_FORM_TRANSFORMER_TYPE));
|
||||||
|
|
||||||
final Constructor c = templateOutputMethodType.getConstructor(NodeRef.class, NodeService.class, ContentService.class);
|
final Constructor c = templateOutputMethodType.getConstructor(NodeRef.class, NodeService.class, ContentService.class);
|
||||||
final TemplateOutputMethod tom = (TemplateOutputMethod)
|
final TemplateOutputMethod tom = (TemplateOutputMethod)
|
||||||
|
@@ -78,44 +78,38 @@ public class ExtensionFunctions
|
|||||||
AVMNodeDescriptor entryNode = entry.getValue();
|
AVMNodeDescriptor entryNode = entry.getValue();
|
||||||
if (entryNode.isFile())
|
if (entryNode.isFile())
|
||||||
{
|
{
|
||||||
final PropertyValue pv =
|
PropertyValue pv =
|
||||||
this.avmRemote.getNodeProperty(-1,
|
this.avmRemote.getNodeProperty(-1,
|
||||||
avmPath + '/' + entryName,
|
avmPath + '/' + entryName,
|
||||||
WCMModel.PROP_TEMPLATE_DERIVED_FROM_NAME);
|
WCMModel.PROP_FORM_DERIVED_FROM_NAME);
|
||||||
if (pv != null &&
|
if (pv == null ||
|
||||||
pv.getStringValue() != null &&
|
pv.getStringValue() == null ||
|
||||||
((String)pv.getStringValue()).equals(templateTypeName))
|
!((String)pv.getStringValue()).equals(templateTypeName))
|
||||||
{
|
{
|
||||||
|
// it's not generated by the same template type
|
||||||
InputStream istream = null;
|
continue;
|
||||||
try
|
}
|
||||||
{
|
|
||||||
istream = new AVMRemoteInputStream(this.avmRemote.getInputHandle(-1, avmPath + '/' + entryName),
|
pv = this.avmRemote.getNodeProperty(-1,
|
||||||
this.avmRemote);
|
avmPath + '/' + entryName,
|
||||||
}
|
WCMModel.PROP_FORM_TRANSFORMER_DERIVED_FROM);
|
||||||
catch (AVMNotFoundException avmnfe)
|
|
||||||
{
|
if (pv != null)
|
||||||
// this is most likely happening because this is the current file we're generating
|
{
|
||||||
// and the avm is telling us that it has no content yet. we won't hit this once
|
// it's generated by a transformer (not the xml file)
|
||||||
// we have a way of distinguishing templateoutputmethodgenerated
|
continue;
|
||||||
// from templategenerated
|
}
|
||||||
LOGGER.debug("skipping "+ entryName, avmnfe);
|
|
||||||
}
|
final InputStream istream =
|
||||||
try
|
new AVMRemoteInputStream(this.avmRemote.getInputHandle(-1, avmPath + '/' + entryName),
|
||||||
{
|
this.avmRemote);
|
||||||
result.put(entryName, db.parse(istream));
|
try
|
||||||
}
|
{
|
||||||
catch (SAXException sax)
|
result.put(entryName, db.parse(istream));
|
||||||
{
|
}
|
||||||
// this is most likely happening because we have the same property for defined
|
finally
|
||||||
// for tempalteoutputmethodderived and templatederived so we can't distinguish them right now
|
{
|
||||||
// need to clean this up
|
istream.close();
|
||||||
LOGGER.debug("error parsing " + entryName+ "... skipping", sax);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
istream.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,6 +52,11 @@ public class FreeMarkerOutputMethod
|
|||||||
this.contentService = contentService;
|
this.contentService = contentService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NodeRef getNodeRef()
|
||||||
|
{
|
||||||
|
return this.nodeRef;
|
||||||
|
}
|
||||||
|
|
||||||
public void generate(final Document xmlContent,
|
public void generate(final Document xmlContent,
|
||||||
final TemplateType tt,
|
final TemplateType tt,
|
||||||
final Map<String, String> parameters,
|
final Map<String, String> parameters,
|
||||||
@@ -76,6 +81,6 @@ public class FreeMarkerOutputMethod
|
|||||||
{
|
{
|
||||||
return (String)
|
return (String)
|
||||||
this.nodeService.getProperty(this.nodeRef,
|
this.nodeService.getProperty(this.nodeRef,
|
||||||
WCMModel.PROP_TEMPLATE_OUTPUT_METHOD_DERIVED_FILE_EXTENSION);
|
WCMModel.PROP_FORM_TRANSFORMER_DERIVED_FILE_EXTENSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ public class XFormsBean
|
|||||||
private static final Log LOGGER = LogFactory.getLog(XFormsBean.class);
|
private static final Log LOGGER = LogFactory.getLog(XFormsBean.class);
|
||||||
|
|
||||||
private TemplateType tt;
|
private TemplateType tt;
|
||||||
private InstanceData instanceData = null;
|
private TemplateInputMethod.InstanceData instanceData = null;
|
||||||
private ChibaBean chibaBean;
|
private ChibaBean chibaBean;
|
||||||
private final LinkedList<XFormsEvent> eventLog = new LinkedList<XFormsEvent>();
|
private final LinkedList<XFormsEvent> eventLog = new LinkedList<XFormsEvent>();
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ public class XFormsBean
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @param instanceData the instance data being modified. */
|
/** @param instanceData the instance data being modified. */
|
||||||
public void setInstanceData(final InstanceData instanceData)
|
public void setInstanceData(final TemplateInputMethod.InstanceData instanceData)
|
||||||
{
|
{
|
||||||
this.instanceData = instanceData;
|
this.instanceData = instanceData;
|
||||||
}
|
}
|
||||||
|
@@ -54,6 +54,7 @@ import org.xml.sax.SAXException;
|
|||||||
public class XSLTOutputMethod
|
public class XSLTOutputMethod
|
||||||
implements TemplateOutputMethod
|
implements TemplateOutputMethod
|
||||||
{
|
{
|
||||||
|
//XXXarielb these should go into a more common location
|
||||||
private static final String ALFRESCO_NS = "http://www.alfresco.org/alfresco";
|
private static final String ALFRESCO_NS = "http://www.alfresco.org/alfresco";
|
||||||
private static final String ALFRESCO_NS_PREFIX = "alfresco";
|
private static final String ALFRESCO_NS_PREFIX = "alfresco";
|
||||||
|
|
||||||
@@ -70,6 +71,11 @@ public class XSLTOutputMethod
|
|||||||
this.nodeService = nodeService;
|
this.nodeService = nodeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NodeRef getNodeRef()
|
||||||
|
{
|
||||||
|
return this.nodeRef;
|
||||||
|
}
|
||||||
|
|
||||||
//XXXarielb this is totally dirty - need to figure a better way to do this
|
//XXXarielb this is totally dirty - need to figure a better way to do this
|
||||||
private static AVMRemote getAVMRemote()
|
private static AVMRemote getAVMRemote()
|
||||||
{
|
{
|
||||||
@@ -88,7 +94,7 @@ public class XSLTOutputMethod
|
|||||||
private static String toAVMPath(final ExpressionContext ec, String path)
|
private static String toAVMPath(final ExpressionContext ec, String path)
|
||||||
throws TransformerException
|
throws TransformerException
|
||||||
{
|
{
|
||||||
final XObject o = ec.getVariableOrParam(new QName("parent_path"));
|
final XObject o = ec.getVariableOrParam(new QName(ALFRESCO_NS, ALFRESCO_NS_PREFIX, "parent_path"));
|
||||||
if (o == null)
|
if (o == null)
|
||||||
return null;
|
return null;
|
||||||
String avmPath = o.toString();
|
String avmPath = o.toString();
|
||||||
@@ -111,6 +117,15 @@ public class XSLTOutputMethod
|
|||||||
return ef.getXMLDocument(XSLTOutputMethod.toAVMPath(ec, path));
|
return ef.getXMLDocument(XSLTOutputMethod.toAVMPath(ec, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static NodeIterator getXMLDocuments(final ExpressionContext ec,
|
||||||
|
final String templateTypeName)
|
||||||
|
throws TransformerException,
|
||||||
|
IOException,
|
||||||
|
SAXException
|
||||||
|
{
|
||||||
|
return XSLTOutputMethod.getXMLDocuments(ec, templateTypeName, "");
|
||||||
|
}
|
||||||
|
|
||||||
public static NodeIterator getXMLDocuments(final ExpressionContext ec,
|
public static NodeIterator getXMLDocuments(final ExpressionContext ec,
|
||||||
final String templateTypeName,
|
final String templateTypeName,
|
||||||
String path)
|
String path)
|
||||||
@@ -228,7 +243,7 @@ public class XSLTOutputMethod
|
|||||||
for (Map.Entry<String, String> e : parameters.entrySet())
|
for (Map.Entry<String, String> e : parameters.entrySet())
|
||||||
{
|
{
|
||||||
final Element el = xslDocument.createElementNS(XSL_NS, XSL_NS_PREFIX + ":variable");
|
final Element el = xslDocument.createElementNS(XSL_NS, XSL_NS_PREFIX + ":variable");
|
||||||
el.setAttribute("name", e.getKey());
|
el.setAttribute("name", ALFRESCO_NS_PREFIX + ':' + e.getKey());
|
||||||
el.appendChild(xslDocument.createTextNode(e.getValue()));
|
el.appendChild(xslDocument.createTextNode(e.getValue()));
|
||||||
docEl.insertBefore(el, docEl.getFirstChild());
|
docEl.insertBefore(el, docEl.getFirstChild());
|
||||||
}
|
}
|
||||||
@@ -300,6 +315,6 @@ public class XSLTOutputMethod
|
|||||||
{
|
{
|
||||||
return (String)
|
return (String)
|
||||||
this.nodeService.getProperty(this.nodeRef,
|
this.nodeService.getProperty(this.nodeRef,
|
||||||
WCMModel.PROP_TEMPLATE_OUTPUT_METHOD_DERIVED_FILE_EXTENSION);
|
WCMModel.PROP_FORM_TRANSFORMER_DERIVED_FILE_EXTENSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,8 +9,6 @@
|
|||||||
doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
|
doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
|
||||||
<xsl:preserve-space elements="*"/>
|
<xsl:preserve-space elements="*"/>
|
||||||
|
|
||||||
<xsl:variable name="my_variable">my_variable has a value</xsl:variable>
|
|
||||||
<xsl:variable name="my_variable_as_arg">my_variable_as_arg has a value</xsl:variable>
|
|
||||||
<xsl:template match="/">
|
<xsl:template match="/">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@@ -36,11 +34,11 @@ body
|
|||||||
<div>Generated by output-method-callout.xsl</div>
|
<div>Generated by output-method-callout.xsl</div>
|
||||||
<div class="name">My value accessed using /simple/string:</div>
|
<div class="name">My value accessed using /simple/string:</div>
|
||||||
<span><xsl:value-of select="/simple/string"/></span>
|
<span><xsl:value-of select="/simple/string"/></span>
|
||||||
<div class="name">My value accessed using alfresco:getXMLDocument(<xsl:value-of select="$derived_from_file_name"/>):</div>
|
<div class="name">My value accessed using alfresco:getXMLDocument(<xsl:value-of select="$alfresco:derived_from_file_name"/>):</div>
|
||||||
<span><xsl:value-of select="alfresco:getXMLDocument($derived_from_file_name)/simple/string"/></span>
|
<span><xsl:value-of select="alfresco:getXMLDocument($alfresco:derived_from_file_name)/simple/string"/></span>
|
||||||
<div class="name">Values from xml files generated by in <xsl:value-of select="$parent_path"/>:</div>
|
<div class="name">Values from xml files generated by in <xsl:value-of select="$alfresco:parent_path"/>:</div>
|
||||||
<ul>
|
<ul>
|
||||||
<xsl:for-each select="alfresco:getXMLDocuments('output-method-callout', '')/simple">
|
<xsl:for-each select="alfresco:getXMLDocuments('output-method-callout')/simple">
|
||||||
<li><xsl:value-of select="@alfresco:file-name"/> = <xsl:value-of select="string"/></li>
|
<li><xsl:value-of select="@alfresco:file-name"/> = <xsl:value-of select="string"/></li>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</ul>
|
</ul>
|
||||||
|
@@ -37,7 +37,7 @@ final CreateWebContentWizard wiz = (CreateWebContentWizard)
|
|||||||
TemplateType tt = wiz.getTemplateType();
|
TemplateType tt = wiz.getTemplateType();
|
||||||
TemplateInputMethod tim = tt.getInputMethods().get(0);
|
TemplateInputMethod tim = tt.getInputMethods().get(0);
|
||||||
final TemplatingService ts = TemplatingService.getInstance();
|
final TemplatingService ts = TemplatingService.getInstance();
|
||||||
final InstanceData instanceData = new InstanceData()
|
final TemplateInputMethod.InstanceData instanceData = new TemplateInputMethod.InstanceData()
|
||||||
{
|
{
|
||||||
public Document getContent()
|
public Document getContent()
|
||||||
{
|
{
|
||||||
|
@@ -36,11 +36,11 @@
|
|||||||
final AVMBrowseBean browseBean = (AVMBrowseBean)session.getAttribute("AVMBrowseBean");
|
final AVMBrowseBean browseBean = (AVMBrowseBean)session.getAttribute("AVMBrowseBean");
|
||||||
NodeRef nr = browseBean.getAvmActionNode().getNodeRef();
|
NodeRef nr = browseBean.getAvmActionNode().getNodeRef();
|
||||||
final AVMEditBean editBean = (AVMEditBean)session.getAttribute("AVMEditBean");
|
final AVMEditBean editBean = (AVMEditBean)session.getAttribute("AVMEditBean");
|
||||||
final NodeRef ttNodeRef = (NodeRef)browseBean.getNodeService().getProperty(nr, WCMModel.PROP_TEMPLATE_DERIVED_FROM);
|
final NodeRef ttNodeRef = (NodeRef)browseBean.getNodeService().getProperty(nr, WCMModel.PROP_FORM_DERIVED_FROM);
|
||||||
final TemplatingService ts = TemplatingService.getInstance();
|
final TemplatingService ts = TemplatingService.getInstance();
|
||||||
final TemplateType tt = ts.getTemplateType(ttNodeRef);
|
final TemplateType tt = ts.getTemplateType(ttNodeRef);
|
||||||
TemplateInputMethod tim = tt.getInputMethods().get(0);
|
TemplateInputMethod tim = tt.getInputMethods().get(0);
|
||||||
final InstanceData instanceData = new InstanceData()
|
final TemplateInputMethod.InstanceData instanceData = new TemplateInputMethod.InstanceData()
|
||||||
{
|
{
|
||||||
public Document getContent()
|
public Document getContent()
|
||||||
{
|
{
|
||||||
@@ -62,7 +62,7 @@ final InstanceData instanceData = new InstanceData()
|
|||||||
};
|
};
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<r:page titleId="title_edit_text_inline">
|
<r:page titleId="title_edit_xml_inline">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function _xforms_getSubmitButtons()
|
function _xforms_getSubmitButtons()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user