<kupu:feature
    name="mmbase" implementation="mmbase"
    xmlns:mm="http://www.mmbase.org/mmbase-taglib-2.0"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
    xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:kupu="http://kupu.oscom.org/namespaces/dist" >

  <kupu:part name="tools-div">
    <div id="mmbase-tools">
      <mm:import externid="tools" from="this,parameters" vartype="list">empty</mm:import>
      <mm:stringlist referid="tools">
        <mm:isnotempty>
          <mm:include page="tools/${_}.jspx" />
        </mm:isnotempty>
      </mm:stringlist>
    </div>
  </kupu:part>

  <kupu:part name="node-div">
    <div id="nodefields">
      <mm:include page="node.jspx" />
    </div>
  </kupu:part>

  <kupu:part name="preview-div">
    <div id="node-preview">
      <mm:include page="preview.jspx" />
    </div>
  </kupu:part>

  <kupu:part name="kupu-div">
    <div id="kupu">
      <kupu:insert-part feature="body" part="fulleditor" />
    </div>
  </kupu:part>

  <kupu:part name="import-variables">
    <mm:import externid="objectnumber"  />
    <mm:import externid="tools"  />
    <mm:import externid="origin"  />
    <mm:import externid="prefix"  />
    <mm:import id="back" externid="kupu_back">${header.referer}</mm:import>
    <mm:import externid="templates">${mm:directory(header.referer)}</mm:import>
    <mm:import externid="style">${templates}</mm:import>
    <mm:import externid="javascript">${style}</mm:import>
  </kupu:part>

  <kupu:part name="styles">
    <link href="mmbase.css" rel="stylesheet" type="text/css" />
    <!-- custom style -->
    <mm:haspage page="${style}/kupu.css">
      <mm:link page="${style}/kupu.css">
        <link href="${_}" rel="stylesheet" type="text/css" />
      </mm:link>
    </mm:haspage>
  </kupu:part>

  <kupu:part name="jsincludes">
    <!-- custom java script -->
    <mm:haspage page="${javascript}/kupu.js">
      <mm:link page="${javascript}/kupu.js">
        <script type="text/javascript" src="${_}">
          <jsp:text> </jsp:text>
        </script>
      </mm:link>
    </mm:haspage>
  </kupu:part>

  <kupu:part name="language-selector">
    <div id="languageSelector">
      <form name="languageform" method="get" action=".">
        <input type="hidden" name="objectnumber" value="${node}" />
        <input type="hidden" name="tools" value="${tools}" />
        <input type="hidden" name="kupu_back" value="${back}" />
        <input type="hidden" name="templates" value="${templates}" />
        <input type="hidden" name="javascript" value="${javascript}" />
        <input type="hidden" name="prefix" value="${prefix}" />
        <input type="hidden" name="style" value="${style}" />
        <input type="hidden" name="link_nodetypes" value="${link_nodetypes}" />
        <select onChange="document.forms['languageform'].submit();" name="language">
          <mm:compare referid="rich_language" value="client">
            <option value="client" selected="selected"><fmt:message key="default" /></option>
          </mm:compare>
          <mm:compare referid="rich_language" value="client" inverse="true">
            <option value="client"><fmt:message key="default" /></option>
          </mm:compare>
          <mm:import id="languages" vartype="list">en,zh,ja,de,fr,pt,nl,da,cs,fi,el,sr,eo,hi</mm:import>
          <mm:stringlist referid="languages" jspvar="l">
            <c:set var="gui"><jsp:expression>new java.util.Locale(l).getDisplayName(new java.util.Locale(l))</jsp:expression></c:set>
            <mm:option value="${_}" compare="${rich_language}">${gui}</mm:option>
          </mm:stringlist>
        </select>
      </form>
    </div>
  </kupu:part>

  <kupu:part name="save-feedback">
    <div id="ajax-loader" style="display: none;">
      <mm:link page="/mmbase/style/ajax-loader.gif">
        <img  src="${_}" alt="*" />
      </mm:link>
    </div>
    <div id="save-message">
      <span>...</span>
    </div>
  </kupu:part>

  <kupu:part name="current-node">
    <mm:node number="${node}" notfound="skip">
      <jsp:text> (<mm:nodeinfo type="guitype" />)</jsp:text>
    </mm:node>
  </kupu:part>


  <kupu:part name="header">
    <div id="header">
      <fmt:bundle basename="org.mmbase.kupu.Messages">
        <div id="back">
          <a href="${back}">
            <mm:link page="/mmbase/style/images/previous.png">
              <img src="${_}" alt="&amp;lt;" />
            </mm:link>
          </a>
        </div>
        <kupu:insert-part feature="mmbase"     part="save-feedback" />

        <fmt:message key="Richtext editor" />
        <kupu:insert-part feature="mmbase"     part="language-selector" />
        <kupu:insert-part feature="mmbase"     part="curent-node" />

      </fmt:bundle>
    </div>
  </kupu:part>

  <kupu:part name="navigate">
    <div id="mmbase-extra">
      <div>
        <kupu:insert-part feature="mmbase"     part="tools-div" />
        <kupu:insert-part feature="mmbase"     part="node-div" />
        <kupu:insert-part feature="mmbase"     part="preview-div" />
      </div>
    </div>
  </kupu:part>

  <kupu:part name="kupu-edit">
    <div id="centerColumn">
      <div id="centerColumnContent">
        <kupu:insert-part feature="mmbase"     part="kupu-div" />
      </div>
    </div>
  </kupu:part>

  <kupu:part name="blockdiv">
    <div class="mm_c c_kupu b_edit"
         xmlns="http://www.w3.org/1999/xhtml"
         xmlns:i18n="http://xml.zope.org/namespaces/i18n"
         i18n:domain="kupu" >
      <kupu:define-slot name="block" />
    </div>
  </kupu:part>


</kupu:feature>
