<metal:block define-macro="tree">

<table cellspacing="0" cellpadding="0"
       tal:define="root           context/@@tree;
                   result         root/getFlatDicts;
                   nodeDictList   python:result[0];
                   maxDepth       python:result[1]">

<tr>
  <td class="list-item"
      tal:attributes="colspan python:maxDepth+2">
    Preferences
  </td>
</tr>

<tr tal:repeat="nodeInfo nodeDictList">
<tal:block tal:define="node nodeInfo/node">

  <td style="width:16px" tal:repeat="state nodeInfo/row-state">
    <img tal:attributes="src context/++resource++tree_images/vline.png"
         tal:condition="state" alt="|" border="0" />
  </td>

  <td style="width:16px">
    <a href=""
       tal:attributes="href string:?tree-state=${nodeInfo/tree-state}"
       tal:condition="node/hasChildren">
      <tal:block condition="not:nodeInfo/last-level-node">
        <img tal:attributes="src context/++resource++tree_images/plus_vline.png"
             tal:condition="not:node/expanded" alt="+" border="0" />
        <img tal:attributes="src context/++resource++tree_images/minus_vline.png"
             tal:condition="node/expanded" alt="-" border="0" />
      </tal:block>
      <tal:block condition="nodeInfo/last-level-node">
        <img tal:attributes="src context/++resource++tree_images/plus.png"
             tal:condition="not:node/expanded" alt="+" border="0" />
        <img tal:attributes="src context/++resource++tree_images/minus.png"
             tal:condition="node/expanded" alt="-" border="0" />
      </tal:block>
    </a>
    <tal:block condition="not:node/hasChildren">
      <img tal:attributes="src context/++resource++tree_images/tline.png"
           tal:condition="not:nodeInfo/last-level-node" alt="" border="0" />
      <img tal:attributes="src context/++resource++tree_images/lline.png"
           tal:condition="nodeInfo/last-level-node" alt="" border="0" />
    </tal:block>
  </td>

  <td class="list-item"
      tal:attributes="colspan python:maxDepth-len(nodeInfo['row-state'])+1">
    &nbsp;<a href=""
       tal:attributes="href 
           string:${node/context/@@absolute_url}/@@index.html"
       tal:content="node/context/zope:name">
      node/id
    </a>
  </td>

</tal:block>
</tr>

</table>
  
</metal:block>


<metal:block define-macro="pref_view">

<html metal:use-macro="context/@@standard_macros/view">
<body>

<div id="navigators" metal:fill-slot="navigators">
 <div class="box">
   <h4>Preferences</h4>
   <div class="body">
    <metal:block use-macro="context/@@preferences_macros/tree" />
   </div>
 </div>
</div>

<div metal:fill-slot="tabs">
  <h1 tal:content="context/__title__">User Preferences</h1>
</div>

<div metal:fill-slot="body">

  <div metal:define-slot="body">
     <p>Body here</p>
  </div>

</div>

</body>

</html>
</metal:block>


<metal:block define-macro="edit_pref_group">

  <div tal:content="structure view/getIntroduction">
    Category Description goes here.
  </div>  
  <br/>

  <p tal:define="status view/update"
     tal:condition="status"
     tal:content="status" />

  <p tal:condition="view/errors" i18n:translate="">
    There are <strong tal:content="python:len(view.errors)"
                      i18n:name="num_errors">6</strong> input errors.
  </p>
      
  <table class="listing" width="90%" cellspacing="0" cellpadding="0"
         tal:condition="view/widgets">

    <thead>
      <tr>
        <th i18n:translate="">Description</th>
        <th i18n:translate="">Value</th>
      </tr>
    </thead>

    <tal:block repeat="widget view/widgets" >
    <tr class=""
        tal:define="oddrow repeat/widget/odd;
                    firstrow repeat/widget/start"
        tal:attributes="class python:oddrow and 'even' or 'odd'">
      <td class="description">
        <b tal:content="widget/label">Option</b>
        <div class="indent small">
          <div tal:content="widget/hint">
            Explanation
          </div>
          <div class="error" tal:define="error widget/error"
            tal:condition="error" tal:content="structure error">
            The Error
          </div>
        </div>
      </td>
      <td class="input" tal:content="structure widget">
        <input type="text" style="width:100%"/>
      </td>
    </tr>
    </tal:block>
  </table>

  <div tal:repeat="subgroup context/values">
    <tal:block replace="structure subgroup/@@editAsSubGroup" />
  </div>

</metal:block>
