<metal:block use-macro="container/macro_edit_view/macros/edit_view">
  <metal:block fill-slot="edit_input">
    <script type="text/javascript"
      tal:content="structure here/asset_reference.js" />  
      <table cellspacing="0" cellpadding="2" border="0" width="100%">
        <tr>
          <td colspan="3">
            <b>Data Source reference</b>
          </td>
        </tr>
        <tr>
          <td width="10%">
          </td>
          <td colspan="2">  
            <input type="button" class="button" name="" value="Get data source reference" title="Access key: alt-g" accesskey="g"
              tal:attributes="onclick python:'getAssetReference(\'%s/edit/asset_lookup?filter=SQL%%20Data%%20Source\', \'_reference_\', \'focusbox\', \'path\');;return false;;' % here.get_start_container().absolute_url();" /><br />
            <input style="width:75%;" type="text" name="path" value=""
              tal:attributes="value python:node.getAttribute('path');" />
            &nbsp;
            <input class="button" type="submit" value=" Update " title="Access key: alt-s" accesskey="u"
              tal:attributes="name string:${rel_url_start}/save:method" />
          </td>
        </tr>
        <tal:block
          define="form here/get_form"
          condition="form">
          <tr>
            <td colspan="3">
              <b>Parameters</b>
            </td>
          </tr>
          <tr>
            <th align="left">
              Description
            </th>
            <th align="left">
              Name
            </th>
            <th align="left">
              Value
            </th>
          </tr>
          <tal:block repeat="field form/get_fields">
            <tal:block
              define="oddrow repeat/field/odd">
              <tr class="focus" valign="top"
                tal:attributes="class python:test(oddrow, 'focus-cycle', 'focus')">
                <td class="leadedbody" width="40%" tal:content="structure string:${field/description}&nbsp;">
                  description
                </td>
                <td align="right" width="10%" tal:content="python:field['title']">
                  parameter
                  <span class="warning">*</span>
                </td>
                <td tal:content="structure python:field.render_from_request(request)">
                  <input type="text" />
                </td>
              </tr>
            </tal:block>
          </tal:block>
        </tal:block>
        <tr>
          <td colspan="3">
            <b>Layout options</b>
          </td>
        </tr>
        <tr>
          <td>
            Caption:
          </td>
          <td colspan="2" align="left"
            tal:define="show_caption python:node.getAttribute('show_caption')">
            Yes:&nbsp;
            <input type="radio" name="show_caption" value="true"
              tal:attributes="checked python:test(show_caption == 'true', 'checked', nothing)" />&nbsp;
            No:&nbsp;
            <input type="radio" name="show_caption" value="false" 
              tal:attributes="checked python:test(show_caption == 'false', 'checked', nothing)"/>&nbsp;(Show Data Source title as caption)
          </td>
        </tr>
        <tr>
          <td>
            Headings:
          </td>
          <td colspan="2" align="left"
            tal:define="show_headings python:node.getAttribute('show_headings')">
            Yes:&nbsp;
            <input type="radio" name="show_headings" value="true"
              tal:attributes="checked python:test(show_headings == 'true', 'checked', nothing)" />&nbsp;
            No:&nbsp;
            <input type="radio" name="show_headings" value="false" 
              tal:attributes="checked python:test(show_headings == 'false', 'checked', nothing)"/>&nbsp;(Show table column headings)
          </td>
        </tr>
        <tr>
          <td>
            Table&nbsp;style:
          </td>
          <td colspan="2" align="left">
            <select class="manipulator"
              name="element_type" tal:define="type python:node.getAttribute('type')">
              <option value="plain" 
                tal:attributes="selected python:test(type == 'plain', 'selected', nothing)">
                Plain table (bold heading, no borders)
              </option>
              <option value="list" 
                tal:attributes="selected python:test(type == 'list', 'selected', nothing)">
                Listing table (bold underlined heading, borderless rows)
              </option>
              <option value="grid" 
                tal:attributes="selected python:test(type == 'grid', 'selected', nothing)" >
                Grid table (bold bordered heading, bordered rows)
              </option>
              <option value="datagrid"
                tal:attributes="selected python:test(type == 'datagrid', 'selected', nothing)">
                Data grid table (bold borderless heading, bordered rows)
              </option>
            </select>
          </td>
        </tr>
      </table>
  </metal:block>
  <metal:block fill-slot="edit_notes">
    <ul class="tips">
      <li>
        Use the "Get data source reference" button to locate a data source
      </li>
      <li>
        <span class="warning">Hit "Update" to update the parameter form!</span>
      </li>
      <li>
        Fill in the parameters (if available).
      </li>
    </ul>
  </metal:block>
</metal:block>
