<%@ codepage ="936" %>
<!--#include file="../../conn/conn.asp" -->
<!--#include file="../../Inc/Commoncode.asp" -->
<!--#include file="../checkvalid.asp" -->
<%If Not FRAdminLevel(804) Then
	Call ErrorMsg()
End If%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/style<%=sk%>.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../inc/input.js"></script><style type="text/css">
<!--
.style11 {color: #0066CC;
	font-weight: bold;
}
-->
</style>
</head>
<%
dim body
call main()
sub main()
%>
<table width="98%" border="0" cellspacing="0" cellpadding="0"  align=center class="tableBorder"> 
  <tr> 
     <th height=25 colspan="2" class="tableHeaderText">帮助信息类别管理 </th> 
  </tr> 
  <tr>
    <td colspan="2"><font color="ff6600"><b class="style11">　管理选项</b></font>： <a href="index.asp">管理帮助信息</a> | <a href="addhelp.asp">添加帮助信息</a> | <a href="sort.asp">管理帮助类别</a> | <a href="Admin_Class_Ok.asp?action=add_help_sort">添加帮助类别</a> |   [<a href="javascript:location.reload()">刷新页面</a>] </td>
  </tr>
  <tr> 
     <td colspan="2"><p><B>注意</B>：<BR> 
         <font color="blue">①类别直接与之前发布的信息相关联，删除类别可能会影响到之前发布的信息。<br>
	    ②点击类别名称进入相应下级分类，点击相应的分类操作属性进行相应操作。</font><br>
		 <font color="red">③如：要添加二级分类——>先点击大类进入二级类——>添加二级类别</font>
[<a href="sort.asp">返回大类</a>]    </td> 
  </tr> 
</table>
<br>
<%
if request("action") ="add_help_sort" then 
call add_help_sort()
elseif request("action")="add_help_sort_ok" then
call add_help_sort_ok()

elseif request("action")="add_help_type" then
call add_help_type()
elseif request("action")="add_help_type_ok" then
call add_help_type_ok()

elseif request("action")="edit_help_sort" then
call edit_help_sort()
elseif request("action")="edit_help_type" then
call edit_help_type()

elseif request("action")="savedit_1" then
call savedit_1()
elseif request("action")="savedit_2" then
call savedit_2()

elseif request("action")="del_help_sort" then
call del_help_sort()
elseif request("action")="del_help_type" then
call del_help_type()

else
call linkinfo()
end if
%>
<%
end sub
sub add_help_sort()
%>
<TABLE width=100% border="0" align="center" cellPadding=3 cellSpacing=1 class="tableBorder">
    <FORM name=FORM1 onSubmit="return FORM1_onsubmit()" action=admin_class_ok.asp?action=add_help_sort_ok method=post>
<TR> 
      <Th colSpan=2 height="25" class="tableHeaderText">添加帮助一级类别</Th> 
    </TR>
<TR>
<TD width=40% height=25 align=center><b>帮助一级类别名称</b></TD>
<TD width=60% height=25><INPUT maxLength=16 size=40 name=class_name></TD>
</TR>
<TR>
<TD colSpan=2 height="27" align=center>
<INPUT name=Submit2 type=submit class="inputs" value='确 定 添 加'></TD>
</TR>
</FORM>
</TABLE>
<SCRIPT language=javascript>
function FORM1_onsubmit()
{
if(document.FORM1.class_name.value.length<1)
{
alert("您必须输入大类名称!");
document.FORM1.class_name.focus();
return false;
}
}
</script><%
end sub
sub add_help_type()
%>
<TABLE width=100% border="0" align="center" cellPadding=3 cellSpacing=1 class="tableBorder">
    <FORM name=FORM1 onSubmit="return FORM1_onsubmit()" action=admin_class_ok.asp?action=add_help_type_ok method=post>
<TR> 
      <Th colSpan=2 height="25" class="tableHeaderText">添加帮助二级类别</Th> 
    </TR>
<tr>
<TD width=40% height=25 align=center><b>所属帮助一级分类</b></TD>
<TD width=60% height=25><select name="help_sort_id"> 
<%
sqlsort="select * from JOB_help_sort where sortid="&request("sortid")&""
set rssort=conn.execute(sqlsort) 
response.write"<OPTION value='"&rssort("sortid")&"' selected>"&rssort("sort")&"</OPTION>"
%> 
<%
set rsc=conn.execute("select * from JOB_help_sort")
do while not rsc.eof
response.write "<option value='"&rsc("sortid")&"'>"&rsc("sort")&"</option>"&chr(13)+chr(10)
rsc.movenext
loop
rsc.close
%>
</select></TD>
</TR>
<TR>
<TD width=40% height=25 align=center><b>帮助二级分类名称</b></TD>
<TD width=60% height=25><input type="text" name="help_type_name" size="40"></TD>
</TR>
<TR>
<TD colSpan=2 height="27" align="center"> <INPUT name=Submit2 type=submit class="inputs" value='确 定 添 加' size=3></TD>
</TR>
</form>
</TABLE> 　
<SCRIPT language=javascript>
function FORM1_onsubmit()
{
if(document.FORM1.help_type_name.value.length<1)
{
alert("您必须输入二级分类名称!");
document.FORM1.help_type_name.focus();
return false;
}
}
</script><%
end sub
sub add_help_type_ok()
set rs=server.createobject("adodb.recordset")
sqltext="select * from JOB_help_type where typename='"&request.form("help_type_name")&"' and sortid=" & request.form("help_sort_id")&""
'response.Write(sqltext)
rs.open sqltext,conn,1,1
'查找数据库，检查二级分类是否已经存在
if rs.recordcount >= 1 then 
if rs("typename")=Lcase(request.form("help_type_name")) then
response.write "<script language='javascript'>"
response.write "alert('此二级分类已经存在，请选用其它名称!');"
response.write"javascript:history.back(-1)</script>"
response.end
rs.close
end if
else
set rs=server.createobject("adodb.recordset")
sqltext="select * from JOB_help_type"
rs.open sqltext,conn,3,3
'添加一个二级分类到数据库
rs.addnew
rs("typename")=Replace_Text(request.form("help_type_name"))
rs("sortid")=request.form("help_sort_id")
rs.update
response.redirect "type.asp?sortid="&request.form("help_sort_id")&""
end if
end sub
sub edit_help_sort()
set rs=server.createobject("adodb.recordset")
sqltext="select * from JOB_help_sort where sortid="+Cstr(request("id"))
rs.open sqltext,conn,1,1
%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableBorder">
<form name=FORM1 action="Admin_Class_Ok.asp?action=savedit_1" method=post>
<input type=hidden name=id value="<%=Cstr(request("id"))%>">
<TR> 
<Th colSpan=2 height="25" class="tableHeaderText">帮助一级类别修改</Th> 
    </TR>
<TD width=40% height=25 class="forumRowHighlight" align=center><b>帮助一级类别名称</b></TD>
<td width="60%" class="forumRowHighlight"> 
<input type="text" name="help_sort_name" size='25' value=<%=rs("sort")%>>
</td>
</tr>
<tr> 
<td height="30" colspan="2" align="center"> 
<input name="Submit" type="submit" class="inputs" value="确 定 修 改"></td>
</tr>
</form>
</table>
<SCRIPT language=javascript>
function FORM1_onsubmit()
{
if(document.FORM1.class_name.value.length<1)
{
alert("您必须输入大类名称!");
document.FORM1.class_name.focus();
return false;
}
}
</script><%
rs.close
set rs=nothing
end sub
sub edit_help_type()
set rs=server.createobject("adodb.recordset")
sqltext="select * from JOB_help_type where typeid="+Cstr(request("id"))
rs.open sqltext,conn,1,1
set rs2=server.createobject("adodb.recordset")
sqltext2="select * from JOB_help_sort where sortid="+Cstr(rs("sortid"))
rs2.open sqltext2,conn,1,1
%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableBorder">
    <form name=form1 action=Admin_Class_Ok.asp?action=savedit_2 method=post>
<input type=hidden name=id value=<%=Cstr(request("id"))%>>
<input type=hidden name=sortid value=<%=Cstr(request("sortid"))%>>
<TR> 
      <Th colSpan=2 height="25" class="tableHeaderText">帮助二级类别修改</Th> 
    </TR>
<tr> 
<td width="40%" align=center><b>所属一级分类</b></td>
<td width="60%"><select name="forum_setting" id="forum_setting" disabled=true>
	<option value="0"><%=rs2("sort")%> 
	</select></td>
</tr>
<tr> 
<td width="40%" align=center><b>二级分类名称</b></td>
<td width="60%"> 
<input type="text" name="help_type_name" size='40' value=<%=rs("typename")%>></td>
</tr>
<tr> 
<td height="30" colspan="2" align="center">
<input name="Submit" type="submit" class="inputs" value="确 定 修 改"></td>
</tr>
</form>
</table>
<SCRIPT language=javascript>
function FORM1_onsubmit()
{
if(document.FORM1.help_type_name.value.length<1)
{
alert("您必须输入二级分类名称!");
document.FORM1.help_type_name.focus();
return false;
}
}
</script><%
rs.close
rs2.close
set rs=nothing
set rs2=nothing
end sub
sub savedit_1()
set rs= server.createobject ("adodb.recordset")
sql ="select * from JOB_help_sort where sortid="+Cstr(request("id"))
rs.Open sql,conn,1,3
if rs.eof and rs.bof then
body=body+"<br>"+"错误，数据库操作错误，没有找到此条信息。"
else
rs("sort")=Trim(Request.Form ("help_sort_name"))
rs.Update
end if 
response.redirect "sort.asp"
end sub
sub savedit_2()
set rs= server.createobject ("adodb.recordset")
sql ="select * from JOB_help_type where typeid="+Cstr(request("id"))
rs.Open sql,conn,1,3
if rs.eof and rs.bof then
body=body+"<br>"+"错误，数据库操作错误，没有找到此条信息"
else
rs("typename")=Trim(Request.Form ("help_type_name"))
rs.Update
end if 
response.redirect "type.asp?sortid="&request("sortid")&""
end sub
sub del_help_sort()
conn.execute("delete from [JOB_help_sort] where sortid="+Cstr(request("id")))
conn.execute("delete from [JOB_help_type] where sortid="+Cstr(request("id")))
response.redirect "sort.asp"
end sub
sub del_help_type()
conn.execute("delete from [JOB_help_type] where typeid="+Cstr(request("id")))
response.redirect "type.asp?sortid="&request("sortid")&""
end sub
sub add_help_sort_ok()
set rs=server.createobject("adodb.recordset")
sqltext="select * from JOB_help_sort where sort='"&request.form("class_name")&"'"
rs.open sqltext,conn,1,1
'查找数据库，检查大类是否已经存在
if rs.recordcount >= 1 then 
if rs("help_sort_name")=Replace_Text(request.form("class_name")) then
response.write "<script language='javascript'>"
response.write "alert('此类别已经存在，请选用其它名称！');"
response.write"javascript:history.back(-1)</script>"
response.end
end if
else
set rs=server.createobject("adodb.recordset")
sqltext="select * from JOB_help_sort"
rs.open sqltext,conn,3,3
rs.addnew
rs("sort")=request.form("class_name")
rs.update
response.redirect "sort.asp"
end if
end sub
%>
<br>
<!--#include file="../inc/copy.asp" -->
<%
conn.close
set conn=nothing
%>



