<tal:block metal:use-macro="python:here.getFormsTool().getForm('site_admin_template').macros['page']">

<h1 metal:fill-slot="title" i18n:translate="">Manage portlets - Static HTML</h1>

<tal:block metal:fill-slot="section"
  tal:define="site_url here/getSitePath;
        ob_id python:request.get('id', '');
        ob python:here.getPortletsTool().getPortletById(ob_id);
        languages here/gl_get_languages_mapping;
        curr_lang python:request.get('lang', None) or here.gl_get_selected_language()">
<tal:block tal:define="editor here/getEditorTool" tal:replace="structure editor/includeLibs" />
<div class="tabbedmenu">
<ul>
  <li><a tal:attributes="href string:${site_url}/admin_remotechportlets_html" i18n:translate="">Remote channels</a></li>
  <li><a tal:attributes="href string:${site_url}/admin_localchportlets_html" i18n:translate="">Local channels</a></li>
  <li><a tal:attributes="href string:${site_url}/admin_folderportlets_html" i18n:translate="">For folders</a></li>
  <li><a tal:attributes="href string:${site_url}/admin_linksportlets_html" i18n:translate="">List of links</a></li>
  <li class="currenttab"><a tal:attributes="href string:${site_url}/admin_htmlportlets_html" i18n:translate="">Static HTML</a></li>
  <li><a tal:attributes="href string:${site_url}/admin_specialportlets_html" i18n:translate="">Special</a></li>
</ul>
</div>

<p i18n:translate="" class="cleaner">This page displays the list of available portlets that contains static HTML. The content of each of them can be modified using an WYSIWYG editor.</p>
<p>
  <a tal:attributes="href string:${site_url}/admin_addhtmlportlet" i18n:translate="">Add new portlet</a>
</p>

<fieldset tal:condition="python:ob is not None" class="admin-edit-htmlportlet">
  <legend i18n:translate="">Edit portlet</legend>
  <div class="edit-holder" tal:attributes="style python:'background-color: %s' % here.utHexColors(curr_lang)">
  <form method="post" tal:attributes="action string:${site_url}/admin_edithtmlportlet">
    <div class="field">
      <label for="title" i18n:translate="">Title</label>
      <input type="text" name="title:utf8:ustring" size="50" tal:attributes="value python:ob.getLocalProperty('title', curr_lang)" />
    </div>
    <div class="field" tal:define="editor here/getEditorTool">
      <label for="body" i18n:translate="">Body</label>
      <span tal:replace="structure python:editor.render('body', curr_lang, image_support=True)" />
      <textarea id="body" name="body:utf8:ustring" rows="20" cols="72" class="mceEditor" 
              tal:content="python:ob.getLocalProperty('body', curr_lang)" />
    </div>
    <p>
      <input type="hidden" name="id" tal:attributes="value ob_id" />
      <input type="hidden" name="lang" tal:attributes="value curr_lang" />
      <input type="submit" value="Save changes" i18n:attributes="value" />
    </p>
  </form>
  </div>
  <div class="translate translate-bottom">
    <span i18n:translate="">Translate in</span>
    <tal:block tal:repeat="language languages">
      <div class="current" tal:condition="python:language['code'] == curr_lang"
                 tal:attributes="style python:'background-color: %s' % here.utHexColors(curr_lang)">
        <span tal:content="python:language['name']" i18n:translate="" />
      </div>
      <a tal:condition="python:language['code'] != curr_lang"
        tal:attributes="href string:?id=${ob_id}&amp;lang=${language/code}; 
                title python:language['name']; 
                style python:'background-color: %s' % here.utHexColors(language['code'])">
        <span tal:content="python:language['name']" i18n:translate="" />
      </a>
    </tal:block>
  </div>
</fieldset>
<form method="post" tal:attributes="action string:${site_url}/admin_deletehtmlportlet">
  <table class="datatable" tal:define="portlets python:here.getPortletsTool().get_html_portlets()">
  <thead>
    <tr>
      <th class="scope-col" scope="col">&nbsp;</th>
      <th class="scope-col" scope="col" i18n:translate="">Title</th>
    </tr>
  </thead>
  <tbody>
    <tr tal:repeat="portlet portlets" tal:attributes="class python:test(path('repeat/portlet/odd'), 'zebraodd', 'zebraeven')">
      <td><input type="checkbox" name="ids" tal:attributes="value portlet/id" /></td>
      <td><a tal:attributes="href string:${site_url}/admin_htmlportlets_html?id=${portlet/id}" tal:content="portlet/title_or_id" /></td>
    </tr>
  </tbody>
  </table>
  <input type="submit" value="Delete" i18n:attributes="value" />
</form>
</tal:block>

</tal:block>
