1. AJAX, Authentication and Aggregation

a.jpg

CForm Definition to use AJAX

<fd:field id="environment" required="true">
   <fd:label>Environment:</fd:label>
   <fd:datatype base="string"/>
   <fd:selection-list src="environment.xml"/>
   <fd:on-value-changed>
      <fd:javascript>
      var value = this.value;
      var appwidget = widget.lookupWidget("../appGroup");
      if (value != null)
      {
         // Get the corresponding type list
         appwidget.setSelectionList(value + ".xml");
         appwidget.state = Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE;
      }
      else
      {
         // Set an empty selection list
         appwidget.setSelectionLis
         (
            new Packages.org.apache.cocoon.forms.datatype.EmptySelectionList("Select an Environment First")
         );
         appwidget.state = Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED;
      }
      // Always set the type value to null. Note that it will also fire an event on the "type"
      // widget if it already had a value.
      appwidget.value = null;
      </fd:javascript>
   </fd:on-value-changed>
   <fd:help>Please select an Environment</fd:help>
</fd:field>

Pipeline matcher to handle asynchronous browser updates

<map:match pattern="viewform-*.html">
   <map:generate type="jx" src="pages/{1}.xml"/>
   <map:transform type="browser-update"/>
   <map:transform type="i18n"/>
   <map:transform src="resources/forms-samples-styling.xsl"/>
   <map:select type="ajax-request">
      <map:when test="true">
         <map:serialize type="xml"/>
      </map:when>
      <map:otherwise>
         <map:transform src="resources/page-styling.xsl"/>
         <map:serialize type="html"/>
      </map:otherwise>
   </map:select>
</map:match>

Authentication Framework

<authentication-manager>
   <handlers>
      <handler name="ldaphandler">
         <redirect-to uri="cocoon:/login"/>
         <authentication uri="cocoon:raw:/authenticate"/>
      </handler>
   </handlers>
</authentication-manager>
<map:match pattern="updateAppointment">
   <map:act type="auth-protect">
      <map:parameter name="handler" value="ldaphandler"/>
         <map:generate src="empty.xml"/>

Deprecated in favour of CoWarp http://osoco.sourceforge.net/cowarp/

Aggregation

aggregate.jpg

Aggregation is a very powerful concept that allows a document be generated from several other documents. Strictly speaking, all parts are just concatenated in this order to a new document.

"cocoon:" is a pseudo protocol and refers to another pipeline. "cocoon:/" refers to a pipeline from the current sitemap while "cocoon://" refers to a pipeline from the root sitemap.

Other pseudo protocols exist:

"context:" is another pseudo protocol, "context://" is referring to a resource using the servlet context.

"resource:" is yet another pseudo protocol, "resource://" is referring to a resource from the context classloader.

All these pseudo protocols are declared in the cocoon.xconf.

Thus, the parts refer to the pipeline fragments above.

The optional element attribute places the content in a new root element named as specified, using the namespace provided by an optional ns attribute.

©Cocoon Technology Ltd