<?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"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    i18n:domain="kupu"
    >
  <kupu:id>$Id: body.kupu 62831 2009-03-10 21:03:13Z mihxil $</kupu:id>


  <kupu:part name="body">

    <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" inverse="true">
        <mm:import id="wizardxml" reset="true">${templates}/${param.wizard}.xml</mm:import>
      </mm:haspage>
      <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">
        <c:choose>
          <c:when test="${! empty param.wizard}">
            <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>
          </c:when>
          <c:otherwise>
            <mm:import externid="type" required="true" />
          </c:otherwise>
        </c:choose>
      </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:import externid="currentTitle" />
      <mm:redirect referids="node@objectnumber,tools?,language?,origin?,nodetypes?,back@kupu_back,link_nodetypes?,related_types?,javascript?,style?,templates?,prefix?,currentTitle?" />
    </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>
