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 2005/04/08 22:02:34 UTC

svn commit: r160594 - in lenya/docu/src/documentation/content/xdocs/1_4/concepts: publication-templating/index.xml usecase-framework/index.xml

Author: andreas
Date: Fri Apr  8 13:02:33 2005
New Revision: 160594

URL: http://svn.apache.org/viewcvs?view=rev&rev=160594
Log:
added docu: section 'view' for the usecase framework, section 'instantiator' for publication templating

Modified:
    lenya/docu/src/documentation/content/xdocs/1_4/concepts/publication-templating/index.xml
    lenya/docu/src/documentation/content/xdocs/1_4/concepts/usecase-framework/index.xml

Modified: lenya/docu/src/documentation/content/xdocs/1_4/concepts/publication-templating/index.xml
URL: http://svn.apache.org/viewcvs/lenya/docu/src/documentation/content/xdocs/1_4/concepts/publication-templating/index.xml?view=diff&r1=160593&r2=160594
==============================================================================
--- lenya/docu/src/documentation/content/xdocs/1_4/concepts/publication-templating/index.xml (original)
+++ lenya/docu/src/documentation/content/xdocs/1_4/concepts/publication-templating/index.xml Fri Apr  8 13:02:33 2005
@@ -89,6 +89,7 @@
       </ul>
       
       <p>
+        The publication <em>my-pub</em> is called an <strong>instance</strong> of the publication <em>template(my-pub)</em>.
         Note that, in contrast to the fallback mechanism in Lenya 1.2, the prefix <code>lenya</code> is not used,
         but the path is resolved relatively to the <code>context://</code> root. 
       </p>
@@ -183,6 +184,58 @@
   <usecases>
     <usecase name="create"/>
   </usecases>
+  ...
+</publication>]]></source>
+    </section>
+    
+    <section>
+      <title>Setting Up a Publication To Support Templating</title>
+      
+      <p>
+        The service <code>org.apache.lenya.cms.publication.templating.Instantiator</code> is responsible for
+        creating instances of publications which support templating. If your publication shall support
+        templating, you have to follow these steps:
+      </p>
+      
+      <section>
+        <title>Implement an <code>Instantiator</code> Class</title>
+        
+<source xml:space="preserve"><![CDATA[package org.myproject.lenya;
+
+public class MyInstantiator extends AbstractLogEnabled implements Instantiator {
+
+    public void instantiate(Publication template, String newPublicationId, String name)
+            throws Exception {
+        ...
+    }
+
+}]]></source>
+      </section>
+      
+      <section>
+        <title>Add it to <code>cocoon.xconf</code> Using a Patch File</title>
+        
+        <p>
+          For instance <code>my-pub/config/instantiator.xconf</code>:
+        </p>
+        
+<source xml:space="preserve"><![CDATA[<xconf xpath="/cocoon/template-instantiators"
+       unless="/cocoon/template-instantiators/component-instance[@name = 'default']">
+
+    <component-instance name="mypub"
+                        logger="myproject.publication"
+                        class="org.myproject.lenya.MyInstantiator"/>
+
+</xconf>]]></source>
+      </section>
+      
+      <section>
+        <title>Declare the Instantiator in <code>publication.xconf</code></title>
+      </section>
+      
+<source xml:space="preserve"><![CDATA[<publication>
+  ...
+  <template-instantiator name="mypub"/>
   ...
 </publication>]]></source>
     </section>

Modified: lenya/docu/src/documentation/content/xdocs/1_4/concepts/usecase-framework/index.xml
URL: http://svn.apache.org/viewcvs/lenya/docu/src/documentation/content/xdocs/1_4/concepts/usecase-framework/index.xml?view=diff&r1=160593&r2=160594
==============================================================================
--- lenya/docu/src/documentation/content/xdocs/1_4/concepts/usecase-framework/index.xml (original)
+++ lenya/docu/src/documentation/content/xdocs/1_4/concepts/usecase-framework/index.xml Fri Apr  8 13:02:33 2005
@@ -162,7 +162,8 @@
           </li>
           <li>
             Add the usecase handler class declaration to an XPatch file, e.g. <code>$PUB_HOME/config/usecases.xconf</code>:
-<source xml:space="preserve"><![CDATA[<xconf xpath="/cocoon/usecases" unless="/cocoon/usecases/component-instance[@name = 'article.editHeadline']">
+<source xml:space="preserve"><![CDATA[<xconf xpath="/cocoon/usecases"
+       unless="/cocoon/usecases/component-instance[@name = 'article.editHeadline']">
   <component-instance name="article.editHeadline"
                       logger="lenya.usecases.editHeadline"
                       class="org.myproject.lenya.usecases.EditHeadline"/>
@@ -173,10 +174,34 @@
       
       <section>
         <title>Implement the View</title>
-        <ol>
-          <li>The view for a usecase is implemented using a JX template.</li>
-          <li>
-            The output of the view has to be a Lenya page:
+          <p>
+            The view of a usecase is optional. If you omit the view declaration, no screen is presented
+            to the user. The view is declared in the usecase configuration:
+          </p>
+<source xml:space="preserve"><![CDATA[  <component-instance ...>
+    <view template="article/editHeadline" menu="false">
+      <parameter name="title" value="Edit Headline"/>
+      <parameter name="..." value="..."/>
+    </view>
+  </component-instance>]]></source>
+
+        <p>
+          The <code>&lt;view&gt;</code> element takes an optional <code>menu</code> attribute
+          which denotes if the menubar should be visible when the usecase screen is presented.
+          If omitted, it defaults to <code>false</code>.
+        </p>
+        <p>
+          The <code>&lt;view&gt;</code> element can contain an arbitrary number of <code>&lt;parameter&gt;</code>
+          elements, each containing a <code>name</code> and <code>value</code> attribute. These
+          parameters can be accessed in the JX template using
+          <code>${usecase.getView().getParameter('...')}</code>.
+        </p>
+        <p>
+          The view for a usecase is implemented using a JX template. The location of the
+          JX template is defined using the <code>&lt;view&gt;</code> element's <code>template</code>
+          attribute (relatively to the <code>usecases</code> directory, the suffix <code>.jx</code>
+          is appended). The output of the view has to be a Lenya page:
+        </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"
@@ -184,12 +209,14 @@
   xmlns:i18n="http://apache.org/cocoon/i18n/2.1"    
   >
 
-  <page:title><i18n:text>Edit Headline</i18n:text></page:title>
+  <page:title>
+    <i18n:text><jx:out value="${usecase.getView().getParameter('title')}"/></i18n:text>
+  </page:title>
   <page:body>
   
     <form>
       <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
-      <input type="hidden" name="lenya.usecase" value="${request.getParameter('lenya.usecase')}"/>
+      <input type="hidden" name="lenya.usecase" value="${usecase.getName()}"/>
 
       ...
 
@@ -197,12 +224,9 @@
 
   </page:body>
 </page:page>]]></source>
-          </li>
-          <li>Take care of adding the hidden <code>lenya.usecase</code> and <code>lenya.continuation</code> fields as shown above.</li>
-          <li>The template has to be located at <code><![CDATA[$PUB_HOME/lenya/usecases/<usecase>.jx]]></code>
-            (replace . with /), for instance
-          </li>
-        </ol>
+          <p>
+          Take care of adding the hidden <code>lenya.usecase</code> and <code>lenya.continuation</code> fields as shown above.
+          </p>
       </section>
       
     </section>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org