<%@ codepage ="936" %>
  <% 
	data_path="../../" 'ACC连接数据库路径，对SQL无效
	numid="82"
	dir="../err.asp" 
  %>
  <!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
<!--#include file="../../inc/FileSystem.asp"-->
 <!--#include file="../rolecheck.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../css/style.css" rel=stylesheet type=text/css>
</head>
<%
dim body
call main()
set rs=nothing
conn.close
set conn=nothing
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"   height="20"><font color="#666666">温馨提示：①类别直接与之前发布的信息相关联，删除类别可能会影响到之前发布的信息。 
	    ②点击类别名称进入相应下级分类，点击相应的分类操作属性进行相应操作。 
 
[<a href="sort.asp">返回大类</a>] </font>   </td> 
  </tr> 
</table>
 <%
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&LogName=128 method=post>
<TR> 
      <Th colSpan=2 height="25" class="tableHeaderText">添加帮助一级类别</Th> 
    </TR>
<TR>
<TD width=40% height=40 class="forumRowHighlight" align=center><b>帮助一级类别名称</b></TD>
<TD width=60% height=25 class="forumRowHighlight"><INPUT maxLength=16 size=40 name=class_name></TD>
</TR>
<TR>
<TD colSpan=2 height="27" align=center class="forumRowHighlight">
<INPUT type=submit value='确 定 添 加' name=Submit2>
</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&LogName=129 method=post>
<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% height=25 class="forumRowHighlight"><select name="help_sort_id"> 
 
<%
set rsc=server.CreateObject("adodb.recordset")
sqlc="select * from Yixiang_help_sort"
rsc.open sqlc,conn,1,1
if not rsc.eof then
do while not rsc.eof
%>
<option value='<%=rsc("sortid")%>'  <%if trim(rsc("sortid"))=trim(request("sortid")) then %>selected<% end if%> ><%=rsc("sort")%></option> 
<%
rsc.movenext
loop
rsc.close
end if
%>
 </select></TD>
</TR>
<TR>
<TD width=40% height=40 class="forumRowHighlight" align=center><b>帮助二级分类名称</b></TD>
<TD width=60% height=25 class="forumRowHighlight"><input name="help_type_name" type="text" size="40" maxlength="16"></TD>
</TR>
<TR>
<TD colSpan=2 height="27" align="center" class="forumRowHighlight"> <INPUT type=submit size=3 value='确 定 添 加' name=Submit2></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 Yixiang_help_type where typename='"&request.form("help_type_name")&"' and sortid=" & request.form("help_sort_id")&""
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 Yixiang_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

%>
<table cellpadding=2 cellspacing=1 border=0 width=400 class=tableBorder align=center><TR>
  <TH class=tableHeaderText colSpan=2 height=25>添加帮助分类信息</TH>
<TR><tr><td height=85 valign=top class=forumRow>
<iframe src='../../manage/makehtml/help/makelist.asp?all=all' width=100% height=35 frameborder=0 ></iframe>
<iframe src='../../manage/makehtml/help/makeindex.asp' frameborder=0 width=100% height=0> </iframe>
<div align=center><br><br>
添加帮助信息分类成功！</div></td></tr><tr align=center><td height=30 class=forumRowHighlight><a href='sort.asp'>&lt;&lt; 返回上一页</a></td></tr></table>

<%

end if
	Rs.Close
	Set Rs=Nothing
end sub

sub edit_help_sort()
set rs=server.createobject("adodb.recordset")
sqltext="select * from Yixiang_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" height="40"> 
<input type="text" name="help_sort_name" size='25' value=<%=rs("sort")%>>
</td>
</tr>
<tr> 
<td height="30" colspan="2" class="forumRowHighlight" align="center"> 
<input type="submit" name="Submit" 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 Yixiang_help_type where typeid="+Cstr(request("id"))
rs.open sqltext,conn,1,1
set rs2=server.createobject("adodb.recordset")
sqltext2="select * from Yixiang_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%" class="forumRowHighlight" align=center><b>所属一级分类</b></td>
<td width="60%" class="forumRowHighlight"><select name="forum_setting" id="forum_setting" disabled=true>
	<option value="0"><%=rs2("sort")%> 
	</select></td>
</tr>
<tr> 
<td width="40%" height="40" align=center class="forumRowHighlight"><b>二级分类名称</b></td>
<td width="60%" bgcolor="#E0EEF5"> 
<input name="help_type_name" type="text" value=<%=rs("typename")%> size='40' maxlength="16"></td>
</tr>
<tr> 
<td height="30" colspan="2" class="forumRowHighlight" align="center">
<input type="submit" name="Submit" 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 Yixiang_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 Yixiang_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()
Set RsHELP=Conn.Execute("Select ID,sortid,typeid  From yixiang_help Where  sortid="&Cstr(request("id"))&"")
	IF NOt RsHELP.Eof Then 
		Do WHile not RsHELP.eof 
			
			typeid=RsHELP("typeid")
			ttid=RsHELP("id")
			sortid=RsHELP("sortid")
			
			FileName=HOPE_InstallDir&"help/bin/detail/"&sortid&"-"&typeid&"-"&ttid&".html"
			Call FileDel(FileName)' 删除当前二级分类下详细的生成文件信息
			
		RsHELP.MOvenext
			if RsHELP.Eof then exit do
		loop
	
	End if
		RsHELP.CLose
		Set RsHELP=NOthing
		
	Set Rstwo=Conn.Execute("Select * From yixiang_help_type Where sortid="&Cstr(request("id"))&"")
		IF Not Rstwo.Eof Then 
			DO While Not RsTwo.Eof 
				typeid=Rstwo("typeid")
				sortid=Rstwo("sortid")	
				
				FileName=HOPE_InstallDir&"help/bin/info/"&sortid&"-"&typeid&".html"
				Call FileDel(FileName)' 删除当前二级分类的生成文件信息
				Rstwo.MOvenext
					if Rstwo.Eof then exit do 
			loop
		End if
		Rstwo.Close
		SEt rsTwo=nothing

conn.execute("delete from [Yixiang_help_sort] where sortid="+Cstr(request("id")))
conn.execute("delete from [Yixiang_help_type] where sortid="+Cstr(request("id")))
Conn.Execute("Delete From yixiang_help Where  sortid="&Cstr(request("id"))&"") '删除表中信息
%>
<table cellpadding=2 cellspacing=1 border=0 width=400 class=tableBorder align=center><TR>
  <TH class=tableHeaderText colSpan=2 height=25>添加帮助分类</TH>
<TR><tr><td height=85 valign=top class=forumRow>
<script>
	if(confirm("删除成功!您是否要重新生成?")){
		document.write("<iframe src='../../manage/makehtml/help/makeindex.asp' width='100%' height='25' frameborder='0' style='display:none;'></iframe>");
		document.write("<iframe src='../../manage/makehtml/help/makelist.asp?all=all' width='100%' height='25' frameborder='0' style='overflow-y:hidden;'></iframe>");

	}
	else{
		window.location.href="sort.asp";
	}
</script>
<div align=center><br><br>
删除帮助分类成功！</div></td></tr><tr align=center><td height=30 class=forumRowHighlight><a href='sort.asp'>&lt;&lt; 返回上一页</a></td></tr></table>

<%

end sub
sub del_help_type()

Set RsHELP=Conn.Execute("Select ID,sortid,typeid  From yixiang_help Where  typeid="&Cstr(request("id"))&"")
	IF NOt RsHELP.Eof Then 
		Do WHile not RsHELP.eof 
			
			typeid=RsHELP("typeid")
			ttid=RsHELP("id")
			sortid=RsHELP("sortid")
			
			FileName=HOPE_InstallDir&"help/bin/detail/"&sortid&"-"&typeid&"-"&ttid&".html"
			Call FileDel(FileName)' 删除当前二级分类下详细的生成文件信息
			
		RsHELP.MOvenext
			if RsHELP.Eof then exit do
		loop
	
	End if
		RsHELP.CLose
		Set RsHELP=NOthing
	Set Rstwo=Conn.Execute("Select * From yixiang_help_type Where typeid="&Cstr(request("id"))&"")
		IF Not Rstwo.Eof Then 
		   do while not Rstwo.Eof
				typeid=Rstwo("typeid")
				sortid=Rstwo("sortid")	
				
				FileName=HOPE_InstallDir&"help/bin/info/"&sortid&"-"&typeid&".html"
				Call FileDel(FileName)' 删除当前二级分类的生成文件信息
				Rstwo.Movenext
				 if Rstwo.Eof Then exit do 
			loop
		End if
		Rstwo.Close
		SEt rsTwo=nothing
Conn.Execute("Delete From yixiang_help Where  typeid="&Cstr(request("id"))&"") '删除表中信息
conn.execute("delete from [Yixiang_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 Yixiang_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 Yixiang_help_sort"
rs.open sqltext,conn,3,3
rs.addnew
rs("sort")=Replace_Text(request.form("class_name"))
rs.update
Response.write "<iframe src='../../manage/makehtml/help/makeindex.asp' frameborder=0></iframe>"
response.Write "<script>window.location.href='sort.asp'</script>"
end if
end sub
%>
<br>
<!--#include file="../copy.asp" -->