<html xmlns="http://www.w3.org/1999/xhtml" tal:omit-tag="">

  <head tal:replace="nothing">
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <title>tree_block_template</title>
  </head>

  <body tal:define="block nocall:options/block;
                    slots block/getSlotsDic;
                    displayAction options/displayAction;
                    rootObject nocall:slots/rootObject;
                    filteredMetaTypes nocall:slots/filteredMetaTypes;"
        tal:omit-tag=""
        i18n:domain="plinn">
    <div tal:condition="python:displayAction=='edit'" tal:omit-tag="">
      <h3 i18n:translate="">Tree box settings</h3>
      <form action="." metal:use-macro="here/block_utils/macros/block_form">
        <table border="0" cellspacing="4" cellpadding="0" metal:fill-slot="html_block_content">
          <tr>
            <td i18n:translate="">Root object expression:</td>
          </tr>
          <tr>
            <td valign="top" tal:content="structure python:rootObject.callAction(displayAction)">
              rootObject slot here
            </td>
          </tr>
          <tr>
            <td valign="top" i18n:translate="">
              Filter (meta_type list) :
            </td>
          </tr>
          <tr>
            <td valign="top" tal:content="structure python:filteredMetaTypes.callAction(displayAction)">filteredMetaTypes slot here</td>
          </tr>
        </table>
      </form>
    </div>
    <div tal:define="treeRoot   python:rootObject.text(rootObject.getExprContext());
                     treeDict   python:block.make_nav_tree(rootObject=treeRoot, filtered_meta_types=filteredMetaTypes.text );
                     tree       treeDict/tree;
                     rows       treeDict/rows;
                     height			tree/height;
                     rootNode   python:rows.pop(0);
                     box_id string:tree_box_${rootNode/object/id};
                     portal_url here/portal_url"
         tal:condition="python:displayAction=='view' and rows"
         tal:omit-tag=""
         tal:on-error="string:Path Error">
      <script type="text/javascript" tal:attributes="src here/tree_block_script.js/absolute_url"></script>
			<table class="tree_box" cellspacing="0">
				<tr>
					<th>
						<table>
							<tr>
								<td width="16" tal:condition="nothing">
									<a title="collapse all" href="." tal:attributes="href string:?collapse_all=${rootNode/object/id}" i18n:attributes="title"><img src="../skins/collapse_all.gif" alt="collapse all" height="16" width="16" border="0" tal:attributes="src here/collapse_all.gif/absolute_url" i18n:attributes="alt" /></a>
								</td>
								<th tal:content="rootNode/object/title_or_id" style="border : none">Root Node</th>
							</tr>
						</table>
					</th>
				</tr>

				<tr>
					<td>
						<table  cellspacing="0">
							<tbody tal:attributes="id  box_id">
								<tr tal:repeat="row rows">
								<td tal:define="indent python: row.depth - 1" tal:attributes="colspan indent" tal:condition="indent">&nbsp;</td>
								<td tal:define="state row/state ; rlink row/branch ; msg python:state > 0 and 'collapse' or 'expand'" width="16"
								 ><a href="#" tal:condition="state" tal:attributes="name row/id ; href rlink/link ; title msg" i18n:attributes="title"
								 ><img src="/p_/pl" alt="" tal:attributes="src python:'%s/%s' % (portal_url, state > 0 and 'mi.gif' or 'pl.gif') ; alt msg" i18n:attributes="alt" border="0" height="16" width="16" /></a>
								  <a href="#" tal:attributes="name row/id ; href rlink/link" tal:condition="not:state">&nbsp;&nbsp;</a>
								</td>
								<td colspan="1" tal:define="obj nocall: row/object; url obj/absolute_url; description obj/Description"
										tal:attributes="colspan python: height - row.depth"
										width="99%" tal:on-error="string:erreur"
								 ><a href="." tal:attributes="href url; title description"
								 ><img src="." alt="" tal:define="icon python:here.restrictedTraverse(obj.icon())" tal:attributes="src icon/absolute_url; height icon/height; width icon/width" border="0" />
									<span tal:replace="obj/title_or_id">Title</span></a></td>
								</tr>
							</tbody>
						</table>
						<tal:include content="structure python:here.inline_tree_script(box_id=box_id, filter_str=','.join(filteredMetaTypes.text))" />
					</td>
				</tr>
			</table>
    </div>
    
  </body>

</html>