Added: lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.1193910778308.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.1193910778308.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.1193910778308.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.1193910778308.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2006 The Apache Software Foundation
+
+ Licensed 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: metadata.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Creating a Resource Type, Part 3: Presentation</title>
+ </header>
+ <body>
+
+ <section>
+ <title>A Basic Presentation Pipeline</title>
+ <p>
+ Now the Lenya web application can create new person documents, but
+ it won't be able to render them as HTML pages (or anything else) yet.
+ In our resource type declaration we specified the format <em>xhtml</em>.
+ According to this specification, we'll setup a basic presentation pipeline
+ which converts our FoaF XML document to XHTML.
+ </p>
+ <p>
+ First we'll add the sitemap (<code>$MODULE_HOME/sitemap.xmap</code>).
+ Note that some lines have been wrapped (marked with backslashes):
+ </p>
+ <source xml:space="preserve"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+ <map:pipelines>
+ <map:pipeline>
+
+ <!-- {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/person/xslt/foaf2xhtml.xsl"/>
+ <map:serialize type="xml"/>
+ </map:match>
+
+ <!-- The icon for person nodes in the sitetree. -->
+ <map:match pattern="icon/*/*/*/*">
+ <map:read src="fallback://lenya/modules/person/resources/icons/person.gif"/>
+ </map:match>
+
+ </map:pipeline>
+ </map:pipelines>
+</map:sitemap>
+ ]]></source>
+ <p>
+ The sitemap uses an XSLT stylesheet <code>$MODULE_HOME/xslt/foaf2xhtml.xsl</code>
+ to render the XHTML view of the FoaF file:
+ </p>
+ <source xml:space="preserve"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
+ xmlns="http://www.w3.org/1999/xhtml">
+
+ <xsl:template match="rdf:RDF">
+ <html>
+ <body>
+ <div id="body">
+ <xsl:apply-templates select="foaf:Person"/>
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="foaf:Person">
+ <h2>Person Details</h2>
+ <table class="person">
+ <tr>
+ <th>Title:</th>
+ <td><xsl:value-of select="foaf:title"/></td>
+ </tr>
+ <tr>
+ <th>Given name:</th>
+ <td><xsl:value-of select="foaf:givenname"/></td>
+ </tr>
+ <tr>
+ <th>Family name:</th>
+ <td><xsl:value-of select="foaf:family_name"/></td>
+ </tr>
+ <tr>
+ <th>E-Mail:</th>
+ <td>
+ <xsl:variable name="mbox" select="foaf:mbox/@rdf:resource"/>
+ <a href="{$mbox}">
+ <xsl:value-of select="substring-after($mbox, 'mailto:')"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <th>Phone:</th>
+ <td>
+ <xsl:variable name="phone" select="foaf:phone/@rdf:resource"/>
+ <xsl:value-of select="substring-after($phone, 'tel:')"/>
+ </td>
+ </tr>
+ <tr>
+ <th>Homepage:</th>
+ <td>
+ <xsl:variable name="homepage" select="foaf:workplaceHomepage/@rdf:resource"/>
+ <a href="{$homepage}"><xsl:value-of select="$homepage"/></a>
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+</xsl:stylesheet>]]></source>
+ </section>
+
+ <section>
+ <title>Adding the CSS</title>
+ <p>
+ The default publication allows to add custom CSS files for each resource type.
+ We want to style our table headers a bit, so we add the file
+ <code>pubs/default/resources/shared/css/person.css</code> with the following content:
+ </p>
+ <source xml:space="preserve"><![CDATA[table.person { font-size: small; }
+table.person th {
+ font-weight: normal;
+ color: #999999;
+ text-align: left;
+ padding-right: 1em;
+}]]></source>
+ </section>
+
+ <section>
+ <title>Creating our First Person Document</title>
+ <p>
+ Now it's time to check out if everything works as expected. First, we build the
+ Lenya web application to deploy our new resource type. If Lenya is running, shut it down.
+ Go to <code>$LENYA_HOME</code> and execute
+ </p>
+ <source xml:space="preserve">./build.sh</source>
+ <p>
+ When the build has finished, start the Jetty server:
+ </p>
+ <source xml:space="preserve">./lenya.sh</source>
+ <p>
+ Now go to <a href="http://localhost:8888/default/authoring/index.html">http://localhost:8888/default/authoring/index.html</a>
+ and log in as user "lenya". The <em>File</em> menu should now contain an
+ item <em>New Person Document</em>. But before creating person documents,
+ we'll add a new top level XHTML document <em>People</em>:
+ </p>
+ <ul>
+ <li>File -> New XHTML Document</li>
+ <li>Node Name: people</li>
+ <li>Navigation Title: People</li>
+ </ul>
+ <p>
+ You end up on the <em>People</em> page. Now you can create a new person document
+ as a child of this document by selecting the <em>New Person Document</em> menu item:
+ </p>
+ <figure alt="Create a person document" src="lenya-document:6858ce70-8731-11dc-ae46-9e7b5d14892d"/>
+ <p>
+ After hitting OK, you're redirected to the newly created person document:
+ </p>
+ <figure alt="Person document" src="lenya-document:685ffa60-8731-11dc-ae46-9e7b5d14892d"/>
+ <p>
+ In the <a href="lenya-document:8913abe0-8730-11dc-ae46-9e7b5d14892d">next section</a> we'll make our
+ person documents editable.
+ </p>
+ </section>
+
+ </body>
+</document>
Modified: lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.meta
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.meta?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.meta (original)
+++ lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.meta Fri Nov 2 03:57:25 2007
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://apache.org/lenya/metadata/1.0">
-<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
-<element key="mimeType">
-<value>application/xml</value>
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Presentation</value>
</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
<element key="extension">
<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
</element>
<element key="resourceType">
<value>forrestDocument20</value>
Added: lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910778308.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910778308.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910778308.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910778308.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Presentation</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/87e36940-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 2 03:57:25 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910778308" version="2"/>
+<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910764208"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781621393" version="1"/>
<CheckOut identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781610105"/>
</XPSRevisionControl>
Added: lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.1193910790516.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.1193910790516.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.1193910790516.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.1193910790516.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2006 The Apache Software Foundation
+
+ Licensed 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: metadata.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Creating a Resource Type, Part 4: Editing</title>
+ </header>
+ <body>
+
+ <p>
+ In this section we make our person documents editable.
+ </p>
+
+ <section>
+ <title>Adding the Relax NG Schema</title>
+ <p>
+ When we allow to edit documents, we have to make sure that the resulting
+ XML conforms to the FoaF specification. For this purpose we provide a
+ <a href="http://relaxng.org">Relax NG</a> schema for the FoaF person XML format.
+ Here's a simple schema, created with <a href="http://www.thaiopensource.com/relaxng/trang.html">Trang</a>,
+ which - according to the resource type declaration - has to be located at
+ <code>$MODULE_HOME/resources/schemas/foaf.rng</code>:
+ </p>
+ <source xml:space="preserve"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <start>
+ <element name="rdf:RDF">
+ <element name="foaf:Person">
+ <attribute name="rdf:ID"><data type="NCName"/></attribute>
+ <element name="foaf:title"><text/></element>
+ <element name="foaf:givenname"><text/></element>
+ <element name="foaf:family_name"><text/></element>
+ <element name="foaf:mbox">
+ <attribute name="rdf:resource">
+ <data type="anyURI"/>
+ </attribute>
+ </element>
+ <element name="foaf:phone">
+ <attribute name="rdf:resource">
+ <data type="NMTOKEN"/>
+ </attribute>
+ </element>
+ <element name="foaf:workplaceHomepage">
+ <attribute name="rdf:resource">
+ <data type="anyURI"/>
+ </attribute>
+ </element>
+ </element>
+ </element>
+ </start>
+</grammar>
+ ]]></source>
+ </section>
+
+ <section>
+ <title>Enabling the One-Form Editor</title>
+
+ <p>
+ In the first step we don't want to invest much time, so we just
+ enable the one-form editor. We have to add the corresponding menu item
+ to our <code>menu.xsp</code> file. But since we want to enable it only
+ for person documents, we have to test if the currently displayed document
+ has the <em>person</em> resource type. Here's the extended <code>menu.xsp</code>
+ file - note that a new namespace declaration (<code>xmlns:input</code>)
+ has been added:
+ </p>
+ <source xml:space="preserve"><![CDATA[<?xml version="1.0"?>
+<xsp:page
+ language="java"
+ xmlns:xsp="http://apache.org/xsp"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+ xmlns:uc="http://apache.org/cocoon/lenya/usecase/1.0"
+ xmlns:input="http://apache.org/cocoon/xsp/input/1.0"
+ xmlns="http://apache.org/cocoon/lenya/menubar/1.0">
+
+ <xsp:structure>
+ <xsp:include>org.apache.lenya.cms.publication.Document</xsp:include>
+ </xsp:structure>
+
+ <menu>
+ <menus>
+ <menu i18n:attr="name" name="File">
+ <block areas="site authoring">
+ <item uc:usecase="sitemanagement.create" href="?doctype=person">
+ <i18n:translate>
+ <i18n:text>New ... Document</i18n:text>
+ <i18n:param>Person</i18n:param>
+ </i18n:translate>
+ </item>
+ </block>
+ </menu>
+
+ <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 ("person".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>
+ ]]></source>
+
+ <p>
+ Now you should be able to edit your person document with the one-form editor.
+ </p>
+ <p>
+ In the <a href="lenya-document:8a8eb320-8730-11dc-ae46-9e7b5d14892d">next section</a> we explain how
+ to make person documents editable with the BXE WYSIWYG editor.
+ </p>
+
+ </section>
+ </body>
+</document>
Modified: lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.meta
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.meta?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.meta (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.meta Fri Nov 2 03:57:25 2007
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://apache.org/lenya/metadata/1.0">
-<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
-<element key="mimeType">
-<value>application/xml</value>
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Editing (One-Form)</value>
</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
<element key="extension">
<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
</element>
<element key="resourceType">
<value>forrestDocument20</value>
Added: lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910790516.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910790516.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910790516.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910790516.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Editing (One-Form)</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8913abe0-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 2 03:57:25 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910790516" version="2"/>
+<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910763941"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781634245" version="1"/>
<CheckOut identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781613092"/>
</XPSRevisionControl>
Added: lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.1193910794352.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.1193910794352.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.1193910794352.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.1193910794352.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2006 The Apache Software Foundation
+
+ Licensed 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: metadata.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Creating a Resource Type, Part 5: WYSIWYG Editing with BXE</title>
+ </header>
+ <body>
+
+ <p>
+ In this section we make our person documents editable with the BXE WYSIWYG editor.
+ </p>
+
+ <section>
+ <title>Adding the Menu Item</title>
+ <p>
+ First, we add the BXE menu item to <code>$MODULE_HOME/config/menu.xsp</code>,
+ right above the one-form editor item:
+ </p>
+ <source xml:space="preserve"><![CDATA[<item uc:usecase="bxe.edit" href="?"><i18n:text>With BXE</i18n:text></item>]]></source>
+ </section>
+
+ <section>
+ <title>Adding the webdavGET format</title>
+ <p>
+ The BXE editor uses the <acronym title="Web-based Distributed Authoring and Versioning">WebDAV</acronym>
+ protocol to load the document source. To provide this functionality, we have to
+ add the <em>webdavGET</em> format to our resource type declaration:
+ </p>
+ <source xml:space="preserve"><![CDATA[<component-instance name="person"
+ ...
+ <format name="webdavGET" uri="cocoon://modules/person/davget.xml"/>
+</component-instance>]]></source>
+ <p>
+ When you re-deploy the module, make sure that <code>cocoon.xconf</code> is properly updated
+ - either by deleting the file from the web application, or by adding the new line manually.
+ </p>
+ <p>
+ The format is served by the following pipeline in <code>$MODULE_HOME/sitemap.xmap</code>:
+ </p>
+ <source xml:space="preserve"><![CDATA[<!-- webdav GET matcher -->
+<map:match pattern="davget.xml">
+ <map:act type="set-header">
+ <map:parameter name="Last-Modified" value="{date-iso8601-rfc822:{page-envelope:document-lastmodified}}" />
+ <map:generate src="lenya-document:{page-envelope:document-uuid}"/>
+ <map:transform type="uuid2url">
+ <map:parameter name="urls" value="absolute"/>
+ </map:transform>
+ <map:serialize type="xml"/>
+ </map:act>
+</map:match>]]></source>
+ </section>
+
+ <section>
+ <title>Adding BXE Support to the XSLT</title>
+ <p>
+ Now we have to add specific <code>bxe_xpath</code> attributes to the XHTML elements
+ of our page so that BXE knows what can be edited. We update our stylesheet
+ <code>$MODULE_HOME/xslt/foaf2xhtml.xsl</code> and add the attributes when the
+ parameter <code>rendertype</code> equals <code>edit</code>:
+ </p>
+ <source xml:space="preserve"><![CDATA[ <xsl:param name="rendertype"/>
+
+ ...
+
+ <xsl:template name="bxeAttribute">
+ <xsl:param name="element"/>
+ <xsl:if test="$rendertype = 'edit'">
+ <xsl:attribute name="bxe_xpath">
+ /rdf:RDF/foaf:Person/foaf:<xsl:value-of select="$element"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="foaf:Person">
+ <h2>Person Details</h2>
+ <table class="person">
+ <tr>
+ <th>Title:</th>
+ <td>
+ <xsl:call-template name="bxeAttribute">
+ <xsl:with-param name="element">title</xsl:with-param>
+ </xsl:call-template>
+ <xsl:value-of select="foaf:title"/>
+ </td>
+ </tr>
+ <tr>
+ <th>Given name:</th>
+ <td>
+ <xsl:call-template name="bxeAttribute">
+ <xsl:with-param name="element">givenname</xsl:with-param>
+ </xsl:call-template>
+ <xsl:value-of select="foaf:givenname"/>
+ </td>
+ </tr>
+ <tr>
+ <th>Family name:</th>
+ <td>
+ <xsl:call-template name="bxeAttribute">
+ <xsl:with-param name="element">family_name</xsl:with-param>
+ </xsl:call-template>
+ <xsl:value-of select="foaf:family_name"/>
+ </td>
+ </tr>
+ ...
+ </xsl:template>]]></source>
+ <p>
+ Now we're faced with a limitation of BXE: It is not possible to edit attributes in WYSIWYG mode.
+ We'd have to change our XML structure to allow this. For this little tutorial, we'll
+ just edit the element values - <code>foaf:title</code>, <code>foaf:givenname</code>,
+ and <code>foaf:family_name</code>.
+ </p>
+ <p>
+ The <code>rendertype</code> parameter is passed to the stylesheet in
+ <code>$MODULE_HOME/sitemap.xmap</code>:
+ </p>
+ <source xml:space="preserve"><![CDATA[<map:transform src="fallback://lenya/modules/person/xslt/foaf2xhtml.xsl">
+ <map:parameter name="rendertype" value="{request-param:rendertype}"/>
+</map:transform>]]></source>
+ </section>
+ <section>
+ <title>Start Editing</title>
+ <p>
+ Now you should be able to edit your person documents with BXE:
+ </p>
+ <figure alt="Editing with BXE" src="lenya-document:68666300-8731-11dc-ae46-9e7b5d14892d"/>
+ </section>
+ </body>
+</document>
Modified: lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.meta
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.meta?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.meta (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.meta Fri Nov 2 03:57:25 2007
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://apache.org/lenya/metadata/1.0">
-<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
-<element key="mimeType">
-<value>application/xml</value>
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Editing (BXE)</value>
</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
<element key="extension">
<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
</element>
<element key="resourceType">
<value>forrestDocument20</value>
Added: lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910794352.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910794352.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910794352.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910794352.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Editing (BXE)</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8a8eb320-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 2 03:57:25 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910794352" version="2"/>
+<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910766571"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781619865" version="1"/>
<CheckOut identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781608088"/>
</XPSRevisionControl>
Added: lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.1193910796290.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.1193910796290.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.1193910796290.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.1193910796290.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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: index.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Apache Lenya Documentation</title>
+ </header>
+ <body>
+ <p>
+ This is a Forrest Document 2.0 sample.
+ </p>
+ </body>
+</document>
Modified: lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.meta
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.meta?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.meta (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.meta Fri Nov 2 03:57:25 2007
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://apache.org/lenya/metadata/1.0">
-<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
-<element key="mimeType">
-<value>application/xml</value>
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Implement a Usecase</value>
</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
<element key="extension">
<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
</element>
<element key="resourceType">
<value>forrestDocument20</value>
Added: lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910796290.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910796290.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910796290.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910796290.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Implement a Usecase</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8a940a50-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 2 03:57:25 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910796290" version="2"/>
+<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910767838"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781622948" version="1"/>
<CheckOut identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781612206"/>
</XPSRevisionControl>
Added: lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.1193910776505.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.1193910776505.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.1193910776505.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.1193910776505.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2006 The Apache Software Foundation
+
+ Licensed 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: metadata.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Implementing a Usecase, Part 1: Prerequisites</title>
+ </header>
+ <body>
+
+ <section>
+ <title>Introduction</title>
+ <p>
+ In this tutorial we'll implement a simple user interaction scenario using
+ the <a href="lenya-document:9ffa4030-8730-11dc-ae46-9e7b5d14892d">usecase framework</a>.
+ The implementation will be based on the <em>person</em> resource type module described
+ in the tutorial <a href="lenya-document:852cadb0-8730-11dc-ae46-9e7b5d14892d">Creating a Resource Type</a>.
+ We'll extend the resource type to include "knows" relationships. Our usecase will
+ allow the connect a person to other people.
+ </p>
+ <p>
+ To accomplish this task, we will
+ </p>
+ <ul>
+ <li>Extend the person schema to support <code><![CDATA[<foaf:knows/>]]></code> elements,</li>
+ <li>Implement a wrapper class to manage person documents,</li>
+ <li>Add a usecase handler class to provide the functionality to connect people,</li>
+ <li>
+ Add a <a href="http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html">JX template</a>
+ which acts as the view for the usecase,
+ </li>
+ <li>Add a menu item to trigger the usecase, and</li>
+ <li>Specify who is allowed to invoke the usecase.</li>
+ </ul>
+ </section>
+
+ <section>
+ <title>Add the "Knows" Relation to the Person Resource Type</title>
+ <p>
+ First, we'll add support for the <code><![CDATA[<foaf:knows/>]]></code> element to the
+ Relax NG schema, which is located at <code>$MODULE_HOME/resources/schemas/foaf.rng</code>.
+ We allow to specify the known person using an <code>rdf:resource</code> attribute, which
+ can hold an internal <code>lenya-document:</code> URI.
+ </p>
+ <source xml:space="preserve"><![CDATA[<grammar ...>
+ <start>
+ <element name="rdf:RDF">
+ <element name="foaf:Person">
+ ...
+
+ <zeroOrMore>
+ <element name="foaf:knows">
+ <attribute name="rdf:resource">
+ <data type="anyURI"/>
+ </attribute>
+ </element>
+ </zeroOrMore>
+
+ </element>
+ </element>
+ </start>
+</grammar>]]></source>
+
+ <p>
+ Now we need to extend our presentation layer to consider the "knows" relations.
+ We use CInclude to lookup the person's name based on the <code>foaf:knows</code>
+ element. This requires two steps: an XSLT preprocessing to add the CInclude element to
+ the <code>foaf:knows</code> element, and the actual CInclude transformation.
+ In the module sitemap, which is located at <code>$MODULE_HOME/sitemap.xmap</code>,
+ add these steps to the presentation pipeline:
+ </p>
+ <source xml:space="preserve"><![CDATA[<!-- {format}.xml/{pubId}/{area}/{uuid}/{language} -->
+<map:match pattern="*.*/*/*/*/*">
+ <map:generate src="lenya-document:{5},lang={6}{link:rev}"/>
+ <map:transform src="fallback://lenya/modules/person/xslt/knows2include.xsl"/>
+ <map:transform type="cinclude"/>
+ <map:transform src="fallback://lenya/modules/person/xslt/foaf2{1}.xsl">
+ ...
+</map:match>]]></source>
+ <p>
+ Now we add the XSLT which adds the CInclude statements. It is located at
+ <code>$MODULE_HOME/xslt/knows2include.xsl</code>. The <code>src</code>
+ attribute of the <code><![CDATA[<ci:include/>]]></code> element is set to the
+ <code>rdf:resource</code> attribute, which holds a <code>lenya-document:</code> URI.
+ </p>
+ <source xml:space="preserve"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
+ xmlns:ci="http://apache.org/cocoon/include/1.0"
+ >
+
+ <xsl:template match="foaf:knows">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <ci:include src="{@rdf:resource}"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="@*|node()" priority="-1">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>]]></source>
+
+ <p>
+ Finally, we have to include the known people in the output. We add a table row to
+ the <code>$MODULE_HOME/xslt/foaf2xhtml.xsl</code> stylesheet:
+ </p>
+ <source xml:space="preserve"><![CDATA[<tr>
+ <th>Knows:</th>
+ <td>
+ <xsl:for-each select="foaf:knows">
+ <a href="{@rdf:resource}">
+ <xsl:value-of select="rdf:RDF/foaf:Person/foaf:givenname"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="rdf:RDF/foaf:Person/foaf:family_name"/>
+ </a>
+ <br/>
+ </xsl:for-each>
+ </td>
+</tr>]]></source>
+ <p>
+ To test this functionality, you can add two person documents to your
+ publication, edit one of them using the one-form editor, and add the
+ <code><![CDATA[<foaf:knows/>]]></code> element, pointing to the other
+ person document, e.g.:
+ </p>
+ <source xml:space="preserve"><![CDATA[<foaf:knows rdf:resource="lenya-document:5e13b150-6855-11dc-8b37-f5f12a4217db"/>]]></source>
+ </section>
+
+ <section>
+ <title>Implement the Person Document Wrapper</title>
+ <p>
+ In Lenya projects, the wrapper pattern (also known as adapter pattern) has proven
+ useful to simplify the handling of XML documents. A wrapper object provides
+ access to a certain object, in our case a Lenya document, to client objects. It can
+ be used to add a layer of abstraction. In our case we use the wrapper to abstract
+ from the XML content and provide the functionality of adding "knows" relations
+ between person documents.
+ </p>
+ <p>
+ The following code snippet contains some methods to illustrate the functionality
+ of the Person class. For the full source code, check out the person module from the
+ Subversion repository.
+ </p>
+ <p>
+ We pass an <code>org.apache.lenya.cms.publication.Document</code>
+ object to the constructor which stores the XML content describing the person.
+ The <code>getName()</code> function returns the full name, i.e. the concatenation
+ of the given name and the family name. This method will be used to show the person's
+ name on the usecase view page. The <code>load()</code> and <code>save()</code> methods
+ act as the persistence facilities of the person object.
+ </p>
+ <source xml:space="preserve"><![CDATA[public class Person extends AbstractLogEnabled {
+
+ ...
+
+ public Person(Document doc) {
+ ...
+ }
+
+ public Person[] getKnownPeople() {
+ load();
+ Collection persons = this.knownPersons.values();
+ return (Person[]) persons.toArray(new Person[persons.size()]);
+ }
+
+ public void addKnownPerson(Person person) {
+ load();
+ this.knownPersons.put(person.getDocument().getUUID(), person);
+ save();
+ }
+
+ public String getName() {
+ load();
+ return this.givenName + " " + this.familyName;
+ }
+
+ ...
+
+}]]></source>
+
+ <p>
+ Now we can go on with the <a href="lenya-document:8d27d490-8730-11dc-ae46-9e7b5d14892d">actual usecase</a>.
+ </p>
+ </section>
+
+ </body>
+</document>
Modified: lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.meta
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.meta?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.meta (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.meta Fri Nov 2 03:57:25 2007
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://apache.org/lenya/metadata/1.0">
-<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
-<element key="mimeType">
-<value>application/xml</value>
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Prerequisites</value>
</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
<element key="extension">
<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
</element>
<element key="resourceType">
<value>forrestDocument20</value>
Added: lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910776505.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910776505.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910776505.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910776505.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Prerequisites</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8be409f0-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 2 03:57:25 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910776505" version="2"/>
+<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910762445"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781618035" version="1"/>
<CheckOut identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781605454"/>
</XPSRevisionControl>
Added: lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.1193910781898.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.1193910781898.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.1193910781898.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.1193910781898.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,270 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2006 The Apache Software Foundation
+
+ Licensed 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: metadata.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Implementing a Usecase, Part 2: The Usecase</title>
+ </header>
+ <body>
+
+ <section>
+ <title>Declaring the Usecase</title>
+ <p>
+ Now we're ready to start working on the actual usecase. First, we tell Lenya about
+ the usecase. The usecase declaration is a patch file for <code>cocoon.xconf</code>.
+ It is located at <code>$MODULE_HOME/config/cocoon-xconf/usecase-addKnownPerson.xconf</code>.
+ It adds the <em>person.addKnownUsecase</em> usecase component instance if it doesn't
+ exist yet (determined by the <code>unless</code> attribute):
+ </p>
+ <source xml:space="preserve"><![CDATA[<xconf xpath="/cocoon/usecases"
+ unless="/cocoon/usecases/component-instance[@name = 'person.addKnownPerson']">
+
+ <component-instance name="person.addKnownPerson" logger="lenya.modules.person"
+ class="org.apache.lenya.modules.person.usecases.AddKnownPerson">
+ <view template="modules/person/usecases/addKnownPerson.jx"/>
+ </component-instance>
+
+</xconf>
+]]></source>
+ <p>
+ This usecase declaration specifies the usecase handler class (in our case
+ <code>AddKnownPerson</code>) and the JX template which acts as the view for
+ the usecase (<code>addKnownPerson.jx</code>). For a complete list of the generic
+ usecase configuration options, refer to the <a href="lenya-document:a1297160-8730-11dc-ae46-9e7b5d14892d">AbstractUsecase</a>
+ documentation.
+ </p>
+ </section>
+
+ <section>
+ <title>Implementing the Usecase Handler Class</title>
+ <p>
+ The usecase handler object receives user input and manipulates the business objects,
+ in our case the <code>Person</code> objects, accordingly. It has the following
+ responsibilities:
+ </p>
+ <ul>
+ <li>Prepare data to be displayed on the view,</li>
+ <li>Validate user input and generate appropriate error messages, and</li>
+ <li>Manipulate the business objects.</li>
+ </ul>
+ <p>
+ If you want to follow a strictly object-oriented approach, the usecase handler class
+ itself shouldn't contain any knowledge about the business logic. It belongs to the
+ controller part of the <acronym title="Model-View-Controller">MVC</acronym> pattern
+ (the other parts of the controller are the usecase sitemap and the flowscript).
+ </p>
+ <p>
+ The following code snippet shows the usecase handler class.
+ At this point, we implement only the two most important methods:
+ </p>
+ <ul>
+ <li>
+ <code>initParameters()</code> initializes the usecase parameters which are
+ used to communicate between the usecase handler and the view. In our case, it
+ compiles a list of <code>Person</code> objects, one for each document with the resource type
+ <em>person</em>.
+ </li>
+ <li>
+ <code>doExecute()</code> gets the <em>uuid</em> parameter from the view and adds
+ the corresponding <code>Person</code> object to the list of known people.
+ </li>
+ </ul>
+ <source xml:space="preserve"><![CDATA[public class AddKnownPerson extends DocumentUsecase {
+
+ protected void initParameters() {
+ super.initParameters();
+
+ Document doc = getSourceDocument();
+ Document[] allDocs = doc.area().getDocuments();
+
+ try {
+ Set peopleDocs = new HashSet();
+ for (int i = 0; i < allDocs.length; i++) {
+ if (allDocs[i].getResourceType().getName().equals("person")) {
+ Person person = new Person(allDocs[i]);
+ peopleDocs.add(person);
+ }
+ }
+ setParameter("people", peopleDocs);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected void doExecute() throws Exception {
+ super.doExecute();
+
+ String uuid = getParameterAsString("uuid");
+ Document doc = getSourceDocument();
+ Person person = new Person(doc);
+
+ Document knownDoc = doc.area().getDocument(uuid, doc.getLanguage());
+ Person knownPerson = new Person(knownDoc);
+
+ person.addKnownPerson(knownPerson);
+ }
+
+}]]></source>
+ </section>
+
+ <section>
+ <title>Implementing the View</title>
+ <p>
+ We're using a JX template to implement the view. It allows us to generate XHTML
+ code using properties of Java objects which are passed as parameters from the usecase
+ handler object.
+ </p>
+ <p>
+ The page contains a form, passing the <em>lenya.usecase</em> and <em>lenya.continuation</em>
+ parameters as hidden input fields. We choose POST as the form method because we want
+ to manipulate data on the server, avoiding that the user submits the form multiple times.
+ We generate a drop-down list containing an option for each person,
+ using the UUID as the <code>value</code> attribute of the <code>option</code> element.
+ Remember that the <em>people</em> parameter was set in the <code>initParameters()</code>
+ method of the usecase handler class.
+ </p>
+ <source xml:space="preserve"><![CDATA[<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+ xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
+
+ <page:title>
+ <i18n:text>Add Known Person</i18n:text>
+ </page:title>
+ <page:body>
+
+ <jx:import uri="fallback://lenya/modules/usecase/templates/messages.jx"/>
+
+ <form method="POST">
+ <input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
+ <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
+
+ <p>
+ <i18n:text>Select a person you know:</i18n:text>
+ </p>
+ <p>
+ <select name="uuid">
+ <jx:forEach var="person" items="${usecase.getParameter('people')}">
+ <option value="${person.getDocument().getUUID()}">
+ <jx:out value="${person.getName()}"/>
+ </option>
+ </jx:forEach>
+ </select>
+ </p>
+
+ <p>
+ <input i18n:attr="value" name="submit" type="submit" value="Submit"/>
+ <i18n:text> </i18n:text>
+ <input i18n:attr="value" name="cancel" type="submit" value="Cancel"/>
+ </p>
+
+ </form>
+ </page:body>
+</page:page>]]></source>
+ </section>
+
+ <section>
+ <title>Adding the Menu Item</title>
+ <p>
+ To be able to trigger the usecase, we have to add the corresponding menu item
+ to the menu of the person module, which is located at
+ <code>$MODULE_HOME/config/menu.xsp</code>. We add a menu block which shall be
+ visible only in the authoring area, right below the block containing the
+ editor menu items. The value of the <code>uc:usecase</code> attribute of the
+ <code><![CDATA[<item/>]]></code> element is the name of the usecase as specified
+ in the usecase declaration.
+ </p>
+ <source xml:space="preserve"><![CDATA[<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 ("person".equals(doctype)) {
+ <block areas="authoring">
+ <item uc:usecase="bxe.edit" href="?">
+ <i18n:text>With BXE</i18n:text>
+ </item>
+ <item uc:usecase="editors.oneform" href="?">
+ <i18n:text>With one Form</i18n:text>
+ </item>
+ </block>
+ <block areas="authoring">
+ <item uc:usecase="person.addKnownPerson" href="?">
+ <i18n:text>Add Known Person</i18n:text>
+ </item>
+ </block>
+ }
+ }
+ }
+ catch (Exception e) {
+ throw new ProcessingException("Error during menu generation: ", e);
+ }
+ </xsp:logic>
+</menu>]]></source>
+ </section>
+
+ <section>
+ <title>Setting the Usecase Permissions</title>
+ <p>
+ Finally we have to specify who shall be able to execute the usecase.
+ To accomplish this, we have to add an entry to the usecase policies file of the
+ publication(s) which will use the person module. The file is located at
+ <code>$PUB_HOME/config/access-control/usecase-policies.xml</code>.
+ We allow everyone with the <em>admin</em> or <em>editor</em> role to
+ execute the usecase:
+ </p>
+ <source xml:space="preserve"><![CDATA[<usecase id="person.addKnownPerson">
+ <role id="admin" method="grant"/>
+ <role id="edit" method="grant"/>
+</usecase>]]></source>
+ <p>
+ Now you can deploy the changes by running the build process and restarting the
+ servlet engine. After that you should be able to connect people using the
+ "knows" relation.
+ </p>
+ <figure alt="Screenshot: Add Known Person usecase" src="lenya-document:688de830-8731-11dc-ae46-9e7b5d14892d"/>
+ </section>
+
+ <section>
+ <title>What's Next?</title>
+ <p>
+ There are some important steps which are missing from the example:
+ </p>
+ <ul>
+ <li>
+ In <code>initParameters()</code>, you should exclude the person itself and
+ all people which she or he already knows.
+ </li>
+ <li>
+ If you set the relation from person A to person B, it probably makes sense
+ to set the relation from B to A at the same time.
+ </li>
+ <li>
+ To avoid sending stack traces to the user, you should validate the <em>uuid</em>
+ parameter: Is it provided? Does it refer to an existing person document?
+ You can do this kind of validation in the <code>doCheckExecutionConditions()</code>
+ method - just call <code>addErrorMessage()</code> for each validation error.
+ </li>
+ </ul>
+ </section>
+
+ </body>
+</document>
Modified: lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.meta
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.meta?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.meta (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.meta Fri Nov 2 03:57:25 2007
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://apache.org/lenya/metadata/1.0">
-<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
-<element key="mimeType">
-<value>application/xml</value>
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>The Usecase</value>
</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
<element key="extension">
<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
</element>
<element key="resourceType">
<value>forrestDocument20</value>
Added: lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910781898.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910781898.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910781898.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910781898.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>The Usecase</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8d27d490-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 2 03:57:25 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910781898" version="2"/>
+<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910767086"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781619273" version="1"/>
<CheckOut identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781607133"/>
</XPSRevisionControl>
Added: lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.1193910790640.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.1193910790640.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.1193910790640.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.1193910790640.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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: index.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Setting up Your Development Environment</title>
+ </header>
+ <body>
+ <p>
+ To ensure a good productivity when building Lenya applications, it is essential
+ that you have a well-configured development environment.
+ </p>
+ <p>
+ The following steps guide you through the process of setting up the Eclipse IDE for Lenya.
+ The paths apply to a Unix-like operating system, for Windows you have to change
+ the paths accordingly and replace all shell script names with the names of the corresponding
+ batch files.
+ </p>
+ <ul>
+ <li>
+ <p>
+ Check out the Lenya trunk and the Cocoon branch 2.1 from the Subversion
+ repository (see <a href="lenya-document:82081520-8730-11dc-ae46-9e7b5d14892d">Installation Instructions</a>).
+ I suggest to use the following directory layout:
+ </p>
+<source xml:space="preserve"><![CDATA[src/
+ apache/
+ lenya/
+ trunk/ -> LENYA_HOME
+ cocoon/
+ branches/
+ BRANCH_2_1_X/ -> COCOON_HOME
+]]></source>
+ <p>
+ You don't need to set these environment variables, I only use them in
+ this tutorial.
+ </p>
+ <p>
+ Note that we don't use the Cocoon version which ships with Lenya, but
+ a separate working copy of Cocoon. This is necessary because Eclipse
+ doesn't support nested projects.
+ </p>
+ <p>
+ The <code>apache</code> directory will come in handy when you start serious
+ development, because you're likely to peek into the source code of other
+ ASF projects like Excalibur or Xalan.
+ </p>
+ </li>
+ <li>
+ Edit <code>$LENYA_HOME/local.build.properties</code> and set the property
+ <code>cocoon.src.dir</code> to the path of your <code>$COCOON_HOME</code>
+ directory. When you use the suggested directory structure, this would be
+ <code>../../cocoon/branches/BRANCH_2_1_X</code>.
+ </li>
+ <li>
+ Go to the <code>$COCOON_HOME</code> directory and execute
+ <source xml:space="preserve">./build.sh eclipse-project</source>
+ This creates the Cocoon project files for Eclipse.
+ </li>
+ <li>
+ Go to the <code>$LENYA_HOME</code> directory and execute
+ <source xml:space="preserve">./build.sh eclipse-project</source>
+ This creates the Lenya project files for Eclipse.
+ </li>
+ <li>
+ You can now import both projects in Eclipse.
+ </li>
+ <li>
+ If your Lenya project complains that various packages are not
+ found, it is probably necessary to edit the <em>Java Build Path</em> properties
+ of your Cocoon project and select all libraries on the <em>Order and Export</em> tab.
+ </li>
+ <li>
+ In the <em>Preferences</em> pane, you have to configure the Java compiler to
+ use the 1.4 compliance level.
+ </li>
+ <li>
+ Eclipse stores the class files in <code>$LENYA_HOME/build/eclipse</code> by default.
+ Whenever you execute <code>./build.sh clean</code>, it gets confused. To avoid this,
+ set the default output folder in <em>Project properties > Build path > Source</em>
+ to a different directory (e.g. <code>$LENYA_HOME/eclipse</code>).
+ </li>
+ <li>
+ A decent XML and XSLT editor is recommended, you can for instance install the
+ web tools platform from the Eclipse project.
+ </li>
+ <li>
+ Have fun!
+ </li>
+ </ul>
+ </body>
+</document>
Modified: lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.meta
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.meta?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.meta (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.meta Fri Nov 2 03:57:25 2007
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://apache.org/lenya/metadata/1.0">
-<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
-<element key="mimeType">
-<value>application/xml</value>
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Setting up Eclipse</value>
</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
<element key="extension">
<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
</element>
<element key="resourceType">
<value>forrestDocument20</value>
Added: lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910790640.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910790640.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910790640.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910790640.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Setting up Eclipse</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8e678080-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 2 03:57:25 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910790640" version="2"/>
+<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910764034"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781619581" version="1"/>
<CheckOut identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781607497"/>
</XPSRevisionControl>
Added: lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.1193910779926.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.1193910779926.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.1193910779926.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.1193910779926.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed 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: index.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Apache Lenya Documentation</title>
+ </header>
+ <body>
+ <p>
+ This is a Forrest Document 2.0 sample.
+ </p>
+ </body>
+</document>
Modified: lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.meta
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.meta?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.meta (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.meta Fri Nov 2 03:57:25 2007
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://apache.org/lenya/metadata/1.0">
-<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
-<element key="mimeType">
-<value>application/xml</value>
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Proxying</value>
</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
<element key="extension">
<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
</element>
<element key="resourceType">
<value>forrestDocument20</value>
Added: lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910779926.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910779926.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910779926.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910779926.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Proxying</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8e6e8560-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 2 03:57:25 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910779926" version="2"/>
+<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910765580"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781619415" version="1"/>
<CheckOut identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781607281"/>
</XPSRevisionControl>
Added: lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.1193910791871.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.1193910791871.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.1193910791871.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.1193910791871.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 1999-2006 The Apache Software Foundation
+
+ Licensed 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: metadata.xml 55543 2004-10-26 00:14:59Z gregor $ --><!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+
+<document>
+ <header>
+ <title>Running Lenya Behind Apache with mod_proxy</title>
+ </header>
+ <body>
+
+ <section>
+ <title>Introduction</title>
+
+ <p>
+ This tutorial aims at getting you started with a proxy environment.
+ We're using Apache HTTPD 2.2 with the <em>mod_proxy</em> module. You'll find
+ a lot of documentation on the web how to set up the web server on your
+ machine.
+ </p>
+ <p>
+ Our goal is to run two virtual servers on your local machine:
+ </p>
+ <ul>
+ <li>
+<em>cms.example.com</em> - the authoring environment of your publication</li>
+ <li>
+<em>www.example.com</em> - the actual live site</li>
+ </ul>
+ <p>
+ Your administrators, editors etc. will use the URL <em>http://cms.example.com</em>
+ to connect to the authoring environment. We'll require an SSL connection for the
+ login usecase. Once you have established an SSL connection, your connection will
+ stay encrypted.
+ </p>
+ <p>
+ The live area is mapped directly to the root of the <em>www.example.com</em> host.
+ Since the authoring environment comprises different areas (for instance authoring,
+ archive, trash), the publication root is mapped to the root of <em>cms.example.com</em>:
+ </p>
+ <source xml:space="preserve"><![CDATA[/pub/authoring <-> cms.example.com/authoring
+/pub/archive <-> cms.example.com/archive
+/pub/trash <-> cms.example.com/trash
+/pub/live <-> www.example.com]]></source>
+ </section>
+
+ <section>
+ <title>Declaring the Hosts</title>
+ <p>
+ To tell your system that the <em>example.com</em> domains run on your local machine,
+ open your <code>hosts</code> file, usually located at <code>/etc/hosts</code>,
+ and add the following lines:
+ </p>
+ <source xml:space="preserve"><![CDATA[127.0.0.1 cms.example.com
+127.0.0.1 www.example.com]]></source>
+ </section>
+
+ <section>
+ <title>Configuring the Apache Web Server</title>
+ <p>
+ There are multiple options to connect the Apache web server, which acts as the
+ reverse proxy, to the Tomcat servlet container. The two most common ways are
+ </p>
+ <ul>
+ <li>
+<a href="lenya-document:910f47f0-8730-11dc-ae46-9e7b5d14892d">mod_proxy</a>
+</li>
+ <li>
+<a href="lenya-document:923ca460-8730-11dc-ae46-9e7b5d14892d">mod_proxy_ajp</a>
+</li>
+ <li>mod_jk</li>
+ </ul>
+ <p>
+ mod_proxy is the classic, proven approach. The AJP protocol
+ is newer, easier to set up and provides seamless SSL integration. For more information
+ on which connector to choose, refer to the
+ <a href="http://tomcat.apache.org/faq/connectors.html">Tomcat connectors FAQ</a>.
+ </p>
+ <p>
+ After configuring the Apache web server, you can restart it using
+ </p>
+ <source xml:space="preserve">$ sudo apachectl restart</source>
+ </section>
+
+ <section>
+ <title>Configuring Tomcat's Cookie Path</title>
+ <note>
+ You'll certainly run into cookie problems when using a non-empty context path
+ (like <em>lenya14</em> in the example above) instead of running Lenya in the root context.
+ This causes errors like "The session doesn't contain the identity.".
+ To avoid these problems, edit <code>$TOMCAT_HOME/conf/server.xml</code> and set the
+ <em>emptySessionPath</em> attribute of the Tomcat connector configuration to <em>true</em>.
+ You find more information in the <a href="http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html">Apache
+ Tomcat configuration reference</a>.
+ </note>
+ </section>
+
+ <section>
+ <title>Configuring the Publication for Proxying</title>
+ <p>
+ When you use a proxy, Lenya has to convert all internal links accordingly.
+ Therefore you have to tell the publication about the proxy configuration.
+ Open the file <code>$PUBLICATION_HOME/config/publication.xml</code> and uncomment
+ and modify the <code><![CDATA[<proxy/>]]></code> elements:
+ </p>
+ <source xml:space="preserve"><![CDATA[<proxies>
+ <proxy area="authoring" ssl="true" url="https://cms.example.com/authoring"/>
+ <proxy area="authoring" ssl="false" url="http://cms.example.com/authoring"/>
+ <proxy area="trash" ssl="true" url="https://cms.example.com/trash"/>
+ <proxy area="trash" ssl="false" url="http://cms.example.com/trash"/>
+ <proxy area="archive" ssl="true" url="https://cms.example.com/archive"/>
+ <proxy area="archive" ssl="false" url="http://cms.example.com/archive"/>
+ <proxy area="live" ssl="true" url="https://www.example.com"/>
+ <proxy area="live" ssl="false" url="http://www.example.com"/>
+</proxies>]]></source>
+ </section>
+
+ <section>
+ <title>Configuring the Global Proxies</title>
+ <p>
+ The application-wide (publication independent) proxies are configured in
+ <code>WEB-INF/cocoon.xconf</code>. Look for the declaration of the <code>GlobalProxies</code>
+ service and update this entry:
+ </p>
+ <source xml:space="preserve"><![CDATA[<component logger="lenya.proxy"
+ role="org.apache.lenya.cms.linking.GlobalProxies"
+ class="org.apache.lenya.cms.linking.impl.GlobalProxiesImpl">
+ <proxy ssl="false" url="http://cms.host.com"/>
+ <proxy ssl="true" url="https://cms.host.com"/>
+</component>]]></source>
+ </section>
+
+ <section>
+ <title>Testing the Settings</title>
+ <p>
+ After re-deploying the publication and restarting your servlet container,
+ you should be able to access the
+ authoring environment of the default publication at the URL
+ <a href="http://cms.example.com/">http://cms.example.com/</a>.
+ </p>
+ </section>
+
+ </body>
+</document>
Modified: lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.meta
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.meta?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.meta (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.meta Fri Nov 2 03:57:25 2007
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://apache.org/lenya/metadata/1.0">
-<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
-<element key="mimeType">
-<value>application/xml</value>
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Proxying</value>
</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
<element key="extension">
<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
</element>
<element key="resourceType">
<value>forrestDocument20</value>
Added: lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910791871.bak
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910791871.bak?rev=591298&view=auto
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910791871.bak (added)
+++ lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.meta.1193910791871.bak Fri Nov 2 03:57:25 2007
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://apache.org/lenya/metadata/1.0">
+<element-set namespace="http://purl.org/dc/elements/1.1/">
+<element key="title">
+<value>Proxying</value>
+</element>
+</element-set>
+<element-set namespace="http://apache.org/lenya/metadata/document/1.0">
+<element key="extension">
+<value>xml</value>
+</element>
+<element key="mimeType">
+<value>application/xml</value>
+</element>
+<element key="resourceType">
+<value>forrestDocument20</value>
+</element>
+<element key="contentType">
+<value>xml</value>
+</element>
+</element-set>
+</metadata>
Modified: lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.rcml
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.rcml?rev=591298&r1=591297&r2=591298&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.rcml (original)
+++ lenya/sandbox/pubs/docu/content/authoring/8fc75ea0-8730-11dc-ae46-9e7b5d14892d/en.rcml Fri Nov 2 03:57:25 2007
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<XPSRevisionControl xmlns="">
+<CheckIn backup="true" identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910791871" version="2"/>
+<CheckOut identity="lenya" session="1f12dc80-8860-11dc-ba66-cfbbb816bd0d" time="1193910764988"/>
<CheckIn backup="true" identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781627628" version="1"/>
<CheckOut identity="lenya" session="60798970-8730-11dc-ae46-9e7b5d14892d" time="1193781607204"/>
</XPSRevisionControl>
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.