<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>

<% 
	data_path="../../" 'ACC连接数据库路径，对SQL无效
	numid="101"
	dir="../err.asp" 
  %>
<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
<!--#include file="../rolecheck.asp"-->

<%
 
   '添加^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   addbtn=Replace_Text(Request("addbtn"))
   addkind=Replace_Text(Request("addkind"))
   addkind=Replace(addkind," ","")
   If addbtn<>"" Then
   If addkind="" Then 
   Response.Write("<script>alert('请输入种类名称！');history.back(-1);</script>")
   Response.End()
   End  If 
   Set arsk=Server.CreateObject("ADODB.Recordset")
   sqlak="select  * from Websen_cuskind where kindname='"&addkind&"'"
   arsk.Open sqlak,conn,1,3
   If Not arsk.Eof Then 
   Response.Redirect("cuskind.asp?msg=对不起！添加"&addkind&"失败！"&addkind&"已经存在！ ")   
   Else
   conn.execute "insert into Websen_cuskind(kindname) values('"&addkind&"')"
   Response.Redirect("cuskind.asp?msg=添加类别"&addkind&"成功！ ")
   End If
   End If
  '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   
   
   '修改^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   editid=Replace_Text(Request("id"))
   ekind=Replace_Text(Request("ekind"))
   ekind=Replace(ekind," ","")
   ebtn=Replace_Text(Request("ebtn"))
   If ebtn<>"" Then 
   If ekind="" Then
   Response.Write("<script>alert('请输入种类名称！');history.back(-1);</script>")
   Response.End()
   End If
   Set rslk=Server.CreateObject("ADODB.Recordset")
   sqllk="select * from Websen_cuskind where kindname='"&ekind&"' and id<>"&editid
   rslk.Open sqllk,conn,1,3
   If Not rslk.Eof Then 
    Response.Redirect("cuskind.asp?msg=对不起！修改"&ekind&"失败！"&ekind&"已经存在！ ")
   Else
    conn.Execute "update Websen_cuskind set kindname='"&ekind&"' where id="&editid
   Response.Redirect("cuskind.asp?msg=修改"&ekind&"成功！ ")
   rslk.Close
   End If 
   End If
    '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	
	'删除^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    act=Replace_Text(Request("act"))
	delid=Replace_Text(Request("id"))
 	If act="del" Then
	Set dersk=Server.CreateObject("ADODB.Recordset")
	desqlk="select * from Websen_cuslabel where lkind="&delid
	dersk.Open desqlk,conn,1,3
	If Not dersk.Eof Then 
	Do While Not dersk.Eof 
	conn.Execute "delete from Websen_cuslabel where id="&dersk("id")
	dersk.MoveNext
	Loop
	End If
	conn.Execute "delete from Websen_cuskind where id="&delid
 	Response.Redirect("cuskind.asp?msg=删除成功！ ")
	End If
    
	'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<LINK href="../css/style.css" rel=stylesheet type=text/css>
 <title></title>
 <script language="javascript">
   function isdel()
 {
 var i=confirm("你确定要删除吗?删除此类别时，将删除所有属于该类别的所有自定义标签！");
 if(i)
 {
 return true ;
 }
 else
 {
 return false;
 }
 }
</script>
 <script language="javascript">
  function isempty()
  {
  var str=document.addform.addkind.value;
  if(str.replace(/\s+/g,"")=="")
  {
  alert("请输入类别名称！");
  document.addform.addkind.focus();
  return false;
  } 
   }
   function isemptye()
  {
  var str=document.eform.ekind.value;
  if(str.replace(/\s+/g,"")=="")
  {
  alert("请输入类别名称！");
  document.eform.ekind.focus();
  return false;
  } 
   }
  
 </script>
<style type="text/css">
a:link{
	color: #E30000;
}
a:visited{
	color: #E80000;
}
a:hover{}
a:active{}
.STYLE1 {
	color: #0099CC;
	font-weight: bold;
}
</style>
</head>
<body>
<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="#333333"> <B>温馨提示</B>：①本操作是主要用于网站页面头部的不同风格的显示而定的，主要用于登陆页面，搜索页面，注册页面等
 ②如果自定义标签名称与系统标签重复，则：自定义标签优先于系统标签<br />
	
		</td></tr>
<tr><td bgcolor="#CCCCCC" height="1"></td></tr>
<tr><td colspan="2"  height="20">
 	 <script language="javascript">
	 function chesear()
	 {
	  var str=document.seform.seark.value;
  if(str.replace(/^\s+|\s+$/g,'')=="")
  {
  alert("请输入搜索的自定义标签名称！");
  document.seform.seark.focus();
  return false;
  }
  		 }
	 </script>
	
	 <table border="0" cellpadding="0"   cellspacing="0" align="center" width="100%" >
	  <form name="seform"  action="cuslabelch.asp" method="post" onSubmit="return chesear();" ><tr><td><font color="#0099CC">〓</font><span class="STYLE1">请输入要查询的自定义标签(全名):</span>
	    <input name="seark" type="text" onBlur="this.value=this.value.replace(/\s/igm,'')"    value="<%=request("seark")%>" size="30" maxlength="35"/>
	  &nbsp;
	  <input type="submit" name="seago" value=" 查 询 " />
	  &nbsp;<font color="#666666">(如：#WS_gdtop#)</font></td>
	  </tr></form></table></td> 
  </tr> 
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="tableBorder"  >
	<tr><td height="20"   align="left"   bgcolor="#E3EBF9">&nbsp;&nbsp;<a href="addcuslabel.asp"  >添加自定义页面显示标签</a>&nbsp;&nbsp;<a href="cuslabel.asp" >自定义标签管理</a>&nbsp;&nbsp;<a href="cuskind.asp">自定义标签类别管理</a></td>
	</tr><tr><td align="center"><font color="red"><b><%=Request("msg")%></b></font></td></tr> 
 <tr><td>  
  <form   name="addform" method="post" action="cuskind.asp" onSubmit="return isempty();">
 <table width="100%" align="center" >
 <tr><td  	 align="center">
 <font color="#799ADD">添加自定义标签类别</font>
 </td>
 </tr>
 <tr><td height="30" colspan="2" align="center" bgcolor="#F4F3F0">类别名称: 
   <input type="text" name="addkind" value="" onBlur="this.value=this.value.replace(/\s/g,'')"  maxlength="25"/>&nbsp;&nbsp;<input type="submit"  value="添加类别"  name="addbtn"  style="background-color:#F4F3F0"/></td>
 </tr>
  </table>
  </form> 
  
  <%
  If Replace_Text(Request("act"))="edit" Then
  Set rsee=Server.CreateObject("ADODB.Recordset")
  sqlee="select * from Websen_cuskind where id="&Replace_Text(Request("id"))
  rsee.Open sqlee,conn,1,1
  If Not rsee.Eof Then 
  %>
  <table border="0" cellpadding="0"  cellspacing="0" width="100%">
   <form action="cuskind.asp" method="post" name="eform" onSubmit="return isemptye();">
  <tr><td width="28%" align="center" bgcolor="#F4F3F0">
  </td>
    <td width="72%" height="30" align="left" bgcolor="#F4F3F0">&nbsp;&nbsp;&nbsp;修改类别名称:
      <input type="hidden" name="id" value="<%=rsee("id")%>" /><input type="text" value="<%=rsee("kindname")%>" onBlur="this.value=this.value.replace(/\s/g,'')" maxlength="16"   name="ekind" />&nbsp;&nbsp;<input type="submit" name="ebtn" value="修改"  style="background-color:#F4F3F0"/></td>
  </tr>
  </form>
   </table>
   <%  
   rsee.Close
   End If
  End If
  %>
   <%
  If  Replace_Text(Request("act"))="showof" Then
  Set rsshow=Server.CreateObject("ADODB.Recordset")
  sqlshow="select * from Websen_cuslabel where lkind="&Replace_Text(Request("id"))
  rsshow.Open sqlshow,conn,1,1
  If Not rsshow.Eof Then 
  si=1
  %>
  <table border="1" cellpadding="0" bordercolor="#F4F3F0" cellspacing="0" width="100%" bgcolor="#F9F9F9">
  <tr><td align="center" colspan="4"><b><font color="#5881D5"><%=Request("kn")%></font></b></td></tr><tr> 
  <%
  Do While Not rsshow.Eof 
  %>
  <td>&nbsp;<font color="#0099CC"><%=si%></font>.<a href="cuslabel.asp?act=edit&id=<%=rsshow("id")%>"><%=rsshow("lname")%></a><br />&nbsp;〖<font  color="#999999">描述:</font><font color="#666666"><%=rsshow("ldes")%></font>〗</td> 
 <%
 If si Mod 4 =0 Then
 %>
 </tr><tr>
 <%
 End If
   si=si+1
  rsshow.MoveNext
  Loop
   %>
</tr> </table>
  <%
  End If 	
  End If
   %>
  <table border="0"  cellpadding="0"  cellspacing="0" width="100%" ><tr>
   <%
   Set rsek=Server.CreateObject("ADODB.Recordset")
   sqlek="select * from Websen_cuskind"
   rsek.Open sqlek,conn,1,1
    If rsek.Eof Then 
	%>
	<td align="center">暂无类别!</td>
	<%
	End If 
   If Not rsek.Eof Then 
   ei=1
   Do While Not rsek.Eof 
   %>
   <td>&nbsp;<font color="#0099CC"><%=ei%></font>.<a href="cuskind.asp?act=showof&id=<%=rsek("id")%>&kn=<%=rsek("kindname")%>"  ><%=rsek("kindname")%></a>〖<a href="cuskind.asp?act=edit&id=<%=rsek("id")%>">修改</a>〗〖<a href="cuskind.asp?act=del&id=<%=rsek("id")%>" onClick="return isdel();">删除</a>〗 </td>
   <%
   If ei Mod 3 =0 Then 
   %>
   </tr><tr>
   <%
   End If
   ei=ei+1
   rsek.Movenext
   Loop
   rsek.Close
   End If 
   %>
    </tr></table>
     </td>
 </TR></table>
 
 
 </body>
</html>
