📄 admin_subcate.asp
字号:
<!--#include file="Config.asp" -->
<HTML><HEAD><TITLE>小类管理 </TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<meta name=keywords content="视听新时空(网络电视,网络广播,免费电影:全球最大的中文网络电视,广播网站)">
<link rel="stylesheet" href="admin.css" type="text/css">
</HEAD>
<SCRIPT LANGUAGE=javascript>
<!--
function Juge(myform)
{
if (myform.SubCateName.value == "")
{
alert("小类名称不能为空!");
myform.SubCateName.focus();
return (false);
}
if (myform.CateID.value == "")
{
alert("所属大类没有选择!");
myform.CateID.focus();
return (false);
}
}
function SelectAll() {
for (var i=0;i<document.selform.selSubCateID.length;i++) {
var e=document.selform.selSubCateID[i];
e.checked=!e.checked;
}
}
//-->
</script>
<BODY leftMargin=0>
<% dim sql,rs,subrs
if not isnull(UserName) and UserName<>"" then
if chkMaster(UserName) then
select case request("action")
case "add"
call SaveAdd()
case "modify"
call SaveModify()
case "del"
call delSubCate()
case "edit"
isEdit=True
call myform(isEdit)
case else
isEdit=False
call myform(isEdit)
end select
else
msgtitle="小类管理"
msginfo="<li>操作错误,你不是系统管理员,没有权限进行此项操作!</li>"
call Sysmsg(msgtitle,msginfo)
end if
else
msgtitle="小类管理"
msginfo="<li>操作错误,你没有登录系统!<li><a href=""User.Asp"" class=""ArticleList"">点此登录系统</a><li><a href=""./"" class=""ArticleList"">返回频道首页</a></li>"
call Sysmsg(msgtitle,msginfo)
end if
sub SaveAdd
msgtitle="添加小类"
if Trim(Request.Form("SubCateName"))="" or Trim(Request.Form("CateID"))="" then
msginfo="添加小类时出现错误,小类名称没有填写或者所属大类没有选择!"
else
set rs=server.createobject("adodb.recordset") '检查版面是否重名
rs.open "select * from "&CategoryName&"_SubCate where SubCateName='"&trim(request("SubCateName"))&"'",conn,1,1
if not(rs.bof and rs.eof) then
msginfo="添加小类时出现错误,已经有相同名称的小类已存在!"
else
sql="insert into "&CategoryName&"_SubCate(SubCateName,CateID) values('" & trim(request("SubCateName")) & "'," & cstr(request("CateID")) & ")"
conn.execute sql
msginfo="添加成功,<a href=""Admin_SubCate.asp"" class=""ArticleList"">点此继续添加分类</a>!"
end if
rs.close
set rs=nothing
end if
call Sysmsg(msgtitle,msginfo)
end sub
sub SaveModify()
msgtitle="修改小类"
if Trim(Request.Form("SubCateName"))="" or Trim(Request.Form("CateID"))="" then
msginfo="修改小类时出现错误,小类名称没有填写或者所属大类没有选择!"
else
set rs=server.createobject("adodb.recordset") '检查版面是否重名
rs.open "select * from "&CategoryName&"_SubCate where SubCateName='"&trim(request("SubCateName"))&"'",conn,1,1
if not(rs.bof and rs.eof) then
msginfo="修改小类时出现错误,已经有相同名称的小类已存在!"
else
sql="update "&CategoryName&"_SubCate set SubCateName='" &trim(request("SubCateName")) & "',CateID="&request("CateID")&" where SubCateID=" & request("SubCateID")
conn.execute sql
sql="update "&CategoryName&"_SoftInfo set CateID=" & request("CateID") & " where SubCateID=" &request("SubCateID")
conn.execute sql
msginfo="修改成功,<a href=""Admin_SubCate.asp"" class=""ArticleList"">点此返回小类管理页面</a>!"
end if
rs.close
set rs=nothing
end if
call Sysmsg(msgtitle,msginfo)
end sub
sub delSubCate()
msgtitle="删除小类"
conn.execute("delete from "&CategoryName&"_SubCate where SubCateID in ("&Request.Form("selSubCateID")&")")
'删除该分类下的全部节目
conn.execute("delete from "&CategoryName&"_SoftInfo where SubCateID in ("&Request.Form("selSubCateID")&")")
msginfo="删除操作成功,该分类相关信息已全部删除,<a href=""Admin_SubCate.asp"">点此返回小类管理页面</a>!"
call Sysmsg(msgtitle,msginfo)
end sub
%> <% sub myform(isEdit) %>
<table width="95%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableBorder">
<tr>
<th>
<%
set Rs=server.createobject("adodb.recordset")
set SubRs=server.createobject("adodb.recordset")
if isedit then
rs.open "select * from "&CategoryName&"_SubCate where SubCateID=" & request("SubCateID"),conn,1,1
response.write "编辑小类"
else
response.write "添加小类"
end if %></th>
</tr>
<form name="myform" method="post" action="Admin_SubCate.asp" onSubmit="return Juge(this)" >
<tr>
<td align="center" class="forumRow" >
<input type="Hidden" name="action" value='<% If isedit then%>modify<% Else %>add<% End If %>'>
<%If isedit then%> <input type="Hidden" name="SubCateID" value='<%=request("SubCateID")%>'>
<%End If%>
小类名称:
<input type="text" name="SubCateName" maxlength=40 size="12" value="<% if isedit then
response.write rs("SubCateName")
end if %>">
所属大类:
<select name="CateID">
<option value="">请选择...</option>
<%
SubRs.open "select * from "&CategoryName&"_Cate order by CateID",conn,1,1
if not(SubRs.bof and SubRs.eof) then
do while not SubRs.eof
if isedit then %>
<option value="<%=SubRs("CateID")%>" <% if trim(rs("CateID"))=trim(SubRs("CateID")) then
response.write "selected"
end if %>><%=SubRs("CateName")%></option>
<% else %>
<option value="<%=SubRs("CateID")%>"><%=SubRs("CateName")%></option>
<%
end if
SubRs.movenext
loop
end if
SubRs.close
%>
</select> <input name="submit" type=submit value="确 定"> </td>
</tr>
</form>
<form name="selform" method="post" action="Admin_SubCate.asp" >
<% if isedit then rs.close
rs.open "select * from "&CategoryName&"_Cate order by CateID asc",conn,1,1
if not(rs.bof and rs.eof) then
do while not rs.eof %>
<tr>
<td class="forumRowHighlight"> <strong><%=rs("CateName")%></strong> </td>
</tr>
<tr>
<td class="forumRow" >
<% SubRs.open "select * from "&CategoryName&"_SubCate where CateID="&Rs("CateID")&" order by SubCateID asc",conn,1,1
if err.number <> 0 then
response.write "数据库出错"
else
if SubRs.bof and SubRs.eof then
response.write "没有添加小类"
else
i=1
do while not SubRs.eof
%> <input type="checkbox" name="selSubCateID" value="<%=SubRs("SubCateID")%>"><a href="Admin_SubCate.asp?SubCateID=<%=SubRs("SubCateID")%>&action=edit" class="ArticleList"><%=SubRS("SubCateName")%></a> <% if (i mod 7)=0 then response.write "<br>"
i=i+1
SubRs.movenext
loop
end if
end if
SubRs.close
%> </td>
</tr>
<% rs.movenext
loop
end if
rs.close
set subrs=nothing
set rs=nothing
%>
<tr>
<td class="forumRow">管理操作:选择/反选
<input type="checkbox" name="checkbox" value="checkbox" onClick="javascript:SelectAll()">
<input onClick="{if(confirm('此操作同时将删除该分类下的全部节目!\n\n确定要执行此项操作吗?')){this.document.selform.submit();return true;}return false;}" type=submit value=删除 name=action2>
<input type="Hidden" name="action" value='del'>
<font color="#FF0000">此操作同时将删除该分类下的全部节目!</font></td>
</tr>
</form>
</table>
<% end sub
sub Sysmsg(msgtitle,msginfo)
%> <br>
<table width="85%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableBorder" >
<tr>
<th><%=msgtitle%></th>
</tr>
<tr>
<td class="forumRow"><%=msginfo%></td>
</tr>
<tr>
<td height="22" align="center" class="forumRowHighlight"><a href="javascript:history.go(-1)" ><<
返回上一页</a></td>
</tr>
</table>
<br> <%end sub %>
</BODY></HTML>
<%
CloseDatabase
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -