You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by th...@apache.org on 2005/10/13 12:39:23 UTC
svn commit: r320713 - in /lenya/trunk/src:
java/org/apache/lenya/cms/usecase/ modules/cforms/ modules/cforms/config/
modules/cforms/samples/ modules/cforms/usecases/ modules/cforms/xslt/
webapp/lenya/pubs/default/config/ webapp/lenya/pubs/default/conte...
Author: thorsten
Date: Thu Oct 13 03:38:56 2005
New Revision: 320713
URL: http://svn.apache.org/viewcvs?rev=320713&view=rev
Log:
Adds a cforms doctype to the default publication to show the possibilites of
CForms/Ajax together with Lenya.
See http://wiki.apache.org/lenya/HowToCFormsInLenya1.4 for some basic notes.
There is still an issue with saving the document when Ajax is used.
Cooperation work with Felix Röthenbacher who provided a patch for that.
Solves Bug 37069. Thx Felix.
Added:
lenya/trunk/src/java/org/apache/lenya/cms/usecase/CFormsUsecase.java (with props)
lenya/trunk/src/modules/cforms/
lenya/trunk/src/modules/cforms/config/
lenya/trunk/src/modules/cforms/config/menu.xsp (with props)
lenya/trunk/src/modules/cforms/config/module.xconf (with props)
lenya/trunk/src/modules/cforms/config/usecase-edit.xconf (with props)
lenya/trunk/src/modules/cforms/menus.xmap (with props)
lenya/trunk/src/modules/cforms/samples/
lenya/trunk/src/modules/cforms/samples/cforms.xml (with props)
lenya/trunk/src/modules/cforms/sitemap.xmap (with props)
lenya/trunk/src/modules/cforms/usecases/
lenya/trunk/src/modules/cforms/usecases/dynamicrepeater.xml (with props)
lenya/trunk/src/modules/cforms/usecases/dynamicrepeater_binding.xml (with props)
lenya/trunk/src/modules/cforms/usecases/dynamicrepeater_template.xml (with props)
lenya/trunk/src/modules/cforms/xslt/
lenya/trunk/src/modules/cforms/xslt/cforms2xhtml.xsl (with props)
lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/cforms/
lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/cforms/index_en.xml (with props)
lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/cforms/index_en.xml.meta
Modified:
lenya/trunk/src/webapp/lenya/pubs/default/config/publication.xconf
lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/index_en.xml
lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/sitetree.xml
Added: lenya/trunk/src/java/org/apache/lenya/cms/usecase/CFormsUsecase.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/usecase/CFormsUsecase.java?rev=320713&view=auto
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/usecase/CFormsUsecase.java (added)
+++ lenya/trunk/src/java/org/apache/lenya/cms/usecase/CFormsUsecase.java Thu Oct 13 03:38:56 2005
@@ -0,0 +1,78 @@
+/*
+ *
+ * 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.
+ *
+ */
+package org.apache.lenya.cms.usecase;
+
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.repository.Node;
+import org.apache.lenya.cms.usecase.DocumentUsecase;
+import org.apache.cocoon.components.ContextHelper;
+import org.apache.cocoon.environment.Request;
+
+public class CFormsUsecase extends DocumentUsecase {
+ /**
+ * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
+ */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
+ */
+ protected void initParameters() {
+ super.initParameters();
+ try {
+ doPreparation(this.manager);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ /**
+ * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckExecutionConditions()
+ */
+ protected void doCheckExecutionConditions() throws Exception {
+ super.doCheckExecutionConditions();
+ }
+
+ /**
+ * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
+ */
+ protected void doExecute() throws Exception {
+ super.doExecute();
+ }
+
+ protected Node[] getNodesToLock() {
+ Node[] nodes = { getSourceDocument().getRepositoryNode() };
+ return nodes;
+ }
+
+ private void doPreparation(ServiceManager manager) {
+ Request request = ContextHelper.getRequest(this.context);
+ Document doc = getSourceDocument();
+ String sourceUri=doc.getSourceURI();
+ setParameter("sourceUri", sourceUri);
+ String pubId = doc.getPublication().getId();
+ setParameter("pubId", pubId);
+ String host="http://"+request.getServerName()+":"+request.getServerPort() ;
+ /*
+ * + "/"+request.getServletPath()<- FIXME: need to check with tomcat!
+ * Not have to be if contextprefix is working propably, needs testing!!!
+ */
+ setParameter("host", host);
+ }
+
+}
Propchange: lenya/trunk/src/java/org/apache/lenya/cms/usecase/CFormsUsecase.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/cforms/config/menu.xsp
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/cforms/config/menu.xsp?rev=320713&view=auto
==============================================================================
--- lenya/trunk/src/modules/cforms/config/menu.xsp (added)
+++ lenya/trunk/src/modules/cforms/config/menu.xsp Thu Oct 13 03:38:56 2005
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<!--
+ 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: 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="File">
+ <block admin="false">
+ <item uc:usecase="site.create" href="?doctype=cforms"><i18n:text>New CForms Document</i18n:text></item>
+ </block>
+ </menu>
+
+ <menu i18n:attr="name" name="Edit">
+ <xsp:logic>
+ String doctype = <input:get-attribute module="page-envelope" as="string" name="document-type"/>;
+ if ("cforms".equals(doctype)) {
+ <block info="false">
+ <item wf:event="edit" uc:usecase="edit.cforms" href="?"><i18n:text>With CForms</i18n:text></item>
+ <!-- TODO: add RelaxNG schemas for cforms doctype.
+ <item wf:event="edit" uc:usecase="edit.forms"><xsp:attribute name="href"><xsp:expr>"?form=" + doctype</xsp:expr></xsp:attribute><i18n:text>With Forms</i18n:text></item>
+ <item wf:event="edit" uc:usecase="edit.oneform" href="?"><i18n:text>With one Form</i18n:text></item>
+ -->
+ </block>
+ }
+ </xsp:logic>
+ </menu>
+
+ </menus>
+
+ </menu>
+</xsp:page>
Propchange: lenya/trunk/src/modules/cforms/config/menu.xsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/cforms/config/module.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/cforms/config/module.xconf?rev=320713&view=auto
==============================================================================
--- lenya/trunk/src/modules/cforms/config/module.xconf (added)
+++ lenya/trunk/src/modules/cforms/config/module.xconf Thu Oct 13 03:38:56 2005
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+ 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: doctypes.xconf 164635 2005-04-25 20:01:43Z tschlabach $ -->
+
+<xconf xpath="/cocoon/resource-types" unless="/cocoon/resource-types/component-instance[@name = 'cforms']">
+
+ <component-instance name="cforms"
+ logger="lenya.resourcetypes.cforms"
+ class="org.apache.lenya.cms.publication.ResourceTypeImpl">
+ <schema src="fallback://lenya/modules/cforms/schemas/cforms.rng" language="http://relaxng.org/ns/structure/0.9"/>
+ <creator src="org.apache.lenya.cms.authoring.DefaultBranchCreator">
+ <sample-name>fallback://lenya/modules/cforms/samples/cforms.xml</sample-name>
+ </creator>
+ <link-attribute xpath="//*[namespace-uri() = 'http://www.w3.org/1999/xhtml']/@href"/>
+ <format name="xhtml" uri="cocoon://modules/cforms/xhtml.xml"/>
+ </component-instance>
+
+</xconf>
Propchange: lenya/trunk/src/modules/cforms/config/module.xconf
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/cforms/config/usecase-edit.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/cforms/config/usecase-edit.xconf?rev=320713&view=auto
==============================================================================
--- lenya/trunk/src/modules/cforms/config/usecase-edit.xconf (added)
+++ lenya/trunk/src/modules/cforms/config/usecase-edit.xconf Thu Oct 13 03:38:56 2005
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xconf xpath="/cocoon/usecases" remove="/cocoon/usecases/component-instance[@name = 'edit.cforms']">
+ <component-instance name="edit.cforms"
+ logger="lenya.site"
+ class="org.apache.lenya.cms.usecase.CFormsUsecase">
+ <view template="modules/cforms/usecases/dynamicrepeater_template.xml" type="cforms">
+ <intro/>
+ <definition template="modules/cforms/usecases/dynamicrepeater.xml">
+ form.setAttribute("counter", new java.lang.Integer(0));
+ </definition>
+ <binding template="modules/cforms/usecases/dynamicrepeater_binding.xml">
+ generic.doc = loadDocument(generic.proxy.getParameter('sourceUri'));
+ form.load(generic.doc);
+ </binding>
+ <outro>
+ form.save(generic.doc);
+ saveDocument(generic.doc, generic.proxy.getParameter('sourceUri'));
+ </outro>
+ </view>
+ </component-instance>
+</xconf>
+
Propchange: lenya/trunk/src/modules/cforms/config/usecase-edit.xconf
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/cforms/menus.xmap
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/cforms/menus.xmap?rev=320713&view=auto
==============================================================================
--- lenya/trunk/src/modules/cforms/menus.xmap (added)
+++ lenya/trunk/src/modules/cforms/menus.xmap Thu Oct 13 03:38:56 2005
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+ 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: 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="config/menu.xsp"/>
+ <map:serialize type="xml"/>
+ </map:match>
+
+ </map:pipeline>
+
+ </map:pipelines>
+</map:sitemap>
Propchange: lenya/trunk/src/modules/cforms/menus.xmap
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/cforms/samples/cforms.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/cforms/samples/cforms.xml?rev=320713&view=auto
==============================================================================
--- lenya/trunk/src/modules/cforms/samples/cforms.xml (added)
+++ lenya/trunk/src/modules/cforms/samples/cforms.xml Thu Oct 13 03:38:56 2005
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<data>
+ <contacts>
+ </contacts>
+</data>
Propchange: lenya/trunk/src/modules/cforms/samples/cforms.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/cforms/sitemap.xmap
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/cforms/sitemap.xmap?rev=320713&view=auto
==============================================================================
--- lenya/trunk/src/modules/cforms/sitemap.xmap (added)
+++ lenya/trunk/src/modules/cforms/sitemap.xmap Thu Oct 13 03:38:56 2005
@@ -0,0 +1,55 @@
+<?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: doctypes.xmap 179488 2005-06-02 02:29:39Z gregor $ -->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+ <map:pipelines>
+
+ <map:pipeline>
+ <!-- View Revision? -->
+ <map:match pattern="*.xml">
+ <map:match type="step" pattern="view-revision">
+ <map:generate type="serverpages" src="fallback://lenya/content/rc/view.xsp">
+ </map:generate>
+ <map:transform src="fallback://lenya/xslt/rc/toDoc.xsl"/>
+ <map:transform src="fallback://lenya/modules/cforms/xslt/cforms2xhtml.xsl">
+ <map:parameter name="rendertype" value="{1}"/>
+ <map:parameter name="nodeid" value="{page-envelope:document-name}"/>
+ <map:parameter name="language" value="{page-envelope:document-language}"/>
+ </map:transform>
+ <map:serialize type="xml"/>
+ </map:match>
+ </map:match>
+
+ <!-- parametrized doctype matcher -->
+ <!-- pattern="{rendertype}" -->
+ <map:match pattern="*.xml">
+ <map:generate src="lenya://lenya/pubs/{page-envelope:publication-id}/content/{page-envelope:area}/{page-envelope:document-path}"/>
+ <map:transform src="fallback://lenya/modules/cforms/xslt/cforms2xhtml.xsl">
+ <map:parameter name="rendertype" value="{request-param:rendertype}"/>
+ <map:parameter name="nodeid" value="{page-envelope:document-name}"/>
+ <map:parameter name="language" value="{page-envelope:document-language}"/>
+ </map:transform>
+ <map:serialize type="xml"/>
+ </map:match>
+
+ </map:pipeline>
+
+ </map:pipelines>
+</map:sitemap>
Propchange: lenya/trunk/src/modules/cforms/sitemap.xmap
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/cforms/usecases/dynamicrepeater.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/cforms/usecases/dynamicrepeater.xml?rev=320713&view=auto
==============================================================================
--- lenya/trunk/src/modules/cforms/usecases/dynamicrepeater.xml (added)
+++ lenya/trunk/src/modules/cforms/usecases/dynamicrepeater.xml Thu Oct 13 03:38:56 2005
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<!--
+ @version $Id: dynamicrepeater.xml 190962 2005-06-16 17:17:00Z sylvain $
+-->
+
+<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+
+ <fd:widgets>
+
+ <fd:repeater id="contacts">
+ <fd:widgets>
+
+ <!-- The ID is here to keep track of row creation order, which can
+ have no relation with row index when the users used move up/down -->
+ <fd:output id="ID">
+ <fd:label>ID</fd:label>
+ <fd:datatype base="integer"/>
+ </fd:output>
+
+ <fd:field id="firstname">
+ <fd:label>Firstname</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+
+ <fd:field id="lastname">
+ <fd:label>Lastname</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+
+ <fd:row-action id="up" command="move-up"/>
+
+ <fd:row-action id="down" command="move-down"/>
+
+ <fd:booleanfield id="select">
+ <fd:label>Select</fd:label>
+ </fd:booleanfield>
+
+ </fd:widgets>
+ </fd:repeater>
+
+ <fd:repeater-action id="addcontact" command="add-row" repeater="contacts">
+ <fd:label>Add contact</fd:label>
+ <fd:on-action>
+ <fd:javascript>
+ // Increment the row creation ID counter (it has been initialized in
+ // the flowscript when the form was created).
+ // This shows how attributes can be used as a communication means between
+ // application logic and widget event handlers.
+ var form = event.source.form;
+ var count = new java.lang.Integer(form.getAttribute("counter").intValue() + 1);
+ form.setAttribute("counter", count);
+ var repeater = form.getChild("contacts");
+ repeater.getRow(repeater.getSize() - 1).getChild("ID").setValue(count);
+ </fd:javascript>
+ </fd:on-action>
+ </fd:repeater-action>
+
+ <fd:repeater-action id="removecontacts" command="delete-rows" repeater="contacts" select="select">
+ <fd:label>Remove selected contacts</fd:label>
+ </fd:repeater-action>
+
+ <fd:submit id="ok">
+ <fd:label>Submit</fd:label>
+ </fd:submit>
+ </fd:widgets>
+
+</fd:form>
Propchange: lenya/trunk/src/modules/cforms/usecases/dynamicrepeater.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/cforms/usecases/dynamicrepeater_binding.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/cforms/usecases/dynamicrepeater_binding.xml?rev=320713&view=auto
==============================================================================
--- lenya/trunk/src/modules/cforms/usecases/dynamicrepeater_binding.xml (added)
+++ lenya/trunk/src/modules/cforms/usecases/dynamicrepeater_binding.xml Thu Oct 13 03:38:56 2005
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+<!--
+ @version $Id: dynamicrepeater_binding.xml 151045 2005-02-02 20:36:01Z tim $
+-->
+
+<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
+ path="/data">
+
+ <fb:simple-repeater id="contacts" parent-path="contacts" row-path="contact">
+ <fb:value id="ID" path="@id"/>
+ <fb:value id="firstname" path="firstname"/>
+ <fb:value id="lastname" path="lastname"/>
+ </fb:simple-repeater>
+
+</fb:context>
Propchange: lenya/trunk/src/modules/cforms/usecases/dynamicrepeater_binding.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/cforms/usecases/dynamicrepeater_template.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/cforms/usecases/dynamicrepeater_template.xml?rev=320713&view=auto
==============================================================================
--- lenya/trunk/src/modules/cforms/usecases/dynamicrepeater_template.xml (added)
+++ lenya/trunk/src/modules/cforms/usecases/dynamicrepeater_template.xml Thu Oct 13 03:38:56 2005
@@ -0,0 +1,107 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<page:page xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+ xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+ xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0">
+
+ <!-- Import the macros that define CForms template elements -->
+ <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
+
+ <page:head>
+ </page:head>
+
+ <page:body>
+ <ft:form-template method="POST" ajax="true">
+ <input type="hidden" name="lenya.continuation" value="${continuation.id}"/>
+ <input type="hidden" name="lenya.usecase"
+ value="${request.getParameter('lenya.usecase')}"/>
+
+ <p>
+ This is an example of how dynamic templates (using the JX macros) allow to change the
+ page structure depending on the form contents. By adding or removing rows in the repeater
+ below you will see:
+ </p>
+ <ul>
+ <li>when there are no contacts, only the "Add contact" button is displayed and the table isn't shown,</li>
+ <li>when there are some contacts, the "move up" and "move down" buttons are not shown on the first and last lines, respectively.</li>
+ </ul>
+ <ft:repeater id="contacts">
+ <div>
+ <jx:choose>
+ <jx:when test="${repeater.getSize() == 0}">
+ <p><strong><em>There are no contacts to display</em></strong></p>
+ </jx:when>
+ <jx:otherwise>
+
+ <table border="1">
+ <tr>
+ <th><ft:repeater-widget-label widget-id="firstname"/></th>
+ <th><ft:repeater-widget-label widget-id="lastname"/></th>
+ <th><ft:repeater-widget-label widget-id="ID"/></th>
+ <th><ft:repeater-widget-label widget-id="select"/></th>
+ </tr>
+ <!-- The contents of the repeater-widget element is a template that will
+ be applied to each row in the repeater. -->
+ <ft:repeater-rows>
+ <tr class="forms-row-${repeaterLoop.index % 2}">
+ <td><ft:widget id="firstname"/></td>
+ <td><ft:widget id="lastname"/></td>
+ <td><ft:widget id="ID"/></td>
+ <td>
+ <!-- Don't display the "move up" button on the first row -->
+ <jx:choose>
+ <jx:when test="${repeaterLoop.first}">
+ <img src="resources/img/blank_btn.gif"/>
+ </jx:when>
+ <jx:otherwise>
+ <ft:widget id="up">
+ <fi:styling type="image" src="resources/img/move_up.gif"/>
+ </ft:widget>
+ </jx:otherwise>
+ </jx:choose>
+ <!-- Don't display the "move down" button on the first row -->
+ <jx:choose>
+ <jx:when test="${repeaterLoop.last}">
+ <img src="resources/img/blank_btn.gif"/>
+ </jx:when>
+ <jx:otherwise>
+ <ft:widget id="down">
+ <fi:styling type="image" src="resources/img/move_down.gif"/>
+ </ft:widget>
+ </jx:otherwise>
+ </jx:choose>
+ <ft:widget id="select"/>
+ </td>
+ </tr>
+ </ft:repeater-rows>
+ </table>
+ </jx:otherwise>
+ </jx:choose>
+ <p>
+ <ft:widget id="../addcontact"/>
+ <jx:if test="${widget.getChild('contacts').getSize() > 0}">
+ <ft:widget id="../removecontacts"/>
+ </jx:if>
+ </p>
+ </div>
+ </ft:repeater>
+ <ft:widget id="ok"/>
+ <br/>
+ </ft:form-template>
+ </page:body>
+</page:page>
Propchange: lenya/trunk/src/modules/cforms/usecases/dynamicrepeater_template.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/modules/cforms/xslt/cforms2xhtml.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/modules/cforms/xslt/cforms2xhtml.xsl?rev=320713&view=auto
==============================================================================
--- lenya/trunk/src/modules/cforms/xslt/cforms2xhtml.xsl (added)
+++ lenya/trunk/src/modules/cforms/xslt/cforms2xhtml.xsl Thu Oct 13 03:38:56 2005
@@ -0,0 +1,70 @@
+<?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: xhtml2xhtml.xsl 201776 2005-06-25 18:25:26Z gregor $ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xhtml="http://www.w3.org/1999/xhtml"
+ xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ exclude-result-prefixes="xhtml lenya"
+ >
+
+ <xsl:template match="/">
+ <div id="body">
+ <body>
+ <h1>CForms/Ajax Example</h1>
+ <p>
+ Please edit with CForms editor to add more contacts. The CForms editor uses Ajax to reduce network traffic
+ and to increase response times.
+ </p>
+ <xsl:apply-templates select="data"/>
+ </body>
+ </div>
+
+ </xsl:template>
+
+ <xsl:template match="data">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="contacts">
+ <p>
+ <strong>Contacts:</strong>
+ <p>
+ <xsl:choose>
+ <xsl:when test="contact">
+ <ul>
+ <xsl:apply-templates/>
+ </ul>
+ </xsl:when>
+ <xsl:otherwise>
+ <i>No contacts to display.</i>
+ </xsl:otherwise>
+ </xsl:choose>
+ </p>
+ </p>
+ </xsl:template>
+
+ <xsl:template match="contact">
+ <li>
+ <xsl:value-of select="firstname"/><xsl:text> </xsl:text><xsl:value-of select="lastname"/>
+ </li>
+ </xsl:template>
+</xsl:stylesheet>
Propchange: lenya/trunk/src/modules/cforms/xslt/cforms2xhtml.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Modified: lenya/trunk/src/webapp/lenya/pubs/default/config/publication.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/config/publication.xconf?rev=320713&r1=320712&r2=320713&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/config/publication.xconf (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/config/publication.xconf Thu Oct 13 03:38:56 2005
@@ -32,10 +32,12 @@
<resource-type name="homepage" workflow="fallback://config/workflow/workflow.xml"/>
<resource-type name="links" workflow="fallback://config/workflow/workflow.xml"/>
<resource-type name="search" workflow="fallback://config/workflow/workflow.xml"/>
+ <resource-type name="cforms" workflow="fallback://config/workflow/workflow.xml"/>
<module name="xhtml"/>
<module name="links"/>
<module name="opendocument"/>
+ <module name="cforms"/>
<module name="homepage"/>
<module name="search"/>
<module name="blog"/>
Added: lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/cforms/index_en.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/cforms/index_en.xml?rev=320713&view=auto
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/cforms/index_en.xml (added)
+++ lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/cforms/index_en.xml Thu Oct 13 03:38:56 2005
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<data>
+ <contacts>
+ </contacts>
+</data>
Propchange: lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/cforms/index_en.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/cforms/index_en.xml.meta
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/cforms/index_en.xml.meta?rev=320713&view=auto
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/cforms/index_en.xml.meta (added)
+++ lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/cforms/index_en.xml.meta Thu Oct 13 03:38:56 2005
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<lenya:document xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0">
+<lenya:meta>
+<lenya:dc>
+<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">CForms Doctype</dc:title>
+<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">lenya</dc:creator>
+<dc:subject xmlns:dc="http://purl.org/dc/elements/1.1/"/>
+<dc:publisher xmlns:dc="http://purl.org/dc/elements/1.1/"/>
+<dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2005-10-13 11:19:30</dc:date>
+<dc:language xmlns:dc="http://purl.org/dc/elements/1.1/">en</dc:language>
+<dc:rights xmlns:dc="http://purl.org/dc/elements/1.1/"/>
+</lenya:dc>
+<lenya:internal>
+<lenya:resourceType>cforms</lenya:resourceType>
+<lenya:contentType>xml</lenya:contentType>
+</lenya:internal>
+</lenya:meta>
+</lenya:document>
Modified: lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/index_en.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/index_en.xml?rev=320713&r1=320712&r2=320713&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/index_en.xml (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/doctypes/index_en.xml Thu Oct 13 03:38:56 2005
@@ -27,7 +27,7 @@
<h1>Document Type Examples</h1>
<p>
-The default publication comes with the <a href="doctypes/xhtml-document.html">XHTML Doctype</a>, the <a href="doctypes/links.html">Links Doctype</a> and the <a href="doctypes/opendocument.html">OpenDocument Doctype</a>.
+The default publication comes with the <a href="doctypes/xhtml-document.html">XHTML Doctype</a>, the <a href="doctypes/links.html">Links Doctype</a>, the <a href="doctypes/opendocument.html">OpenDocument Doctype</a> and the <a href="doctypes/cforms.html">CForms Doctype</a>.
</p>
<p>
@@ -48,6 +48,11 @@
<p>
The <strong>OpenDocument Doctype</strong> is a standardized XML-based file format specification suitable for office applications and has been developed by <a href="http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office">OASIS</a>.
+</p>
+
+<p>
+The <strong>CForms Doctype</strong> is an example of how Lenya manages formular data based on Cocoon's CForms in conjunction
+with Ajax.
</p>
</body>
Modified: lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/sitetree.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/sitetree.xml?rev=320713&r1=320712&r2=320713&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/sitetree.xml (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/content/authoring/sitetree.xml Thu Oct 13 03:38:56 2005
@@ -52,6 +52,10 @@
<label xml:lang="en">OpenDocument Doctype</label>
<label xml:lang="de">OpenDocument Dokumenttyp</label>
</node>
+
+ <node id="cforms" visibleinnav="true">
+ <label xml:lang="en">CForms Doctype</label>
+ </node>
</node>
</site>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org