Hello,

I still have a problem using CForms in the portal of coocoon 2.1.10.

We plan to use several forms inside of coplets in a cocoon portal and want to 
use continuations.
In the cocoon samples (under the tab "Apps") there is a simple calculator form 
sample that seems to work as we need it. It goes through several input forms 
and simply displays the calculation result. The form logic is outside of the 
portal in the directory /samples/flow/jxcalc.

If I put the flowscripts into another directory (with changes in sitemap), it 
doesn't work. And if I try it in my own portal, it doesn't work at all, even if 
I put the code in /samples/flow/

Below is some code that I write into the sample cocoon portal. I have put the 
changes for calc2 into comments.
The coplet calc1 works. The coplet calc2 does not, the portal shows "coplet 
currently not available".

Are there any other things I have to configure, for instance in the following 
classes?
org.apache.cocoon.portal.acting.URLAction
org.apache.cocoon.portal.transformation.HTMLRootTransformer
org.apache.cocoon.portal.transformation.HTMLEventLinkTransformer

Best regards and thanks a lot in advance
Wolfgang



----- /samples/blocks/portal/profiles/copletdata/portal.xml -----

   <coplet-data id="calc1" name="standard">
      <title>Calculator 1</title>
      <coplet-base-data>CachingURICoplet</coplet-base-data>
      <attribute>
         <name>buffer</name>
         <value xsi:type="java:java.lang.Boolean">true</value>
      </attribute>
      <attribute>
         <name>handleParameters</name>
         <value xsi:type="java:java.lang.Boolean">true</value>
      </attribute>
      <attribute>
         <name>uri</name>
         <value 
xsi:type="java:java.lang.String">cocoon:/coplets/genericform/</value>
      </attribute>
      <attribute>
         <name>temporary:application-uri</name>
         <value 
xsi:type="java:java.lang.String">cocoon://samples/flow/calc1/</value>
<!--     <value xsi:type="java:java.lang.String">cocoon://forms/calc2/</value> 
-->
      </attribute>
   </coplet-data>



----- /samples/blocks/portal/profiles/copletinstancedata/portal.xml -----

   <coplet-instance-data id="calc1-1" name="standard">
      <coplet-data>calc1</coplet-data>
   </coplet-instance-data>
   <coplet-instance-data id="calc2-1" name="standard">
      <coplet-data>calc2</coplet-data>
   </coplet-instance-data>


----- /samples/blocks/portal/profiles/layout/portal.xml -----

  <named-item name="Rechner 1">
    <coplet-layout name="coplet">
      <coplet-instance-data>calc1-1</coplet-instance-data>
    </coplet-layout>
  </named-item>
  <named-item name="Rechner 2">
    <coplet-layout name="coplet">
      <coplet-instance-data>calc2-1</coplet-instance-data>
    </coplet-layout>
  </named-item>



----- /samples/blocks/portal/coplets/genericform/sitemap.xmap -----

    <map:pipeline type="noncaching">
      <map:match pattern="">
        <map:act type="portal-urlhelper" 
src="{coplet:temporaryAttributes/application-uri}">
          <map:parameter name="copletid" value="{coplet:#}"/>
          <map:generate src="{url}"/>
        </map:act>
        <map:transform type="htmlroot">
          <map:parameter name="add-mode" value="false"/>
        </map:transform>
        <map:transform type="portal-html-eventlink">
          <map:parameter name="attribute-name" value="application-uri"/>
        </map:transform>
        <map:serialize type="xml"/>
      </map:match>
    </map:pipeline>



----- /samples/flow/calc1/sitemap.xmap -----
----- /forms/calc2/sitemap.xmap -----

  <map:flow language="javascript">
    <map:script src="formlogic.js"/>
  </map:flow>

  <map:pipelines>
    <map:pipeline>
      <map:match pattern="page/*">
        <map:generate type="jx" src="screens/{1}.xml"/>
        <map:transform 
src="context://samples/common/style/xsl/html/simple-page2html.xsl">
          <map:parameter name="servletPath" value="{request:servletPath}"/>
          <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
          <map:parameter name="contextPath" value="{request:contextPath}"/>
          <map:parameter name="file" 
value="/samples/flow/calc1/screens/{1}.xml"/>
<!--      <map:parameter name="file" value="/forms/calc2/screens/{1}.xml"/> -->
          <map:parameter name="remove" value="{0}"/>
        </map:transform>
        <map:serialize/>
      </map:match>
    </map:pipeline>

    <map:pipeline>
      <map:match pattern="continue.*">
        <map:call continuation="{1}"/>
      </map:match>

      <map:match pattern="">
        <map:call function="showForm"/>
      </map:match>

    </map:pipeline>
  </map:pipelines>



----- /samples/flow/calc1/formlogic.js -----
----- /forms/calc2/formlogic.js -----

function showForm()
{
  var a, b, op;

  a = getNumber("a");
  b = getNumber("b", a);
  op = getOperator(a, b);

  if (op == "+")
    sendResult(a, b, op, a + b);
  else if (op == "-")
    sendResult(a, b, op, a - b);
  else if (op == "*")
    sendResult(a, b, op, a * b);
  else if (op == "/")
    sendResult(a, b, op, a / b);
  else
    sendResult("Error: Unkown operator!");
}

function getNumber(name, a, b)
{
  var uri = "page/getNumber" + name.toUpperCase();
  cocoon.sendPageAndWait(uri, { "a" : a, "b" : b });
  return parseFloat(cocoon.request.getParameter(name));
}

function getOperator(a, b)
{
  cocoon.sendPageAndWait("page/getOperator", { "a" : a, "b" : b });
  return cocoon.request.operator;
}

function sendResult(a, b, op, result)
{
  cocoon.sendPage("page/displayResult", {"a" : a, "b" : b, "operator" : op, 
"result" : result});
}



----- /samples/flow/calc1/screens/getNumberA.xml -----
----- /forms/calc2/screens/getNumberA.xml -----

<page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>
    <resources>
      <resource type="file" href="../calc1/formlogic.js">Flowscript</resource>
<!--  <resource type="file" href="../calc2/formlogic.js">Flowscript</resource> 
-->
    </resources>
    <title>Taschenrechner</title>
    <content>
      <form method="post" action="continue.#{$continuation/id}">
        <para>Bitte geben Sie einen Wert ein für <strong>x</strong>: <input 
type="text" name="a"/></para>
        <input type="submit" name="submit" value="OK"/>
      </form>
    </content>
</page>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to