<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en"
metal:use-macro="here/kupu_config/macros/master"
i18n:domain="kupuconfig">

  <metal:cssslot fill-slot="css_slot">
    <link href="kupustyles.css" rel="stylesheet" type="text/css" tal:attributes="href string:${context/portal_url}/kupustyles.css"/>
    <link href="kupuplone.css" rel="stylesheet" type="text/css" tal:attributes="href string:${context/portal_url}/kupuplone.css"/>
    <link href="kupudrawerstyles.css" rel="stylesheet" type="text/css" tal:attributes="href string:${context/portal_url}/kupudrawerstyles.css"/>
    <tal:if condition="not:exists:portal/portal_javascripts"
            metal:use-macro="context/kupu_wysiwyg_support/macros/kupu_js_include">
    </tal:if>
    <script type="text/javascript"
            tal:attributes="src portal/kupu_kjax.js/absolute_url_path"
            ></script>
  </metal:cssslot>
  <body>

    <div class="documentContent" metal:fill-slot="kupu_content">
      <h1 class="documentFirstHeading"
          i18n:translate="heading_toolbar_configuration">Kupu Toolbar Configuration</h1>
      <form action=""
            name="configure_kupu_toolbar"
            method="post"
            tal:attributes="action here/absolute_url">

        <fieldset>
          <legend i18n:translate="global_button_visibility">Global button visibility</legend>
          <div class="formHelp">
             <span i18n:translate="help_button_visibility"> 
                You may enter an expression to control the visibility of all buttons together.
                It should return a list of visible button ids, or None to leave all buttons visible.
                The visibility rules below are then applied to further filter out individual buttons.
                You might use this to restrict a particular class of users to a subset of kupu functions.
             </span>
             <input type="text" style="width:90%" tal:attributes="value context/getGlobalButtonFilter"
                    name="globalfilter" />
          </div>
        </fieldset>

        <fieldset>
          <legend i18n:translate="legend_button_visibility">Button visibility</legend>
          <div class="formHelp" i18n:translate="help_global_visibility">
            Control the global visibility of toolbar buttons from this screen.
            If no expression is entered, only checked buttons are visible. Enter an expression for finer control of visibility.
            Individual fields may also whitelist or blacklist buttons: see the field schema.
            <div>Values available in expressions includes 'field' as well as the usual names</div>
            <!-- object_url folder_url portal_url object folder portal nothing request modules member -->
            e.g. to restrict the drawer buttons to users with the
            appropriate permissions give imagelibdrawer-button and
            linklibdrawer-button the expression:
            <div>
              <code>python:member and member.has_permission('Kupu: Query libraries',portal)</code>
            </div>
          </div>

          <table class="listing nosort">
            <thead>
              <th></th>
              <th i18n:translate="heading_id">ID</th>
              <th i18n:translate="heading_title">Title</th>
              <th>
                <span i18n:translate="heading_visible">Visible</span><br/>
                <input title="Select all items"
                       i18n:attributes="title check_select_all;"
                       onclick="toggleSelect(this, 'filters.visible:records:int', true);"
                       type="checkbox" checked="checked" />
              </th>
              <th i18n:translate="heading_expression">Expression</th>
            </thead>
            <tbody class="kupu-tb-buttons">
              <tr tal:repeat="opt context/getFilterOptions" style="height:28px">
                <td><button tal:condition="opt/classname" disabled="disabled"
                  tal:attributes="class opt/classname">&#160;</button>
                </td>
                <td>
                  <span tal:content="opt/id" />
                  <input type="hidden" name="filters.id:records" tal:attributes="value opt/id" />
                </td>
                <td tal:content="opt/title">
                </td>
                <td>
                  <input type="checkbox" name="filters.visible:records:int" value="1" tal:attributes="checked opt/visible" />
                </td>
                <td>
                  <input type="text" style="width:30em" tal:attributes="value opt/override|nothing" name="filters.override:records" />
                </td>
              </tr>
            </tbody>
          </table>

        </fieldset>

        <input class="context"
               type="submit"
               name="set_toolbar_filters:method"
               value="Save"
               i18n:attributes="value button_save;"
               />
      </form>
    </div>
  </body>
</html>

