<%--
  The contents of this file are subject to the Mozilla Public License Version 1.1
  (the "License"); you may not use this file except in compliance with the License.
  You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.

  Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
  WARRANTY OF ANY KIND, either express or implied. See the License for the specific
  language governing rights and limitations under the License.
  
  The Original Code is the Venice Web Communities System.
  
  The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
  for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
  Copyright (C) 2004 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.

  Contributor(s): 
--%>
<%@ page import = "java.util.*" %>
<%@ page import = "com.silverwrist.venice.core.IPBanInfo" %>
<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %>
<%@ taglib uri="/tlds/util" prefix="util" %>
<%
  JSPView view = JSPView.get(request);
  List ipbans = (List)(view.getRequestAttribute("ipbans.list"));
%>
<util:comment>IP Bans Display</util:comment>
<util:header title="Manage IP Address Bans"/>
<util:font color="content.fg" size="content"><util:link href="sysadmin/menu.js.vs" type="servlet">Return to
System Administration Menu</util:link></util:font><P>
<% if (ipbans.size()>0) { %>
  <table border="0" width="100%" cellpadding="0" cellspacing="2">
    <tr>
      <th align="center"><util:font color="content.fg" size="content"><b><u>Enable</u></b></util:font></th>
      <th align="left"><util:font color="content.fg" size="content"><b><u>Address</u></b></util:font></th>
      <th align="left"><util:font color="content.fg" size="content"><b><u>Mask</u></b></util:font></th>
      <th align="left"><util:font color="content.fg" size="content"><b><u>Expires</u></b></util:font></th>
      <th align="left"><util:font color="content.fg" size="content"><b><u>Added By</u></b></util:font></th>
      <th align="left"><util:font color="content.fg" size="content"><b><u>Added On</u></b></util:font></th>
      <th>&nbsp;</th>
    </tr>
    <% for (Iterator it = ipbans.iterator(); it.hasNext(); ) { %>
      <% IPBanInfo ban = (IPBanInfo)(it.next()); %>
      <tr>
        <td align="center">
          <% if (ban.isEnabled()) { %>
            <util:xlink>
              <util:href type="servlet">sysadmin/ip_bans.js.vs?disable=<%= ban.getID() %></util:href>
              <util:text><util:image src="icn_on.gif" fixup="true" alt="[Yes]" width="16" height="16"
                                     border="0"/></util:text>
            </util:xlink>
          <% } else { %>
            <util:xlink>
              <util:href type="servlet">sysadmin/ip_bans.js.vs?enable=<%= ban.getID() %></util:href>
              <util:text><util:image src="icn_off.gif" fixup="true" alt="[No]" width="16" height="16"
                                     border="0"/></util:text>
            </util:xlink>
          <% } // end if %>
        </td>
        <td align="left"><util:font color="content.fg" size="content"><%= ban.getAddress() %></util:font></td>
        <td align="left"><util:font color="content.fg" size="content"><%= ban.getMask() %></util:font></td>
        <td align="left"><util:font color="content.fg" size="content">
          <% if (ban.getExpire()==null) { %>Never<% } else { %><%= view.formatDate(ban.getExpire()) %><% } // end if %>
        </util:font></td>
        <td align="left"><util:font color="content.fg" size="content"><%= ban.getBlockedBy() %></util:font></td>
        <td align="left"><util:font color="content.fg" size="content"><%= view.formatDate(ban.getBlockedOn()) %></util:font></td>
        <td align="center"><util:xlink>
          <util:href type="servlet">sysadmin/ip_bans.js.vs?remove=<%= ban.getID() %></util:href>
          <util:text><util:button id="remove"/></util:text>
        </util:xlink></td>
      </tr>
    <% } // end for %>
  </table>
<% } else { %>
  <div align="left"><i>No IP bans currently listed.</i></div>
<% } // end if %>
<util:link href="sysadmin/ip_ban_add.js.vs" type="servlet"><util:button id="add"/></util:link>
