<%@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"-->

<%
 
  '删除^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 act=Replace_Text(Request("act"))
 id=Replace_Text(Request("id"))
  If act="del" Then 
   conn.execute "delete from yixiang_cuslabel where id="&id
    msg=" <font color=red><b>删除成功</b></font>！"
  End If
 '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   
 
 
  '^修改 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   
  editid=Replace_Text(Request("editid"))
  editbtn=Replace_Text(Request("editbtn"))
  editlname=Replace_Text(Request("editlname"))
  editlkind=Replace_Text(Request("editlkind"))
  editldes=Replace_Text(Request("editldes"))
  editlcon= Request("editlcon")
  If editbtn<>"" Then
   If editlname="" Then
    Response.Write("<script>alert('请输入名称!');history.back(-1);</script>")
    Response.End()
    End If
    editlname="#YX_"&editlname&"#"
 	If editlkind=0 Then
    Response.Write("<script>alert('请选择添加所属种类!');history.back(-1);</script>")
    Response.End()
    End If
    If editlcon="" Then
    Response.Write("<script>alert('请输入内容！');history.back(-1);</script>")
    Response.End()
    End If
  	Set rsal=Server.CreateObject("ADODB.Recordset")
	sqlal="select * from yixiang_cuslabel where lname='"&editlname&"' and id<>"&editid
	rsal.Open sqlal,conn,1,3
	If Not rsal.Eof Then 
	Response.Write("<script>alert('该标签名已经存在！');history.back(-1);</script>")
    Response.End()	
	Else
  Set rsedit=Server.CreateObject("ADODB.Recordset")
  sqledit="select * from yixiang_cuslabel where id="&editid
  rsedit.Open sqledit,conn,1,3
  If Not rsedit.Eof Then
   datemodi=Now()
   rsedit("lname")=editlname
   rsedit("ldes")=editldes
   rsedit("lcontent")=editlcon
   rsedit("lkind")=editlkind
   rsedit("lidate")=datemodi
   rsedit.Update
   rsedit.Close
    Response.Redirect("cuslabel.asp?msg=修改成功！")
    End If 
   End If
  rsal.Close
  End If
  
    '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   
 
 
   
   '修改搜索页面的头部自定义标签^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
   searbtn=Replace_Text(Request("searbtn"))
   labelall=Replace_Text(Request("labelall"))
   If searbtn<>"" Then 
    If labelall=0 Then
	Response.Write("<script>alert('无任何可供选择的标签，请添加自定义标签！');history.back(-1);</script>")
	Response.End()
	End If
	Set rse=Server.CreateObject("ADODB.Recordset")
	esql="select * from yixiang_cuspage where id=1"
	rse.Open esql,conn,1,3
	If Not rse.Eof Then 
	rse("labelid")=labelall
	rse.Update
	rse.Close
	End If
   End If
   
    '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
   '修改注册页面的头部自定义标签^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
   cebtn=Replace_Text(Request("cebtn"))
   labelallc=Replace_Text(Request("labelallc"))
     If cebtn<>"" Then 
    If labelallc=0 Then
	Response.Write("<script>alert('无任何可供选择的标签，请添加自定义标签！');history.back(-1);</script>")
	Response.End()
	End If
	Set rsec=Server.CreateObject("ADODB.Recordset")
	esqlc="select * from yixiang_cuspage where id=2"
	rsec.Open esqlc,conn,1,3
	If Not rsec.Eof Then 
	rsec("labelid")=labelallc
	rsec.Update
	rsec.Close
	End If
   End If
   
    '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
   '修改登陆页面的头部自定义标签^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
   cebtn3=Replace_Text(Request("cebtn3"))
   labelallc3=Replace_Text(Request("labelallc3"))
   If cebtn3<>"" Then 
    If labelallc3=0 Then
	Response.Write("<script>alert('无任何可供选择的标签，请添加自定义标签！');history.back(-1);</script>")
	Response.End()
	End If
	Set rsec3=Server.CreateObject("ADODB.Recordset")
	esqlc3="select * from yixiang_cuspage where id=3"
	rsec3.Open esqlc3,conn,1,3
	If Not rsec3.Eof Then 
	rsec3("labelid")=labelallc3
	rsec3.Update
	rsec3.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 isdel()
 {
 var i=confirm("你确定要删除吗?一旦删除后，调用它的页面将出错！请慎重操作！");
 if(i)
 {
 return true ;
 }
 else
 {
 return false;
 }
 }
</script>
 <script language="javascript">
  function checkcon()
  {
    var strn=document.myforme.editlname.value;
    var strc=document.myforme.editlcon.value;
	if(strn.replace(/^\s+|\s+$/g,'')=="")
  {
   alert("请输入名称！");
   document.myforme.editlname.focus();
   return false;
  }	
  var str=document.myforme.editlname.value;
    if(/^\w+$/g.test(str)==false)
     {
	 alert("该Tag Name无效！请输入正确的Tag Name！标签中不能包含特殊符号！请使用字母数字下划线之类！请检查！");
	 return false;
	 }
  var sekind=document.myforme.editlkind.value;
  if(sekind==0)
   {
   alert("对不起！当前无任何类别，Add type!");
    return false;
   }
  if(strc.replace(/^\s+|\s+$/g,'')=="")
  {
   alert("请输入内容！");
   document.myforme.editlcon.focus();
   return false;
  }
     }
   function checkl()
  {
   var str=document.myforme.editlname.value;
   var edi=document.myforme.editid.value;
  if(str.replace(/^\s+|\s+$/g,'')=="")
   {
  alert("请输入名称！");
  document.myforme.editlname.focus();
  return false;
  }
    if(/^\w+$/g.test(str)==false)
     {
	 alert("该Tag Name无效！请输入正确的Tag Name！标签中不能包含特殊符号！请使用字母数字下划线之类!请检查！");
	 return false;
	 }
   str=str.replace("#","");
   str=str.replace(/\s+/igm,'');
   str=str+"|"+edi;
   str=str.replace("#","");
    window.open('cuscheckedit.asp?str='+str,'','width=500,height=200');
  }
  function changevalue()
  {
  var str=document.searform.sclabel;
  var strcv=document.searform.labelall.options[document.searform.labelall.selectedIndex].text;
  var i=strcv.indexOf("--");
  str.value=strcv.substring(0,i);
   } 
   
  function changevaluec()
  {
  var strc=document.ceform.sclabelc;
  var strcvc=document.ceform.labelallc.options[document.ceform.labelallc.selectedIndex].text;
  var i=strcvc.indexOf("--");
  strc.value=strcvc.substring(0,i);
   } 
  function changevaluec3()
  {
  var strc3=document.ceform3.sclabelc3;
  var strcvc3=document.ceform3.labelallc3.options[document.ceform3.labelallc3.selectedIndex].text;
  var i=strcvc3.indexOf("--");
  strc3.value=strcvc3.substring(0,i);
   }
   function isok()
   {
    var i=confirm("你确定要修改吗？请仔细确认该项标签的内容后才修改，以防造成调用页面的版面混乱!");
	if(i)
	{
	return true ;
	}
	else
	{
	return false;
	}
   }
  </script>
<script language="javascript">

function showContextMenu(){
	with(Mcontext) {
	style.pixelLeft=event.x;
	style.pixelTop=event.y;
	style.visibility="visible";
	}
	Mcontext.setCapture();
}
 </script>

 <style type="text/css">
   a:link{
	color: #E30000;
}
a:visited{
	color: #E80000;
}
a:hover{}
a:active{}
 
.STYLE1 {
	color: red;
	font-weight: bold;
}
 .STYLE2 {
	color: #0099CC;
	font-weight: bold;
}
 .STYLE5 {	font-size: 16px;
	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 height="20" colspan="2" ><font color="#333333"> <B>温馨提示</B>：①本操作是可用于网站页面头部的不同风格的显示而定的，主要用于登陆页面，搜索页面，注册页面等
	 </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("请输入搜索的自定义Tag Name！");
  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">(如：#YX_gdtop#)</font></td>
	  </tr></form></table>
	 </td> 
  </tr>  
 </table>
<table width="98%" border="0" cellspacing="0" cellpadding="0"  align="center" class="tableBorder" style="margin-top:8px; ">
  <tr>
    <td height="20" colspan="2" bgcolor="#AEC2EC" class="tableHeaderText STYLE4">动态文件页面头部风格统一管理:</td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#CCFFFF" class="forumRowHighlight"><table width="100%%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0"  style="line-height:20px; ">
          <form action="cuslabel.asp" method="post" name="searform" id="searform" onSubmit="return isok();">
            <tr>
              <td>&nbsp;
                  <%
sealid=0
Set rsts=Server.CreateObject("ADODB.Recordset")
tssql="select labelid from yixiang_cuspage where id=1"
rsts.Open tssql,conn,1,1
If Not rsts.Eof Then 
sealid=rsts("labelid")
rsts.Close
End If 
%>
&nbsp;&nbsp;<b></b><span class="STYLE1">网站普通页面风格统一头部界面</span>的<a href="cuslabel.asp?act=edit&amp;id=<%=sealid%>">头部标签</a>为<span class="STYLE5">↓</span><font color="#666666">(请一定要指定,否则将影响整个网站风格的协调)</font><br />
&nbsp;<span class="STYLE1">请选择</span>
        <input   type="text" name="sclabel"   style="width:220px; background-color:#D7D7D7 "   value="<%
 Set rsvalue=Server.CreateObject("ADODB.Recordset")
sqlvalue="select lname from yixiang_cuslabel where id="&sealid
rsvalue.Open sqlvalue,conn,1,1
If rsvalue.Eof Then
 %>
请选合适的标签为为普通页面头部标签显示!
 <%
 End If 
If Not rsvalue.Eof Then 
%>
<%=rsvalue("lname")%>
<%
rsvalue.Close
End IF
%>"   readonly  /><br />&nbsp;&nbsp;&nbsp;
&nbsp;<font color="red">→</font>
        <select size="1" name="labelall" onChange="changevalue();">
          <%
Set rssea=Server.CreateObject("ADODB.Recordset")
seasql="select id,lname,ldes from yixiang_cuslabel"
rssea.Open seasql,conn,1,1
If rssea.Eof Then 
%>
          <option value="0"></option>
          <%
End If 
If Not rssea.Eof Then 
Do While Not rssea.Eof 
%>
          <option value="<%=rssea("id")%>" <%If rssea("id")=sealid Then Response.Write("selected") End If%>><%=rssea("lname")%>--〖描述:<%=rssea("ldes")%>〗</option>
          <%
rssea.MoveNext
Loop
rssea.Close
End If 

%>
        </select>
&nbsp;
        <input type="submit" name="searbtn" value="修改选项"  style=" background-color:#E3E3E3"/>              </td>
            </tr>
          </form>
        </table></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
<!--页面控制（搜索页，注册页，登陆页）的头部显示标签-->
 <!---------------------------------------------------->
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="tableBorder"  >
 	<tr><td height="40" align="left"   bgcolor="#F4FBFF">&nbsp;&nbsp;<a href="addcuslabel.asp"  >Add Custom Tag</a>&nbsp;&nbsp;<a href="cuslabel.asp" >自定义标签管理</a>&nbsp;&nbsp;<a href="cuskind.asp">Custom Type Tag Management </a></td></tr><tr><td align="center"><font color="red"><b><%=Request("msg")%></b></font></td></tr> 
<TR> <td > 
  
 <div id="sdiv"  >
  <form name="myform" method="post" action="" onSubmit="return checkcon();">
  <table border="0" cellpadding="3" cellspacing="1" width="100%"  bgcolor="#F7F7F7">
  <%
  seago=Replace_Text(request("seago"))
  seark=Replace_Text(request("seark"))
  Set rs=Server.CreateObject("ADODB.Recordset")
  sqled="select * from yixiang_cuslabel where lname like '%"&seark&"%'  order by lkind"
   rs.Open sqled,conn,1,1
  msg_per_page=15                   '定义每页显示记录条数
 	rs.Pagesize=msg_per_page '定义分页记录集每页显示记录数
	If rs.eof then 
	 response.Write("<center>没有你要查询的自定义标签<font color=red>"&request("seark")&"</font>信息！</center>")
	 response.End()
	end if
 	If Not (rs.Eof And rs.Bof) Then
		totalrec=rs.RecordCount'总记录条数
		If rs.Recordcount Mod msg_per_page=0 Then'计算总页数,recordcount:数据的总记录数
			n=rs.Recordcount\msg_per_page'n:总页数
		Else
			n=rs.Recordcount\msg_per_page+1                        
		End If                                                                
		currentpage=Request("page")'currentpage:当前页
		If currentpage <> "" Then
			currentpage = Cint(currentpage)
			If currentpage < 1 Then  
				currentpage = 1
			End If  
			If Err.Number <> 0 Then '错误处理
				Err.Clear
				currentpage=1
			End If
		Else
			currentpage=1
		End If                                                                
		If currentpage*msg_per_page > totalrec And Not((currentpage-1)*msg_per_page < totalrec) Then 
			currentPage=1
		End If
		rs.Absolutepage=currentpage'absolutepage：设置指针指向某页开头
		rowcount=rs.Pagesize'pagesize：设置每一页的数据记录数
	End If
   If Not rs.Eof Then 
   li=1
  Do While Not rs.Eof  And rowcount > 0
  If li Mod 2=0 Then 
  icolor="#F1F3F5"
  Else
  icolor="#ffffff"
  End If 
  %>
  <tr bgcolor=<%=icolor%>><td><font  color="#6E92DB"><%=li%></font>.
  <%=rs("lname")%></td><td>〖<font  color="#999999">类别:</font>
 <%
  Set rskk=Server.CreateObject("ADODB.Recordset")
  sqlkk="select  * from yixiang_cuskind where id="&rs("lkind")
  rskk.Open sqlkk,conn,1,1
  If Not rskk.Eof Then 
  %>
  <a href="cuskind.asp?act=showof&id=<%=rs("lkind")%>&kn=<%=rskk("kindname")%>"><font color="#0099CC"><%=rskk("kindname")%></font></a>
  <%
  End If 
   %>
  〗<br />〖<font  color="#999999">描述:</font><font color="#666666"><%=rs("ldes")%></font>〗</td><td>〖<a href="cuslabel.asp?act=edit&id=<%=rs("id")%>"  >修改</a>〗</td><td>〖<a href="cuslabel.asp?act=del&id=<%=rs("id")%>" onClick="return isdel();">删除</a>〗</td></tr>
   <%
    li=li+1
    rowcount=rowcount-1
   rs.MoveNext
  Loop
   End If 
   %>
   <tr><td colspan="5" align="center"><%=listPages("cuslabel.asp")%></td></tr>
  </table>
 </form>
 </div>
  </td>
 </TR></table>
 </body>
</html>
<%
rs.Close
%>
