📄 admin_vote.asp
字号:
isNew=rs(5)
isLock=rs(6)
end if
rs.close
set rs=nothing
%>
<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=editVote" 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" value="<%=vt_name%>" size="40"><input type="hidden" name="vt_id" value=<%=vt_id%>>
<select name="titlecolor" onChange="titlecolor.value=this.value;">
<option style="background-color:<%=titlecolor%>;color:<%=titlecolor%> " value="<%=titlecolor%>"><%=titlecolor%></option>
<%
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="<%=start_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" value="<%=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" name="isNew" <%if isNew=1 then response.write("checked") end if%>><label for="isNew">设为首页投票</label>
<input type="checkbox" value="1" name="isLock" id="isLock" <%if islock=1 then response.write("checked") end if%>><label for="isLock">立即激活</label></td>
</tr>
<tr align="center" valign="middle" class="td_titleB">
<td height="27" colspan="2"> <input type="submit" name="editvote" value="保存修改"> <input type="reset" name="Submit2" value="清除重写"></td>
</tr>
</form>
</table>
<%
Call table(5)
Call itemUpdate()
End Sub
Sub itemUpdate()
if getPopedom("voteAdmin")=false then
popedomMsg
exit sub
end if
dim vt_id,sql
vtID=request("vt_id")
sql="select * from ms_voteitem where vt_id="&vtID
set rs=Server.CreateObject("ADODB.RecordSet")
rs.Open sql,connstr,1,1
%>
<table width="100%" border="0" cellpadding="3" cellspacing="1" class="text table_border mainTable">
<tr>
<td width="100%" height="28" valign="middle" colspan="5" class="td_titleT">投票选项 <a style="color:#ffffff;" href="javascript:showadd()">新增投票选项</a></td>
</tr>
<tr align="center" valign="middle" class="td_topT">
<td width="10%" height="20">序号</td>
<td width="35%">选项名</td>
<td width="15%">选项颜色</td>
<td width="15%">票数</td>
<td width="25%">操 作 选 项</td>
</tr>
<form action="?action=addItem" name="newItmeForm" method="post">
<tr id="addpro" style="display:none;" align="center" onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)" valign="middle" class="td_bgcolor">
<td width="10%"><input type="hidden" name="vtID" value="<%=vtID%>"/></td>
<td width="35%"><input type="text" class="wenbenkang" name="newItemName" size="30"></td>
<td width="15%">
<select name="newItemColor">
<option value="#000000" selected>请选择颜色</option>
<%
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>
<td width="15%"><input type="text" value="0" class="wenbenkang" name="newItemCount"></td>
<td width="25%"><input type="submit" name="saveItem" value="保存"/></td>
</tr>
</form>
<form action="?action=saveitemupdate&vtID=<%=vtID%>" method="post" name="ItemForm">
<%If Not rs.Eof and Not rs.Bof Then
dim j:j=1
Do While Not rs.Eof
item_id=rs("item_id")
%>
<tr align="center" onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)" valign="middle" class="td_bgcolor">
<td width="10%"><%=j%><input type="hidden" name="itemID" value="<%=rs("item_id")%>"/></td>
<td width="35%"><input type="text" class="wenbenkang" name="itemName" value="<%=rs("item_name")%>" size="30"></td>
<td width="15%">
<select name="itemColor">
<option value="<%=rs("item_color")%>" style="background-color:<%=rs("item_color")%>" selected><%=rs("item_color")%></option>
<%
dim i,colorStr
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>
<td width="15%"><input type="text" class="wenbenkang" name="itemCount" value="<%=rs("item_count")%>"></td>
<td width="25%">
<button onClick="javascript:{if(confirm('您确定要删除此项目吗?')){window.location.href='admin_vote.asp?action=delitem&item_id=<%=rs("item_id")%>';}return false;}">删除</button>
</td>
</tr>
<%rs.MoveNext
j=j+1
Loop%>
<tr>
<td width="100%" height="28" align="center" valign="middle" colspan="5" class="td_titleB"><input type="submit" name="saveItem" value="保存更新"> <input type="button" onclick="javascript:window.location.reload();" value="刷新本页"/></td>
</tr>
</form>
<%Else%>
<tr align="center" valign="middle" class="td_bgcolor"><td colspan="5">还没添加投票选项,点击此处 [<a style="color:#ff4444;" href="javascript:showadd()">增加投票选项</a>] !</td></tr>
<%End If%>
</table>
<script language="javascript">
function showadd(){
if(document.all("addpro").style.display=="block"){
document.all("addpro").style.display="none";
}else{
document.all("addpro").style.display="block";
}
}
</script>
<%rs.close
Set rs=Nothing
End Sub
Sub saveItemUpdate
if getPopedom("voteAdmin")=false then
popedomMsg
exit sub
end if
dim vtID,itemIDCount,i,itemID,itemName,itemColor,itemCount
vtID=Request("vtID")
itemIDCount=Request("itemID").count
for i=1 to itemIDCount
itemID=trim(Request("itemID")(i))
itemName=trim(Request("itemName")(i))
itemColor=chkColor(trim(Request("itemColor")(i)))
itemCount=trim(Request("itemCount")(i))
if itemName="" or len(itemName)>30 then
adminShowMsg "操作出错信息","投票选项名不能为空 或者 大于 30 个字符<br><font color=""#ff0000"">投票名如果包含HTML语句,系统会自动清除</font>"
exit sub
end if
if itemID="" then
adminShowMsg "操作出错信息","选项ID不能为空"
exit sub
elseif isNumeric(itemID)="" then
adminShowMsg "操作出错信息","选项ID应为数字型整型"
exit sub
end if
if itemcount="" then
itemCount=0
elseif isNumeric(itemcount)=false then
adminShowMsg "操作出错信息","票数应为数字型整型"
exit sub
end if
conn.execute("update ms_voteitem set item_name='"&itemName&"',item_count="&itemCount&",item_color='"&itemColor&"' where item_id="&itemID)
next
if itemIDCount<>0 then
adminShowMsg "操作成功信息","恭喜恭喜,保存更新成功"
exit sub
else
response.write("<script>window.history.go(-1);window.history.go(0);</script>")
end if
End Sub
Sub addItem()
if getPopedom("voteAdmin")=false then
popedomMsg
exit sub
end if
dim vtID,itemName,itemColor,itemCount,sql
vtID=trim(request("vtID"))
itemName=filterHtml(chkFormStr(trim(request("newItemName"))))
itemColor=chkColor(trim(request("newItemColor")))
itemCount=trim(request("newItemCount"))
if itemName="" or len(itemName)>30 then
adminShowMsg "操作出错信息","投票选项名不能为空 或者 大于 30 个字符<br><font color=""#ff0000"">投票名如果包含HTML语句,系统会自动清除</font>"
exit sub
end if
if vtID="" then
adminShowMsg "操作出错信息","主题编号不能为空"
exit sub
elseif isNumeric(vtID)="" then
adminShowMsg "操作出错信息","主题编号应为数字型整型"
exit sub
end if
if itemcount="" then
itemCount=0
elseif isNumeric(itemcount)=false then
adminShowMsg "操作出错信息","票数应为数字型整型"
exit sub
end if
sql="insert into ms_voteitem(vt_id,item_name,item_count,item_color) values("&clng(vtID)&",'"&itemName&"',"&clng(itemCount)&",'"&itemColor&"')"
conn.execute(sql)
adminShowMsg "操作成功信息","恭喜恭喜,新投票选项添加成功"
exit sub
End Sub
Sub deleteItem()
if getPopedom("voteAdmin")=false then
popedomMsg
exit sub
end if
sql="delete from ms_voteitem where item_id="&request.querystring("item_id")
conn.execute(sql)
adminShowMsg "操作成功信息","恭喜恭喜,投票选项删除成功"
End Sub
Sub deleteVote()
if getPopedom("voteAdmin")=false then
popedomMsg
exit sub
end if
sql="delete from ms_votetopic where vt_id="&request.querystring("vt_id")
conn.execute(sql)
adminShowMsg "操作成功信息","投票删除成功"
End Sub
Sub isNewSet()
if getPopedom("voteAdmin")=false then
popedomMsg
exit sub
end if
vt_id=Request.QueryString("vt_id")
if isNumeric(vt_id)=false then
adminShowMsg "操作出错","ID编号应为一个整形参数"
exit sub
end if
if Request.QueryString("isNew")="no" then
conn.execute("update ms_votetopic set isNew=0")
conn.execute("update ms_votetopic set isNew=0 where vt_id="&cint(vt_id))
response.redirect request.servervariables("HTTP_REFERER")
elseif Request.QueryString("isNew")="yes" then
conn.execute("update ms_votetopic set isNew=0")
conn.execute("update ms_votetopic set isNew=1 where vt_id="&cint(vt_id))
response.redirect request.servervariables("HTTP_REFERER")
end if
End Sub
Sub isLockSet()
if getPopedom("voteAdmin")=false then
popedomMsg
exit sub
end if
vt_id=Request.QueryString("vt_id")
if isNumeric(vt_id)=false then
adminShowMsg "操作出错","ID编号应为一个整形参数"
exit sub
end if
if Request.QueryString("isLock")="no" then
conn.execute("update ms_votetopic set isLock=0 where vt_id="&cint(vt_id))
response.redirect request.servervariables("HTTP_REFERER")
elseif Request.QueryString("isLock")="yes" then
conn.execute("update ms_votetopic set isLock=1 where vt_id="&cint(vt_id))
response.redirect request.servervariables("HTTP_REFERER")
end if
End Sub
'========================================================
'MaoSin CMS 1.1 Power by maosin.com
'Email: maosin@163.com , maosin@maosin.com
'Web: http://www.maosin.com http://www.maosin.net
'Copyright (C) 2006 maosin.com All Rights Reserved.
'========================================================
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -