<%@ page contentType="text/html; charset=gb2312"%>
<%@ page import="java.sql.*"%> 
<%@ page import="java.util.*"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.text.*"%>
<%@ include file="../admin/checkmaster.jsp"%>
<%@ include file="../inc/conn.jsp"%>
<%!String Layer_name,BBS_Cate_PID,BBS_Cate_Name,searchcontent,sql;%>
<%
String Layer=request.getParameter("layer");
int layerint = Integer.parseInt(Layer);
if(Layer.equals("0")){
	Layer_name="一级类别";
	BBS_Cate_PID="0";
	BBS_Cate_Name="";
}
if(Layer.equals("1")){
	Layer_name="二级类别";
	BBS_Cate_PID=request.getParameter("BBS_Cate_PID");
	BBS_Cate_Name=new String(request.getParameter("BBS_Cate_Name").getBytes("iso-8859-1"));
}
//out.print(Layer);
//out.close();
%>
<html>
<head>
<title><%=Layer_name%>分类管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/xmwuye.css" rel="stylesheet" type="text/css">
<script language="javascript">
	function check(form)
		{

		if (form.BBS_Cate_Name.value=="")
			{
			alert("请输入论坛类别名称！");
			form.BBS_Cate_Name.focus();
			return false;
			}
		if (form.BBS_Cate_Manager_Name.value=="")
			{
			alert("请输入版主姓名！");
			form.BBS_Cate_Manager_Name.focus();
			return false;
			}

			return true;
		}
</script>

</head>

<body bgcolor="#FFFFFF" text="#000000">
<br>
<TABLE align=center>
<TR>
	<TD><B>论坛分类管理</B></TD>
</TR>
</TABLE>
<form name="myform" method="post" action="Category_add.jsp" onsubmit="return check(this)">
  <table width="500" border="0" align="center" cellspacing="1" cellpadding="2" bgcolor="#333333">
    <tr bgcolor="#d6dff7"> 
      <td colspan="2"> 
        <div align="center"><b>[<%=BBS_Cate_Name%>-]&nbsp;<%=Layer_name%></b></div>
      </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td width=24%><%=Layer_name%>名称：</td>
      <td width="76%"> 
        <input type="text" name="BBS_Cate_Name" size="40">
      </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td><%=Layer_name%>版主：</td>
      <td> 
        <input type="text" name="BBS_Cate_Manager_Name" size="40">
        多个版主用&quot;|&quot;分开 </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td><%=Layer_name%>版主Email：</td>
      <td> 
        <input name="BBS_Cate_Manager_Email" type="text" size="40">
      </td>
    </tr>
	<tr bgcolor="#FFFFFF"> 
      <td colspan="2"> 
        <div align="center">
		<INPUT TYPE="hidden" name="BBS_Cate_PID" value="<%=BBS_Cate_PID%>">
		<INPUT TYPE="hidden" name="layer" value="<%=Layer%>">
          <input type="submit" name="Submit" value="添加">
          <input type="reset" name="Submit2" value="取消">
        </div>
      </td>
    </tr>
  </table>
</form>
<!--
<FORM METHOD=POST ACTION="index.jsp">
<table width="80%" border="0" align="center" cellspacing="3" cellpadding="3">
<TR >
	<TD align="right"><B>[<%=BBS_Cate_Name%>-]</B>论坛名称：</TD>
	<TD align="left">
	<INPUT TYPE="text" NAME="searchcontent">
	<INPUT TYPE="hidden" name="BBS_Cate_PID" value="<%=BBS_Cate_PID%>">
	<INPUT TYPE="hidden" name="layer" value="<%=Layer%>">
	<INPUT TYPE="hidden" name="BBS_Cate_Name" value="<%=BBS_Cate_Name%>">
	<INPUT TYPE="submit" value="搜索">
	</TD>
</TR>
</TABLE>
</FORM>
-->
<table width="90%" border="0" align="center" cellspacing="3" cellpadding="3">
  <tr>
    <td> 
      <%if(Layer.equals("0")){%>
      管理首页>>一级类别 
      <%}%>
      <%if(Layer.equals("1")){%>
      管理首页>><A HREF="index.jsp?layer=0">一级类别</A> >><%=BBS_Cate_Name%> 
      <%}%>
    </td>
  </tr>
</table>
<table width="95%" border="0" align="center" cellspacing="1" cellpadding="2" bgcolor="#333333">
  <tr bgcolor="#d6dff7"> 
    <td width="10%"> 
      <div align="center"><b>编号</b></div></td>
    <td> 
      <div align="center"><b><%=Layer_name%></b></div></td>
    <td> 
      <div align="center"><b>主题数量</b></div></td>
    <td> 
      <div align="center"><b>回复数量</b></div></td>
    <td> 
      <div align="center"><b>版主</b></div></td>
    <td bgcolor="#d6dff7"> 
      <div align="center"><b>版主Email</b></div></td>
    <td width="8%"> 
      <div align="center"><b>状态</b></div></td>
    <td width="8%"> 
      <div align="center"><b>修改</b></div></td>
    <td width="8%"> 
      <div align="center"><b>删除</b></div></td>
  </tr>
<%
sql="select * from BBS_Cate where BBS_Cate_PID='"+BBS_Cate_PID+"' order by BBS_ID asc";
ResultSet rs=stmt.executeQuery(sql);
int i=1;
while(rs.next()){
%>
  <tr bgcolor="#FFFFFF" align=center> 
    <td> 
      <%if(Layer.equals("0")){%>
      <A HREF="index.jsp?layer=<%=layerint+1%>&BBS_Cate_PID=<%=rs.getString("BBS_Cate_ID")%>&BBS_Cate_Name=<%=rs.getString("BBS_Cate_Name")%>"><FONT  COLOR="blue"><%=rs.getString("BBS_Cate_ID")%></FONT></A> 
      <%}else{%>
      <%=rs.getString("BBS_Cate_ID")%> 
      <%}%>
    </td>
    <td><%=rs.getString("BBS_Cate_Name")%></td>
    <td><%=rs.getString("BBS_Cate_Topic")%></td>
    <td><%=rs.getString("BBS_Cate_Reply")%></td>
    <td><%=rs.getString("BBS_Cate_Manager_Name")%></td>
    <td><%=rs.getString("BBS_Cate_Manager_Email")%></td>
    <td > 
	  <%if(rs.getString("deleted").equals("0")){%>
      <A HREF="status.jsp?BBS_ID=<%=rs.getString("BBS_ID")%>&deleted=1"><FONT COLOR="red">已转正</FONT></A> 
      <%}else{%>
      <A HREF="status.jsp?BBS_ID=<%=rs.getString("BBS_ID")%>&deleted=0"><FONT COLOR="green">未转正</FONT></A> 
      <%}%>
    </td>
    <FORM METHOD=POST ACTION="Category_mod.jsp">
      <td>
	    <INPUT TYPE="hidden" name="BBS_Cate_ID" value="<%=rs.getString("BBS_Cate_ID")%>">
		<INPUT TYPE="hidden" name="BBS_Cate_PID" value="<%=BBS_Cate_PID%>"> 
        <INPUT TYPE="hidden" name="layer" value="<%=Layer%>">
        <INPUT TYPE="hidden" name="BBS_Cate_Name" value="<%=BBS_Cate_Name%>"> 
        <INPUT TYPE="submit" name="修改" value="修改"> 
      </td>
    </FORM>
    <FORM METHOD=POST ACTION="Category_del.jsp" >
      <td> <INPUT TYPE="hidden" name="BBS_Cate_ID" value="<%=rs.getString("BBS_Cate_ID")%>"> 
        <INPUT TYPE="submit" name="删除" value="删除" onclick="return confirm('确实要删除吗？');"> 
      </td>
    </FORM>
  </tr>
<%
i=i+1;
}
rs.close(); 
stmt.close(); 
conn.close(); 
%>
</table>
<br>
</body>
</html>