<!--#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_links.asp
'* 最后更新 2014-05-24 by 56770.kingdge
'*****************************************
Dim admin_flag
admin_flag=",8.9,"
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_link.inc"
CurrentId = 5
CurrentUrl = "admin_links.asp"
LB_Head()
LB_Menu()
l_type = SafeReplace(request("l_type"))
action = request("action")
%>
<div class="tabmenu mainwidth">
	  <ul>
		<li <%If action = "" And (l_type = "" Or l_type = "0") Then Response.Write("class=""current""") End If%>><a href="Admin_links.asp"><span><%=Lang_Menu(140)%></span></a></li>
		<li <%If l_type = "1" Then Response.Write("class=""current""") End If%>><a href="?l_type=1"><span><%=Lang_Link(13)%></span></a></li>
		<li <%If l_type = "2" Then Response.Write("class=""current""") End If%>><a href="?l_type=2"><span><%=Lang_Link(14)%></span></a></li>
		<li <%If l_type = "3" Then Response.Write("class=""current""") End If%>><a href="?l_type=3"><span><%=Lang_Link(15)%></span></a></li>
		<li <%If l_type = "4" Then Response.Write("class=""current""") End If%>><a href="?l_type=4"><span><%=Lang_Link(16)%></span></a></li>
		<li <%If action = "config" Or action = "config_ok" Then Response.Write("class=""current""") End If%>><a href="?action=config"><span><%=Lang_Link(6)%></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 action
			Case "del" : del()
			Case "add" : add()
			Case "edit" : edit()
			Case "config" : config()
			Case "config_ok" : config_ok()
			Case Else
				 main()
		End Select
End If
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()

Sub config_ok()
        If OnlyRead = 1 Then OnlyReadMessage()
        set rs=server.CreateObject("adodb.recordset")
        rs.Open "select * from [Lebi_linkconfig]", conn, 1, 3
		If Not rs.eof Then
				For LangT = 1 To TotalLang
						rs("c_name" & LanguageTxt(LangT)) = trim(safereplace(request("c_name" & LanguageTxt(LangT))))
						rs("c_url" & LanguageTxt(LangT)) = trim(replace(request("c_url" & LanguageTxt(LangT)),"'","&#180;"))
						rs("c_logo" & LanguageTxt(LangT)) = trim(safereplace(request("c_logo" & LanguageTxt(LangT))))
						rs("c_info" & LanguageTxt(LangT)) = trim(safereplace(request("c_info" & LanguageTxt(LangT))))
						rs("c_mes" & LanguageTxt(LangT)) = trim(safereplace(request("c_mes" & LanguageTxt(LangT))))
				Next
		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_Link(1)
		Call Up_mes(Lang_sys(69),"·"& Lang_sys(68),0,"?",0,0,2,1)
End Sub

Sub add
        If OnlyRead = 1 Then OnlyReadMessage()
		xs = CheckNum(request("xs"),0)
		show = CheckNum(request("show"),0)
		bs = CheckNum(request("bs"),0)
		logo= Safereplace(trim(request("logo")))
		url= Replace(trim(request("url")),"'","&#180;")
		wordlink = Safereplace(trim(request("wordlink")))
		set rs=server.CreateObject("adodb.recordset")
		rs.Open "select * from [Lebi_huoban]", conn, 1, 3
		rs.AddNew
		rs("wordlink") = wordlink
		rs("url") = url
		rs("logo") = logo
		rs("bs") = bs
		rs("xs") = xs
		rs("show") = show
		rs.Update
		rs.Close:set rs=Nothing
		If Config_Lebi_Eshop(17)="1" Then
				Application.Contents.RemoveAll
		Else
				NewEvent "0"
		End If
		ManageLog Lang_Link(2) &" ["&url&"]"
		Call Up_mes(Lang_sys(45),"·"& Lang_sys(44),0,"?",0,0,2,1)
End Sub

Sub edit
        If OnlyRead = 1 Then OnlyReadMessage()
		l_id=Replace(Safereplace(trim(request("l_id"))),"，",",")
        xs=Replace(Safereplace(trim(request("xs"))),"，",",")
		show=Replace(Safereplace(trim(request("show"))),"，",",")
		bs=Replace(Safereplace(trim(request("bs"))),"，",",")
		url=Replace(Replace(trim(request("url")),"'","&#180;"),"，",",")
		logo=Replace(Safereplace(trim(request("logo"))),"，",",")
		wordlink=Replace(Safereplace(trim(request("wordlink"))),"，",",")
		If UBound (Split(l_id,",")) = 0 Then
                set rs=server.CreateObject("adodb.recordset")
                rs.open "select * from [Lebi_huoban] where id=" & l_id, conn, 1, 3
                rs("wordlink") = wordlink
                rs("url") = url
                rs("logo") = logo
                rs("bs") = bs
                rs("xs") = xs
                rs("show") = show
                rs.update
                rs.close:set rs=Nothing
				ManageLog Lang_Link(3) &" ["&url&"]"
		Else
		        For links_edit_i = 0 To UBound (Split(l_id,","))
                        set rs=server.CreateObject("adodb.recordset")
                        rs.open "select * from [Lebi_huoban] where id=" & Split(l_id,",")(links_edit_i), conn, 1, 3
                        rs("wordlink") = Trim(Split(wordlink,",")(links_edit_i))
                        rs("url") = Trim(Split(url,",")(links_edit_i))
                        rs("logo") = Trim(Split(logo,",")(links_edit_i))
                        rs("bs") = Trim(Split(bs,",")(links_edit_i))
                        rs("xs") = Trim(Split(xs,",")(links_edit_i))
                        rs("show") = Trim(Split(show,",")(links_edit_i))
                        rs.update
                        rs.close:set rs=Nothing
                Next
				ManageLog Lang_Link(4)
		End If
		If Config_Lebi_Eshop(17)="1" Then
				Application.Contents.RemoveAll
		Else
				NewEvent "0"
		End If
        m_u="?page="& request("page") &"&keyword="& request("keyword") &"&pagenum="& request("pagenum") &"&l_type="& request("l_type")
		Call Up_mes(Lang_sys(48),"·"& Lang_sys(47),0,m_u,0,0,2,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 [Lebi_huoban] where id in("&del_id&")")
		If Config_Lebi_Eshop(17)="1" Then
				Application.Contents.RemoveAll
		Else
				NewEvent "0"
		End If
		ManageLog Lang_Link(5) &" ["&del_id&"]"
        m_u="?page="& request("page") &"&keyword="& request("keyword") &"&pagenum="& request("pagenum") &"&l_type="& request("l_type")
		Call Up_mes(Lang_sys(43),"·"& Lang_sys(42),0,m_u,0,0,2,1)
End Sub

Sub config()
%>
<script language="javascript" type="text/javascript" src="inc/js/js_link.js"></script>
<script language="javascript" type="text/javascript" src="Upfile/js/Upload_Other.js"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="classtable" class="classtable">
<form name="config" method="post" action="?action=config_ok">
<tr>
	<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"></td>
	<td align="right" class="classhead">
	<%=QuickMenu("","")%>
	</td>
 </tr>
<tr>
   <td class="classtop" colspan="2" height="30"><%=Lang_Link(6)%></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
        Set rs = conn.execute("select c_name"& LanguageTxt(LangT) &",c_url"& LanguageTxt(LangT) &",c_logo"& LanguageTxt(LangT) &",c_info"& LanguageTxt(LangT) &",c_mes"& LanguageTxt(LangT) &" from [Lebi_linkconfig]")
		If Not rs.eof Then
		c_name = rs(0)
		c_url = rs(1)
		c_logo = rs(2)
		c_info = rs(3)
		c_mes = rs(4)
		End If
		rs.close : Set rs = Nothing
%>
   <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_Link(7)%></td>
<td width="85%" class="classrow">
<input type="text" name="c_name<%= LanguageTxt(LangT) %>" size="40" value="<%=c_name%>" maxlength="50" class="form">
</td>
</tr>
<tr class="classrow">
<td height="30" class="classrow"><%=Lang_Link(8)%></td>
<td class="classrow">
<input type="text" name="c_url<%= LanguageTxt(LangT) %>" size="40" value="<%=c_url%>" maxlength="100" class="form">
</td>
</tr>
<tr class="classrow">
<td height="30" class="classrow"><%=Lang_Link(9)%></td>
<td class="classrow">
<input type="text" name="c_logo<%= LanguageTxt(LangT) %>" id="c_logo<%= LanguageTxt(LangT) %>" size="40" value="<%=c_logo%>" maxlength="50" class="form"> <img src='images/img.gif' align='absmiddle' onMouseover="javascript:ddrivetip('<img src=../<%=c_logo%> height=31>', '#ffffff', '100')" onMouseout="hideddrivetip()" /> <input type="button" name="Upload_c_logo<%= LanguageTxt(LangT) %>" id="Upload_c_logo<%= LanguageTxt(LangT) %>" value="<%=Lang_sys(52)%>" onclick="uploadpanel('config','c_logo<%= LanguageTxt(LangT) %>','links')" class="button">
</td>
</tr>
<tr class="classrow">
<td height="30" class="classrow"><%=Lang_Link(10)%></td>
<td class="classrow">
<input type="text" name="c_info<%= LanguageTxt(LangT) %>" size="78" value="<%=c_info%>" maxlength="50" class="form">
</td>
</tr>
<tr class="classrow">
<td height="30" class="classrow"><%=Lang_Link(11)%></td>
<td class="classrow">
<textarea name="c_mes<%= LanguageTxt(LangT) %>" rows="3" cols="60" maxlength="50" class="text"><%=c_mes%></textarea>
</td>
</tr>
	</table>
	</div>
	<script>tdshow("classtable_<%= LangT %>");</script>
<%Next%>
</div>
<script>showtabcontent("tablist")</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>
<%
end sub

Sub main
		page = CheckNum(request("page"),1)
		pagenum = CheckNum(request("pagenum"),15)
		l_type = CheckNum(request("l_type"),0)
		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=-1
		.Pkey="id"
		.Field="id,wordlink,url,logo,xs,show,bs"
		.Table="[Lebi_huoban]"
		sql = "1=1"
		If l_type = 1 Then sql = sql &" and show = 0"
		If l_type = 2 Then sql = sql &" and show = 1"
		If l_type = 3 Then sql = sql &" and xs = 1"
		If l_type = 4 Then sql = sql &" and xs = 0"
		If keyword <> "" Then sql = sql &" and (wordlink like '%"& keyword &"%' or url like '%"& keyword &"%')"
		.Condition=sql
		.OrderBy="bs desc"
		End With
		DataCount=ors.RecCount()
		DataList=ors.ResultSet()
%>
<script language="javascript" src="inc/js/js_link.js"></script>
<script language="javascript" src="Upfile/js/Upload_Other.js"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable-top" id="classtable_add">
<tbody>
<tr>
<td height="30" align="left" colspan="2" class="classhead">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<form method="get" action="?">
<td>
<select name="l_type">
<option value="" selected>┌ <%=Lang_Link(12)%></option>
<option value="1" <%=judge2("1",l_type)%>>├ <%=Lang_Link(13)%></option>
<option value="2" <%=judge2("2",l_type)%>>├ <%=Lang_Link(14)%></option>
<option value="3" <%=judge2("3",l_type)%>>├ <%=Lang_Link(15)%></option>
<option value="4" <%=judge2("4",l_type)%>>├ <%=Lang_Link(16)%></option>
</select>
</td>
<td style="padding-left:5px;"><input name="keyword" id="keyword" type="text" value="<%=keyword%>" class="form_query" size="20" autocomplete="off" onkeyup="search_suggest('keyword','lebi_huoban','')"><input name="Submit" type="submit" value="" title="<%=Lang_sys(25)%>" align="absmiddle" class="btn_query"><input type="hidden" name="pagenum" value="<%= pagenum %>"><br /><div id="search_suggest_keyword" class="search_suggest" style="display:none"></div>
</td>
</form>
</tr>
</table>
</td>
<td height="30" align="right" colspan="5" class="classhead">
<%=QuickMenu("Admin_pay.asp|"& Lang_Menu(139) &"","Admin_gug.asp|"& Lang_Menu(141) &"")%>
</td>
</tr>
<tr>
  <form name="links_add" method="post" action="admin_links.asp?action=add" onSubmit="return CheckClass(this);">
  <td height="30" align="left" colspan="7" 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"></td>
 </tr>
<tr>
<td class="classtop" width="5%" height="30">&nbsp;</td>
<td class="classtop" width="23%"><%=Lang_Link(17)%></td>
<td class="classtop" width="24%"><%=Lang_Link(18)%></td>
<td class="classtop" width="27%"><%=Lang_Link(19)%></td>
<td class="classtop" width="7%"><%=Lang_Link(20)%></td>
<td class="classtop" width="7%"><%=Lang_Link(21)%></td>
<td class="classtop" width="7%"><%=Lang_Link(22)%></td>
</tr>
<tr>
<td width="5%" height="30" class="classrow">&nbsp;</td>
<td class="classrow">
<input name="wordlink" type="text" id="wordlink" size="20" class="form">
</td>
<td class="classrow">
<input name="url" type="text" size="20" id="url" value="http://" class="form">
</td>
<td class="classrow">
<input name="logo" type="text" size="18" id="logo" onkeyup="value=value.replace(/[',-]/g,'');" class="form"> <input type="button" id="Upload_logo" name="Submit" value="<%=Lang_sys(52)%>" onclick="uploadpanel('links_add','logo','links')" class="button">
</td>
<td class="classrow"><select name="xs" style="font-size:11px;"><option value="0"><%=Lang_Link(23)%></option><option value="1" style="color:#ff0000;"><%=Lang_Link(24)%></option></select></td>
<td class="classrow"><select name="show" style="font-size:11px;"><option value="0"><%=Lang_Link(23)%></option><option value="1" style="color:#ff0000;"><%=Lang_Link(24)%></option></select></td>
<td class="classrow">
<input name="bs" type="text" id="bs" size="3" style="width:35px;" onkeyup="value=value.replace(/[^\d\.]/g,'');" class="form">
</td>
</form>
</tr>
</tbody>
</table>
<script>tdshow("classtable_add");</script>
<script language="JavaScript" type="text/JavaScript">
function CheckClass(theform)
{
    if (!isEmpty(theform.wordlink,'<%=Lang_Link(25)%>')) return false;
}
function todel()
{

   var i = 0;
   var chkArr = document.getElementsByTagName("input");
   var page = document.getElementById("page").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)+"&pagenum="+pagenum+"&page="+page;
       }else return;
   }
}
</script>
</div>
</div>
<div class="mainbody-block">
<div class="mainbody-block2">
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="classtable" class="classtable">
<form name="links_edit" method="post" action="?action=edit">
<input type="hidden" name="page" id="page" value="<%= page %>">
<input type="hidden" name="l_type" id="l_type" value="<%= l_type %>">
<input type="hidden" name="keyword" id="keyword" value="<%= keyword %>">
<input type="hidden" name="pagenum" id="pagenum" value="<%= pagenum %>">
<tr>
  <td colspan="2" height="30" 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" border="0" title=" <%=Lang_sys(15)%> " onclick="location.href='javascript:todel();';return false;" src="lang/<%=LangFilePath%>/images/bt_delete.gif" align="absmiddle">
  </td>
  <td height="30" class="classhead" align="right" colspan="5"><%=ors.ShowPageHead(page)%></td>
 </tr>
<tr>
<td class="classtop" width="5%" height="30" title="<%=Lang_sys(4)%>" style="cursor:pointer;" onclick="location.href='javascript:selectall();';return false;"><%=Lang_sys(50)%></td>
<td class="classtop" width="23%"><%=Lang_Link(17)%></td>
<td class="classtop" width="24%"><%=Lang_Link(18)%></td>
<td class="classtop" width="27%"><%=Lang_Link(19)%></td>
<td class="classtop" width="7%"><%=Lang_Link(20)%></td>
<td class="classtop" width="7%"><%=Lang_Link(21)%></td>
<td class="classtop" width="7%"><%=Lang_Link(22)%></td>
</tr>
<%
If DataCount >0 Then
		For i = 0 To Ubound(DataList,2)
%>
<tr class="classrow">
<td width="5%" height="30" class="classrow"><input name="id" type="checkbox" value="<%=DataList(0,i)%>"><input name="l_id" type="hidden" value="<%=DataList(0,i)%>"></td>
<td height="30" class="classrow">
<input name="wordlink" type="text" id="linkname" value="<%=DataList(1,i)%>" size="20" class="form">
</td>
<td class="classrow">
<input name="url" type="text" id="linkurl" value="<%=DataList(2,i)%>" size="22" class="form">
</td>
<td class="classrow">
<img src='images/img.gif' align='absmiddle' onMouseover="javascript:ddrivetip('<img src=../<%=DataList(3,i)%> width=88>', '#ffffff', '90')" onMouseout="hideddrivetip()">
<input name="logo" type="text" id="logo<%=DataList(0,i)%>" size="15" value="<%=DataList(3,i)%>" class="form"> <input type="button" id="Upload_logo<%=DataList(0,i)%>" name="Submit" value="<%=Lang_sys(52)%>" onclick="uploadpanel('links_edit','logo<%=DataList(0,i)%>','links')" class="button">
</td>
<td class="classrow">
<select name="xs" style="font-size:11px;"><option value="0"><%=Lang_Link(23)%></option><option value="1" style="color:#ff0000;" <%if DataList(4,i)=1 Then response.write("selected")%>><%=Lang_Link(24)%></option></select>
</td>
<td class="classrow">
<select name="show" style="font-size:11px;"><option value="0"><%=Lang_Link(23)%></option><option value="1" style="color:#ff0000;" <%if DataList(5,i)=1 Then response.write("selected")%>><%=Lang_Link(24)%></option></select>
</td>
<td class="classrow">
<input name="bs" type="text" id="linkidorder" value=<%=DataList(6,i)%> size="3" style="width:35px;" onkeyup="value=value.replace(/[^\d\.]/g,'');" class="form">
</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="5"><%=ors.ShowPageFoot(page)%></td>
</tr>
<tr>
<td colspan="7" class="classfaq">
  <div class="faq_main">
  <p class="faq_title"><%=Lang_sys(49)%></p>
   <%=Lang_Link(26)%>
   </div>
</td>
</tr>
</tbody>
</table>
<script>tdshow("classtable");</script>
<%end Sub%>