⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_vote.asp

📁 依蓝旅游网站管理系统Elan2008.SP2
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%
Option Explicit
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
%>
<!--#Include File="../Conn.asp"-->
<!--#Include File="Admin_CheckPurview.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href='Admin_Style.css' type='text/css' rel='stylesheet'>
<title>网站调查管理</title>
<script language="javascript" src="../js/Common.js"></script>
<script language="javascript" src="../js/InstallDir.js"></script>
</head>
<body>
<%
If EL_Admin.Purview <> 1 Then
   If EL_Admin.CheckAdminPurview(5, 3) = False Then
      EL_Admin.ShowPurviewError("对不起!您没有足够的管理权限")
   End If
End If

Dim CurrentPath, ArrVoteType(1)

ArrVoteType(0) = "单选"
ArrVoteType(1) = "多选"

CurrentPath = "·您现在的位置:<a href='"& EL_CurrentScriptName &"'>调查管理首页</a> "
%>
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="Border">
  <tr>
    <td align="center" class="top_25"><strong>网站调查管理</strong></td>
  </tr>
  <tr>
    <td class="td_50">管理导航:<a href="<%=EL_CurrentScriptName%>">调查管理首页</a> | <a href="<%=EL_CurrentScriptName%>?Action=Add">添加调查</a></td>
  </tr>
</table>
<br>
<%
Select Case Action
  Case "": Call ManageVote()
  Case "Add": Call AddVote()
  Case "Save": Call SaveVote(0)
  Case "Modify": Call ModifyVote()
  Case "SaveModify": Call SaveVote(1)
  Case "Delete": Call SaveVote(2)
  Case "SetVoteType": Call SaveVote(3)
  Case "SetActived": Call SaveVote(4)
  Case "Show": Call ShowVote()
End Select
Call EL_Common.Bottom()
Call ApplicationTerminate()

Sub SaveVote(UpdateType)
  On Error Resume Next
  Dim VoteCmd
  Dim VoteID, Title, VoteType, Options1, Ballot1, Options2, Ballot2, Options3, Ballot3, Options4, Ballot4, Options5, Ballot5
  Dim Options6, Ballot6, Options7, Ballot7, Options8, Ballot8, Options9, Ballot9, Options10, Ballot10, UpdateTime, Actived
  
  
  VoteID = EL_Common.ELRequest("VoteID", 2)
  Title = EL_Common.ELRequest("Title", 1)  
  VoteType = EL_Common.ELRequest("VoteType", 2)
  Options1 = EL_Common.ELRequest("Options1", 1)
  Ballot1 = EL_Common.ELRequest("Ballot1", 2)
  Options2 = EL_Common.ELRequest("Options2", 1)
  Ballot2 = EL_Common.ELRequest("Ballot2", 2)
  Options3 = EL_Common.ELRequest("Options3", 1)
  Ballot3 = EL_Common.ELRequest("Ballot3", 2)
  Options4 = EL_Common.ELRequest("Options4", 1)
  Ballot4 = EL_Common.ELRequest("Ballot4", 2)
  Options5 = EL_Common.ELRequest("Options5", 1)
  Ballot5 = EL_Common.ELRequest("Ballot5", 2)
  Options6 = EL_Common.ELRequest("Options6", 1)
  Ballot6 = EL_Common.ELRequest("Ballot6", 2)
  Options7 = EL_Common.ELRequest("Options7", 1)
  Ballot7 = EL_Common.ELRequest("Ballot7", 2)
  Options8 = EL_Common.ELRequest("Options8", 1)
  Ballot8 = EL_Common.ELRequest("Ballot8", 2)
  Options9 = EL_Common.ELRequest("Options9", 1)
  Ballot9 = EL_Common.ELRequest("Ballot9", 2)
  Options10 = EL_Common.ELRequest("Options10", 1)
  Ballot10 = EL_Common.ELRequest("Ballot10", 2)
  UpdateTime = EL_Common.ELRequest("UpdateTime", 1)
  Actived = EL_Common.ELRequest("Actived", 2)

  If UpdateTime = "" Then UpdateTime = Now()
  Select Case UpdateType
     Case 0, 1:
	    If Not IsDate(UpdateTime) Then
		   EL_Common.ShowScriptError("发布日期格式错误")
		   Exit Sub
		End If
	 Case Else:
	    Title = EL_Common.ELRequest("CheckObject", 1)
		Actived = EL_Common.ELRequest("SetValue", 2)
		If VoteID <> 0 Then Title = EL_Common.Join2String(Title, VoteID, ",")
  End Select
  
  Call EL_Common.InitCommand(VoteCmd, "EL_SP_Vote")
  With VoteCmd
    .Parameters.Append .CreateParameter("RETURN", 2, 4)
	.Parameters.Append .CreateParameter("@UpdateType", 3, 1, 4, UpdateType)
	If UpdateType = 0 Then
	   .Parameters.Append .CreateParameter("@VoteID", 3, 2, 4)
	Else
	   .Parameters.Append .CreateParameter("@VoteID", 3, 1, 4, VoteID)
	End If
	.Parameters.Append .CreateParameter("@TopicID", 3, 1, 4, 0)
	.Parameters.Append .CreateParameter("@Title", 200, 1, 255, Title)
	.Parameters.Append .CreateParameter("@VoteType", 3, 1, 4, VoteType)
	.Parameters.Append .CreateParameter("@Options1", 200, 1, 100, Options1)
	.Parameters.Append .CreateParameter("@Ballot1", 3, 1, 4, Ballot1)
	.Parameters.Append .CreateParameter("@Options2", 200, 1, 100, Options2)
	.Parameters.Append .CreateParameter("@Ballot2", 3, 1, 4, Ballot2)
	.Parameters.Append .CreateParameter("@Options3", 200, 1, 100, Options3)
	.Parameters.Append .CreateParameter("@Ballot3", 3, 1, 4, Ballot3)
	.Parameters.Append .CreateParameter("@Options4", 200, 1, 100, Options4)
	.Parameters.Append .CreateParameter("@Ballot4", 3, 1, 4, Ballot4)
	.Parameters.Append .CreateParameter("@Options5", 200, 1, 100, Options5)
	.Parameters.Append .CreateParameter("@Ballot5", 3, 1, 4, Ballot5)
	.Parameters.Append .CreateParameter("@Options6", 200, 1, 100, Options6)
	.Parameters.Append .CreateParameter("@Ballot6", 3, 1, 4, Ballot6)
	.Parameters.Append .CreateParameter("@Options7", 200, 1, 100, Options7)
	.Parameters.Append .CreateParameter("@Ballot7", 3, 1, 4, Ballot7)
	.Parameters.Append .CreateParameter("@Options8", 200, 1, 100, Options8)
	.Parameters.Append .CreateParameter("@Ballot8", 3, 1, 4, Ballot8)
	.Parameters.Append .CreateParameter("@Options9", 200, 1, 100, Options9)
	.Parameters.Append .CreateParameter("@Ballot9", 3, 1, 4, Ballot9)
	.Parameters.Append .CreateParameter("@Options10", 200, 1, 100, Options10)
	.Parameters.Append .CreateParameter("@Ballot10", 3, 1, 4, Ballot10)
	.Parameters.Append .CreateParameter("@UpdateTime", 135, 1, 8, UpdateTime)
	.Parameters.Append .CreateParameter("@Actived", 11, 1, 1, Actived)
	.Execute()
  End With
  If VoteCmd(0) = 40 Then
     EL_Common.ShowErrorMsg("指定调查不存在")
	 Set VoteCmd = Nothing
	 Exit Sub
  End If
  If UpdateType = 0 Then
     VoteID = VoteCmd(2)
	 Set VoteCmd = Nothing
	 EL_Common.ShowSuccessMsg("添加调查成功!<br>主题:"& EL_Common.ServerHTMLEncode(Title) &"【<a href='"& EL_CurrentScriptName &"'>调查管理</a>】【<a href='"& EL_CurrentScriptName &"?Action=Modify&VoteID="& VoteID &"'>修改信息</a>】【<a href='"& EL_CurrentScriptName &"?Action=Add'>添加调查</a>】")
  ElseIf UpdateType = 1 Then
     Set VoteCmd = Nothing
     EL_Common.ShowSuccessMsg("修改调查成功!<br>主题:"& EL_Common.ServerHTMLEncode(Title) &"【<a href='"& EL_CurrentScriptName &"'>调查管理</a>】【<a href='"& EL_CurrentScriptName &"?Action=Modify&VoteID="& VoteID &"'>修改信息</a>】【<a href='"& EL_CurrentScriptName &"?Action=Add'>添加调查</a>】")
  Else
     Set VoteCmd = Nothing
	 If ComeURL = "" Then ComeURL = "Admin_Vote.asp"
	 Response.Redirect ComeURL
  End If 
  EL_Common.ShowScriptError()
End Sub

Sub ShowVote()
On Error Resume Next
Dim VoteCmd, rsVote, VoteID
Dim ArrDate(10, 1), Length, i, tmp, TotalNum, Percent

VoteID = EL_Common.ELRequest("VoteID", 2)
Call EL_Common.InitCommonCmd(VoteCmd, rsVote, "EL_Vote", "*", "VoteID="& VoteID &" And TopicID=0")

rsVote.Close()

If VoteCmd(0) <> 1 Then
   EL_Common.ShowErrorMsg("指定调查不存在")
   Set rsVote = Nothing
   Set VoteCmd = Nothing
   Exit Sub
End If
rsVote.Open()
TotalNum = 0
length = 0
For i = 1 To 10
   tmp = rsVote("Options"& i)
   If tmp <> "" And Not IsNULL(tmp) Then
      ArrDate(i, 0) = tmp
	  ArrDate(i, 1) = rsVote("Ballot"& i)
	  TotalNum = TotalNum + ArrDate(i, 1)
	  length = length + 1
   End If
Next

CurrentPath = CurrentPath &">> 查看调查信息"
%>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td width="95%"><%=CurrentPath%></td>
    <td width="5%" nowrap style="padding-right:5px;">总票数:<span class="redText"><%=TotalNum%></span></td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="Border">
  <tr>
    <td colspan="4" class="top_25"><strong>查看调查:<%=EL_Common.ServerHTMLEncode(rsVote("Title"))%></strong></td>
  </tr>
  <tr>
    <td class="td_ItemName"><strong>调查项目</strong></td>
    <td class="td_ItemName"><strong>票数</strong></td>
    <td class="td_ItemName"><strong>百分比</strong></td>
    <td class="td_ItemName"><strong>图示</strong></td>
  </tr>
  <%
   For i = 1 To length
      If TotalNum = 0 Then
	     Percent = "0.00%"
	  Else
	     Percent = FormatNumber(ArrDate(i, 1)/TotalNum*100, 2, -1) &"%"
	  End If
  %>  
  <tr>
    <td width="26%" class="item_25"><%=EL_Common.ServerHTMLEncode(ArrDate(i, 0))%></td>
    <td width="20%" class="item_25"><%=ArrDate(i, 1)%></td>
    <td width="27%" class="item_25"><%=Percent%></td>
    <td width="27%" class="item_25"><div style="width:<%=Percent%>; background:blue; font-size:xx-small; color:blue; height:8px;"><img src="Images/blank.gif"></div></td>
  </tr>
  <%
   Next
  %>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td height="50" align="center"><input type="submit" name="Submit4" value=" 返 回 " onClick="history.back();"></td>
  </tr>
</table>
<%
rsVote.Close()
Set rsVote = Nothing
Set VoteCmd = Nothing
EL_Common.ShowScriptError()
End Sub

Sub ModifyVote()
On Error Resume Next
Dim VoteCmd, rsVote
Dim VoteID, OptionIndex

VoteID = EL_Common.ELRequest("VoteID", 2)

Call EL_Common.InitCommonCmd(VoteCmd, rsVote, "EL_Vote", "*", "VoteID="& VoteID &" And TopicID=0")
rsVote.Close()
If VoteCmd(0) <> 1 Then
   EL_Common.ShowErrorMsg("指定调查不存在")
   Set rsVote = Nothing
   Set VoteCmd = Nothing
   Exit Sub
End If
rsVote.Open()
CurrentPath = CurrentPath &">> 修改调查"
%>
<script language="javascript">function Check(frm){
  if(frm.Title.value.trim()==""){
     alert("请输入调查主题");
	 frm.Title.focus();
	 return false;
  }
  
  SubmitOnce(frm);
  return;
}
</script>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td><%=CurrentPath%></td>
  </tr>
</table>
<form name="myform" action="Admin_Vote.asp" method="post" onSubmit="return Check(this)">
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="Border">
  <tr>
    <td colspan="4" class="top_25"><strong>修改调查</strong></td>
  </tr>
  <tr>
    <td width="16%" class="td_ItemName"><strong>调查主题</strong></td>
    <td colspan="3" class="td_25"><input name="Title" type="text" id="Title" value="<%=EL_Common.HTMLEncode(rsVote("Title"))%>" size="70"></td>
  </tr>
  <tr>
    <td class="td_ItemName"><strong>调查类型</strong></td>
    <td colspan="3" class="td_25"><input name="VoteType" type="radio" class="nomargin" value="0" <%=EL_Common.SetObjectChecked(0, rsVote("VoteType").value)%>>
      单选
        <input name="VoteType" type="radio" class="nomargin" value="1" <%=EL_Common.SetObjectChecked(1, rsVote("VoteType").value)%>>
    多选</td>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -