<?xml version="1.0" ?>
<html>
  <mm:content
      xmlns:jsp="http://java.sun.com/JSP/Page"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:mm="http://www.mmbase.org/mmbase-taglib-2.0"
      type="text/html"
      expires="-1">
    <jsp:directive.page session="true" errorPage="../error.jspx" />
    <head>
    </head>


    <mm:cloud rank="basic user">
      <mm:import externid="nodetype">images</mm:import>
      <mm:log>Uploading ${nodetype}</mm:log>
      <mm:createnode type="$nodetype" id="node">
        <mm:import id="file" externid="node_prop_image" from="multipart" vartype="fileitem"  />
        <c:choose>
          <c:when test="${! empty file}">
            <!-- backwards compatibility, can perhaps just as well be dropped -->
            <mm:import id="title" externid="node_prop_title" from="multipart"/>
            <mm:import id="description" externid="node_prop_desc" from="multipart"/>


            <mm:hasfield name="title">
              <mm:setfield name="title" valueid="title" />
            </mm:hasfield>
            <mm:hasfield name="name">
              <mm:setfield name="name" valueid="title" />
            </mm:hasfield>
            <mm:hasfield name="subtitle">
              <mm:setfield name="subtitle" valueid="description" />
            </mm:hasfield>
            <mm:hasfield name="description">
              <mm:setfield name="description" valueid="description" />
            </mm:hasfield>
            <mm:hasfield name="filename">
              <mm:setfield name="filename">${file.name}</mm:setfield>
            </mm:hasfield>
            <mm:setfield name="handle" valueid="file" />
          </c:when>
          <c:otherwise>
            <!-- this newer version depends on uploadfields.jsp to be used, and it much more generic, -->
            <mm:fieldlist nodetype="${nodetype}" type="edit" varStatus="status">
              <c:if test="${status.current.state eq 2}">
                <mm:fieldinfo type="useinput" />
              </c:if>
            </mm:fieldlist>
          </c:otherwise>
        </c:choose>
      </mm:createnode>
      <mm:node referid="node">
        <mm:function name="mimetype" id="mimetype" write="false" />
        <mm:hasfunction name="cache">
          <mm:image template="s(100x100&gt;)">
            <body onLoad="window.parent.kupu.getTool('drawertool').current_drawer.finishUpload('${_}', 'image');">
            </body>
          </mm:image>
        </mm:hasfunction>
        <mm:hasfunction name="cache" inverse="true">
          <mm:field name="number" write="false" id="number" />
          <c:choose>
            <c:when test="${nodetype eq 'flashobjects'}">
              <mm:link page="/mmbase/kupu/mmbase/icons/flash.png" referids="number@o">
                <body onLoad="window.parent.kupu.getTool('drawertool').current_drawer.finishUpload('${_}', 'flash', ${_node.width}, ${_node.height});">
                </body>
              </mm:link>
            </c:when>
            <c:otherwise>
              <body onLoad="window.parent.kupu.getTool('drawertool').current_drawer.finishUpload('mmbase://${nodetype}/${number}', '${mimetype}', '${_node.title}');">
              </body>
            </c:otherwise>
          </c:choose>
        </mm:hasfunction>
      </mm:node>
    </mm:cloud>
  </mm:content>
</html>
