<!--#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_vote.asp
'* 最后更新 2010-12-28 by 56770.kingdge
'*****************************************
Dim admin_flag
admin_flag=",8.12,"
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_vote.inc"
CurrentId = 5
CurrentUrl = "admin_vote.asp"
LB_Head()
LB_Menu()
action = request("action")
%>
<div class="tabmenu mainwidth">
	  <ul>
		<li <%If action = "" Then Response.Write("class=""current""") End If%>><a href="admin_vote.asp"><span><%=Lang_Menu(145)%></span></a></li>
		<li <%If action = "add" Then Response.Write("class=""current""") End If%>><a href="?action=add"><span><%=Lang_Menu(144)%></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 "save" : save()
			Case "del" : del()
			Case "modi" : modi()
			Case "setvote" : setvote()
			Case Else
				list()
		End Select
End If
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()

Sub del()
        If OnlyRead = 1 Then OnlyReadMessage()
		dim id,sql
		id=CheckNum(request("id"),0)
		conn.execute" delete from [vote] where ID="&id
		If Config_Lebi_Eshop(17)="1" Then
				Application.Contents.RemoveAll
		Else
				NewEvent "0"
		End If
		ManageLog Lang_Vote(1) &" ["&id&"]"
        m_u="?page=" & request("page")& "&keyword=" & request("keyword")& "&pagenum="& request("pagenum") &"&Lang="& request("lang")
	    m_time="2"
		Call Up_mes(Lang_sys(43),"·"& Lang_sys(42),0,m_u,0,0,2,1)
End sub

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=-1
		.Pkey="id"
		.Field="id,IsChecked,Title"& lang &",DateAndTime"
		.Table="[vote]"
		sql = "1=1"
		If keyword <> "" Then sql = sql &" and (title"& lang &" like '%"& keyword &"%')"
		.Condition=sql
		.OrderBy="id desc"
		End With
		DataCount=ors.RecCount()
		DataList=ors.ResultSet()
%>
<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" type="text" class="form_query" size="15"><input name="Submit" type="submit" value="" title="<%=Lang_sys(25)%>" align="absmiddle" class="btn_query"><input type="hidden" name="pagenum" value="<%= pagenum %>">
</td>
</tr>
</table>
</td>
</form>
<td align="right" class="classhead">
<%=QuickMenu("Admin_footer.asp|"& Lang_Menu(143) &"","admin_vote.asp?action=add|"& Lang_Menu(144) &"")%>
</td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="list" class="classtable2">
<tbody>
<tr>
<form method="POST" action="?action=setvote">
<td height="30" class="classhead" align="left" colspan="3">
<input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " 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 height="30" class="classhead" align="right" colspan="2"><%=ors.ShowPageHead(page)%></td>
  </tr>
	<tr>
	  <td width="6%" height="30" class="classtop"><%=Lang_sys(50)%></td>
	  <td width="6%" class="classtop"><%=Lang_Vote(2)%></td>
	  <td width="58%" class="classtop"><%=Lang_Vote(3)%></td>
	  <td width="20%" class="classtop"><%=Lang_Vote(4)%></td>
	  <td width="10%" class="classtop"><%=Lang_Vote(5)%></td>
  </tr>
<%
If DataCount >0 Then
		For i = 0 To Ubound(DataList,2)
%>
             <tr class="classrow">
              <td height="30" class="classrow"><input type="radio" value=<%=DataList(0,i)%><%if DataList(1,i)=1 then%> checked<%end if%> name="Checked"></td>
              <td class="classrow"><%=DataList(0,i)%></td>
              <td class="classrow"><%=DataList(2,i)%></td>
              <td class="classrow"><%=DataList(3,i)%></td>
              <td class="classrow">
			    <input onclick="location.href='?action=modi&id=<%=DataList(0,i)%>';return false;" type="image" title=" <%=Lang_sys(51)%> " name="edit" src="images/icon_edit.gif" align="absmiddle">&nbsp;&nbsp;<input onclick="{if(confirm('<%=Lang_sys(64)%>')){location.href='?action=del&id=<%=DataList(0,i)%>';}return false;}" type="image" title=" <%=Lang_sys(15)%> " name="del" src="images/icon_del.gif" align="absmiddle"></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="3"><%=ors.ShowPageFoot(page)%></td>
</tr>
</tbody>
</table>
<script>tdshow("list");</script>
<%
end sub

Sub Add()
%>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable">
		<form method="POST" action="?action=save">
		<tr>
			<td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
			<td align="right" class="classhead">
			<%=QuickMenu("admin_vote.asp|"& Lang_Menu(145) &"","Admin_qq.asp|"& Lang_Menu(146) &"")%>
			</td>
		 </tr>
			<tr>
			  <td class="classtop" height="30" colspan="2"><%=Lang_Menu(144)%></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="add_<%= LangT %>">
						<tr class="classrow">
						  <td width="15%" height="30" class="classrow"><%=Lang_Vote(6)%></td>
						  <td width="85%" class="classrow">
							<input type="text" name="Title<%= LanguageTxt(LangT) %>" size="30" class="form"></td>
					  </tr>
					<%for i=1 to 8%>
			          <tr class="classrow">
						  <td height="30" class="classrow"><%=i%>.<%=Lang_Vote(7)%></td>
						  <td class="classrow">
							<input type="text" name="select<%=i%><%= LanguageTxt(LangT) %>" size="30" class="form"></td>
					  </tr>
					<%next%>
				</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">
			<%for i=1 to 8%>
			<tr class="classrow">
						  <td width="15%" height="30" class="classrow"><%=i%>.<%=Lang_Vote(8)%></td>
						  <td class="classrow"><input type="text" name="answer<%=i%>" size="5" value="0" onkeyup="value=value.replace(/[^\d\.]/g,'');" class="form"></td>
					  </tr>
			<%next%>
				</table>
				</div>
				<script>tdshow("add_other");</script>
			</td>
			</tr>
            <tr>
              <td colspan="2" align="left" height="30" class="classfooter">
                <input type="hidden" value="add" name="act">
                <input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">
            </td>
          </tr>
        </form>
      </table>
<%
End Sub

Sub modi()
dim id,Title,DateAndTime,i,sql
id=CheckNum(request("id"),0)
set rs=server.createobject("adodb.recordset")
sql="select * from [vote] where id="&id
rs.open sql,conn,1,1
if rs.eof then
        response.write "<script>alert('"& Lang_Vote(10) &"');history.go(-1);</Script>"
		Response.End
Else
		DateAndTime=rs("DateAndTime")
end if
%>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable">
		<form method="POST" action="?action=save&id=<%=id%>">
		<tr>
			<td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
			<td align="right" class="classhead">
			<%=QuickMenu("","")%>
			</td>
		 </tr>
		<tr>
		  <td class="classtop" height="30" colspan="2"><%=Lang_Vote(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="edit_<%= LangT %>">
				<tr class="classrow">
				  <td width="15%" height="30" class="classrow"><%=Lang_Vote(6)%></td>
				  <td width="85%" class="classrow">
					<input type="text" name="Title<%= LanguageTxt(LangT) %>" value="<%=rs("Title" & LanguageTxt(LangT))%>" size="30" class="form"></td>
			  </tr>
	<%for i=1 to 8%>
				<tr class="classrow">
				  <td width="15%" height="30" class="classrow"><%=i%>.<%=Lang_Vote(7)%></td>
				  <td class="classrow">
					<input type="text" name="select<%=i%><%= LanguageTxt(LangT) %>" value="<%=rs("select"&i & LanguageTxt(LangT))%>" size="30" class="form"></td>
			  </tr>
	<%next%>
			</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">
			<%for i=1 to 8%>
			<tr class="classrow">
			  <td width="15%" height="30" class="classrow"><%=i%>.<%=Lang_Vote(8)%></td>
			  <td class="classrow"><input type="text" name="answer<%=i%>" value="<%=rs("answer"&i)%>" onkeyup="value=value.replace(/[^\d\.]/g,'');" size="5" class="form"></td>
			</tr>
			<%next%>
			<tr class="classrow">
			  <td width="15%" height="30" class="classrow"><%=Lang_Vote(9)%></td>
			  <td class="classrow"><%=DateAndTime%>　</td>
			</tr>
			</table>
			</div>
			<script>tdshow("edit_other");</script>
		</td>
		</tr>
            <tr>
              <td colspan="2" align="left" height="30" class="classfooter">
                <input type="hidden" value="edit" name="act">
                <input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">
            </td>
          </tr>
        </form>
      </table>
<%
rs.close : set rs=nothing
End Sub

Sub save()
        If OnlyRead = 1 Then OnlyReadMessage()
		dim id,title,act,DateAndTime,Content,sql,i
		ID=CheckNum(request.QueryString("id"),0)
		Title=safereplace(request.form("Title"& lang))
		act=request("act")
		if DateAndTime="" then DateAndTime=now()
		if Title="" then
				response.write "<script>alert('"& Lang_Vote(10) &"');history.go(-1);</Script>"
				Response.End
		end if
		set rs=server.createobject("adodb.recordset")
		if act="edit" Then
				ManageLog Lang_Vote(11) &" ["&Title&"]"
				sql="select * from [vote] where ID="&ID
		elseif act="add" Then
				ManageLog Lang_Vote(12) &" ["&Title&"]"
				sql="select * from [vote]"
		end if
		rs.open sql,conn,1,3
		if act="add" or act="edit" then
				if act="edit" then
						if rs.eof then
								response.write "<script>alert('Error[001]');history.go(-1);</Script>"
								Response.End
						end if
				end if
				if act="add" then rs.addnew
				For LangT = 1 To TotalLang
						rs("Title" & LanguageTxt(LangT))=safereplace(request("Title" & LanguageTxt(LangT)))
				Next
				for i=1 to 8
						if request("select"&i)<>"" Then
								For LangT = 1 To TotalLang
										rs("select"& i & LanguageTxt(LangT))=safereplace(request("select"& i & LanguageTxt(LangT)))
								Next
								if request("answer"&i)="" then
										rs("answer"&i)=0
								else
										rs("answer"&i)=request("answer"&i)
								end if
						end if
				next
				rs("dateandtime")=now()
				rs.update
		end if
		rs.close : set rs=Nothing
		If Config_Lebi_Eshop(17)="1" Then
				Application.Contents.RemoveAll
		Else
				NewEvent "0"
		End If
		If act="add" Then
				Call Up_mes(Lang_sys(45),"·"& Lang_sys(44),0,"?",0,0,2,1)
		Else
				Call Up_mes(Lang_sys(48),"·"& Lang_sys(47),0,"?",0,0,2,1)
		End If
End sub

Sub setvote()
        If OnlyRead = 1 Then OnlyReadMessage()
		dim Checked,sql
		Checked=checknum(request.form("Checked"),0)
		if Checked=0 then
				response.write "<script>alert('"& Lang_Vote(13) &"');history.go(-1);</Script>"
				Response.End
		end if
		set rs=server.createobject("adodb.recordset")
		sql="Select isChecked from [vote] where IsChecked=1"
		rs.open sql,conn,1,3
		if not rs.eof then
				do while not rs.eof
				rs("IsChecked")=0
				rs.movenext
				loop
		end if
		rs.close

		sql="Select IsChecked,title from [vote] where ID="&Checked
		rs.open sql,conn,1,3
		if not rs.EOF then
				rs(0)=1
				rs.update
				title = rs(1)
		end if
		rs.close : set rs=Nothing
		If Config_Lebi_Eshop(17)="1" Then
				Application.Contents.RemoveAll
		Else
				NewEvent "0"
		End If
		ManageLog Lang_Vote(14) &" ["&title&"]"
		Call Up_mes(Lang_sys(69),"·"& Lang_sys(68),0,"?",0,0,2,1)
End sub
%>