<!DOCTYPE html >
<%~set search_widget = 1%>
<html lang="en">
<head>
  <title><%cat_full_name%>: <%forum_name%>: <%if ban_ip%>IP<%else%>User<%endif%> Banned</title>
  <%include include_common_head.html%>
</head>

<%~set content_header_title = "$forum_name: Bans"%>
<body class="page-<%page_id%>">
  <div class="container-b">
    <%include include_header.html%>

    <div class="main">
      <div class="contentwrapper clearfix">
        <div class="sidebar">
            <%include include_sidebar.html%>
        </div>

        <%~init array breadcrumbs%><%init hash breadcrumbs.0%><%init hash breadcrumbs.1%>
        <%~set breadcrumbs.0.name = $forum_name%>
        <%~set breadcrumbs.0.url  = GForum::SEO::url(params => "forum=$forum_id")%>
        <%~set breadcrumbs.1.name = $content_header_title%>

        <%include include_breadcrumb.html%>

        <div class="content"><%-- start content--%>
          <%include include_content_header.html%>

          <%~if not num_bans%><%-- This cannot be bans.length because bans is a code ref --%>
            <p>
              There are no bans are set on this forum.
            </p>
          <%~else%>
            <form action="<%GForum::SEO::url()%>" method="post">
              <%hidden_form%>
              <input type="hidden" name="forum" value="<%forum%>" />

              <div class="dtable">
                <div class="dhead">
                  <div class="drow">
                    <div class="dcell">Set By</div>
                    <div class="dcell">Username</div>
                    <div class="dcell">IP Address</div>
                    <div class="dcell date">Date Set</div>
                    <div class="dcell">Reason</div>
                    <div class="dcell">Expiry</div>
                    <div class="dcell">Delete</div>
                  </div>
                </div>
                <div class="dbody">
                  <%~loop bans%>
                  <div class="drow">
                    <div class="dcell">
                      <%~set escaped_username = escape_url unescape_html $set_by_user_username%>
                      <a href="<%GForum::SEO::url(params => "username=$escaped_username")%>"><%nbsp set_by_user_username%></a>
                    </div>
                    <div class="dcell">
                      <%~set escaped_username = escape_url $user_username%>
                      <%if ban_type eq user_id_fk%><a href="<%GForum::SEO::url(params => "username=$escaped_username")%>"><%nbsp user_username%></a><%endif%>
                    </div>
                    <div class="dcell">
                      <%if ban_type eq ban_ip%><%ban_ip%><%endif%>
                    </div>
                    <div class="dcell">
                      <%ban_set_date%>
                    </div>
                    <div class="dcell">
                      <%ban_reason%>
                    </div>
                    <div class="dcell">
                      <%~if ban_expiry%>
                      <%ban_expiry_date%>
                      <%~else%>
                      <i>none</i>
                      <%~endif%>
                    </div>
                    <div class="dcell">
                      <input type="checkbox" name="ban_id" value="<%ban_id%>" />
                    </div>
                  </div>
                  <%~endloop%>
                </div>
              </div>

              <div class="toolbar clearfix">
                <hr class="line" />
                <div class="btn-wrapper">
                  <input type="submit" class="btn default" name="do=forum_unban;redo=<%this_do%>" value="Remove Checked Bans" />
                </div>
              </div>
            </form>
          <%~endif%>

        </div><%-- end content --%>
      </div>
    </div>
    <%include include_footer.html%>
  </div>  
</body>
<%~include include_global_js.html%>
</html>
