<%@ page contentType="text/html;charset=GBK" %>

<%
/**
 *	$RCSfile: forums.jsp,v $
 *	$Revision: 1.1.1.1 $
 *	$Date: 2002/09/09 13:50:13 $
 */
%>

<%@ page import="java.util.*,
                 com.jivesoftware.forum.*,
				 com.jivesoftware.forum.util.*" %>

<%@ include file="global.jsp" %>

<%	// Get parameters
	int start = ParamUtils.getIntParameter(request,"start",0);
	int range = ParamUtils.getIntParameter(request,"range",10);

    // if the start isn't passed in as a parameter, look for it in the session
    if (request.getParameter("start") == null) {
        try {
            start = Integer.parseInt((String)session.getAttribute("admin.forums.start"));
        } catch (Exception e) {}
    }
    else {
        session.setAttribute("admin.forums.start",start+"");
    }

    // Iterator of forums
    Iterator forums = forumFactory.forums();

    // Total number of forums
    int forumCount = forumFactory.getForumCount();

    // Remove the forum in the session (if we come to this page, the sidebar
    // shouldn't show the specific forum options).
    session.removeAttribute("admin.sidebar.forums.currentForum");
%>

<%  // special onload command to load the sidebar
    onload = " onload=\"parent.frames['sidebar'].location.href='sidebar.jsp?sidebar=forum';\"";
%>
<%@ include file="header.jsp" %>

<p>

<%  // Title of this page and breadcrumbs
    String title = "论坛概览";
    String[][] breadcrumbs = {
        {"主页面", "main.jsp"},
        {"论坛", "forums.jsp"}
    };
%>
<%@ include file="title.jsp" %>

<font size="-1">
论坛总数：<%= forumCount %>  (每页显示<%= range %>条)。
你可以<a href="createForum.jsp">创建一个新论坛</a>。
</font>

<p>

<table bgcolor="<%= tblBorderColor %>" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr><td>
<table bgcolor="<%= tblBorderColor %>" cellpadding="3" cellspacing="1" border="0" width="100%">
<tr bgcolor="#eeeeee">
    <td align="center"><font size="-2" face="verdana"><b>论坛标题及描述</b></font></td>
    <td align="center"><font size="-2" face="verdana"><b>主题数</b></font></td>
    <td align="center"><font size="-2" face="verdana"><b>消息数</b></font></td>
    <td align="center"><font size="-2" face="verdana"><b>编辑</b></font></td>
    <td align="center"><font size="-2" face="verdana"><b>删除</b></font></td>
</tr>
<%  if (!forums.hasNext()) { %>

<%  }
    // skip the first 0->start forums
    int i=0;
    while (i++ < start && forums.hasNext()) {
        forums.next();
    }
    // show "range" number of forums
    i=0;
    while (i++ < range && forums.hasNext()) {
        Forum forum = (Forum)forums.next();
        String description = forum.getDescription();
        long id = forum.getID();
%>
<tr bgcolor="#ffffff">
    <td><font size="-1"><a href="editForum.jsp?forum=<%= id %>" title="Click to edit all forum properties"><%= forum.getName() %></a><br><%= (description!=null)?description:"" %></font></td>
    <td align="center"><font size="-1"><%= forum.getThreadCount() %></font></td>
    <td align="center"><font size="-1"><%= forum.getMessageCount() %></font></td>
    <td align="center"><a href="editForum.jsp?forum=<%= id %>"><img src="images/button_edit.gif" width="17" height="17" alt="Click to edit all forum properties" border="0"></a></td>
    <td align="center"><a href="removeForum.jsp?forum=<%= id %>"><img src="images/button_delete.gif" width="17" height="17" alt="Confirm that you want to delete this forum..." border="0"></a></td>
</tr>
<%  } %>
</table>
</td></tr>
</table>

<p>

<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<%  if (start > 0) { %>
	<td width="1%" nowrap><font size="-1"><a href="forums.jsp?start=<%= start-range %>">前 <%= range %> 个子论坛</a></font></td>
<%  } else { %>
	<td width="1%" nowrap><font size="-1">&nbsp;</font></td>
<%  } %>

<%  if (start > 0) { %>
	<td width="98%" align="center"><font size="-1"><a href="forums.jsp?start=0">前一页</a></font></td>
<%  } else { %>
	<td width="98%" nowrap><font size="-1">&nbsp;</font></td>
<%  } %>

<%  if (start+range < forumCount) { %>
	<td width="1%" nowrap><font size="-1"><a href="forums.jsp?start=<%= start+range %>">下 <%= range %> 个子论坛</a></font></td>
<%  } else { %>
	<td width="1%" nowrap><font size="-1">&nbsp;</font></td>
<%  } %>
</tr>
</table>



<%@ include file="footer.jsp" %>
