You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/11/16 15:41:44 UTC
svn commit: r595679 - in /lenya/sandbox/modules: docustyle/resources/css/
externallinks/config/sitemap/
externallinks/java/src/org/apache/lenya/modules/externallinks/ forrest/
forrest/config/ forrest/java/src/org/apache/lenya/modules/forrest/
forrest/j...
Author: andreas
Date: Fri Nov 16 06:41:42 2007
New Revision: 595679
URL: http://svn.apache.org/viewvc?rev=595679&view=rev
Log:
Adding more functionality to externallinks and propertiesdocument modules
Added:
lenya/sandbox/modules/propertiesdocument/config/menu.xsp
lenya/sandbox/modules/propertiesdocument/menus.xmap
lenya/sandbox/modules/propertiesdocument/resources/i18n/
lenya/sandbox/modules/propertiesdocument/resources/i18n/cmsui.xml
lenya/sandbox/modules/propertiesdocument/resources/i18n/cmsui_de.xml
lenya/sandbox/modules/propertiesdocument/sitemap.xmap
lenya/sandbox/modules/propertiesdocument/xslt/
lenya/sandbox/modules/propertiesdocument/xslt/properties2xhtml.xsl
Modified:
lenya/sandbox/modules/docustyle/resources/css/page.css
lenya/sandbox/modules/externallinks/config/sitemap/transformers.xmap
lenya/sandbox/modules/externallinks/java/src/org/apache/lenya/modules/externallinks/ExternalLinks.java
lenya/sandbox/modules/forrest/config/module.xml
lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/Importer.java
lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/ImportTest.java
lenya/sandbox/modules/forrest/sitemap.xmap
lenya/sandbox/modules/propertiesdocument/java/src/org/apache/lenya/modules/propertiesdocument/PropertiesDocument.java
Modified: lenya/sandbox/modules/docustyle/resources/css/page.css
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/docustyle/resources/css/page.css?rev=595679&r1=595678&r2=595679&view=diff
==============================================================================
--- lenya/sandbox/modules/docustyle/resources/css/page.css (original)
+++ lenya/sandbox/modules/docustyle/resources/css/page.css Fri Nov 16 06:41:42 2007
@@ -17,8 +17,6 @@
/* page */
-@import url("news.css");
-
#page {
padding: 0px;
margin: 0px;
@@ -87,8 +85,15 @@
background: url('/modules/docustyle/images/corner-dddddd.png') right top no-repeat;
}
-.tab a:hover span, .tab-selected a span {
+.tab a:hover span {
+ background-color: #C0C0D0;
+}
+
+.tab-selected a span {
background-color: #AAAABB;
+ /*
+ background-color: #FFFFFF;
+ */
color: #333344;
}
@@ -493,4 +498,26 @@
#apacheBreadcrumb a {
text-decoration: none;
+}
+
+table.properties {
+ border-collapse: collapse;
+}
+
+table.properties th, table.properties td {
+ text-align: left;
+ padding: .2em 2em .2em .5em;
+ border: none;
+}
+
+table.properties th {
+ background-color: #DDDDDD;
+}
+
+table.properties tr.row1 {
+ background-color: #EEEEEE;
+}
+
+table.properties tr.row2 {
+ background-color: #FFFFFF;
}
Modified: lenya/sandbox/modules/externallinks/config/sitemap/transformers.xmap
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/externallinks/config/sitemap/transformers.xmap?rev=595679&r1=595678&r2=595679&view=diff
==============================================================================
--- lenya/sandbox/modules/externallinks/config/sitemap/transformers.xmap (original)
+++ lenya/sandbox/modules/externallinks/config/sitemap/transformers.xmap Fri Nov 16 06:41:42 2007
@@ -17,7 +17,7 @@
-->
<xmap xpath="/sitemap/components/transformers"
- unless="/sitemap/components/transformers/transformer[@name = 'uuid2url']"
+ unless="/sitemap/components/transformers/transformer[@name = 'externallinks-xhtml']"
xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:transformer name="externallinks-xhtml" logger="lenya.sitemap.transformer.externallinks-xhtml"
Modified: lenya/sandbox/modules/externallinks/java/src/org/apache/lenya/modules/externallinks/ExternalLinks.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/externallinks/java/src/org/apache/lenya/modules/externallinks/ExternalLinks.java?rev=595679&r1=595678&r2=595679&view=diff
==============================================================================
--- lenya/sandbox/modules/externallinks/java/src/org/apache/lenya/modules/externallinks/ExternalLinks.java (original)
+++ lenya/sandbox/modules/externallinks/java/src/org/apache/lenya/modules/externallinks/ExternalLinks.java Fri Nov 16 06:41:42 2007
@@ -56,5 +56,9 @@
public String getUri(String name) {
return this.properties.get(name);
}
+
+ public void clear() {
+ this.properties.clear();
+ }
}
Modified: lenya/sandbox/modules/forrest/config/module.xml
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/config/module.xml?rev=595679&r1=595678&r2=595679&view=diff
==============================================================================
--- lenya/sandbox/modules/forrest/config/module.xml (original)
+++ lenya/sandbox/modules/forrest/config/module.xml Fri Nov 16 06:41:42 2007
@@ -20,6 +20,7 @@
<module xmlns="http://apache.org/lenya/module/1.0">
<id>org.apache.lenya.modules.forrest</id>
+ <depends module="org.apache.lenya.modules.externallinks"/>
<package>org.apache.lenya.modules</package>
<version>0.1-dev</version>
<name>Forrest</name>
Modified: lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/Importer.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/Importer.java?rev=595679&r1=595678&r2=595679&view=diff
==============================================================================
--- lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/Importer.java (original)
+++ lenya/sandbox/modules/forrest/java/src/org/apache/lenya/modules/forrest/Importer.java Fri Nov 16 06:41:42 2007
@@ -31,6 +31,9 @@
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.ServiceSelector;
+import org.apache.commons.io.IOUtils;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
import org.apache.lenya.cms.cocoon.source.SourceUtil;
import org.apache.lenya.cms.linking.Link;
import org.apache.lenya.cms.publication.Area;
@@ -38,7 +41,11 @@
import org.apache.lenya.cms.publication.DocumentFactory;
import org.apache.lenya.cms.publication.DocumentManager;
import org.apache.lenya.cms.publication.ResourceType;
+import org.apache.lenya.cms.site.SiteException;
import org.apache.lenya.cms.site.SiteNode;
+import org.apache.lenya.cms.site.SiteStructure;
+import org.apache.lenya.modules.externallinks.ExternalLinks;
+import org.apache.lenya.modules.externallinks.ExternalLinksRewriter;
import org.apache.lenya.xml.DocumentHelper;
import org.apache.lenya.xml.NamespaceHelper;
import org.apache.xpath.XPathAPI;
@@ -103,12 +110,17 @@
info.helper = helper;
info.docMgr = docMgr;
info.links = links;
+
+ info.externalLinks = new ExternalLinks(this.manager, area, getLogger());
+ info.externalLinksRewriter = new ExternalLinksRewriter(this.manager, area, getLogger());
NodeList nodes = XPathAPI.selectNodeList(siteXml.getDocumentElement(), "//*");
info.number = nodes.getLength();
info.start();
+ createExternalLinks(info);
importChildren(info, siteXml.getDocumentElement(), baseUri, "");
+
convertLinks(info);
} finally {
if (docMgr != null) {
@@ -158,6 +170,13 @@
* String path = concatPath(basePath, nodeName); SiteNode node =
* info.area.getSite().add(path); node.setHref(href);
*/
+ }
+ else if (info.externalLinksRewriter.matches(href)) {
+ SiteNode node = getSiteNode(info, basePath, nodeName);
+ String externalUri = info.externalLinksRewriter.rewrite(href);
+
+ // FIXME: not supported yet
+ // node.setHref(externalUri);
} else if (sourceUri.endsWith(".png") || sourceUri.endsWith(".gif")) {
createDocument(info, info.mediaResourceType, sourceUri, basePath, nodeName, linkName,
title);
@@ -172,10 +191,7 @@
}
if (xml == null) {
- // create container site node
- String path = concatPath(basePath, nodeName);
- SiteNode node = info.area.getSite().add(path);
- // TODO: add link (not supported by API yet)
+ SiteNode node = getSiteNode(info, basePath, nodeName);
} else {
String localName = xml.getDocumentElement().getLocalName();
ResourceType type = null;
@@ -194,6 +210,20 @@
}
+ protected SiteNode getSiteNode(ImportInfo info, String basePath, String nodeName)
+ throws SiteException {
+ SiteNode node;
+ String path = concatPath(basePath, nodeName);
+ SiteStructure site = info.area.getSite();
+ if (site.contains(path)) {
+ node = site.getNode(path);
+ } else {
+ node = site.add(path);
+ // TODO: add link (not supported by API yet)
+ }
+ return node;
+ }
+
protected String concatPath(String path1, String path2) {
StringBuffer path = new StringBuffer();
path.append(path1);
@@ -211,8 +241,7 @@
protected String getSampleUri(ResourceType type) {
ResourceType.Sample sample = type.getSample(type.getSampleNames()[0]);
- String sourceUri = sample.getUri();
- return sourceUri;
+ return sample.getUri();
}
protected void createDocument(ImportInfo info, ResourceType type, String sourceUri,
@@ -220,15 +249,50 @@
String path = concatPath(basePath, nodeName);
DocumentFactory factory = info.area.getPublication().getFactory();
try {
- int lastDotIndex = sourceUri.lastIndexOf(".");
- String extension = sourceUri.substring(lastDotIndex + 1);
- Document doc = info.docMgr.add(factory, type, sourceUri, info.area.getPublication(),
- info.area.getName(), path, LANGUAGE, extension, title, true);
- Link link = new Link();
- link.setUuid(doc.getUUID());
- info.links.put(linkName, link.getUri());
- log("Created " + extension.toUpperCase() + " document (" + info.counterToString()
- + ") [" + path + "]");
+
+ Document doc = null;
+ SiteStructure site = info.area.getSite();
+ if (site.contains(path)) {
+ SiteNode node = site.getNode(path);
+ org.apache.lenya.cms.site.Link link = node.getLink(info.area.getPublication()
+ .getDefaultLanguage());
+ if (!link.getLabel().equals(title)) {
+ link.setLabel(title);
+ }
+ if (node.getUuid() != null) {
+ doc = link.getDocument();
+ Source source = null;
+ SourceResolver resolver = null;
+ try {
+ resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
+ source = resolver.resolveURI(sourceUri);
+ String sourceString = IOUtils.toString(source.getInputStream());
+ String docString = IOUtils.toString(doc.getInputStream());
+ if (sourceString.equals(docString)) {
+ log(path + " is up to date (" + info.counterToString() + ")");
+ } else {
+ log("Updating " + path + " (" + info.counterToString() + ")");
+ IOUtils.write(sourceString, doc.getOutputStream());
+ }
+ } finally {
+ if (resolver != null) {
+ this.manager.release(resolver);
+ }
+ }
+ }
+ }
+ if (doc == null) {
+ int lastDotIndex = sourceUri.lastIndexOf(".");
+ String extension = sourceUri.substring(lastDotIndex + 1);
+ doc = info.docMgr.add(factory, type, sourceUri, info.area.getPublication(),
+ info.area.getName(), path, LANGUAGE, extension, title, true);
+ Link link = new Link();
+ link.setUuid(doc.getUUID());
+ info.links.put(linkName, link.getUri());
+ log("Created " + extension.toUpperCase() + " document (" + info.counterToString()
+ + ") [" + path + "]");
+ }
+
} catch (Exception e) {
log("A problem occured:");
log("Path: '" + path + "'");
@@ -258,6 +322,8 @@
protected Map links;
protected long startTime;
protected Calendar startCal;
+ protected ExternalLinks externalLinks;
+ protected ExternalLinksRewriter externalLinksRewriter;
protected static final String dateFormat = "HH:mm:ss";
@@ -332,6 +398,23 @@
Element[] children = DocumentHelper.getChildren(element);
for (int i = 0; i < children.length; i++) {
convertLinks(info, children[i]);
+ }
+ }
+
+ protected void createExternalLinks(ImportInfo info) {
+ Element docElement = info.helper.getDocument().getDocumentElement();
+ Element baseElement = info.helper.getFirstChild(docElement, "external-refs");
+ createExternalLinks(info, baseElement, "");
+ }
+
+ protected void createExternalLinks(ImportInfo info, Element element, String baseUri) {
+ Element[] children = info.helper.getChildren(element);
+ for (int i = 0; i < children.length; i++) {
+ String name = children[i].getLocalName();
+ String uri = baseUri + children[i].getAttribute("href");
+ log("Adding external link: " + name + " -> " + uri);
+ info.externalLinks.setUri(name, uri);
+ createExternalLinks(info, children[i], uri);
}
}
Modified: lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/ImportTest.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/ImportTest.java?rev=595679&r1=595678&r2=595679&view=diff
==============================================================================
--- lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/ImportTest.java (original)
+++ lenya/sandbox/modules/forrest/java/test/org/apache/lenya/modules/forrest/ImportTest.java Fri Nov 16 06:41:42 2007
@@ -52,11 +52,9 @@
Publication pub = getPublication(session, PUB_ID);
Area area = pub.getArea("authoring");
- if (area.getDocuments().length == 0) {
- Importer importer = new Importer(getManager(), getLogger());
- importer.importSite(area);
- session.commit();
- }
+ Importer importer = new Importer(getManager(), getLogger());
+ importer.importSite(area);
+ session.commit();
assertTrue(area.getSite().contains("/project-information"));
}
Modified: lenya/sandbox/modules/forrest/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/forrest/sitemap.xmap?rev=595679&r1=595678&r2=595679&view=diff
==============================================================================
--- lenya/sandbox/modules/forrest/sitemap.xmap (original)
+++ lenya/sandbox/modules/forrest/sitemap.xmap Fri Nov 16 06:41:42 2007
@@ -96,6 +96,7 @@
<map:parameter name="language" value="{4}"/>
</map:transform>
<map:transform type="cinclude"/>
+ <map:transform type="externallinks-xhtml"/>
<map:serialize type="xml"/>
</map:match>
Added: lenya/sandbox/modules/propertiesdocument/config/menu.xsp
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/propertiesdocument/config/menu.xsp?rev=595679&view=auto
==============================================================================
--- lenya/sandbox/modules/propertiesdocument/config/menu.xsp (added)
+++ lenya/sandbox/modules/propertiesdocument/config/menu.xsp Fri Nov 16 06:41:42 2007
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ 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.
+-->
+
+<!-- $Id: generic.xsp 155806 2005-03-01 17:55:42Z andreas $ -->
+
+<xsp:page
+ language="java"
+ xmlns:xsp="http://apache.org/xsp"
+ xmlns:xsp-request="http://apache.org/xsp/request/2.0"
+ xmlns:input="http://apache.org/cocoon/xsp/input/1.0"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+ xmlns:wf="http://apache.org/cocoon/lenya/workflow/1.0"
+ xmlns:uc="http://apache.org/cocoon/lenya/usecase/1.0"
+ xmlns="http://apache.org/cocoon/lenya/menubar/1.0"
+>
+
+ <xsp:structure>
+ <xsp:include>org.apache.lenya.cms.publication.Document</xsp:include>
+ <xsp:include>org.apache.lenya.cms.publication.Publication</xsp:include>
+ </xsp:structure>
+
+ <menu>
+
+ <menus>
+ <menu i18n:attr="name" name="Edit">
+ <xsp:logic>
+ try {
+ Object doc = <input:get-attribute module="page-envelope" as="object" name="document"/>;
+ if (doc instanceof Document && ((Document) doc).exists()) {
+ String doctype = <input:get-attribute module="page-envelope" as="string" name="document-type"/>;
+ if ("properties".equals(doctype)) {
+ <block areas="authoring">
+ <item uc:usecase="editors.oneform" href="?"><i18n:text>With one Form</i18n:text></item>
+ </block>
+ }
+ }
+ }
+ catch (Exception e) {
+ throw new ProcessingException("Error during menu generation: ", e);
+ }
+ </xsp:logic>
+ </menu>
+
+ </menus>
+
+ </menu>
+</xsp:page>
Modified: lenya/sandbox/modules/propertiesdocument/java/src/org/apache/lenya/modules/propertiesdocument/PropertiesDocument.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/propertiesdocument/java/src/org/apache/lenya/modules/propertiesdocument/PropertiesDocument.java?rev=595679&r1=595678&r2=595679&view=diff
==============================================================================
--- lenya/sandbox/modules/propertiesdocument/java/src/org/apache/lenya/modules/propertiesdocument/PropertiesDocument.java (original)
+++ lenya/sandbox/modules/propertiesdocument/java/src/org/apache/lenya/modules/propertiesdocument/PropertiesDocument.java Fri Nov 16 06:41:42 2007
@@ -196,4 +196,8 @@
}
return this.delegate;
}
+
+ public void clear() {
+ properties().clear();
+ }
}
Added: lenya/sandbox/modules/propertiesdocument/menus.xmap
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/propertiesdocument/menus.xmap?rev=595679&view=auto
==============================================================================
--- lenya/sandbox/modules/propertiesdocument/menus.xmap (added)
+++ lenya/sandbox/modules/propertiesdocument/menus.xmap Fri Nov 16 06:41:42 2007
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ 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.
+-->
+
+<!-- $Id: menus.xmap 178738 2005-05-27 03:42:09Z gregor $ -->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+ <map:pipelines>
+
+ <map:pipeline>
+
+ <map:match pattern="**">
+ <map:generate type="serverpages" src="fallback://lenya/modules/propertiesdocument/config/menu.xsp"/>
+ <map:serialize type="xml"/>
+ </map:match>
+
+ </map:pipeline>
+
+ </map:pipelines>
+</map:sitemap>
Added: lenya/sandbox/modules/propertiesdocument/resources/i18n/cmsui.xml
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/propertiesdocument/resources/i18n/cmsui.xml?rev=595679&view=auto
==============================================================================
--- lenya/sandbox/modules/propertiesdocument/resources/i18n/cmsui.xml (added)
+++ lenya/sandbox/modules/propertiesdocument/resources/i18n/cmsui.xml Fri Nov 16 06:41:42 2007
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ 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.
+-->
+
+<!-- $Id: cmsui.xml 446564 2006-09-15 10:13:16Z andreas $ -->
+
+<catalogue xml:lang="en" xmlns:xhtml="http://www.w3.org/1999/xhtml">
+
+ <message key="resourceType-properties">Properties</message>
+
+</catalogue>
Added: lenya/sandbox/modules/propertiesdocument/resources/i18n/cmsui_de.xml
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/propertiesdocument/resources/i18n/cmsui_de.xml?rev=595679&view=auto
==============================================================================
--- lenya/sandbox/modules/propertiesdocument/resources/i18n/cmsui_de.xml (added)
+++ lenya/sandbox/modules/propertiesdocument/resources/i18n/cmsui_de.xml Fri Nov 16 06:41:42 2007
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ 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.
+-->
+
+<!-- $Id: cmsui_de.xml 446564 2006-09-15 10:13:16Z andreas $ -->
+
+<catalogue xml:lang="de" xmlns:xhtml="http://www.w3.org/1999/xhtml">
+
+ <message key="resourceType-properties">Eigenschaften</message>
+
+</catalogue>
+
Added: lenya/sandbox/modules/propertiesdocument/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/propertiesdocument/sitemap.xmap?rev=595679&view=auto
==============================================================================
--- lenya/sandbox/modules/propertiesdocument/sitemap.xmap (added)
+++ lenya/sandbox/modules/propertiesdocument/sitemap.xmap Fri Nov 16 06:41:42 2007
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ 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.
+-->
+
+<!-- $Id: doctypes.xmap 179488 2005-06-02 02:29:39Z gregor $ -->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+<!-- =========================== Components ================================ -->
+
+ <map:pipelines>
+
+ <map:pipeline>
+
+ <!-- parametrized doctype matcher -->
+ <!-- pattern="{format}.xml" -->
+ <map:match pattern="*.xml">
+ <map:generate src="cocoon:/{1}.xml/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-uuid}/{page-envelope:document-language}"/>
+ <map:serialize type="xml"/>
+ </map:match>
+
+ <!-- {format}.xml/{pubId}/{area}/{uuid}/{language} -->
+ <map:match pattern="*.xml/*/*/*/*">
+ <map:generate src="lenya-document:{4},lang={5}{link:rev}"/>
+ <map:transform src="fallback://lenya/modules/propertiesdocument/xslt/properties2xhtml.xsl">
+ <map:parameter name="title" value="{dublincore:title}"/>
+ </map:transform>
+ <map:serialize type="xml"/>
+ </map:match>
+
+ <map:match pattern="icon/*/*/*/*">
+ <map:read src="fallback://lenya/modules/xhtml/resources/icons/xhtml.gif"/>
+ </map:match>
+
+ </map:pipeline>
+
+ </map:pipelines>
+</map:sitemap>
Added: lenya/sandbox/modules/propertiesdocument/xslt/properties2xhtml.xsl
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/propertiesdocument/xslt/properties2xhtml.xsl?rev=595679&view=auto
==============================================================================
--- lenya/sandbox/modules/propertiesdocument/xslt/properties2xhtml.xsl (added)
+++ lenya/sandbox/modules/propertiesdocument/xslt/properties2xhtml.xsl Fri Nov 16 06:41:42 2007
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ 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.
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:p="http://apache.org/lenya/propertiesdocument/1.0"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+ xmlns="http://www.w3.org/1999/xhtml">
+
+ <xsl:param name="title"/>
+ <xsl:param name="maxLength" select="number(50)"/>
+
+
+ <xsl:template match="/">
+ <html>
+ <body>
+ <div id="body">
+ <h1><xsl:value-of select="$title"/></h1>
+ <xsl:apply-templates select="p:properties"/>
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+
+
+ <xsl:template match="p:properties">
+ <table class="properties">
+ <tr>
+ <th><i18n:text>Key</i18n:text></th>
+ <th><i18n:text>Value</i18n:text></th>
+ </tr>
+ <xsl:apply-templates select="p:property">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </table>
+ </xsl:template>
+
+
+ <xsl:template match="p:property">
+ <tr class="row{position() mod 2 + 1}">
+ <td><xsl:value-of select="@name"/></td>
+ <td>
+ <xsl:value-of select="substring(@value, 1, $maxLength)"/>
+ <xsl:if test="string-length(@value) > $maxLength"> ...</xsl:if>
+ </td>
+ </tr>
+ </xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org