<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--#include file="inc/Page_cls.asp"-->
<!--#include file="../include/config.inc"-->
<%
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 Admin_cslist.asp
'* 最后更新 2012-08-10 by 56770.kingdge
'*****************************************
Dim admin_flag
admin_flag=",3.9,"
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_keyword.inc"
CurrentId = 1
CurrentUrl = "admin_cslist.asp"
LB_Head()
LB_Menu()
action = request("action")
%>
<div class="tabmenu mainwidth">
      <ul>
        <li <%If action <> "add" And action <> "updatenum" Then Response.Write("class=""current""") End If%>><a href="Admin_cslist.asp"><span><%=Lang_Menu(85)%></span></a></li>
        <li <%If action = "add" Then Response.Write("class=""current""") End If%>><a href="?action=add"><span><%=Lang_Menu(84)%></span></a></li>
      </ul>
</div>
<%
Response.Write("<div class=""tab-mainbody"">")
Response.Write("<div class=""tab-mainbody2"">")
If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
		adminflag()
Else
		If OutSubmit = 1 Then CheckOutSubmit()
		Select Case Request("action")
			   Case "add" : add()
			   Case "add_ok" : add_ok()
			   Case "edit" : edit()
			   Case "edit_ok" : edit_ok()
			   Case "update" : update()
			   Case "del" : del()
			   Case Else
					list()
		End Select
End If
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()

sub add_ok()
		If OnlyRead = 1 Then OnlyReadMessage()
        gjc = safereplace(request("gjc"))
		s_type = safereplace(request("s_type"))
		s_url = safereplace(request("s_url"))
		cs = CheckNum(request("cs"),1)
        If gjc = "" Then
		        Is_error = 1
				mes = mes &"·"& Lang_Keyword(1) &"<br />"
		End If
        set rs=server.createobject("ADODB.Recordset")
        sql="select * from [search] where gjc='"&gjc&"'"
        rs.open sql, conn, 1, 3
        if not(rs.eof or rs.bof)then
		        Is_error = 1
				mes = mes &"·"& Lang_Keyword(2) &"<br />"
		Else
		        rs.addnew
				For LangT = 1 To TotalLang
						rs("gjc" & LanguageTxt(LangT)) = trim(safereplace(request("gjc" & LanguageTxt(LangT))))
				Next
				rs("s_type") = s_type
				rs("s_url") = s_url
				rs("cs") = cs
				rs.update
		End If
        rs.close:set rs=nothing
		If is_error = 1 Then
		        m_t=Lang_sys(45)
		        m_s=mes
		        m_u="javascript:history.back()"
				m_u1="?action=gjcadd"
		        m_time="2"
		        Call Up_mes(m_t,m_s,0,m_u,m_u1,0,m_time,0)
		End If
		If Config_Lebi_Eshop(17)="1" Then
				Application.Contents.RemoveAll
		Else
				NewEvent "0"
		End If
		ManageLog Lang_Keyword(3) &" ["&gjc&"]"
		m_t=Lang_sys(45)
		m_s="·"& Lang_sys(44)
		m_u="?"
		m_time="2"
		Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,1)
end sub

sub edit_ok()
		If OnlyRead = 1 Then OnlyReadMessage()
        id = CheckNum(request("id"),0)
        gjc = safereplace(request("gjc"))
		s_type = safereplace(request("s_type"))
		s_url = safereplace(request("s_url"))
		cs = CheckNum(request("cs"),1)
        set rs=server.createobject("ADODB.Recordset")
        sql="select * from [search] where id="&id
        rs.open sql, conn, 1, 3
        if not(rs.eof or rs.bof)then
				For LangT = 1 To TotalLang
						rs("gjc" & LanguageTxt(LangT)) = trim(safereplace(request("gjc" & LanguageTxt(LangT))))
				Next
				rs("s_type") = s_type
				rs("s_url") = s_url
				rs("cs") = cs
				rs.update
		End If
        rs.close:set rs=nothing
		If Config_Lebi_Eshop(17)="1" Then
				Application.Contents.RemoveAll
		Else
				NewEvent "0"
		End If
		ManageLog Lang_Keyword(4) &" ["&gjc&"]"
		m_t=Lang_sys(48)
		m_s="·"& Lang_sys(47)
		m_u="?keywords="& request("keywords") &"&page="& request("page")
		m_time="2"
		Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,1)
end Sub

sub update()
        If OnlyRead = 1 Then OnlyReadMessage()
        id = Replace(Safereplace(request("item_id"))," ","")
		s_type = safereplace(request("s_type"))
		s_url = safereplace(request("s_url"))
		cs = safereplace(request("cs"))
        if id = "" then
                response.write"<SCRIPT language=JavaScript>alert('"& Lang_Keyword(5) &"');javascript:history.back();</SCRIPT>"
                response.end
        end If
		If UBound(Split(id,",")) = 0 Then
		        conn.execute("update [search] Set s_type = "& Trim(s_type) &",s_url = '"& Trim(s_url) &"',cs = "& cs &" where id = "& id &"")
		Else
		        For gjc_num = 0 To UBound(Split(id,","))
		                conn.execute("update [search] Set s_type = "& Trim(Split(s_type,",")(gjc_num)) &",s_url = '"& Trim(Split(s_url,",")(gjc_num)) &"',cs = "& Split(cs,",")(gjc_num) &" where id = "& Split(id,",")(gjc_num) &"")
                Next
		End If
		If Config_Lebi_Eshop(17)="1" Then
				Application.Contents.RemoveAll
		Else
				NewEvent "0"
		End If
		ManageLog Lang_Keyword(6) & " ["& id &"]"
		m_t=Lang_sys(69)
		m_s="·"& Lang_sys(68)
	    m_u="?keyword="& request("keyword") &"&s_type="& request("l_type") &"&lang="& request("lang") &"&pagenum="& request("pagenum") &"&page="& request("page")
		m_time="2"
		Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,1)
end Sub

Sub del()
        If OnlyRead = 1 Then OnlyReadMessage()
        del_id= Replace(safereplace(Trim(request("id"))),"，",",")
		If Right(del_id,1) = "," Then del_id = Left(del_id,Len(del_id)-1)
        if del_id="" then
                response.write"<SCRIPT language=JavaScript>alert('"& Lang_sys(41) &"');javascript:history.go(-1)</SCRIPT>"
                response.end
        end if
        conn.execute "delete from [search] where id in("&del_id&")"
		If Config_Lebi_Eshop(17)="1" Then
				Application.Contents.RemoveAll
		Else
				NewEvent "0"
		End If
		ManageLog Lang_Keyword(7) &" ["& del_id &"]"
	    m_t=Lang_sys(43)
	    m_s="·"& Lang_sys(42)
	    m_u="?keyword="& request("keyword") &"&s_type="& request("l_type") &"&lang="& request("lang") &"&pagenum="& request("pagenum") &"&page="& request("page")
	    m_time="2"
	    Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,1)
End Sub

sub add()
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable">
<form name="add" method="post" action="?">
<tr class="classrow">
	<td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"><input type="hidden" name="action" value="add_ok"></td>
	<td class="classhead" align="right">
	<%=QuickMenu("","")%>
	</td>
 </tr>
<tr>
   <td class="classtop" colspan="2" height="30"><%=Lang_Keyword(8)%></td></tr>
<tr>
<td class="classbg" colspan="2">
<ul id="tablist">
   <%For LangT = 1 To TotalLang%>
   <li<%If LangT = 1 Then response.write(" class=""selected""") End If%>><a rel="tcontent<%= LangT %>" style="CURSOR:hand;"><%= LanguageName(LangT) %></a></li>
   <%Next%>
</ul>
<div id="tabcontentcontainer">
<%For LangT = 1 To TotalLang%>
   <div id="tcontent<%= LangT %>" class="tabcontent">
   <table cellspacing="0" cellpadding="4" width="100%" border="0" id="classtable_<%= LangT %>">
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Keyword(9)%></td>
<td width="85%" class="classrow">
<input type="text" name="gjc<%= LanguageTxt(LangT) %>" size="20" class="form">
</td>
</tr>
	</table>
	</div>
	<script>tdshow("classtable_<%= LangT %>");</script>
<%Next%>
</div>
<script>showtabcontent("tablist")</script>
<ul id="tablistmain">
   <li class="selected"><a rel=""><%=Lang_sys(66)%></a></li>
</ul>
<div id="tabcontentcontainer">
<table cellspacing="0" cellpadding="4" width="100%" border="0" id="classtable">
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Keyword(10)%></td>
<td width="85%" class="classrow">
<input type="radio" name="s_type" value="0" onclick="UType(1)" checked><%=Lang_Keyword(11)%>
<input type="radio" name="s_type" value="1" onclick="UType(0)"><%=Lang_Keyword(12)%>
</td>
</tr>
<tr class="classrow">
<td height="30" class="classrow"><%=Lang_Keyword(13)%></td>
<td class="classrow">
<input type="text" id="s_url" name="s_url" size="40" value="http://" class="form" disabled>
</td>
</tr>
<tr class="classrow">
<td height="30" class="classrow"><%=Lang_Keyword(14)%></td>
<td class="classrow">
<input type="text" name="cs" size="5" value="1" class="form">
</td>
</tr>
</table>
</div>
<script>tdshow("classtable");</script>
</td>
</tr>
<tr class="classfooter">
  <td height="30" colspan="2" align="left" class="classfooter"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
 </tr>
</form>
</table>
<SCRIPT LANGUAGE="JavaScript">
function UType(n){
    var s_url = document.getElementById("s_url");
	if (n==0&&s_url.disabled==true){
		s_url.disabled = false;
	}
	else{
		s_url.disabled=true;
	}
}
</script>
<%
end sub

sub edit()
id = CheckNum(request("id"),0)
Set rs = conn.execute("select * from [search] where id = "& id &"")
If Not rs.eof Then
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable">
<form name="add" method="post" action="?">
<tr class="classrow">
	<td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"><input type="hidden" name="id" value="<%= id %>"><input type="hidden" name="action" value="edit_ok"></td>
	<td class="classhead" align="right">
	<%=QuickMenu("","")%>
	</td>
 </tr>
<tr>
   <td class="classtop" colspan="2" height="30"><%=Lang_Keyword(15)%></td></tr>
<tr>
<td class="classbg" colspan="2">
<ul id="tablist">
   <%For LangT = 1 To TotalLang%>
   <li<%If LangT = 1 Then response.write(" class=""selected""") End If%>><a rel="tcontent<%= LangT %>" style="CURSOR:hand;"><%= LanguageName(LangT) %></a></li>
   <%Next%>
</ul>
<div id="tabcontentcontainer">
<%For LangT = 1 To TotalLang%>
   <div id="tcontent<%= LangT %>" class="tabcontent">
   <table cellspacing="0" cellpadding="4" width="100%" border="0" id="classtable_<%= LangT %>">
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Keyword(9)%></td>
<td width="85%" class="classrow">
<input type="text" name="gjc<%= LanguageTxt(LangT) %>" value="<%= rs("gjc"& LanguageTxt(LangT)) %>" size="20" class="form">
</td>
</tr>
	</table>
	</div>
	<script>tdshow("classtable_<%= LangT %>");</script>
<%Next%>
</div>
<script>showtabcontent("tablist")</script>
<ul id="tablistmain">
   <li class="selected"><a rel=""><%=Lang_sys(66)%></a></li>
</ul>
<div id="tabcontentcontainer">
<table cellspacing="0" cellpadding="4" width="100%" border="0" id="classtable">
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Keyword(10)%></td>
<td width="85%" class="classrow">
<input type="radio" name="s_type" value="0" onclick="UType(1)" <%if rs("s_type")="0" then response.write("checked") End If%>><%=Lang_Keyword(11)%>
<input type="radio" name="s_type" value="1" onclick="UType(0)" <%if rs("s_type")="1" then response.write("checked") End If%>><%=Lang_Keyword(12)%>
</td>
</tr>
<tr class="classrow">
<td height="30" class="classrow"><%=Lang_Keyword(13)%></td>
<td class="classrow">
<input type="text" id="s_url" name="s_url" size="40" value="<%= rs("s_url") %>" class="form" <%if rs("s_type")="0" then response.write("disabled") End If%>>
</td>
</tr>
<tr class="classrow">
<td height="30" class="classrow"><%=Lang_Keyword(14)%></td>
<td class="classrow">
<input type="text" name="cs" size="5" value="<%= rs("cs") %>" class="form">
</td>
</tr>
</table>
</div>
<script>tdshow("classtable");</script>
</td>
</tr>
<tr class="classfooter">
  <td height="30" colspan="2" align="left" class="classfooter">
  <input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
 </tr>
</form>
</table>
<SCRIPT LANGUAGE="JavaScript">
function UType(n){
	if (n==0&&add.s_url.disabled==true){
		add.s_url.disabled = false;
	}
	else{
		add.s_url.disabled=true;
	}
}
</script>
<%
End If
rs.close : Set rs = Nothing
end Sub

sub list()
		lang = safereplace(request("lang"))
		If lang = "" Then lang = LanguageTxt(0)
		page = CheckNum(request("page"),1)
		pagenum = CheckNum(request("pagenum"),15)
		s_type = safeReplace(request("s_type"))
		keyword = safereplace(Trim(request("keyword")))
		Dim ors
		Set ors=new Cls_vbsPage
		Set ors.Conn=conn
		With ors
		.PageSize=pagenum
		.PageName="Page"
		If IsSqlDataBase = 0 Then
				.DbType="AC"
		Else
				.DbType="MSSQL"
		End If
		.RecType=0
		.Pkey="id"
		.Field="id,gjc"& lang &",s_type,s_url,cs"
		.Table="[search]"
		sql = "1=1"
		If keyword <> "" Then sql = sql &" and (gjc"& lang &" like '%"& keyword &"%' or s_url like '%"& keyword &"%')"
		If s_type<>"" Then sql=sql&" and s_type="& CLng(s_type)
		.Condition=sql
		.OrderBy="cs desc"
		End With
		DataCount=ors.RecCount()
		DataList=ors.ResultSet()
%>
<script>
function todel()
{

   var i = 0;
   var chkArr = document.getElementsByTagName("input");
   var page = document.getElementById("page").value;
   var Lang = document.getElementById("Lang").value;
   var l_type = document.getElementById("l_type").value;
   var keyword = document.getElementById("keyword").value;
   var pagenum = document.getElementById("pagenum").value;
   var param = "";
   for (i=0;i<chkArr.length;i++)
   if (chkArr[i].checked)
   param+=chkArr[i].value +",";
   if (param.length == 0)
   {
       alert("<%=Lang_sys(41)%>");
   }else{
       if(window.confirm("<%=Lang_sys(64)%>")){
           location="?action=del&id="+param+"&keyword="+escape(keyword)+"&l_type="+escape(l_type)+"&Lang="+Lang+"&pagenum="+pagenum+"&page="+page;
       }else return;
   }
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable-top">
<tbody>
<tr>
<form name="Lebi" method="get" action="?">
<td height="30" align="left" class="classhead">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
	<select name="lang">
	<option value="" selected>┌ <%=Lang_sys(67)%></option>
	<%For LangT = 1 To TotalLang%>
	<option value="<%= LanguageTxt(LangT) %>"<%=judge2(LanguageTxt(LangT),Lang)%>>├ <%= LanguageName(LangT) %></option>
	<%Next%>
	</select>
	<select name="s_type">
	<option value="">┌ <%=Lang_Keyword(16)%></option>
	<option value="0"<%=judge2(s_type,0)%>>├ <%=Lang_Keyword(11)%></option>
	<option value="1"<%=judge2(s_type,1)%>>├ <%=Lang_Keyword(12)%></option>
	</select>
</td>
<td style="padding-left:5px;">
     <input name="keyword" id="keyword" type="text" class="form_query" size="15" autocomplete="off" onkeyup="search_suggest('keyword','search','<%=lang%>')"><input name="Submit" type="submit" value="" title="<%=Lang_sys(25)%>" align="absmiddle" class="btn_query"><br /><div id="search_suggest_keyword" class="search_suggest" style="display:none"></div>
</td>
</tr>
</table>
</td>
</form>
<td align="right" class="classhead">
<%=QuickMenu("Admin_packing.asp|"& Lang_Menu(83) &"","Admin_searchwords.asp|"& Lang_Menu(197) &"")%>
</td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="classtable" class="classtable2">
<tbody>
<form name="Lebi" method="post" action="?">
<tr>
  <td colspan="2" height="30" align="left" class="classhead">
	<input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> " align="absmiddle">
	<input type="image" name="Submit" title=" <%=Lang_sys(15)%> " onClick="javascript:todel();return false;" src="lang/<%=LangFilePath%>/images/bt_delete.gif" align="absmiddle">
	<input type="hidden" name="page" id="page" value="<%=page%>">
	<input type="hidden" name="keyword" id="keyword" value="<%=keyword%>">
	<input type="hidden" name="l_type" id="l_type" value="<%=s_type%>">
	<input type="hidden" name="Lang" id="Lang" value="<%=Lang%>">
	<input type="hidden" name="pagenum" id="pagenum" value="<%= pagenum %>">
	<input type="hidden" name="action" value="update">
  </td>
  <td colspan="4" height="30" class="classhead" align="right"><%=ors.ShowPageHead(page)%></td>
 </tr>
<tr>
<td height="30" width="5%" class="classtop" title="<%=Lang_sys(4)%>" style="cursor:pointer;" onclick="location.href='javascript:selectall();';return false;"><%=Lang_sys(50)%></td>
<td width="25%" class="classtop"><%=Lang_Keyword(17)%></td>
<td width="10%" class="classtop"><%=Lang_Keyword(16)%></td>
<td width="40%" class="classtop"><%=Lang_Keyword(18)%></td>
<td width="10%" class="classtop"><%=Lang_Keyword(19)%></td>
<td width="10%" class="classtop"><%=Lang_Keyword(20)%></td>
</tr>
<%
If DataCount >0 Then
		For i = 0 To Ubound(DataList,2)
%>
<tr class="classrow">
<td height="30" class="classrow"><input name="id" type="checkbox" value="<%=DataList(0,i)%>"><input name="item_id" type="hidden" value="<%=DataList(0,i)%>"></td>
<td class="classrow"><%=DataList(1,i)%></td>
<td class="classrow"><select name="s_type">
<option value="0"><%=Lang_Keyword(11)%></option>
<option value="1" style="background-color:#FFFFFF;color:red;" <%if DataList(2,i)="1" then response.write"selected" end if%>><%=Lang_Keyword(12)%></option>
</select></td>
<td class="classrow"><input type="text" name="s_url" size="35" value="<%=DataList(3,i)%>" class="form"></td>
<td class="classrow"><input type="text" name="cs" size="5" value="<%=DataList(4,i)%>" class="form"></td>
<td class="classrow"><a href="?id=<%=DataList(0,i)%>&action=edit"><img src="images/icon_edit.gif" width="16" height="16" title=" <%=Lang_sys(51)%> " border="0"></a></td>
</tr>
<%
        Next
End If
%>
</form>
<tr>
	<td height="30" class="classfooter" colspan="2"><%=GetPageNum(15,pagenum)%></td>
	<td height="30" class="classfooter" align="right" colspan="4"><%=ors.ShowPageFoot(page)%></td>
</tr>
<tr>
<td colspan="6" class="classfaq">
  <div class="faq_main">
  <p class="faq_title"><%=Lang_sys(49)%></p>
   <%=Lang_Keyword(21)%>
   <br><%=Lang_Keyword(22)%>
   <br><%=Lang_Keyword(23)%>
  </div>
</td>
</tr>
</tbody>
</table>
<script>tdshow("classtable");</script>
<%end sub%>