<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:i18n="http://genshi.edgewall.org/i18n"
      xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="layout.html" />
  <head>
    <title>Available Reports</title>
  </head>

  <body>
    <div id="content" class="report">
      <h1>Available Reports</h1>

      <div id="description" xml:space="preserve" />

      <table class="listing reports"
             py:with="any_edit = any(can_edit for id, title, can_edit, can_delete in reports);
                      any_delete = any(can_delete for id, title, can_edit, can_delete in reports)">
        <thead><tr>
          <th><a href="${href.report(sort='report', asc=(sort == 'report' and asc) and '0' or '1')}">Report</a></th>
          <th><a href="${href.report(sort='title', asc=(sort == 'title' and asc) and '0' or '1')}">Title</a></th>
          <th py:if="any_edit or any_delete" colspan="${any_edit and any_delete and '2' or None}">Actions</th>
        </tr></thead>

        <tbody py:choose="">
          <tr py:when="reports" py:for="id, title, can_edit, can_delete in reports">
            <td class="report"><a title="View report" href="${href.report(id)}">{$id}</a></td>
            <td class="title"><a title="View report" href="${href.report(id)}">$title</a></td>
            <td class="action" py:if="any_edit"><a py:if="can_edit" href="${href.report(id, action='edit')}"
                                    title="Edit report">Edit</a></td>
            <td class="action" py:if="any_delete"><a py:if="can_delete" href="${href.report(id, action='delete')}"
                                      title="Delete report">Delete</a></td>
          </tr>
          <tr py:otherwise="">
            <td colspan="${2 + any_edit + any_delete}">No reports available.</td>
          </tr>
        </tbody>
      </table>
      
      <div py:if="'REPORT_CREATE' in perm" class="buttons">
        <form action="" method="get" id="create_report">
          <div>
            <input type="hidden" name="action" value="new" />
            <input type="submit" value="${_('Create new report')}" />
          </div>
        </form>
      </div>

      <div id="help" i18n:msg="">
        <strong>Note:</strong>
        See <a href="${href.wiki('TracReports')}">TracReports</a> for help on using and creating reports.
      </div>
    </div>
  </body>
</html>
