cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/mail/samples/sendmail done.xml form.xml sendmail_xsp.xml sitemap.xmap
Date Thu, 17 Apr 2003 20:38:40 GMT
haul        2003/04/17 13:38:40

  Added:       src/blocks/mail/samples samples.xml sitemap.xmap
               src/blocks/mail/samples/sendmail done.xml form.xml
                        sendmail_xsp.xml sitemap.xmap
  Log:
  improved sendmail action and logicsheet
  includes attachments and more
  thanks to Frank Ridderbusch <frank.ridderbusch AT fujitsu-siemens.com>
  
  Revision  Changes    Path
  1.1                  cocoon-2.1/src/blocks/mail/samples/samples.xml
  
  Index: samples.xml
  ===================================================================
  <?xml version="1.0" encoding="iso-8859-1"?>
  
  <!-- CVS: $Id: samples.xml,v 1.1 2003/04/17 20:38:40 haul Exp $ -->
  
  <samples xmlns:xlink="http://www.w3.org/1999/xlink" name="mail block">
  
    <group name="Sendmail">
       <note>
         You need to have SMTP up and running on the server for this.
       </note>
       <sample name="Action documentation" href="/docs/userdocs/actions/sendmail-action.html">
         Documentation for the Sendmail action component.
       </sample>
       <sample name="Logicsheet documentation" href="/docs/userdocs/xsp/sendmail.html">
         Documentation for the Sendmail logicsheet component.
       </sample>
       <sample name="Sample" href="sendmail/new.html" xlink:role="dynamic">
         Send email using the either Sendmail action or Sendmail logicsheet.
       </sample>
    </group>
  
    <group name="Web-Mail Sample">
       <sample name="Web-Mail" href="mail/index.html" xlink:role="dynamic">
         Start the Web-Mail application.
       </sample>
    </group>
    
  </samples>
  
  
  
  1.1                  cocoon-2.1/src/blocks/mail/samples/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
  
  <!-- ========================= Components ================================ -->
  
   <map:components>
    <map:generators default="file"/>
    <map:transformers default="xslt"/>
    <map:readers default="resource"/>
    <map:serializers default="html"/>
    <map:matchers default="wildcard"/>
    <map:selectors default="browser"/>
   </map:components>
  
  
  <!-- =========================== Views =================================== -->
  
   <map:views>
    <map:view name="content" from-label="content">
     <map:serialize type="xml"/>
    </map:view>
  
    <map:view name="pretty-content" from-label="data">
      <map:transform src="context://stylesheets/system/xml2html.xsl"/>
      <map:serialize type="html"/>
    </map:view>
    
    <map:view name="links" from-position="last">
     <map:serialize type="links"/>
    </map:view>
  
   </map:views>
  
  <!-- =========================== Pipelines ================================= -->
  
   <map:pipelines>
  
    <map:pipeline>
  
     <map:match pattern="">
       <map:redirect-to uri="samples"/>
     </map:match>
  
     <map:match pattern="welcome">
       <map:redirect-to uri="samples"/>
     </map:match>
     
     <map:match pattern="samples">
      <map:generate src="samples.xml"/>
      <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
         <map:parameter name="contextPath" value="{request:contextPath}"/>
      </map:transform>
      <map:serialize/>
     </map:match>
  
     <!-- samples automount -->  
     <map:match pattern="*/**">
       <map:mount uri-prefix="{1}" src="{1}/" check-reload="yes"/>
     </map:match>
          
    </map:pipeline>
   </map:pipelines>
  
  </map:sitemap>
  
  <!-- end of file -->
  
  
  
  1.1                  cocoon-2.1/src/blocks/mail/samples/sendmail/done.xml
  
  Index: done.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:xsp-request="http://apache.org/xsp/request/2.0">
  <page>
      <resources>
         <resource type="doc" href="userdocs/actions/sendmail-action.html">Actions</resource>
         <resource type="doc" href="userdocs/xsp/sendmail.html">Logicsheet</resource>
      </resources>
  
    <title>Send EMail using action</title>
  
     <p>
       EMail sent.
     </p>
  
     <form>
       <input type="hidden" name="smtphost"/>
       <input type="hidden" name="from"/>
       <input type="hidden" name="to"/>
       <input type="hidden" name="cc"/>
       <input type="hidden" name="bcc"/>
       <input type="hidden" name="subject"/>
       <input type="hidden" name="body"/>
       <input type="hidden" name="attachment"/>
       <input type="submit" name="retry" value="retry"/>
     </form>
  
  </page>
  </xsp:page>
  
  
  1.1                  cocoon-2.1/src/blocks/mail/samples/sendmail/form.xml
  
  Index: form.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:xsp-request="http://apache.org/xsp/request/2.0">
  <page>
  
      <resources>
         <resource type="doc" href="userdocs/actions/sendmail-action.html">Actions</resource>
         <resource type="doc" href="userdocs/xsp/sendmail.html">Logicsheet</resource>
      </resources>
  
    <title>Send EMail</title>
  
     <p>
       You can choose which frontend is used to actually compose the email.
       The old action is only kept for compatibility and does not support
       attachments. Migrating to the new action is very painless however: only
       reading request parameters is not supported by the new action anymore
       since this can easily be done with input modules from sitemap.
     </p>
  
     <p>
        The default installation of Apache Cocoon does not allow
        uploads. This feature needs to be enabled in web.xml
     </p>
  
     <p>
       Sending email from this sample is restricted to clients accessing the
       server as "localhost". So even if the client runs on the same host, it
       does not work if the URL is not "http://<b>localhost</b>..." The sample
       silently fails otherwise.
     </p>
  
     <p style="color:red;">
       <xsp-request:get-attribute name="org.apache.cocoon.acting.Sendmail" default=""/>
     </p>
  
        <table cellpadding="2" cellspacing="2" border="0">
          <tbody>
       	  <form method="POST" enctype="multipart/form-data">
       	    <tr>
       	      <td valign="Top" align="Right">SMTP Host</td>
       	      <td valign="Top">
       	        <input type="text" name="smtphost" value="localhost"/>
       	      </td>
                <td />
              </tr>
       	    <tr>
       	      <td valign="Top" align="Right">From</td>
       	      <td valign="Top">
       	        <input type="text" name="from" value="cocoon@localhost"/>
       	      </td>
                <td />
              </tr>
       	    <tr>
       	      <td valign="Top" align="Right">To</td>
       	      <td valign="Top">
       	        <input type="text" name="to" value="@localhost"/>
       	      </td>
                <td />
              </tr>
       	    <tr>
       	      <td valign="Top" align="Right">CC</td>
       	      <td valign="Top">
       	        <input type="text" name="cc"/>
       	      </td>
                <td />
              </tr>
       	    <tr>
       	      <td valign="Top" align="Right">BCC</td>
       	      <td valign="Top">
       	        <input type="text" name="bcc"/>
       	      </td>
                <td />
              </tr>
       	    <tr>
       	      <td valign="Top" align="Right">Subject</td>
       	      <td valign="Top">
       	        <input type="text" name="subject"/>
       	      </td>
                <td />
              </tr>
       	    <tr>
       	      <td valign="Top" align="Right">Body</td>
       	      <td valign="Top">
       	        <textarea name="body" rows="10" cols="72"/>
       	      </td>
                <td />
              </tr>
       	    <tr>
       	      <td valign="Top" align="Right">File to attach</td>
       	      <td valign="Top">
       	        <input type="file" name="attachment"/>
       	      </td>
                <td/>
              </tr>
              <tr>
       	      <td>Choose the frontend:</td>
                <td>Send mail using
       	        <input type="submit" name="use-action" value="action"/>
       	        <input type="submit" name="use-oldaction" value="old action"/>
       	        <input type="submit" name="use-logicsheet" value="logicsheet"/>
       	      </td>
                <td/>
       	    </tr>
       	  </form>
          </tbody>
        </table>
  
  </page>
  </xsp:page>
  
  
  1.1                  cocoon-2.1/src/blocks/mail/samples/sendmail/sendmail_xsp.xml
  
  Index: sendmail_xsp.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:sendmail="http://apache.org/cocoon/sendmail/1.0"
            xmlns:xsp-request="http://apache.org/xsp/request/2.0">
  <page>
      <resources>
         <resource type="doc" href="userdocs/actions/sendmail-action.html">Actions</resource>
         <resource type="doc" href="userdocs/xsp/sendmail.html">Logicsheet</resource>
      </resources>
  
    <title>Send EMail</title>
  
     <sendmail:send-mail>
        <sendmail:smtphost><xsp-request:get-parameter name="smtphost"/></sendmail:smtphost>
        <sendmail:from><xsp-request:get-parameter name="from"/></sendmail:from>
        <sendmail:to><xsp-request:get-parameter name="to"/></sendmail:to>
        <sendmail:cc><xsp-request:get-parameter name="cc"/></sendmail:cc>
        <sendmail:bcc><xsp-request:get-parameter name="bcc"/></sendmail:bcc>
        <sendmail:subject><xsp-request:get-parameter name="subject"/></sendmail:subject>
        <sendmail:body><xsp-request:get-parameter name="body"/></sendmail:body>
        <sendmail:attachment>
          <sendmail:param name="object"><xsp:expr>request.get("attachment")</xsp:expr></sendmail:param>
        </sendmail:attachment>
        <sendmail:attachment url="context://welcome.xml" mime-type="text/plain" name="foo.txt"/>
        <sendmail:attachment url="cocoon:///"            mime-type="text/html"  name="welcome.html"/>
  
        <sendmail:on-success>
           <p>
             Email successfully sent.
           </p>
        </sendmail:on-success>
        <sendmail:on-error>
     		 <p style="color:red;">
             An error occurred: <sendmail:error-message/>
     		 </p>
        </sendmail:on-error>
     </sendmail:send-mail>
  
     <form>
       <input type="hidden" name="smtphost"/>
       <input type="hidden" name="from"/>
       <input type="hidden" name="to"/>
       <input type="hidden" name="cc"/>
       <input type="hidden" name="bcc"/>
       <input type="hidden" name="subject"/>
       <input type="hidden" name="body"/>
       <input type="hidden" name="attachment"/>
       <input type="submit" name="retry" value="retry"/>
     </form>
  
  </page>
  </xsp:page>
  
  
  1.1                  cocoon-2.1/src/blocks/mail/samples/sendmail/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
  
  <!-- ========================= Components ================================ -->
  
   <map:components>
    <map:generators default="file"/>
    <map:transformers default="xslt">
      <map:transformer name="simpleform" 
                       logger="sitemap.transformer.simpleform"
                       src="org.apache.cocoon.transformation.SimpleFormTransformer"/>
    </map:transformers>
    <map:readers default="resource"/>
    <map:serializers default="html"/>
  
    <map:matchers default="wildcard">
      <map:matcher name="host-matcher"
                   logger="sitemap.matcher.wildcard"
                   src="org.apache.cocoon.matching.modular.CachingWildcardMatcher">
        <input-module name="request"/>
  	  <parameter-name>serverName</parameter-name>
      </map:matcher>
    </map:matchers>
  
    <map:selectors default="browser"/>
    <map:actions>
       <map:action name="sendmail" 
                   logger="sitemap.action.sendmail"
                   src="org.apache.cocoon.acting.Sendmail"/>
       <map:action name="old-sendmail" 
                   logger="sitemap.action.sendmail"
                   src="org.apache.cocoon.acting.SendmailAction"/>
       <map:action name="req-params" 
                   logger="sitemap.action.requestParamExists"
                   src="org.apache.cocoon.acting.RequestParameterExistsAction"/>
    </map:actions>
   </map:components>
  
   <map:resources>
    <map:resource name="show-page">
      <map:generate type="serverpages" src="{target}"/>
      <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="remove" value="{remove}"/>
         <map:parameter name="file" value="{target}"/>
      </map:transform>
      <map:transform type="simpleform"/>
      <map:serialize/>
    </map:resource>
   </map:resources>
  
  <!-- =========================== Pipelines ================================= -->
  
   <map:pipelines>
  
    <map:pipeline>
  
     <map:match pattern="*">
  
       <map:match type="host-matcher" pattern="localhost">
       <!--+
           | to avoid creating an open SPAM relay in default
           | deployments, only allow "localhost" as server name.
           | -> client accesses this host as localhost => client == server
           +-->
  
  
         <map:act type="req-params">
           <map:parameter name="parameters" value="use-action"/>
           <!--+
               | Use action to send mail
               +-->
  
           <map:act type="sendmail">
             <!--+
                 | new sendmail action extends the deprecated action with options
                 | to use CC, BCC, attachments, and more. Incompatibility with 
                 | deprecated action: does not read request parameters. All
                 | parameters need to be passed explicitly from sitemap.
                 +-->
             <map:parameter name="smtphost"    value="{request-param:smtphost}"/>
             <map:parameter name="from"        value="{request-param:from}"/>
             <map:parameter name="to"          value="{request-param:to}"/>
             <map:parameter name="subject"     value="{request-param:subject}"/>
             <map:parameter name="body"        value="{request-param:body}"/>
             <map:parameter name="cc"          value="{request-param:cc}"/>
             <map:parameter name="bcc"         value="{request-param:bcc}"/>
             <map:parameter name="attachments" value="attachment cocoon:/// context://welcome.xml"/>
  
             <map:call resource="show-page">
               <map:parameter name="target" value="done.xml"/>
               <map:parameter name="remove" value="{0}"/>
             </map:call>
           </map:act>
         </map:act>
  
  
         <map:act type="req-params">
           <map:parameter name="parameters" value="use-oldaction"/>
           <!--+
               | Use (deprecated) action to send mail
               +-->
  
           <map:act type="old-sendmail">
             <map:parameter name="smtphost"    value="{request-param:mail.smtphost}"/>
             <!--+ 
                 | optional: if these parameters are not present, they will be read 
                 | from request
                 +-->
             <!--
             <map:parameter name="from"        value="{request-param:mail.from}"/>
             <map:parameter name="to"          value="{request-param:mail.to}"/>
             <map:parameter name="subject"     value="{request-param:mail.subject}"/>
             <map:parameter name="body"        value="{request-param:mail.body}"/>
             -->
  
             <map:call resource="show-page">
               <map:parameter name="target" value="done.xml"/>
               <map:parameter name="remove" value="{0}"/>
             </map:call>
           </map:act>
         </map:act>
  
  
         <map:act type="req-params">
           <map:parameter name="parameters" value="use-logicsheet"/>
           <!--+
               | Use logicsheet from XSP to send mail
               +-->
  
           <map:call resource="show-page">
             <map:parameter name="target" value="sendmail_xsp.xml"/>
             <map:parameter name="remove" value="{0}"/>
           </map:call>
         </map:act>
  
       </map:match> <!-- type="host-matcher" pattern="localhost" -->
  
  
       <!-- default page -->
       <map:call resource="show-page">
         <map:parameter name="target" value="form.xml"/>
         <map:parameter name="remove" value="{0}"/>
       </map:call>
  
     </map:match>
  
     <map:match pattern="">
      <map:redirect-to uri="../"/>
     </map:match>
  
    </map:pipeline>
    
   </map:pipelines>
  
  </map:sitemap>
  
  <!-- end of file -->
  
  
  

Mime
View raw message