You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by wh...@mac.com on 2003/06/18 04:24:50 UTC

JavaScript Flow/Sendmail Action Question

Sorry to jump into the list with a question rightaway.

I'm working off of Milestone 1, using JVM 1.4.1 on Mac OS X 10.2.6, 
built with 'war'. And the java mail and activation jars in the 
appropriate places. I've been able to confirm that Sendmail is working.

I've started from the flowscript example in:

http://localhost:8080/cocoon/samples/xmlform/flow

The relevant sitemap fragment is (and yes, the sendmail action was 
declared in the components):

  <map:pipeline>

     <!--AMP Work Planning Wizard, using the Cocoon Flow Layer -->

       <map:match pattern="workPlanning">
         <map:call function="xmlForm">
           <map:parameter name="xmlform-function" 
value="workPlanningWizard"/>
	  <map:parameter name="xmlform-id" value="form-feedback"/>
           <map:parameter name="xmlform-validator-schema-ns" 
value="http://www.ascc.net/xml/schematron"/>
           <map:parameter name="xmlform-validator-schema" 
value="schematron/wizard-xmlform-sch-report.xml"/>
           <map:parameter name="xmlform-scope" value="session"/>
         </map:call>
       </map:match>

       <map:match pattern="workPlanning/*.xml">
	      <!-- original XMLForm document -->
	      <map:generate src="workPlanning/{1}.xml"/>
	
	      <!-- populating the document with model instance data -->
	      <map:transform type="xmlform"  label="xml"/>
	
	      <!-- personalizing the look and feel of the form controls  -->
	      <map:transform type="xalan" src="stylesheets/wizard2html.xsl" />
	
	      <!-- Transforming the XMLForm controls to HTML controls -->
	      <map:transform 
src="context://stylesheets/system/xmlform2html.xslt" />
	
	      <!-- sending the HTML back to the browser -->
	      <map:serialize type="html" label="debug"/>
	</map:match>
	
	<!-- Need to get the sendmail action built -->
	<map:match pattern="workPlanning/send">		
		<map:act type="sendmail">
			<map:parameter name="smtphost" value="relay.apple.com"/>
			<map:parameter name="from" value="whump@apple.com"/>
			<map:parameter name="to" value="whump@apple.com"/>
			<map:parameter name="subject" value="AMP: Work Planning Form"/>
			<map:parameter name="body" value="Here are the results of the work 
planning form you completed." />
			<map:parameter name="attachments" 
value="context://workPlanning/confirm.xml" />
			<map:generate src="workPlanning/end.xml"/>
			<map:serialize type="html"/>
		</map:act>
	</map:match>
		
     </map:pipeline>

And the relevant part of the flowscript is:

  xform.setModel(bean);

     xform.sendView("userIdentity",
                    "workPlanning/userIdentity.xml",
                    function(xform) {
         var bean = xform.getModel();
     });
     print("handling user identity");

     xform.sendView("work",
                    "workPlanning/work.xml",
                    function(xform) {
         var bean = xform.getModel();
     });

     xform.sendView("confirm", "workPlanning/confirm.xml");

     print("handling confirm");
     xform.sendView("confirm", "workPlanning/send");
     xform.finish("workPlanning/end.xml");
     print("done");

The problem comes when starting from the continuation for 
workPlanning/send.

Note from the sitemap that I want to attach a file (for now, just the 
XForm with the bean values inserted, later a PDF generated from the 
form) to the mail.

So I'm calling out to a URI in the current context to regenerate the 
XML with the form data.

However, as I'm tailing the sitemap log. We get an error from the 
Sendmail action. But we don't get the normal cocoon error page, 
instead, we're redirected to a generic Cocoon 404 handler page.

So the questions I have:

1) Can I re-enter the flow from outside the match, or do I need another 
flow to generate the attachment?

2) Perhaps I'm doing this the wrong way, however, since there's not 
much out there on flow, I'm learning by experiment.


-- whump


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org