<dtml-var standard_wiki_header>

<dtml-if "not _.has_key('zwiki_showhierarchy') or zwiki_showhierarchy">

<h2>Backlinks and Parents</h2>

<form action="reparent">

<p>
Here are the pages which link to <a href="&dtml-wiki_page_url;"><dtml-var id></a> 
(<em>backlinks</em>). Click a page name to go there.
<p>
You can also configure this page's <em>parent(s)</em>, 
to locate it within the contents hierarchy.
Check the boxes or enter a new page name and click Reparent. Or just click set.
A single parent is usually sufficient.
<p>

<dtml-let thispage=id
          thisparents=parents>
<strong> Parent? &nbsp;&nbsp; Backlink </strong>
<br>
<dtml-in "aq_parent.objectValues(spec='ZWiki Page')" sort=id>
<dtml-unless "_.string.find(_.getitem('sequence-item').raw,thispage) == -1">
  <dtml-let thisitem="_.getitem('id')()"
        thisisparent="thisitem in thisparents">
    <dtml-unless thisisparent>&nbsp;&nbsp;</dtml-unless>
       <input type=checkbox name="parents" value="<dtml-var thisitem>"
              <dtml-if "thisitem in thisparents">CHECKED</dtml-if>>
<dtml-if thisisparent>&nbsp;&nbsp;</dtml-if>
<small><a href="reparent?parents=<dtml-var "_.getitem('id')()" url_quote>">set</a></small>
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="&dtml-wiki_base_url;/<dtml-var "_.getitem('id')()" url_quote>">
<dtml-var "_.getitem('id')()"></a>
<br>
  </dtml-let>
</dtml-unless>
</dtml-in>
</dtml-let>
<br>
Other parent: <input type="text" name="parents">
<br><br>
<b><input type="submit" value="Reparent" style="font-weight:bold"></b>

</form>

<dtml-else>


<h2> Backlinks </h2>

<p>
Here are the pages which link to <a href="&dtml-wiki_page_url;"><dtml-var id></a> 
(<em>backlinks</em>). Click a page name to go there.
<p>

<dtml-let thispage=id>
<dtml-in "aq_parent.objectValues(spec='ZWiki Page')" sort=id>
<dtml-if "_.string.find(_.getitem('sequence-item').raw,thispage) != -1">
<a href="&dtml-wiki_base_url;/<dtml-var id url_quote>"><dtml-var id></a><br>
</dtml-if>
</dtml-in>
</dtml-let>

</dtml-if>

</body>
</html>