<%@ codepage ="936" %>
  <% 
	data_path="../" 'ACC连接数据库路径，对SQL无效
	numid="04"
	dir="err.asp" 
  %>
<!--#include file="../conn/conn.asp" -->
<!--#include file="../inc/safe.asp"--> 
<!--#include file="rolecheckout.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网站热门关键字</title>
<LINK href="css/style.css" rel=stylesheet type=text/css>
  <SCRIPT language=javascript>
function checkclass()
{
 if(document.addclassform.keyclass.value.length<1)
 {
   alert("您必须输入类别名称!");
   document.addclassform.keyclass.focus();
   return false;
 }
}
function checkkeyedit()
{
 if(document.editkeyform.editkeyname.value.length<1)
 {
   alert("您必须输入关键字名称!");
   document.editkeyform.editkeyname.focus();
   return false;
 }
}
function suredel()
{
var a=confirm("你确定要删除吗？此操作将删除属于该类别的所有关键字");
if(a)
{
return true;
}
else
{
return false;
}
} 
function suredelkey()
{
var a=confirm("你确定要删除吗？");
if(a)
{
return true;
}
else
{
return false;
}
} 
function checkkey()
{
 if(document.addkeyform.keyname.value.length<1)
 {
   alert("您必须输入关键字名称!");
   document.addkeyform.keyname.focus();
   return false;
 }
}
</SCRIPT> 
<style >
.tdc{filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr=#EBF0FA, EndColorStr=#FFFFFF);
}
</style>
</HEAD>
<%
'添加关键字类别：^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
dim addgo,keyclass
keyclass=Replace_Text(request("keyclass"))
addgo=Replace_Text(request("addgo"))
if addgo<>"" and keyclass<>"" then
conn.execute("INSERT INTO Websen_KeyKinds(KindName) VALUES('"&keyclass&"')")
end if
'删除关键字类别：
dim editgo,editid,editclassname
editclassname=Replace_Text(request("editclassname"))
editid=Replace_Text(request("editid"))
editgo=request("editgo")
if editgo<>"" and editid<>"" then
conn.execute "update  Websen_KeyKinds set KindName='"&editclassname&"' where id="&editid
end if
dim id
id=request("id")
if request("action")="delclass" and id<>"" then
conn.execute "delete  from Websen_KeyKinds where id="&id
conn.execute "delete  from Websen_Keywords where Websen_KeyKindId="&id '删除类别名称时，一起删除其下的关键字
end if
'添加关键字：^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
dim addkeygo,keyname,addkind
addkeygo=request("addkeygo")
keyname=Replace_Text(request("keyname"))
addkind=Replace_Text(request("addkind"))
if addkeygo<>"" then
if addkind="" then
response.Write("<script language=javascript>alert('请先添加关键字的类别！');history.back(-1);</script>")
response.End()
end if
if keyname<>"" then 
conn.execute "insert into Websen_Keywords(Websen_Keyword,Websen_KeyKindId) values('"&keyname&"',"&addkind&")"
end if
end if
'修改关键字：^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
dim editkeygo,editkeyname,editkind,editkeyid
editkeyid=request("editkeyid")
editkeygo=request("editkeygo")
editkeyname=Replace_Text(request("editkeyname"))
editkind=Replace_Text(request("editkind"))
if editkeygo<>"" and editkeyname<>"" and editkind<>"" and editkeyid<>""  then
conn.execute "update Websen_Keywords set Websen_Keyword='"&editkeyname&"',Websen_KeyKindId="&editkind&" where id="&editkeyid
end if
'^删除关键字：^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
dim keydelid
action=request("action")
keydelid=request("keydelid")
if action="delkeyname" and keydelid<>"" then
conn.execute "delete  from Websen_Keywords where id="&keydelid
end if
%>
<table width="100%" border="0"  align=center cellpadding="3" cellspacing="1" bordercolor="#FFFFFF"> 
  <tr> 
     <td width="100%" height=30 align="center" bgcolor="#FFFFFF" class="tableHeaderText"><strong> 网站热门关键字(静态)管理 </strong></td> 
  </tr> 
  <tr> 
     <td  height="20" bgcolor="#EEF7FD" class="indhot"> <B>注意</B>：<br>
      ① 网站热门关键字是用于网站内快速搜索用途;<br>
      ② 该静态热门关键字是由管理员后态手动添加的，其调用可由【<A onClick="javascript:window.open('labelwrite.asp','','toolbar=no,directories=no,scrollbars=yes,resizable=1,status=no,menubar=no');" href="#">自定义标签辅助工具</A>】产生标签放入对应系统模板中生效！<br>
	 <a href="keywords.asp?action=addlinkkey"><font color=red><b>添加关键字</b></font></a>
    </td> 
  </tr> 
</table>
  <table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
 	<tr>
	  <td>

<%
'修改关键字：^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if request("action")="editkeyname" and request("keyid")<>""  then
set keyrs=server.CreateObject("adodb.recordset")
sqlkeye="select * from Websen_Keywords where id="&request("keyid")
keyrs.open sqlkeye,conn,1,1
if not keyrs.eof then
%>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF" >
  <form action="?" name="editkeyform" method="post"  onSubmit="return checkkeyedit();" ><tr><td height="30" bgcolor="#EEF7FD">&nbsp;所属类别:
  <select name="editkind" size="1" >
<%
set rskinde=server.CreateObject("adodb.recordset")
sqlkinde="select * from Websen_KeyKinds"
rskinde.open sqlkinde,conn,1,1
if not rskinde.eof then
do while not rskinde.eof
%>
<option value="<%=rskinde("id")%>" <%if keyrs("Websen_KeyKindId")=rskinde("id") then response.Write("selected") end if%>><%=rskinde("KindName")%></option><%
rskinde.movenext 
loop
rskinde.close
set rskinde=nothing
end if
 %></select>&nbsp;关键字：<input name="editkeyname" type="text" value="<%=keyrs("Websen_Keyword")%>" size="20" maxlength="10">
<input type="hidden" name="editkeyid" value="<%=keyrs("id")%>">&nbsp;<input type="submit" value="确认修改" name="editkeygo"></td>
</tr></form></table><%
keyrs.close
 set keyrs=nothing
 end if
end if
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
'添加关键字类别：^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if request("action")="addlink" then
%>
	  <TABLE border="0" width="100%" cellpadding="0">
	    <form name="addclassform" method="post" action="?" onSubmit="return checkclass()">
        <TR><td height="30"> 请输入关键字类别名：
          <input type="text" name="keyclass" value="" maxlength="15"> <input type="submit" value="添加类别" name="addgo"></td>
        </TR></form></TABLE>
<%
end if
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
'修改关键字类别：^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
		 if request("action")="editclass" and request("id")<>"" then
		 set rseditclass=server.CreateObject("adodb.recordset")
		 sqle="select * from Websen_KeyKinds where id="&request("id")
		 rseditclass.open sqle,conn,1,1
		 if not rseditclass.eof then
%>
<table border="0" cellpadding="0" cellspacing="0" width="100%" ><form action="?" name="editclassform" method="post" ><tr><td><input type="text" name="editclassname" value="<%=rseditclass("KindName")%>"><input type="hidden" name="editid" value="<%=rseditclass("id")%>"><input type="submit" value="确定修改" name="editgo"></td></tr></form></table>
<%
rseditclass.close
set rseditclass=nothing
end if
end if
 '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'添加关键字：
if request("action")="addlinkkey" then
%>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#FFFFFF" >
  <form action="?" name="addkeyform" method="post"  onSubmit="return checkkey();" ><tr><td bgcolor="#EEF7FD" height="30">&nbsp;所属类别:
  <select name="addkind" size="1" >
<%
set rskind=server.CreateObject("adodb.recordset")
sqlkind="select * from Websen_KeyKinds"
rskind.open sqlkind,conn,1,1
if not rskind.eof then
do while not rskind.eof
%>
<option value="<%=rskind("id")%>"><%=rskind("KindName")%></option><%
rskind.movenext 
loop
rskind.close
set rskind=nothing
end if
 %></select>&nbsp;关键字：<input name="keyname" type="text" value="" size="20" maxlength="10">
&nbsp;<input type="submit" value="添加关键字" name="addkeygo"></td>
</tr></form></table>
<%
end if
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'****************************************************************************************************************
'显示所有类别：
 set rstype=server.createobject("adodb.recordset")
sql="select * from Websen_KeyKinds "
rstype.open sql,conn,1,1
%>
	  <TABLE border="0" width="100%" cellpadding="0">
        <TR>   
<%
if rstype.eof then
response.Write"<br><br><div align='center'>暂无类别  </div><br><br>"
else		  
dim k
k=1
          do while not rstype.eof
          %>
        <tr > <td width="28%" height="25" class="tdc"  >&nbsp;<font color="#0099CC"><%=k%></font>.&nbsp;<b><%=rstype("KindName")%></b><!-- 〖<a href=keywords.asp?action=editclass&id=<%=rstype("id")%>><font color=#ff0000>修改 </font></a>│<a href=keywords.asp?action=delclass&id=<%=rstype("id")%> onClick="return suredel();"><font color=#ff0000>删除</font></a>〗 --> </td></tr>
		  <%
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'显示该类别下的关键字：
		  set rschild=server.CreateObject("adodb.recordset")
		  sqlchild="select * from Websen_Keywords where Websen_KeyKindId="&rstype("id")
		  rschild.open sqlchild,conn,1,1
		  if not rschild.eof then
		  dim j,h
		  h=1
		  j=1
		  %><tr><td><table border="0" cellpadding="0" bgcolor="#F5F5F5"  cellspacing="0" width="99%" align="center"> 
		    <tr>
		 <% do while not rschild.eof 
		  %>
		 <td height="30" class="Forumrow"><%=h%>.<%=rschild("Websen_Keyword")%>&nbsp; <IMG src="../images_new/plus.gif" width="9" height="9">   〖<a href=keywords.asp?action=editkeyname&keyid=<%=rschild("id")%>><font color=#ff0000>修改</font></a>│<a href=keywords.asp?action=delkeyname&keydelid=<%=rschild("id")%> onClick="return suredelkey();"><font color=#ff0000>删除</font></a>〗 </td>
		  <%
		  if j mod 3=0 then
		 response.Write("</tr><tr>")
		 end if
		  rschild.movenext
		 
		  h=h+1
		  j=j+1
		  loop
rschild.close
set rschild=nothing
		  
   '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
		%>
		 </tr></table>
		  </td>
          </tr>  
 <%
		  end if
		  rstype.movenext
           k=k+1
          loop
  %>
      </TABLE>
 <% 
             rstype.close
             set rstype=nothing
			 end if
'***************************************************************************************************************
   %> 

<br>
 