<!-- #include file="conn.asp" -->
<!-- #include file="check.asp" -->

<% 
 '===========================================================================================
	'软件名称：126 cms 视频影视管理系统
	'程序版权：126电影               '咨询QQ：479025
	'开发作者：magicblack(479025)    '官方网站：http://www.126oo.com/
	'Copyright (C) 2009 - ... 126oo.com  All Rights Reserved.
	'郑重声明:
	'    1、免费版本请在程序首页保留版权信息，并做上本站LOGO友情连接,商业版本无此要求;
	'    2、任何个人或组织不得以盈利为目的发布,修改,本软件及其他副本上一切关于版权的信息；
	'    3、126电影保留此软件的法律追究权利；
'==========================================================================================
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>自定义标签管理 - 后台管理中心 - 126电影程序CMS</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="images/css_body.css" type=text/css rel=stylesheet>
</HEAD>
<BODY>
<DIV class=bodytitle>
<DIV class=bodytitleleft></DIV>
<DIV class=bodytitletxt>自定义标签管理</DIV>
<DIV class=bodytitletxt2><a href="admin_dimlabels.asp?action=add">添加自定义标签</a></DIV>
</DIV>

<%
response.Charset="GBK"
dim action
action = SafeData("RQ","action",0)

Select case action
	case "add" : add
	case "addsave" : addsave
	case "edit" : edit
	case "editsave" : editsave
	case "del" : del
	case "delall" : delAll
	case else : main
End Select

sub addsave()
Dim L_Name : L_Name = SafeData("RF","L_Name",0)
Dim L_Code : L_Code = SafeData("RF","L_Code",0)
Dim L_Remarks : L_Remarks = SafeData("RF","L_Remarks",0)

'L_Code = HtmlEncode(L_Code)

Dim result : result = DataBase.AddRecord("Tbl_Label",Array("L_Name:"&L_Name, "L_Code:"&L_Code, "L_Remarks:"&L_Remarks)) 

If result<>0 Then  
    ShowMsg "添加自定义标签成功！"  ,"admin_dimlabels.asp" 
End If
end sub

sub editsave()
Dim L_ID : L_ID = SafeData("RF","L_ID",0)
Dim L_Name : L_Name = SafeData("RF","L_Name",0)
Dim L_Code : L_Code = SafeData("RF","L_Code",0)
Dim L_Remarks : L_Remarks = SafeData("RF","L_Remarks",0)

'L_Code = HtmlEncode(L_Code)

Dim result : result = DataBase.UpdateRecord("Tbl_Label","L_ID = "& L_ID ,Array("L_Name:"&L_Name, "L_Remarks:"&L_Remarks,"L_Code:"&L_Code))  

If result<>0 Then  
    ShowMsg "修改自定义标签成功！"  ,"admin_dimlabels.asp" 
End If
end sub

sub del()
	Dim L_ID : L_ID = SafeData("RQ","L_ID",0)

	Dim result : result = Database.DeleteRecord("Tbl_Label", "L_ID:" & L_ID)
	
	If result<>0 Then  
    	ShowMsg "删除记录成功!" ,"admin_dimlabels.asp"  
	End If  
end sub

sub main()
Dim rs : Set rs = DataBase.GetPageRecord(0,Array("Tbl_Label:L_ID,L_Name,L_Code,L_Remarks","","L_ID Asc","L_ID")) 

Dim Page
 Page = DataBase.GetPager ("")
 %>
<TABLE width="96%" border=0 align=center cellpadding="5" cellSpacing=1 class=tbtitle style="BACKGROUND: #cad9ea;">
  <TBODY>
    <TR bgColor="#f5fafe">
      <TD align="center"  width="15%">自定义标签名称</TD>
      <TD align="center">自定义标签调用代码</TD>
       <TD align="center">自定义标签描述</TD>
      <TD width="15%" align="center">操作</TD>
    </TR>
	<%do while not rs.eof%>
    <TR bgcolor="#FFFFFF">
      <TD align="center"><%=rs("L_Name")%></TD>
      <TD align="center">
	  <input id="text<%=rs("L_ID")%>" name="text<%=rs("L_ID")%>" type="text" value='{DimLabels:<%=rs("L_Name")%>}' size="50"> 
	  <INPUT class=inputbut type=button value=复制 name=Submit onClick='document.getElementById("text<%=rs("L_ID")%>").select();document.getElementById("text<%=rs("L_ID")%>").createTextRange().execCommand("Copy");alert("复制成功");'>
	  </TD>
      <TD align="center"><%=rs("L_Remarks")%></TD>
      <TD align="center"><A href="admin_dimlabels.asp?action=edit&L_id=<%=rs("L_ID")%>">修改</a> | <A href="admin_dimlabels.asp?action=del&L_id=<%=rs("L_ID")%>" onClick="return confirm('确定要删除吗?');">删除</a></TD>
    </TR>
	<%rs.MoveNext
	loop%>
	<TR align="center" bgcolor="#f8fbfb">
      <TD colspan="6"><%=Page%></TD>
    </TR>
  </TBODY>
</TABLE>
<%
Database.C(rs)
end sub

sub add()%>
<TABLE width="96%" border=0 align=center cellpadding="4" cellSpacing=1 class=tbtitle style="BACKGROUND: #cad9ea;">
<form action="?action=addsave" method="post">
  <TBODY>
    <TR>
      <TD vAlign=center width="20%" bgColor=#f5fafe>自定义标签名称：</TD>
      <TD bgColor=#ffffff><INPUT id="L_Name" size=50 value="" name="L_Name" dataType="Require" msg="请填写自定义标签名称"></TD>
    </TR>
    <TR>
      <TD vAlign=center width="20%" bgColor=#f5fafe>自定义标签描述：</TD>
      <TD bgColor=#ffffff><INPUT id="L_Remarks" size=50 value="" name="L_Remarks" dataType="Require" msg="请填写自定义标签文件名"></TD>
    </TR>
    <TR>
      <TD bgColor=#f5fafe>自定义标签内容：</TD>
      <TD bgColor=#ffffff><textarea id="L_Code" name="L_Code" style="width:100%;" rows="20" dataType="Require" msg="请填写自定义标签内容"></textarea></TD>
    </TR>
    <TR align="center" bgcolor="#f8fbfb">
      <TD colspan="2"><INPUT class=inputbut type=submit value=添加 name=Submit>
      &nbsp;</TD>
    </TR>
  </TBODY>
  </form>
</TABLE>
<%
end sub

sub edit()
Dim L_ID : L_ID = SafeData("RQ","L_ID",0)
Dim rs : Set rs = Database.GetRecordDetail("Tbl_Label","L_ID=" & L_ID)  

if rs.eof then ShowMsg "找不到此ID的自定义标签!","admin_dimlabels.asp"

%>
<TABLE width="96%" border=0 align=center cellpadding="4" cellSpacing=1 class=tbtitle style="BACKGROUND: #cad9ea;">
<form action="?action=editsave" method="post" onSubmit="return Validator.Validate(this,3)">
<input name="L_ID" type="hidden" value="<%=rs("L_ID")%>">
  <TBODY>
    <TR>
      <TD vAlign=center width="20%" bgColor=#f5fafe>自定义标签名称：</TD>
      <TD bgColor=#ffffff><INPUT id="L_Name" size=50 value="<%=rs("L_Name")%>" name="L_Name" dataType="Require" msg="请填写自定义标签名称"></TD>
    </TR>
    <TR>
      <TD vAlign=center width="20%" bgColor=#f5fafe>自定义标签描述：</TD>
      <TD bgColor=#ffffff><INPUT id="L_Remarks" size=50 value="<%=rs("L_Remarks")%>" name="L_Remarks" dataType="Require" msg="请填写自定义标签文件名"></TD>
    </TR>
    <TR>
      <TD bgColor=#f5fafe>自定义标签内容：</TD>
      <TD bgColor=#ffffff><textarea id="L_Code" name="L_Code" style="width:100%;" rows="20" dataType="Require" msg="请填写自定义标签内容"><%=HtmlDecode(rs("L_Code"))%></textarea></TD>
    </TR>
    <TR align="center" bgcolor="#f8fbfb">
      <TD colspan="2"><INPUT class=inputbut type=submit value=修改 name=Submit>
      &nbsp;</TD>
    </TR>
  </TBODY>
  </form>
</TABLE>

<%
Database.C(rs)
end sub
%>
</BODY>
</HTML>
