<!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:xi="http://www.w3.org/2001/XInclude"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:i18n="http://genshi.edgewall.org/i18n">
  <xi:include href="admin.html"/>
  <head>
    <title>Repository Permissions</title>
  </head>

  <body>
    <h2>Manage Repository Permissions</h2>
    <form method="post" action="">

    <table class="listing">
      <thead>
	<tr>
	  <th>Repository</th>
	  <th py:for="user in users">$user</th>
	</tr>
      </thead>
      <tbody>
	<tr py:for="repo, repo_perms in sorted(repositories.items())">
	  <td>$repo</td>
	  <td py:for="user in users">
	    <label py:for="perm in permissions"
		   for='{"repo": "$repo", "user": "$user", "perm": "$perm"}'
		   style="border: 1px solid lightgray; border-radius: 5px; padding: 2px; margin-right: 2px">
	      $perm
	      <input type="checkbox" 
		     name='{"repo": "$repo", "user": "$user", "perm": "$perm"}'
		     id='{"repo": "$repo", "user": "$user", "perm": "$perm"}'
		     checked="checked" py:if="user in repo_perms.get(perm, [])" />
	      <input type="checkbox" 
		     name='{"repo": "$repo", "user": "$user", "perm": "$perm"}'
		     id='{"repo": "$repo", "user": "$user", "perm": "$perm"}'
		     py:if="user not in repo_perms.get(perm, [])" />
	    </label>
	  </td>
	</tr>
      </tbody>
    </table>

    <div class="buttons">
      <input type="submit" value="${_('Update repository permissions')}" />
    </div>

    </form>
  </body>

</html>
