<% #main %>
<div class="ample">
   <% members.link add <% gettext "Add member" %> prefix="... " %>
</div>
<% gettext Show prefix="... " %>
<% members.link . all %>
<% members.link owners prefix="| " %>
<% members.link contributors prefix="| " %>
<% members.link managers prefix="| " %> 
<% members.link subscribers prefix="| " %>
<% response.pager %>
<% response.list %>
<% response.pager %>

<% #login %>
<p class="storyTitle"><% response.title %></p>
<script type="text/javascript">
$(function() {
   $("#submit").click(function() {
      var name = $("#name").val();
      $.ajax({
         async: false,
         url: '<% members.href salt.js %>',
         data: "user=" + encodeURIComponent(name),
         dataType: "json",
         cache: false,
         error: function() { /* ... */ },
         success: function(salt) {
            var password = $("#password").val();
            var token = "<% session.token %>";
            $("input:password").val("");
            $("#digest").val($.md5($.md5(password + salt) + token));
         }
      });
      return true;
   });
});
</script>
<form id="login" method="post" action="<% response.action %>">
<input type="hidden" name="digest" id="digest" />
<table border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="small"><% gettext "Username" suffix=":" %></td>
<td>
<input type="text" name="name" id="name" size="15" tabindex="1" 
value="<% request.name encoding="form" %>" />
</td>
<td rowspan="4"> </td>
<td class="small">
<% members.link register <% gettext "Not registered yet" %> %>
</td>
</tr>
<tr>
<td class="small"><% gettext Password suffix=: %></td>
<td>
<input type="password" name="password" id="password" size="15" tabindex="2" />
</td>
<td class="small">
<% members.link reset <% gettext "Password forgotten?" %> %>
</td>
</tr>
<tr>
<td> </td>
<td colspan="2" class="small">
<input type="checkbox" id="remember" name="remember" tabindex="3" 
<% if <% request.remember %> is "on" then 'checked="checked"' %> />
<label for="remember"><% gettext "Remember me" %></label>
</td>
</tr>
<tr>
<td> </td>
<td colspan="2"><br />
<button type="submit" id="submit" name="login" value="1" 
tabindex="4"><% gettext Login %></button>
<a href="" class="cancel"><% gettext Cancel %></a>
</td>
</tr>
</table>
</form>

<% #register %>
<script type="text/javascript">
$(function() {
   $("#submit").click(function() {
      var token = "<% session.token %>";
      var password = $("#password").val();
      var passwordConfirm = $("#passwordConfirm").val();
      $("input:password").val("");
      // Check both passwords but let the server do the error handling
      if (!password || !passwordConfirm) {
         return true;
      } else if (password !== passwordConfirm) {
         $("#password1").val(0);
         $("#password2").val(1);
         return true;
      }
      var hash = $.md5(password + token);
      $("#hash").val(hash);
      return true;
   });
});
</script>
<form method="post" action="<% response.action %>">
<input type="hidden" name="hash" id="hash" />
<table border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="small"><% gettext Username suffix=: %></td>
<td>
<input type="text" name="name" value="<% request.name encoding="form" %>" />
</td>
</tr>
<tr>
<td class="small" valign="top"><% gettext e-mail suffix=: %></td>
<td>
<input type="text" name="email" value="<% request.email encoding="form" %>" />
</td>
</tr>
<tr>
<td class="small"><% gettext Password suffix=: %></td>
<td>
<input type="password" name="password" id="password" />
</td>
</tr>
<tr>
<td class="small"><% gettext "Confirm password" suffix=: %></td>
<td>
<input type="password" name="passwordConfirm" id="passwordConfirm" />
</td>
</tr>
<tr>
<td></td>
<td><br />
<button type="submit" id="submit" name="register" 
value="register"><% gettext Register %></button>
<a href="" class="cancel"><% gettext Cancel %></a>
</td>
</tr>
</table>
</form>

<% #reset %>
<p class="storyTitle"><% response.title %></p>
<p class="small"><% gettext "Enter your user name and the e-mail address you
have used when you registered. You will then receive a confirmation e-mail 
containing further instructions." %></p> 
<form id="login" method="post" action="<% response.action %>">
<div class="small"><% gettext Username suffix=: %></div>
<div><input type="text" name="name" id="name" size="15" tabindex="1" 
value="<% request.name encoding="form" %>" /></div>
<div class="small"><% gettext e-mail suffix=: %></div>
<div><input type="text" name="email" id="email" size="15" tabindex="2" 
value="<% request.email encoding="form" %>"/></div>
<br />
<button type="submit" id="submit" name="reset" value="1" 
tabindex="4"><% gettext "Reset password" %></button>
<a href="" class="cancel"><% gettext Cancel %></a>
</form>

<% #password %>
<p class="storyTitle"><% response.title %></p>
<form id="login" method="post" action="<% response.action %>">
<div class="small"><% gettext Password suffix=: %></div>
<div><input type="password" name="password" id="password" size="15" tabindex="1" /></div>
<div class="small"><% gettext "Confirm Password" suffix=: %></div>
<div><input type="password" name="passwordConfirm" id="passwordConfirm" 
size="15" tabindex="2" /></div>
<input type="hidden" name="user" id="user" value="<% request.user %>" />
<input type="hidden" name="token" id="token" value="<% request.token %>" />
<br />
<button type="submit" id="submit" name="save" value="1" 
tabindex="4"><% gettext Save %></button>
<a href="" class="cancel"><% gettext Cancel %></a>
</form>

<% #add %>
<form method="post" action="<% response.action %>">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
   <input type="text" name="term" id="term" 
   value="<% request.term encoding="form" %>" />
</td>
<td> 
   <button type="submit" name="search" value="1"><% gettext Search %></button>
   <a href="<% this.href %>"><% gettext Cancel %></a>
</td>
</tr>
</table>
</form>
<% response.result %>

<% #results %>
<form method="post" action="<% response.action %>">
<% param.result prefix="<br />" %>
<br />
<button type="submit" id="add" name="add" value="1">
   <% gettext "Add to members" %>
</button>
</form>

<% #result %>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
   <input type="radio" name="name" id="<% param.name %>" value="<% param.name %>" />
</td>
<td><label for="<% param.name %>"><% param.name %></label></td>
</tr>
</table>
