📄 admin_vote.asp
字号:
<!--#include file="admin_conn.asp"-->
<!--#include file="../include/admin_setting.asp"-->
<!--#include file="admin_function.asp"-->
<%
''==============================================================
'程序名称:茂盛网站管理系统(Maoin CSM)
'当前版本:Maosin CMS Version 1.1 Powered by maosin.com
'程序作者:阿茂(李胜茂)
'网站地址:www.maosin.com www.maosin.net
' QQ:57861417
'电子邮箱:maosin@163.com maosin@maosin.com
'--------------------------------------------------------------
'Copyright (C) 2006 maosin.com All Rights Reserved.
'免费版本请在程序首页保留(Powered by:Maosin CMS)版权链接信息;
'您可以对此版本进行修改,美化,但请保留此ASP文件内的版权信息;
'茂盛设计网保留此软件的法律追究权利
'==============================================================
Call admin_top()
Call navMenu()
Select Case LCase(Request.QueryString("action"))
Case LCase("voteAdmin")
Call voteAdmin()
Case LCase("addvote")
Call addVote()
Case LCase("editvote")
Call editVote()
Case LCase("delvote")
Call deleteVote()
Case LCase("addItem")'增加投票选项
Call addItem()
Case LCase("saveitemupdate")
Call saveItemUpdate()
Case LCase("delitem")'删除投票选项
Call deleteItem()
Case LCase("isNew")
Call isNewSet()
Case LCase("isLock")
Call isLockSet()
Case Else
Call voteAdmin()
End Select
Call admin_foot()
Sub navMenu()%>
<table width="100%" border="0" cellpadding="4" cellspacing="1" class="text table_border mainTable">
<tr><td colspan="2" class="td_titleT">投票管理</td></tr>
<tr><td width="95" height="30" class="td_bgcolor">管理快捷导航:</td><td class="td_bgcolor"> <a href="admin_vote.asp">投票列表</a> | <a href="admin_vote.asp?action=addvote">添加投票主题</a> </td></tr>
</table>
<%table(5)%>
<%End Sub
Sub voteAdmin()
if getPopedom("voteAdmin")=false then
popedomMsg
exit sub
end if
sql="select * from ms_votetopic order by vt_id desc"
set rs=Server.CreateObject("ADODB.RecordSet")
rs.Open sql,connstr,1,1
%>
<table width="100%" border="0" cellpadding="4" cellspacing="1" class="text table_border mainTable">
<tr><td colspan="7" class="td_titleT">投票管理</td></tr>
<tr class="td_topT" align="center" valign="middle">
<td width="50" height="20">编号ID</td>
<td width="*">投票主题</td>
<td width="60">开始时间</td>
<td width="60">结束时间</td>
<td width="90">当 前 状 态</td>
<td width="90">属 性 设 置</td>
<td width="80">操 作 选 项</td>
</tr>
<%
if not rs.bof and not rs.eof then
dim nextpage,lineNo,getdate,dNum,startDiffD,endDiffD,currStatus,propSet
nextpage=pagetitle(rs,10,"admin_vote.asp?","个投票主题")
lineNo=1
getdate=date
do while Not rs.Eof And lineNo<=rs.PageSize
dNum=cint(DateDiff("d",rs("start_date"),rs("end_date")))
startDiffD=cint(DateDiff("d",rs("start_date"),getdate))
endDiffD=cint(DateDiff("d",getdate,rs("end_date")))
currStatus=""
propSet=""
currStatus="期限:"&dNum&"天<br>进行:"&startDiffD&"天<br>还乘:"&endDiffD&"天"
if rs("isNew")=1 then
vt_name="<font color="""&rs("titlecolor")&""">"&rs("vt_name")&"</font><br><font color=""#6d6d6d"">{首页投票}</font>"
propSet="<a href=""?action=isNew&isNew=no&vt_id="&rs("vt_id")&""" title=""取消设定""><b><font color=""#00648A"">首页投票(√)</font></b></font></a>"
else
vt_name="<font color="""&rs("titlecolor")&""">"&rs("vt_name")&"</font>"
propSet="<a href=""?action=isNew&isNew=yes&vt_id="&rs("vt_id")&""" title=""没为首页投票""><b><font color=""#ff4400"">首页投票(×)</font></b></a>"
end if
if rs("islock")=1 then
propSet=propSet&"<a href=""?action=isLock&isLock=no&vt_id="&rs("vt_id")&""" title=""立即锁定""><br><b><font color=""#00648A"">立即锁定(√)</font></b></a>"
else
propSet=propSet&"<a href=""?action=isLock&isLock=yes&vt_id="&rs("vt_id")&""" title=""解除锁定""><br><b><font color=""#ff4400"">立即激活(<font color=""#ff4400"">×</font>)</b></a>"
end if
if rs("start_date")>getdate and rs("end_date")>getdate then
currStatus="<font color=""#ff4400"">准备就绪……</font>"
elseif rs("end_date")=<getdate then
currStatus="<font color=""#6D6D6D"">已经过期</font>"
elseif rs("start_date")<=getdate and rs("end_date")>getdate then
if rs("isLock")=1 then
currStatus="<font color=""#00648A"">期限:"&dNum&" 天<br>进行:"&startDiffD&" 天<br>还乘:"&endDiffD&" 天</font>"
else
currStatus="<font color=""#ff4400"">已被锁定</font>"
end if
end if
%>
<tr align="center" valign="middle" class="td_bgcolor" onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
<td><%=rs("vt_id")%></td>
<td align="left"><%=vt_name%></td>
<td><%=rs("start_date")%></td>
<td><%=rs("end_date")%></td>
<td align="left" style="color:#6D6D6D;line-height:15px;"><%=currStatus%></td>
<td align="left" style="color:#6D6D6D;line-height:16px;"><%=propSet%></td>
<td>
<a href="admin_vote.asp?action=editvote&vt_id=<%=rs("vt_id")%>&vt_name=<%=rs("vt_name")%>">编辑</a>
<a href="javascript:" onclick="javascript:{if(confirm('您确定要删除此项目吗?')){window.location.href='admin_vote.asp?action=delvote&vt_id=<%=rs("vt_id")%>';}return false;}">删除</a></td>
</tr>
<%rs.MoveNext
lineNo=lineNo+1
Loop%>
<tr><td colspan="7" class="td_titleB">
<%=(nextpage)%>
</td></tr>
<%else%>
<tr><td colspan="7" class="td_bgcolor">
当前没有任何投票!
</td></tr>
<%end if%>
</table>
<%rs.close
set rs=nothing
End Sub
Sub addVote()
if getPopedom("voteAdmin")=false then
popedomMsg
exit sub
end if
If request.form("addvote")<>"" Then
dim vt_name,titlecolor,start_date,end_date,isNew,sql
vt_name=filterHtml(chkFormStr(trim(request.form("vt_name"))))
titlecolor=chkColor(trim(request.form("titlecolor")))
start_date=trim(request.form("start_date"))
end_date=trim(request.Form("end_date"))
if chkFormatDate(end_date)=false or chkFormatDate(start_date)=false then
adminShowMsg "操作出错信息","日期格式不对!"
exit sub
end if
if cdate(end_date)<cdate(start_date) then
adminShowMsg "操作出错信息","投票“结束时间”不能小于“开始时间”"
exit sub
end if
if vt_name="" or len(vt_name)>30 then
adminShowMsg "操作出错信息","投票主题不能为空 或者 大于 30 个字符<br><font color=""#ff0000"">投票主题如果包含HTML语句,系统会自动清除</font>"
exit sub
end if
if request.form("isNew")="" then
isNew=0
else
isNew=1
end if
if request.form("islock")="" then
isLock=0
else
isLock=1
end if
if isNew=1 then
conn.execute("update ms_votetopic set isNew=0")
end if
sql="insert into ms_votetopic(vt_name,titlecolor,start_date,end_date,isNew,isLock) values('"&vt_name&"','"&titlecolor&"',#"&start_date&"#,#"&end_date&"#,"&isNew&","&isLock&")"
conn.execute(sql)
adminShowMsg "成功信息","恭喜恭喜,已成功添加一个新的投票主题<p>您可以:[<a href=""admin_vote.asp"" style=""color:#ff0000"">返回主题列表</a>],[<a href=""admin_vote.asp?action=addvote"" style=""color:#ff0000"">继续添加</a>]</p><br>"
exit sub
End If
%>
<table width="100%" border="0" cellpadding="3" cellspacing="1" class="text table_border mainTable">
<tr><td colspan="2" class="td_titleT">增加投票主题</td></tr>
<form name="voteform" action="?action=addVote" method="post">
<tr valign="middle" align="center" class="td_bgcolor">
<td width="30%" align="right">主题名称:</td>
<td align="left"> <input type="text" name="vt_name" size="40">
<select name="titlecolor" onChange="titlecolor.value=this.value;">
<option value="#000000">选择颜色</option>
<%
dim colorStr,i
colorStr=split(colorRS,",")
for i=0 to ubound(colorStr)
Response.Write ("<option style=""background-color:"& colorStr(i) &";color: "& colorStr(i) &""" value="""&colorStr(i)&""">"&colorStr(i)&"</option>")
next
%>
</select></td>
</tr>
<tr valign="middle" align="center" class="td_bgcolor">
<td width="30%" align="right">开始时间:</td>
<td align="left"> <input type="text" name="start_date" value="<%=date()%>" size="20"> 格式:如 2006-5-30</td>
</tr>
<tr valign="middle" align="center" class="td_bgcolor">
<td width="30%" align="right">结束时间:</td>
<td align="left"> <input type="text" name="end_date" size="20"></td>
</tr>
<tr valign="middle" align="center" class="td_bgcolor">
<td width="30%" align="right">属性:</td>
<td align="left"> <input type="checkbox" value="1" name="isNew" id="isNew"><label for="isNew">设为首页投票</label>
<input type="checkbox" value="1" name="isLock" id="isLock" checked><label for="isLock">立即激活</label></td>
</tr>
<tr align="center" valign="middle" class="td_titleB">
<td height="27" colspan="2"> <input type="submit" name="addvote" value="确定增加"> <input type="reset" name="Submit2" value="清除重写"></td>
</tr>
</form>
</table>
<%End Sub
Sub editVote()
if getPopedom("voteAdmin")=false then
popedomMsg
exit sub
end if
If request.form("editvote")<>"" Then
dim vt_id,vt_name,titlecolor,start_date,end_date,isNew,sql
vt_id=request.form("vt_id")
vt_name=filterHtml(chkFormStr(trim(request.form("vt_name"))))
titlecolor=chkColor(trim(request.form("titlecolor")))
start_date=trim(request.form("start_date"))
end_date=trim(request.Form("end_date"))
if isNumeric(vt_id)=false then
adminShowMsg "操作出错信息","ID编号不正确"
exit sub
end if
if cdate(end_date)<cdate(start_date) then
adminShowMsg "操作出错信息","投票“结束时间”不能小于“开始时间”"
exit sub
end if
if chkFormatDate(end_date)=false or chkFormatDate(start_date)=false then
adminShowMsg "操作出错信息","日期格式不对!"
exit sub
end if
if vt_name="" or len(vt_name)>30 then
adminShowMsg "操作出错信息","投票主题不能为空 或者 大于 30 个字符<br><font color=""#ff0000"">投票主题如果包含HTML语句,系统会自动清除</font>"
exit sub
end if
if request.form("isNew")="" then
isNew=0
else
isNew=1
end if
if request.form("islock")="" then
isLock=0
else
isLock=1
end if
if isNew=1 then
conn.execute("update ms_votetopic set isNew=0")
end if
sql="update ms_votetopic set vt_name='"&vt_name&"',titlecolor='"&titlecolor&"',start_date=#"&start_date&"#,end_date=#"&end_date&"#,isNew="&isNew&",isLock="&isLock&" where vt_id="&vt_id
conn.execute(sql)
adminShowMsg "成功信息","恭喜恭喜,投票主题修改成功"
exit sub
End If
dim rs
set rs=conn.execute("select * from ms_votetopic where vt_id="&request.querystring("vt_id"))
if rs.eof and rs.bof then
response.write("<script>alert('没有此主题,可能已经删除了');</script>")
rs.close
set rs=nothing
else
vt_id=rs(0)
vt_name=rs(1)
titlecolor=rs(2)
start_date=rs(3)
end_date=rs(4)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -