<%@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 Websen_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="#WS_"&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 Websen_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 Websen_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 Websen_cuspage "
	rse.Open esql,conn,1,3
	If Not rse.Eof Then 
	rse("labelid")=labelall
	rse.Update
	rse.Close
	msgd="修改成功！"
	End If
   End If
   
    '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
     
  '-修改动态页面的整体宽度----------------------------
   pwpw=Replace_Text(Request("pwpw"))
  gopw=Replace_Text(Request("gopw"))
  if pwpw<>"" then
  if not isnumeric(pwpw) then
  pwpw=778
  end if
  pwpw=cint(pwpw)
  conn.execute "update Websen_worldec_config set pagewidth="&pwpw&""
  msgs="修改成功!"
  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("该标签名称无效！请输入正确的标签名称！标签中不能包含特殊符号！请使用字母数字下划线之类！请检查！");
	 return false;
	 }
  var sekind=document.myforme.editlkind.value;
  if(sekind==0)
   {
   alert("对不起！当前无任何类别，请添加类别!");
    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("该标签名称无效！请输入正确的标签名称！标签中不能包含特殊符号！请使用字母数字下划线之类!请检查！");
	 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;
}
.STYLE4 {
	color: #333333;
	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 colspan="2"  height="20" ><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("请输入搜索的自定义标签名称！");
  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="1"  align="center" cellpadding="0" cellspacing="0" bordercolor="#AEC2EC" 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> 
                  <%
sealid=0
Set rsts=Server.CreateObject("ADODB.Recordset")
tssql="select labelid from Websen_cuspage where id=1"
rsts.Open tssql,conn,1,1
If Not rsts.Eof Then 
sealid=rsts("labelid")
rsts.Close
End If 
%>
 <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 Websen_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;&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,lkind from Websen_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")%>〗〓(类别:
		  <%
		  set  rslei=server.CreateObject("adodb.recordset")
		  sqllei="select  * from Websen_cuskind where id="&rssea("lkind")
		  rslei.open sqllei,conn,1,1
		  if not rslei.eof then
		  response.Write(rslei("kindname"))
		  rslei.close
		  end if
		  %>
		  
		  )</option>
          <%
rssea.MoveNext
Loop
rssea.Close
End If 

%>
        </select> 
&nbsp;
        <input type="submit" name="searbtn" value="修改选项"  style=" background-color:#E3E3E3"/><font color="red">&nbsp;<%=msgd%></font>              </td>
            </tr>
          </form>
        </table>
		<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0" >
		<form name="pwidth" method="post" action="cuslabel.asp">
		<tr><td align="left" bgcolor="#F1F3F5">
 <%
set rspe=server.CreateObject("adodb.recordset")
sqlpe="select top 1 pagewidth from Websen_worldec_config"
rspe.open sqlpe,conn,1,3
if not rspe.eof then
%>
 <strong>请修改动态页面的整体宽度</strong>(除头部外)：
 <input type="text" name="pwpw" value="<%=rspe("pagewidth")%>" style="background-color:#000000; color:#FFFFFF; font-weight:bold" size="5" maxlength="5" />
 px
 
 <input type="submit" name="gopw" value="修改" />
 <%
rspe.close
end if
 %><font color="red"><%=msgs%></font>
		</td>
		</tr>
		</form>
		</table>
		</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"  >添加自定义页面显示标签</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 > 
 <%
 If Replace_Text(Request("act"))="edit" Then
 Set rse=Server.CreateObject("ADODB.Recordset")
 sqle="select * from Websen_cuslabel where id="&Replace_Text(Request("id"))
 rse.Open sqle,conn,1,1
 If Not rse.Eof Then 
 %>
 <div id="editlabel"   >
<form name="myforme" method="post" action="" onSubmit="return checkcon();">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="4" bgcolor="#FCFCFC">
 <tr><td  bgcolor="#F0F0F0" colspan="2"></td></tr>
  <tr>
 <td align="right">标签名称：</td><td>#WS_<input type="text" name="editlname" value="<%=Replace(Replace(rse("lname"),"#WS_",""),"#","")%>" 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;<%=rse("lidate")%>  <br /> 
 </td>
  </tr><tr>
    <td align="right">
  所属类型：</td><td>  <select size="1" name="editlkind">
   <%
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")%>" <%If rse("lkind")=rsk("id") Then Response.Write("selected")   End If%>><%=rsk("kindname")%></option>
<%
rsk.MoveNext
Loop
rsk.Close
End If
 %>
  </select>
   </td></tr>
  <tr> <td colspan="2"></td></tr>
  <tr>
    <td align="right">
  简单描述：</td><td><input type="text" name="editldes" value="<%=rse("ldes")%>"  style="width:300px" maxlength="60" />
                     <input type="hidden" name="editid" value="<%=Request("id")%>" /></td>
  </tr>
  <tr><td  align="right">
 标签内容：</td><td>
  <div id=Mcontext style="position:absolute;height:200;border:1px solid #000000;visibility:hidden;background-color:#DFDFDF" onClick="Mselect()" onMouseOver="itemOver()" onMouseOut="itemOut()">
  <div id="#HOPE_NowKey#" class="mitem1">插入最近搜索关键字标签#HOPE_NowKey#</div>
  <div id="#HOPE_HotKeyW#" class="mitem1">动态热门关键字标签#HOPE_HotKeyW#</div>
  <div id="#HOPE_WebButtomGo#"  class="mitem1">底部站点导航标签#HOPE_WebButtomGo#</div>
  <div id="#HOPE_HelpOpinion#" class="mitem1">我有建议提交框标签#HOPE_HelpOpinion#</div>
  <div id="#HOPE_Announce#" class="mitem1">网站开关标签#HOPE_Announce#</div>
  <div id="#" class="mitem1" align="center"  >   取   消   </div>
 </div>
 <div  contentEditable id="editBox" style="width:500PX;height:200;border:1px solid #000000"  >
   <textarea rows="15" cols="87"   name="editlcon"><%=rse("lcontent")%></textarea>
 </div>
  </td></tr>
 <tr><td align="center" colspan="2" height="40">
 <input type="submit"  name="editbtn"  value="我要修改" style="background-color:#DFDFDF"/>
 </td>
 </tr>
 <tr><td colspan="6" align="center"  > </td></tr>
</table>
</form>
</div>
<%
 rse.Close
End If
End If
%>
 <div id="sdiv"  >
  <form name="myform" method="post" action="" onSubmit="return checkcon();">
  <table border="0" cellpadding="3" cellspacing="1" width="100%"  bgcolor="#F7F7F7">
  <%

  Set rs=Server.CreateObject("ADODB.Recordset")
  sqled="select * from Websen_cuslabel   order by lkind"
   rs.Open sqled,conn,1,1
  msg_per_page=15                   '定义每页显示记录条数
 	rs.Pagesize=msg_per_page '定义分页记录集每页显示记录数
 	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  
		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 Websen_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
%>
