<!--#include file="../conn2.asp"-->
<!--#include file="set.asp"-->
<%
act=request("act")
id=request("id")
id2=request("id2")
if act="add" then
set rs=server.createobject("adodb.recordset")
sql="select * from bbs_class3 where class3_class1_id="&id&" and class3_class2_id="&id2&" and class3_class3_name='"&request.form("bidname")&"'"
rs.open sql,conn,1,3
if not rs.eof then
response.write"<script language='javascript'>alert('论坛名称重复！')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
response.end
end if
rs.addnew
rs("class3_class1_id")=id
rs("class3_class2_id")=id2
rs("class3_class3_name")=request.form("bidname")
rs("class3_class3_logo")=request.form("logo")
rs("class3_class3_px")=request.form("px")
rs("class3_class3_info")=request.form("bidinfo")

rs.update
set rs=nothing
set conn=nothing
response.redirect "boardman3.asp?aid="&id&"&nclass="&id2
end if
if act="del" then
conn.execute"delete from bbs_class3 where class3_id="&request("delid")
conn.execute"delete from book where bbs_book_class3_id="&request("delid")
response.redirect "boardman3.asp?aid="&id&"&nclass="&id2
end if
%>
<head>
<LINK href="css.css" type=text/css rel=stylesheet>

<title></title>
<style type="text/css">
<!--
.style1 {color: #000000}
.STYLE2 {
	color: #000000;
	font-weight: bold;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>

<body topmargin="2" leftmargin="2">
<br>
<div align="center">
<center>
    <table width="609" border="0" cellpadding="2" cellspacing="1" bordercolordark="#FFFFFF" bgcolor="#CCCCCC">
      <tr bgcolor="f1f1f1"> 
        <td height="25" colspan="3" bgcolor="f1f1f1" class="norightbuttonborder2"><div align="center" class="style1"><strong>三级栏目管理</strong></div></td>
      </tr>
      <tr bgcolor="#FFFFFF"><form name="form1" method="post" action="">
        <td colspan="3" bgcolor="#FFFFFF"><span style="font-size:14px;color:#000000">
          <%
		  aid=request("aid")
		   nclass=request("nclass")
		     if aid="" then
		  aid=0
		  end if
		  if nclass="" then
		  nclass=0
		  end if
		  set rs=server.createobject("adodb.recordset")
        rs.open "select * from board order by px",conn,1,1
	if rs.eof and rs.bof then
	response.write "请先添加栏目。"
	response.end
	else
%><select name="anclassid" size="1" id="anclassid" onChange="var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0 ;}"  class="wenbenkuang">
  <option >--选择大类--</option>
  <option value="boardman3.asp?aid=<%=rs("bid")%>&nclass=0" <%if rs("bid")=cint(request.QueryString("aid")) then %>selected<%end if%>><%=trim(rs("bidname"))%></option>
  <%			         rs.movenext
        do while not rs.eof
%>
  <option value="boardman3.asp?aid=<%=rs("bid")%>&nclass=0" <%if rs("bid")=cint(request.QueryString("aid")) then %>selected<%end if%>><%=trim(rs("bidname"))%></option>
  <%
        rs.movenext
        loop
	end if
        rs.close
%>
</select>

<select name="Nclassid" class="wenbenkuang" id="Nclassid" onChange="var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0 ;}" >
  <option  >--选择小类--</option>
  <%set rs=server.createobject("adodb.recordset")		 
		rs.Open "select * from bbs_class2 where class2_class1_id="&aid&" order by class2_class2_px",conn,1,1
		do while not rs.eof 
		
		%>
  <option value="boardman3.asp?aid=<%=aid%>&nclass=<%=rs("class2_id")%>" <%if rs("class2_id")=int(nclass) then %> selected <%end if%>><%=trim(rs("class2_class2_name"))%></option>
  <%rs.movenext
		loop
		rs.close
		set rs=nothing
		
		%>
</select>
<%if int(nclass)>0 then
			set rsqq=server.createobject("adodb.recordset")			
			rsqq.Open "select * from bbs_class2 where class2_id="&nclass,conn,1,1
        response.Write "<font color=""#FF0000"">当前查询："&rsqq("class2_class2_name")&"<font>"
        end if%>
        </span></td>
	 </form>  
      </tr>
      <tr bgcolor="#FFFFFF"> 
        <td width="75" height="25"> <p align="center"><b>排序</b></td>
        <td width="324" height="25"> 
          <p align="center"><b>论坛名称</b></td>
        <td height="25"> <p align="center"><b>管理操作</b></p></td>
      </tr>
      <%
	   	set bidreco=server.createobject("adodb.recordset")
    	sqlstr="select * from bbs_class3 where class3_class1_id="&aid&" and class3_class2_id="&nclass&" order by class3_class3_px"
    	bidreco.open sqlstr,conn,3,1
		i=1
        do while not bidreco.eof
	%>
      <tr bgcolor="#FFFFFF"> 
        <td width="75" height="25" align="center"><%=bidreco("class3_class3_px")%>　</td>
        <td width="324" height="25" align="center"><%=bidreco("class3_class3_name")%>　</td>
        <td height="25" align="center" bgcolor="#FFFFFF"><a href="edit_board3.asp?bid=<%=bidreco("class3_id")%>">修改</a>  <a href="boardman3.asp?act=del&id=<%=aid%>&id2=<%=nclass%>&delid=<%=bidreco("class3_id")%>" onClick="javascript:return confirm('真的要删除吗？')">删除</a></td>
      </tr> 
      <%  i=i+1
			bidreco.movenext  
			loop  
			set bidreco=nothing  
			set conn=nothing %> 
    </table> 
  </center> 
</div> 
 <br>
 <table width="609" border="0" align="center" cellpadding="2" cellspacing="1" bordercolordark="#FFFFFF" bgcolor="#CCCCCC">
  <form method="post" name="form" action="boardman3.asp?act=add&id=<%=aid%>&id2=<%=nclass%>" onSubmit="return ck1()">
    <tr bgcolor="#FFFFFF"> 
      <td height="23" colspan="2" align="center" bgcolor="f1f1f1" class="norightbuttonborder2"><span class="STYLE2">新增栏目</span></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td width="30%" height="23" align="center"><div align="right">论坛名称：</div></td>
      <td width="70%" height="23"> <input type="text" name="bidname" size="49" maxlength="60" class=wenbenkuang>      </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td width="30%" height="23" align="center"><div align="right">论坛logo：</div></td>
      <td width="70%"> <input type="text" name="logo" size="49" maxlength="60" class=wenbenkuang value="images/boy_1.gif"> 
        <a href=# onClick="window.open('/upload.asp?formname=form&editname=logo&infoname=bbs&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=35')">上传图片</a></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td width="30%" height="23" align="center"><div align="right">论坛排序：</div></td>
      <td width="70%" height="23"> <input name="px" type="text" class=wenbenkuang 
onkeypress="return event.keyCode>=48&&event.keyCode<=57" value="<%=i%>" size="17" maxlength="60" >
        请填写数字 </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td width="30%" height="79" align="center"><div align="right">论坛介绍：</div></td>
      <td width="70%" height="79"> <textarea name="bidinfo" cols="48" rows="5" class="wenbenkuang" ></textarea>      </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="29" colspan="2" align="center"> <p align="center"> 
          <input name="B12" type="submit" class="go-wenbenkuang" value=" 提 交">　
          <input name="B122" type="reset" class="go-wenbenkuang" value=" 重 置">
      </p></td>
    </tr>
  </form>
</table>
</body> 
<script>
function showadv(){
if (document.form.advshow.checked == true) {
adv.style.display = "";
}else{
adv.style.display = "none";
}
}
function ck1()
{

 if(form1.anclassid.value==0)
  {
  alert("请选择大类")
  return false  
  }
  if(form1.Nclassid.value==0)
  {
  alert("请选择小类")
  return false  
  }


if(form.bidname.value=="")
{
alert("请输入名称")
form.bidname.focus()
return false
}
if(form.logo.value=="")
{
alert("请输入logo")
form.logo.focus()
return false
}
if(form.px.value=="")
{
alert("请输入排序")
form.px.focus()
return false
}
if(form.bidinfo.value=="")
{
alert("请输入介绍")
form.bidinfo.focus()
return false
}

}


</script>
 
