<html xmlns="http://www.w3.org/1999/xhtml"
      xml:lang="en"
      lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
      metal:use-macro="here/main_template/macros/master"
      i18n:domain="producepublish">

    <metal:fill fill-slot="main" tal:define="result view/debugLinks">
        <h1 i18n:translate="label_debug_links">Links</h1>
        <div class="formHelp" i18n:translate="help_debug_anchors">
            The links debug view lists all links to external sites by document.
            For debugging purposes only.
        </div>
        <div tal:condition="not: result">
            <span i18n:translate="label_no_links">No links found</span>
        </div>
        <table class="listing" tal:condition="result" id="debug-links">
            <thead>
                <tr>
                    <th i18n:translate="label_document">Document</th>
                    <th i18n:translate="label_link_url">URL</th>
                    <th i18n:translate="label_link_text">Link text</th>
                    <th i18n:translate="label_css_classes">CSS classes</th>
                </tr>
            </thead>
            <tbody>
                <tal:loop repeat="d result">
                    <tal:loop repeat="link d/links">
                        <tr tal:attributes="class python: repeat['d'].even() and 'even' or 'odd'">
                            <td tal:condition="repeat/link/start"
                                tal:attributes="rowspan python: len(d['links'])">
                                <a tal:attributes="href d/url" 
                                   tal:content="string:${d/title} (${d/id})" />
                                <div class="formHelp" tal:content="d/description" />
                            </td>
                            <td tal:content="link/href" />
                            <td tal:content="structure link/text" />
                            <td tal:content="link/css_class" />
                        </tr>
                    </tal:loop>
                </tal:loop>
            </tbody>
        </table>
        <a tal:attributes="href context/absolute_url" i18n:translate="label_back_to_conversion">Back to conversion folder</a>
    </metal:fill>
</html>
