<%@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"-->
 <%
  
 '添加^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  msg=""
  addbtn=Replace_Text(request("addbtn"))
  addlabel=Replace_Text(request("addclname"))
  addlabel=Replace(addlabel," ","")
  addcldes=Replace_Text(request("addcldes"))
  idatemodi=Replace_Text(request("idatemodi"))
  addlkind=Replace_Text(request("addlkind"))
  addclcontent= request("addclcontent")
   If addbtn<>"" Then 
    If addlabel="" Then
    Response.Write("<script>alert('请输入名称!');history.back(-1);</script>")
    Response.End()
    End If
	addlabel="#WS_"&addlabel&"#"
	 If addlkind=0 Then
    Response.Write("<script>alert('请选择添加所属种类!');history.back(-1);</script>")
    Response.End()
    End If
     If addclcontent="" Then
    Response.Write("<script>alert('请输入内容！');history.back(-1);</script>")
    Response.End()
    End If
    Set rshas=Server.CreateObject("ADODB.Recordset")
	sqlhas="select * from Websen_cuslabel where lname='"&addlabel&"'"
	rshas.Open sqlhas,conn,1,3
	If  rshas.Eof Then 
	rshas.AddNew
 	rshas("lname")=addlabel
	rshas("ldes")=addcldes
	rshas("lcontent")=addclcontent
	 rshas("lkind")=addlkind
	 rshas("lidate")=idatemodi
	 rshas.Update
 	 msg="添加<font color=red>"&addlabel&"</font>成功！"
	 rshas.Close
 	Else
	  msg="<font color=red>对不起！操作失败！该标签名称(&nbsp;<font color=blue>"&addlabel&"</font>&nbsp;)已经存在！</font>修改名称请点击→<a href='#' onclick='javascript:history.back(-1);'>返回</a>" 
 	 rshas.Close
	End If
   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 checkcon()
  {
    var strn=document.myform.addclname.value;
    var strc=document.myform.addclcontent.value;
	if(strn.replace(/^\s+|\s+$/g,'')=="")
  {
   alert("请输入名称！");
   document.myform.addclname.focus();
   return false;
  }	
      var str=document.myform.addclname.value;
    if(/^\w+$/g.test(str)==false)
     {
	 alert("该标签名称无效！请输入正确的标签名称！标签中不能包含特殊符号！请使用字母数字下划线之类!请检查！");
	 return false;
	 }
    var sekind=document.myform.addlkind.value;
   if(sekind==0)
   {
   alert("对不起！当前无任何类别，请添加类别!");
   return false;
   }
    if(strc.replace(/^\s+|\s+$/g,'')=="")
  {
   alert("请输入内容！");
   document.myform.addclcontent.focus();
   return false;
  }
     }
     function checkl()
 {
    var str=document.myform.addclname.value;
  if(str.replace(/^\s+|\s+$/g,'')=="")
  {
  alert("请输入名称！");
  document.myform.addclname.focus();
  return false;
  }
    if(/^\w+$/g.test(str)==false)
     {
	 alert("该标签名称无效！请输入正确的标签名称！标签中不能包含特殊符号！请使用字母数字下划线之类!请检查！");
	 return false;
	 }
   str=str.replace("#","");
  str=str.replace(/\s+/igm,'');
    window.open('cuscheck.asp?str='+str,'','width=500,height=200');
  }
 </script>
 <style type="text/css">
a:link{
	color: #E30000;
}
a:visited{
	color: #E80000;
}
a:hover{}
a:active{}
.STYLE2 {	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>①本操作是主要用于网站页面头部的不同风格的显示而定的，主要用于登陆页面，搜索页面，注册页面等
    <br />②如果自定义标签名称与系统标签重复，则：自定义标签优先于系统标签<br /></font>
	
	</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="STYLE2">请输入要查询的自定义标签(全名)</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> 
	<th height="22" colspan="2"></th>
	</tr>
	<tr><td height="40" align="left"   bgcolor="#F4FBFF">&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 > 
<table border="0" cellpadding="0" cellspacing="0" align="center"><tr><td align="center"> <%=msg%></td></tr></table>
 <div id="addlabel"   >
<form name="myform" method="post" action="" onSubmit="return checkcon();">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="4" bgcolor="#F7F7F7">
 <tr><td  bgcolor="#F0F0F0" colspan="2"></td></tr>
  <tr>
 <td align="right">标签名称：</td><td>#WS_<input type="text" name="addclname" value="" maxlength="25"  onblur="this.value=this.value.replace(/\s/igm,'')"/>#&nbsp;&nbsp;<input type="button"  name="checklabel"  value="检查标签是否有效" style="background-color:#DFDFDF" onClick="checkl();"/>&nbsp;&nbsp;<input type="text" name="idatemodi" readonly value="<%=Now()%>" style="background-color:#F7F7F7; border:none 	" />   <br /> 
 </td>
  </tr><tr>
    <td align="right">
  所属类型：</td><td> 
  <select size="1" name="addlkind">
   <%
Set rsk=Server.CreateObject("ADODB.Recordset")
sqlk="select * from Websen_cuskind"
rsk.Open sqlk,conn,1,1
If rsk.Eof Then 
%>
<option value="0">请添加类别</option>
<%
End If 
If Not rsk.Eof Then 
Do While Not rsk.Eof
%>
<option value="<%=rsk("id")%>"><%=rsk("kindname")%></option>
<%
rsk.MoveNext
Loop
End If
 %>
  </select>
   </td></tr>
  <tr>
    <td align="right">
  简单描述：</td><td><input type="text" name="addcldes" value=""  style="width:300px" maxlength="60" />
  </td></tr>
  <tr><td  align="right">
 标签内容：</td><td><textarea rows="15" cols="87" name="addclcontent"></textarea>
 </td></tr>
 <tr><td align="center" colspan="2" height="40">
 <input type="submit"  name="addbtn"  value="我要添加" style="background-color:#DFDFDF"/>
 </td>
 </tr>
 <tr><td colspan="6" align="center"  > </td></tr>
</table>
</form>
</div>
 </td>
 </TR></table>
 </body>
</html>
