<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html i18n:domain="plone">

<!-- wysiwyg default widget -->
<div metal:define-macro="wysiwygEditorBox">
  <tal:block define="field field|nothing;
                     fname fieldName|inputname|nothing;
                     force_wysiwyg force_wysiwyg|nothing;
                     object nocall:object|here;
                     text_format python:here.portal_tinymce.getContentType(object=object, field=field, fieldname=fname);
                     suppressed python:request.form.get('tinymce.suppress') == fname;
                     wysiwyg python:(not suppressed and 'html' in text_format.lower()) or force_wysiwyg;
                     configuration_method nocall:here/@@tinymce-jsonconfiguration;
                     configuration_json python:configuration_method(fieldname=field);
                     element_id id|inputname;">
  <textarea cols="80"
            rows="25"
            name="description"
            tal:content="inputvalue"
            tal:attributes="name inputname;
                            id element_id;
                            onfocus onfocus|nothing;
                            onblur onblur|nothing;
                            rows rows|default;
                            cols cols|default;
                            maxlength maxlength|nothing;
                            title python:wysiwyg and configuration_json or None;
                            class python:wysiwyg and 'mce_editable' or None"></textarea>

  <script type="text/javascript"
      tal:condition="wysiwyg"
      tal:content="string:
      tinymce.dom.Event.add(window, 'load', function(e) { var config = new TinyMCEConfig('${element_id}'); config.init(); });"></script>

  <div tal:condition="wysiwyg"
       class="discreet suppressVisualEditor" style="margin-top: -1em;">
    <a i18n:translate="suppress_visual_editor"
       i18n:domain="plone.tinymce"
       tal:attributes="href string:${request/URL0}?tinymce.suppress=${fname}&amp;${request/QUERY_STRING};">
      Edit without visual editor
    </a>
  </div>

  </tal:block>
</div>

<div metal:define-macro="textFormatSelector">

 <tal:block tal:define="wysiwyg_enabled python: here.portal_membership.getAuthenticatedMember().getProperty('wysiwyg_editor')!='None';
                        fname fieldName|inputname|nothing;
                        text_format python: here.portal_tinymce.getContentType(object=here, fieldname=fname);
                        wysiwyg python:wysiwyg_enabled and 'html' in text_format.lower()">

  <tal:block condition="wysiwyg">
        <input type="hidden"
               name="text_format"
               value="html" id="Hidden1"/>
  </tal:block>

  <tal:block condition="not: wysiwyg">
    <div class="row">
      <div class="label">
         <span i18n:translate="label_format">Format</span>
         <div id="format_help"
              i18n:translate="help_format"
              class="help"
              style="visibility:hidden">
           Select which format you want to type the contents of this
           document in. If you are unsure of which format to use, just
           select Plain Text and type the document as you usually
           do.
         </div>
      </div>
      <div class="field"
           tal:define="text_format python:request.get('text_format', getattr(here,'text_format','structured-text'))">
        <input class="noborder"
               type="radio"
               name="text_format"
               value="structured-text"
               id="cb_structuredtext"
               onfocus="formtooltip('format_help',1)"
               onblur="formtooltip('format_help',0)"
               tal:attributes="checked python:test(text_format=='structured-text', 1, '');"
               />
        <label for="cb_structuredtext" i18n:translate="structured_text">Structured Text</label> <br />

        <input class="noborder"
               type="radio"
               name="text_format"
               value="html"
               id="cb_html"
               tal:attributes="checked python:test(text_format=='html', 1, '');"
               onfocus="formtooltip('format_help',1)"
               onblur="formtooltip('format_help',0)"
               />
        <label for="cb_html" i18n:translate="html">HTML</label> <br />

        <input class="noborder"
               type="radio"
               name="text_format"
               value="plain"
               id="cb_plain"
               tal:attributes="checked python:test(text_format=='plain', 1, '');"
               onfocus="formtooltip('format_help',1)"
               onblur="formtooltip('format_help',0)"
               />
        <label for="cb_plain" i18n:translate="plain_text">Plain Text</label>
      </div>
    </div>
  </tal:block>

 </tal:block>

</div>

</html>
