<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--#include file="inc/Page_cls.asp"-->
<%
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 Admin_packing.asp
'* 最后更新 2012-01-08 by 56770.kingdge
'*****************************************
Dim admin_flag
admin_flag=",3.8,"
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_packing.inc"
CurrentId = 1
CurrentUrl = "admin_packing.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_packing.asp"><span><%=Lang_Menu(83)%></span></a></li>
        <li <%If action = "add" Then Response.Write("class=""current""") End If%>><a href="?action=add"><span><%=Lang_Packing(13)%></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 "add_ok" : add_ok()
	           Case "edit" : edit()
			   Case "add" : add()
	           Case "del" : del()
	           Case Else
	                list()
        End Select
End If
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()

sub add_ok
		id=CheckNum(request("id"),0)
		packing_name=Safereplace(request("packing_name"))
		packing_type=CheckNum(request("packing_type"),0)
		packing_info=safereplace(request("packing_info"))
		pic=Safereplace(request("pic"))
		if pic="" then pic="pic/noimages.gif"
		packing_price=CheckNum(request("packing_price"),0)
		If id <> "0"Then
				set rs=server.createobject("ADODB.Recordset")
				sql="select * from [Lebi_packing] where id<>"& id &" and packing_name='"&packing_name&"' order by id desc"
				rs.open sql,conn,1,1
				if not(rs.eof or rs.bof) then
						response.write"<SCRIPT lang1uage=JavaScript>alert('"& Lang_Packing(1) &"');javascript:history.go(-1)</SCRIPT>"
						response.End
				End If
				rs.close:set rs=nothing
				set rs=server.createobject("ADODB.Recordset")
				sql="select * from [Lebi_packing] where id="&id
				rs.open sql, conn, 1, 3
				if not(rs.eof or rs.bof)then
						For LangT = 1 To TotalLang
								rs("packing_name" & LanguageTxt(LangT)) = safereplace(request("packing_name" & LanguageTxt(LangT)))
								rs("packing_info" & LanguageTxt(LangT)) = safereplace(request("packing_info" & LanguageTxt(LangT)))
						Next
						rs("packing_price") = packing_price
						rs("packing_type") = packing_type
						rs("pic") = pic
						rs.update
				End If
				rs.close:set rs=nothing
				ManageLog Lang_Packing(2) &" ["&packing_name&"]"
				Call Up_mes(Lang_sys(48),"·"& Lang_sys(47),0,"?",0,0,2,1)
		Else
				set rs=server.createobject("ADODB.Recordset")
				sql="select * from [Lebi_packing] where packing_name='"&packing_name&"' order by id desc"
				rs.open sql, conn, 1, 3
				if not(rs.eof or rs.bof) then
						response.write"<SCRIPT lang1uage=JavaScript>alert('对不起，您所添加的包装名称已经存在, 请核实！');javascript:history.go(-1)</SCRIPT>"
						response.End
				Else
						rs.addnew
						For LangT = 1 To TotalLang
								rs("packing_name" & LanguageTxt(LangT)) = safereplace(request("packing_name" & LanguageTxt(LangT)))
								rs("packing_info" & LanguageTxt(LangT)) = safereplace(request("packing_info" & LanguageTxt(LangT)))
						Next
						rs("packing_price") = packing_price
						rs("packing_type") = packing_type
						rs("pic") = pic
						rs.update
				end If
				rs.close:set rs=nothing
				ManageLog Lang_Packing(3) &" ["&packing_name&"]"
				Call Up_mes(Lang_sys(45),"·"& Lang_sys(44),0,"?",0,0,2,1)
		End If
End Sub

sub del
        If OnlyRead = 1 Then OnlyReadMessage()
		id=safereplace(request("id"))
		if id="" then
				response.write"<SCRIPT lang1uage=JavaScript>alert('"& Lang_sys(41) &"');javascript:history.go(-1)</SCRIPT>"
				response.end
		end if
		'删除图片
		If Right(del_id,1) = "," Then del_id = Left(del_id,Len(del_id)-1)
		sql="select id,pic from [Lebi_packing] where id in ("&id&") "
        set rs=conn.execute(sql)
		If Not rs.eof Then
		Do While Not rs.eof
        pic=LCase(Trim(rs("pic")))
        filepath_pic="../"&pic
        path_pic= server.MapPath(filepath_pic)
        set objfso = server.createobject("scripting.FileSystemObject")
        if objfso.FileExists(path_pic) then
                If pic<>"pic/noimages.gif" And objfso.FileExists(path_pic) then
                        objfso.DeleteFile(path_pic)
				End If
                set objfso = Nothing
        end if
        conn.execute "delete from [Lebi_packing] where id="&rs("id")&""
		rs.movenext
		Loop
		ManageLog Lang_Packing(4) &" ["&id&"]"
		End If
		rs.close:set rs=Nothing
		m_u="?page=" & request("page")& "&keyword=" & request("keyword")& "&pagenum="& request("pagenum") &"&Lang="& request("lang")
		Call Up_mes(Lang_sys(43),"·"& Lang_sys(42),0,m_u,0,0,2,1)
end sub
%>
<script language="JavaScript">
function CheckForm(theform)
{
    if (!isEmpty(theform.packing_name,'<%=Lang_Packing(5)%>')) return false;
}

</script>
<%
sub list()
		page = CheckNum(request("page"),1)
		pagenum = CheckNum(request("pagenum"),15)
		keyword = safereplace(Trim(request("keyword")))
		lang = safereplace(request("lang"))
		If lang = "" Then lang = LanguageTxt(0)
		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,packing_name"& lang &",packing_price,packing_type,pic"
		.Table="[Lebi_packing]"
		sql = "1=1"
		If keyword <> "" Then sql = sql &" and (packing_name like '%"& keyword &"%')"
		.Condition=sql
		.OrderBy="id desc"
		End With
		DataCount=ors.RecCount()
		DataList=ors.ResultSet()
%>
<script language="javascript" type="text/javascript" src="inc/js/js_link.js"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable-top">
<tbody>
<tr>
<form 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>
</td>
<td style="padding-left:5px;">
<input name="keyword" id="keyword" type="text" class="form_query" size="15" autocomplete="off" onkeyup="search_suggest('keyword','Lebi_packing','<%=lang%>')"><input name="Submit" type="submit" value="" title="查询" 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>
</tr>
</table>
</td>
</form>
<td height="30" align="right" class="classhead">
<%=QuickMenu("admin_tags.asp|"& Lang_Menu(81) &"","Admin_cslist.asp|"& Lang_Menu(85) &"")%>
</td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="packinglist" class="classtable2">
<tbody>
<tr>
<form name="myform" action="?action=del" method="post">
<td colspan="2" height="30" align="left" class="classhead">
<input type="image" name="Submit" title=" <%=Lang_sys(15)%> " onClick="return confirm('您确定要这样操作吗？')" src="lang/<%=LangFilePath%>/images/bt_delete.gif" align="absmiddle">
<input type="hidden" name="page" value="<%=page%>">
<input type="hidden" name="keyword" value="<%=keyword%>">
<input type="hidden" name="lang" value="<%=lang%>">
<input type="hidden" name="pagenum" value="<%= pagenum %>">
</td>
<td colspan="4" height="30" class="classhead" align="right"><%=ors.ShowPageHead(page)%></td>
</tr>
<tr>
<td class="classtop" height="30" width="5%" title="<%=Lang_sys(4)%>" style="cursor:pointer;" onclick="location.href='javascript:selectall();';return false;"><%=Lang_sys(50)%></td>
<td class="classtop" width="55%"><%=Lang_Packing(6)%></td>
<td class="classtop" width="10%"><%=Lang_Packing(7)%></td>
<td class="classtop" width="10%"><%=Lang_Packing(8)%></td>
<td class="classtop" width="10%"><%=Lang_Packing(9)%></td>
<td class="classtop" width="10%"><%=Lang_Packing(10)%></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)%>"></td>
<td class="classrow"><%=DataList(1,i)%></td>
<td class="classrow"><img src='images/img.gif' align='absmiddle' onMouseover="javascript:ddrivetip('<img src=../<%=trim(DataList(4,i))%> width=200>', '#ffffff', '200')" onMouseout="hideddrivetip()"></td>
<td class="classrow"><%=formatnumber2(DataList(2,i))%></td>
<td class="classrow"><%if DataList(3,i)=1 then response.write Lang_Packing(11) else response.write("<font color=red>"& Lang_Packing(12) &"</font>") end if%></td>
<td class="classrow" width="5%"><a href="?action=edit&id=<%=DataList(0,i)%>"><img src="images/icon_edit.gif" width="16" height="16" border="0" title="<%=Lang_sys(51)%>"></a></a>
</td>
</tr>
<%
        Next
End If
%>
</form>
</tbody>
<tfoot>
<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>
</tfoot>
</table>
<script>tdshow("packinglist");</script>
<%
end sub

sub add()
%>
<script language="javascript" src="Upfile/js/Upload_Other.js"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable">
<form action="?action=add_ok&id=0" method="post" name="add_list" onSubmit="return CheckForm(this);">
<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 class="classhead" align="right">
	<%=QuickMenu("","")%>
	</td>
</tr>
<tr>
<td height="30" colspan="2" class="classtop"><%=Lang_Packing(13)%></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 %>"><%= 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="add_<%= LangT %>">
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Packing(14)%>
</td>
<td class="classrow"><input type="text" name="packing_name<%= LanguageTxt(LangT) %>" size="40" value="" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" valign="top" class="classrow" style="padding-top:6px"><%=Lang_Packing(15)%><br><br>&nbsp;</td>
<td class="classrow">
<textarea name="packing_info<%= LanguageTxt(LangT) %>" id="packing_info<%= LanguageTxt(LangT) %>" rows="6" cols="53" class="text"></textarea>
<br /><a href="javascript:u_Size(-5,'packing_info<%= LanguageTxt(LangT) %>')"><img src="lang/<%=LangFilePath%>/images/tab/bt_close.gif" border='0'></a>
<a href="javascript:u_Size(5,'packing_info<%= LanguageTxt(LangT) %>')"><img src="lang/<%=LangFilePath%>/images/tab/bt_open.gif" border='0'></a>
</td>
</tr>
	</table>
	</div>
	<script>tdshow("add_<%= 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="add_other">
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Packing(16)%></td>
<td class="classrow"><input type="text" name="packing_price" size="5" value="" onkeyup="value=value.replace(/[^\d\.]/g,'');" class="form">
</td>
</tr>
<tr class="classrow">
<td height="30" class="classrow"><%=Lang_Packing(17)%></td>
<td class="classrow"><input type="radio" name="packing_type" value="1" checked> <%=Lang_Packing(11)%>&nbsp;&nbsp;<input type="radio" value="0" name="packing_type"> <%=Lang_Packing(12)%>
</td>
</tr>
<tr class="classrow">
<td height="30" class="classrow"><%=Lang_Packing(18)%></td>
<td class="classrow"><input type="text" id="pic" name="pic" size="30" class="form">
 <input type="button" id="Upload_pic" name="Upload_pic" value="<%=Lang_sys(52)%>" onclick="uploadpanel('add_list','pic','packing')" class="btn_upload">
</td>
</tr>
</table>
</div>
<script>tdshow("add_other");</script>
</td>
</tr>
<tr>
<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 edit()
id=CheckNum(request("id"),0)
sql="select * from [Lebi_packing] where id=" & id
set rss = conn.execute(sql)
If Not rss.eof Then
	packing_price = rss("packing_price")
	packing_type = rss("packing_type")
	pic = trim(rss("pic"))
	showpic = "<img src='images/img.gif' align='absmiddle' onMouseover=""javascript:ddrivetip('<img src=../"&pic&" width=200>', '#ffffff', '200')"" onMouseout=""hideddrivetip()"">"
%>
<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">
<form action="?action=add_ok&id=<%=id%>" method="post" name="add_list" onSubmit="return CheckForm(this);">
<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 class="classhead" align="right">
	<%=QuickMenu("","")%>
	</td>
</tr>
<tr>
<td height="30" colspan="2" class="classtop"><%=Lang_Packing(19)%></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="edit_<%= LangT %>">
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Packing(14)%>
</td>
<td class="classrow"><input type="text" name="packing_name<%= LanguageTxt(LangT) %>" size="40" value="<%=rss("packing_name"& LanguageTxt(LangT))%>" class="form">&nbsp;<%=showpic%>
</td>
</tr>
<tr class="classrow">
<td height="30" valign="top" class="classrow" style="padding-top:6px"><%=Lang_Packing(15)%><br><br>&nbsp;</td>
<td class="classrow">
<textarea name="packing_info<%= LanguageTxt(LangT) %>" id="packing_info<%= LanguageTxt(LangT) %>" rows="6" cols="53" class="text"><%=rss("packing_info"& LanguageTxt(LangT))%></textarea>
<br /><a href="javascript:u_Size(-5,'packing_info<%= LanguageTxt(LangT) %>')"><img src="lang/<%=LangFilePath%>/images/tab/bt_close.gif" border='0'></a>
<a href="javascript:u_Size(5,'packing_info<%= LanguageTxt(LangT) %>')"><img src="lang/<%=LangFilePath%>/images/tab/bt_open.gif" border='0'></a>
</td>
</tr>
	</table>
	</div>
	<script>tdshow("edit_<%= 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="edit_other">
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Packing(16)%></td>
<td class="classrow"><input type="text" name="packing_price" size="5" value="<%=packing_price%>" onkeyup="value=value.replace(/[^\d\.]/g,'');" class="form">
</td>
</tr>
<tr class="classrow">
<td height="30" class="classrow"><%=Lang_Packing(17)%></td>
<td class="classrow"><input type="radio" name="packing_type" value="1" <%If packing_type=1 Then response.write("checked")%>> <%=Lang_Packing(11)%>&nbsp;&nbsp;<input type="radio" value="0" name="packing_type" <%If packing_type=0 Then response.write("checked")%>> <%=Lang_Packing(12)%>
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Packing(18)%></td>
<td class="classrow"><input type="text" id="pic" name="pic" size="30" class="form" value="<%=pic%>">
 <input type="button" id="Upload_pic" name="Upload_pic" value="<%=Lang_sys(52)%>" onclick="uploadpanel('add_list','pic','packing')" class="btn_upload">
</td>
</tr>
</table>
</div>
<script>tdshow("edit_other");</script>
</td>
</tr>
<tr>
<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 If
rss.close:set rss=nothing
end sub
%>