<?xml version="1.0" ?>
<kupu:feature
    name="body"
    implementation="mmbase"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:kupu="http://kupu.oscom.org/namespaces/dist"
    xmlns:i18n="http://xml.zope.org/namespaces/i18n"
    xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:mm="http://www.mmbase.org/mmbase-taglib-2.0"
    xmlns:fn="http://java.sun.com/jsp/jstl/functions"
    i18n:domain="kupu"
    >
  <kupu:id>$Id: body.kupu,v 1.10 2005/09/27 18:26:52 michiel Exp $</kupu:id>


  <kupu:part name="body">
    <mm:import externid="objectnumber"  />
    <mm:import externid="tools"  />
    <mm:import externid="origin"  />
    <mm:import id="back" externid="kupu_back">${header.referer}</mm:import>
    <mm:compare referid="objectnumber" value="new">
      <mm:import externid="referrer">${header.referer}</mm:import>
      <mm:import id="wizardxml">${mm:directory(referrer)}/${param.wizard}.xml</mm:import>
      <mm:haspage page="$wizardxml">
        <mm:formatter id="type" write="false">
          <mm:include cite="true" page="${wizardxml}"/>
          <mm:xslt>
            <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform" match="/">
              <xsl:value-of select="/wizard-schema/action[@type='create']/object/@type"/>
            </xsl:template>
          </mm:xslt>
        </mm:formatter>
        <mm:formatter id="role" write="false">
          <mm:include cite="true" page="${wizardxml}"/>
          <mm:xslt>
            <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform" match="/">
              <xsl:value-of select="/wizard-schema/action[@type='create']/object/relation/@role"/>
            </xsl:template>
          </mm:xslt>
        </mm:formatter>
        <mm:isempty referid="role">
          <mm:import reset="true" id="role">related</mm:import>
        </mm:isempty>
      </mm:haspage>
      <mm:haspage page="${wizardxml}" inverse="true">
        <mm:import externid="wizard" vartype="list" listdelimiter="/" />
        <mm:import id="type">${wizard[fn:length(wizard) - 1]}</mm:import>
        <mm:import id="role">related</mm:import>
      </mm:haspage>
      <mm:createnode type="$type" id="node">

      </mm:createnode>
      <mm:present referid="origin">
        <mm:hasnode number="$origin">
          <mm:log>Creating relation between ${origin} and ${node} with role ${role}</mm:log>
          <mm:node id="origin" referid="origin" />
          <mm:createrelation role="${role}" source="origin" destination="node" />
        </mm:hasnode>
      </mm:present>
      <mm:import externid="link_nodetypes" />
      <mm:import externid="related_types" />
      <mm:redirect referids="node@objectnumber,tools?,language?,origin?,nodetypes?,back@kupu_back,link_nodetypes?,related_types?" /> 
    </mm:compare>
    <mm:compare referid="objectnumber" value="new" inverse="true">
      <mm:node id="node" referid="objectnumber" />
    </mm:compare>
    <mm:url absolute="true" page="." id="abs" write="false" />
    <body onload="kupu = startKupu('${lang}'); mmbaseInit('${node}', '${abs}');">
      <kupu:define-slot name="body" />
    </body>
  </kupu:part>

  <kupu:part name="fulleditor">
    <div class="kupu-fulleditor">
      <kupu:define-slot name="fulleditor" />
    </div>
  </kupu:part>

  <kupu:part name="editorframe">
    <div class="kupu-editorframe">
      <form>					
        <iframe id="kupu-editor"
                class="kupu-editor-iframe"
                frameborder="0"
                src="start.jspx"
                scrolling="auto">
          <jsp:text>
          </jsp:text>
        </iframe>
        <textarea
         class="kupu-editor-textarea" 
         id="kupu-editor-textarea"><jsp:text> </jsp:text></textarea>
      </form>
    </div>
  </kupu:part>

</kupu:feature>
