mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- fix error in namespaces in get company footer
- add a very demoware ready sample multi channel output, meaning generating a really ugly plain text version of the press release and adding a link to it from the html version. - removing the company footer xsl as it is no longer mandatory to have one - passing more parameters to the xsl process - rather ugly implementation - needs to be revisited git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4044 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,6 +18,8 @@ package org.alfresco.web.templating;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
@@ -71,7 +73,10 @@ public class OutputUtil
|
||||
LOGGER.debug("Created file node for file: " +
|
||||
fullAvmPath);
|
||||
final OutputStreamWriter out = new OutputStreamWriter(fileOut);
|
||||
tom.generate(xml, tt, sandBoxUrl, out);
|
||||
|
||||
final HashMap<String, String> parameters =
|
||||
getOutputMethodParameters(sandBoxUrl, fileName, generatedFileName);
|
||||
tom.generate(xml, tt, parameters, out);
|
||||
out.close();
|
||||
|
||||
NodeRef outputNodeRef = AVMNodeConverter.ToNodeRef(-1, fullAvmPath);
|
||||
@@ -136,7 +141,9 @@ public class OutputUtil
|
||||
}
|
||||
|
||||
final OutputStreamWriter writer = new OutputStreamWriter(out);
|
||||
tom.generate(xml, tt, sandBoxUrl, writer);
|
||||
final HashMap<String, String> parameters =
|
||||
getOutputMethodParameters(sandBoxUrl, fileName, generatedFileName);
|
||||
tom.generate(xml, tt, parameters, writer);
|
||||
writer.close();
|
||||
LOGGER.debug("generated " + fileName + " using " + tom);
|
||||
}
|
||||
@@ -148,4 +155,15 @@ public class OutputUtil
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private static HashMap<String, String> getOutputMethodParameters(final String sandBoxUrl,
|
||||
final String fileName,
|
||||
final String generatedFileName)
|
||||
{
|
||||
final HashMap<String, String> parameters = new HashMap<String, String>();
|
||||
parameters.put("avm_store_url", sandBoxUrl);
|
||||
parameters.put("derived_from_file_name", fileName);
|
||||
parameters.put("generated_file_name", generatedFileName);
|
||||
return parameters;
|
||||
}
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ package org.alfresco.web.templating;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.Writer;
|
||||
import java.util.Map;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
/**
|
||||
@@ -37,7 +38,7 @@ public interface TemplateOutputMethod
|
||||
*/
|
||||
public void generate(final Document xmlContent,
|
||||
final TemplateType tt,
|
||||
final String sandBoxUrl,
|
||||
final Map<String, String> parameters,
|
||||
final Writer out)
|
||||
throws Exception;
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package org.alfresco.web.templating.xforms;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Map;
|
||||
import org.alfresco.web.templating.*;
|
||||
import org.chiba.xml.util.DOMUtil;
|
||||
|
||||
@@ -33,7 +34,7 @@ public class FreeMarkerOutputMethod
|
||||
|
||||
public void generate(final Document xmlContent,
|
||||
final TemplateType tt,
|
||||
final String sandBoxUrl,
|
||||
final Map<String, String> parameters,
|
||||
final Writer out)
|
||||
{
|
||||
}
|
||||
|
@@ -43,6 +43,7 @@ import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import java.util.Map;
|
||||
|
||||
public class XSLTOutputMethod
|
||||
implements TemplateOutputMethod
|
||||
@@ -62,7 +63,7 @@ public class XSLTOutputMethod
|
||||
|
||||
public void generate(final Document xmlContent,
|
||||
final TemplateType tt,
|
||||
final String sandBoxUrl,
|
||||
final Map<String, String> parameters,
|
||||
final Writer out)
|
||||
throws ParserConfigurationException,
|
||||
TransformerConfigurationException,
|
||||
@@ -70,6 +71,8 @@ public class XSLTOutputMethod
|
||||
SAXException,
|
||||
IOException
|
||||
{
|
||||
// XXXarielb - dirty - fix this
|
||||
final String sandBoxUrl = (String)parameters.get("avm_store_url");
|
||||
final TransformerFactory tf = TransformerFactory.newInstance();
|
||||
final TemplatingService ts = TemplatingService.getInstance();
|
||||
final DOMSource source = new DOMSource(ts.parseXML(this.nodeRef));
|
||||
@@ -103,7 +106,12 @@ public class XSLTOutputMethod
|
||||
}
|
||||
}
|
||||
});
|
||||
t.setParameter("avm_store_url", sandBoxUrl);
|
||||
|
||||
for (Map.Entry<String, String> e : parameters.entrySet())
|
||||
{
|
||||
t.setParameter(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
LOGGER.debug("setting parameter avm_store_url=" + sandBoxUrl);
|
||||
final StreamResult result = new StreamResult(out);
|
||||
try
|
||||
|
@@ -1,12 +1,12 @@
|
||||
<jsp:root version="1.2"
|
||||
xmlns:jsp="http://java.sun.com/JSP/Page"
|
||||
xmlns:alfresco="http://www.alfresco.org/alfresco"
|
||||
xmlns:c="http://java.sun.com/jsp/jstl/core"
|
||||
xmlns:pr="http://www.alfresco.org/pr">
|
||||
<jsp:directive.page language="java" contentType="text/html; charset=UTF-8"/>
|
||||
<jsp:directive.page isELIgnored="false"/>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
elementFormDefault="qualified">
|
||||
xmlns:alfresco="http://www.alfresco.org/alfresco"
|
||||
elementFormDefault="qualified">
|
||||
<xs:simpleType name="company-footer">
|
||||
<xs:restriction base="xs:string">
|
||||
<c:forEach items="${pr:getCompanyFooters(pageContext)}" var="companyFooter">
|
||||
|
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:alfresco="http://www.alfresco.org/alfresco"
|
||||
exclude-result-prefixes="xhtml">
|
||||
<xsl:output method="html" version="4.01" encoding="UTF-8" indent="yes"
|
||||
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
|
||||
<xsl:preserve-space elements="*"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
this template produces no output. the xml is used by press-release.xsl
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
@@ -3,6 +3,7 @@
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:alfresco="http://www.alfresco.org/alfresco"
|
||||
xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
|
||||
exclude-result-prefixes="xhtml">
|
||||
<xsl:output method="html" encoding="UTF-8" indent="yes"
|
||||
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
@@ -10,6 +11,7 @@
|
||||
|
||||
<xsl:preserve-space elements="*"/>
|
||||
<xsl:param name="avm_store_url" select="'not_specified'"/>
|
||||
<xsl:param name="derived_from_file_name" select="'not_specified'"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
@@ -98,6 +100,10 @@
|
||||
<div><p>Chuck Tanowitz<br />Schwartz Communications<br />+1 781 684-0770<br />alfresco@schwartz-pr.com</p></div>
|
||||
</xsl:if>
|
||||
<!-- END MAIN CONTENT -->
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href"><xsl:value-of select="fn:replaceAll($derived_from_file_name, '.xml', '.txt')"/></xsl:attribute>
|
||||
<xsl:text>view plain text version</xsl:text>
|
||||
</xsl:element>
|
||||
</div>
|
||||
<!-- Feature Content -->
|
||||
<div id="right_content"> </div>
|
||||
|
Reference in New Issue
Block a user