📄 class.asp
字号:
<!--#include file="i_login.asp" -->
<%
mode=request("mode")
select case mode
case "add"
call add_sub()
case "edit"
call edit_sub()
case "del"
call del_sub()
case "order"
call order_sub()
end select
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>信息分类</title>
<script type="text/javascript" src="../inc/functions.js"></script>
<LINK href="images/style.css" type=text/css rel=stylesheet>
<script>
function chk(form)
{
if(form.name.value==""){
alert("请填写目录名!");
form.name.focus();
return false;
}
else
{
return true;
}
}
</script>
</head>
<body><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="26" class="gray"> CMS >> 作品分类</td>
</tr>
</table>
<br>
<%
select case mode
case "xiugai"
dim request_id
request_id=cint(trim(request("id")))
set rs=conn.execute("select * from data_class where id="&request_id&"")
%>
<table border="1" align="center">
<form name="form_xiugai" method="post" action="?" onSubmit="return chk(this);">
<input type="hidden" name="mode" value="edit">
<input type="hidden" name="id" value="<%=rs("id")%>">
<tr>
<td align="center" nowrap bgcolor="#EAEAEA">目录名</td>
<td nowrap>
<input name="name" type="text" class="input" value="<%=rs("name")%>"></td>
</tr>
<tr>
<td align="center" nowrap bgcolor="#EAEAEA">IE标题</td>
<td nowrap><input name="title" type="text" class="input" id="title" value="<%=rs("title")%>"></td>
</tr>
<tr>
<td align="center" nowrap bgcolor="#EAEAEA">所属目录</td>
<td nowrap>
<select name="classid">
<%site_class_showpid 0," "%>
<script>document.getElementById('classid').value='<%=rs("classid")%>';</script>
</select>
<span onClick="javascript:showList(show);" style="cursor:pointer;color:#0000ff;">详细信息↓</span></td>
</tr>
<tr align="center" id="show" style="display:none;">
<td colspan="2" align="center" nowrap bgcolor="#FFFFFF" ><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10%" align="center" bgcolor="#E8F8FF">关键字</td>
<td width="90%" align="left"><label>
<textarea name="keywords" cols="45" rows="5" class="input" id="keywords"><%=rs("keywords")%></textarea>
</label></td>
</tr>
<tr>
<td align="center" bgcolor="#E8F8FF">描述</td>
<td align="left"><textarea name="Description" cols="45" rows="5" class="input" id="Description"><%=rs("Description")%></textarea></td>
</tr>
</table></td>
</tr>
<tr align="center">
<td colspan="2" nowrap><input type="submit" name="Submit" value=" 保 存 "></td>
</tr></form>
</table>
<%
rs.close
set rs=nothing
case else
%>
<table border="1" align="center">
<form name="form_add" method="post" action="?" onSubmit="return chk(this);">
<input type="hidden" name="mode" value="add">
<tr>
<td align="center" nowrap bgcolor="#EAEAEA">目录名</td>
<td nowrap>
<input name="name" type="text" class="input"></td>
</tr>
<tr>
<td align="center" nowrap bgcolor="#EAEAEA">IE标题</td>
<td nowrap><input name="title" type="text" class="input" id="title"></td>
</tr>
<tr>
<td align="center" nowrap bgcolor="#EAEAEA">所属目录</td>
<td nowrap>
<select name="classid">
<%site_class_showpid 0," "%>
<script>document.getElementById('classid').value='<%=session("temp_class_classid")%>';</script>
</select> <span onClick="javascript:showList(show);" style="cursor:pointer; color:#0000ff">详细信息↓</span></td>
</tr>
<tr align="center" id="show" style="display:none;">
<td colspan="2" nowrap><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10%" align="center" bgcolor="#E8F8FF">关键字</td>
<td width="90%" align="left"><label>
<textarea name="keywords" cols="45" rows="5" class="input" id="keywords"></textarea>
</label></td>
</tr>
<tr>
<td align="center" bgcolor="#E8F8FF">描述</td>
<td align="left"><textarea name="Description" cols="45" rows="5" class="input" id="Description"></textarea></td>
</tr>
</table></td>
</tr>
<tr align="center">
<td colspan="2" nowrap><input type="submit" name="Submit" value=" 添 加 "></td>
</tr></form>
</table>
<%
end select
%>
<hr>
<%
site_class_show 0
%>
</body>
</html>
<%
conn.close
set conn=nothing
'--------------------------------------mode 添加 修改 删除
sub order_sub
dim request_id,request_flag,i,request_classid,temp_orderby
request_flag=request("flag")
request_id=cint(trim(request("id")))
request_classid=cint(trim(request("classid")))
'初始化
set rs=server.CreateObject("adodb.recordset")
rs.open "select orderby from data_class where classid="&request_classid&" order by orderby,id",conn,1,2
i=0
while not rs.eof
i=i+1
rs("orderby")=i
rs.update
rs.movenext
wend
rs.close
'排列
rs.open "select orderby from data_class where id="&request_id&" ",conn,1,2
if not rs.eof then
temp_orderby=rs("orderby")
if request_flag="up" then
conn.execute("update data_class set orderby=orderby+1 where orderby="&temp_orderby-1&" and classid="&request_classid&" ")
rs("orderby")=rs("orderby")-1
elseif request_flag="down" then
conn.execute("update data_class set orderby=orderby-1 where orderby="&temp_orderby+1&" and classid="&request_classid&" ")
rs("orderby")=rs("orderby")+1
end if
rs.update
end if
rs.close
set rs=nothing
end sub
sub add_sub()
dim request_name,request_classid,request_title
dim request_keywords,request_Description
request_classid=cint(request.Form("classid"))
request_name=trim(request.Form("name"))
request_title=trim(request.Form("title"))
request_keywords=trim(request.Form("keywords"))
request_Description=trim(request.Form("Description"))
if request_name="" then
call msg("未填写完整!","-1")
end if
session("temp_class_classid")=request_classid
conn.execute("insert into data_class(name,title,classid,orderby,keywords,Description) VALUES('"&request_name&"','"&request_title&"',"&request_classid&",1000,'"&request_keywords&"','"&request_Description&"')")
end sub
sub edit_sub()
dim request_id,request_name,request_classid,request_title
dim request_keywords,request_Description
request_id=cint(trim(request.Form("id")))
request_classid=cint(request.Form("classid"))
request_name=trim(request.Form("name"))
request_title=trim(request.Form("title"))
request_keywords=trim(request.Form("keywords"))
request_Description=trim(request.Form("Description"))
if request_name="" and request_name_en="" then
call msg("未填写完整!","-1")
end if
conn.execute("update data_class set name='"&request_name&"',title='"&request_title&"',classid="&request_classid&",keywords='"&request_keywords&"',Description='"&request_Description&"' where id="&request_id&"")
'更新classnames
set rs=conn.execute("select id from data_class where id in ("&get_sids(request_id)&")")
while not rs.eof
conn.execute("update data_product set classnames='"&get_classnames(rs("id"))&"' where classid="&rs("id")&"")
rs.movenext
wend
rs.close
set rs=nothing
end sub
sub del_sub()
dim request_id,ids,rs
request_id=cint(trim(request("id")))
if request_id<>"" then
ids=get_sids(request_id)
conn.execute("delete from data_class where id in ("&ids&")")
set rs=server.CreateObject("adodb.recordset")
rs.open "select img,img_s from data_product where classid in ("&ids&")",conn,1,2
while not rs.eof
if trim(rs(0))<>"" then
if localhost(rs(0)) then
call del_file(rs(0))
end if
end if
if trim(rs(1))<>"" then
if localhost(rs(1)) then
call del_file(rs(1))
end if
end if
rs.delete
rs.movenext
wend
rs.close
set rs=nothing
end if
end sub
'--------------------------------------显示所属目录
function site_class_showpid(byval classid,byval str)
dim rs,request_id
if str=" " then
response.Write("<option value=""0"">根目录</option>")
end if
if trim(request("id"))<>"" and mode="xiugai" then
request_id=cint(trim(request("id")))
else
request_id=0
end if
set rs=conn.execute("select id,name from data_class where classid="&classid&" order by orderby,id")
while not rs.eof
if cint(rs("id"))<>request_id then
response.Write("<option value="""&rs("id")&""">"&str&rs("name")&"</option>")
site_class_showpid cint(rs("id")),str & " "
end if
rs.movenext
wend
rs.close
set rs=nothing
end function
'--------------------------------------显示目录
function site_class_show(byval classid)
dim rs,i,m
set rs=server.CreateObject("adodb.recordset")
rs.open "select id,name,classid from data_class where classid="&cint(classid)&" order by orderby,id",conn,1,1
m=rs.RecordCount
i=0
while not rs.eof
i=i+1
response.write("<div style=""padding-left:10px;"">"&vbcrlf)
response.write("<div style=""height:20;""> ◆ "&vbcrlf)
'排列
if i>1 then
response.Write("<a href=""?id="&rs("id")&"&classid="&rs("classid")&"&mode=order&flag=up"">↑</a>")
else
response.Write("<font color=""#999999"">↑</font>")
end if
if i<m then
response.Write("<a href=""?id="&rs("id")&"&classid="&rs("classid")&"&mode=order&flag=down"">↓</a>")
else
response.Write("<font color=""#999999"">↓</font>")
end if
response.Write("<a href=""product.asp?showclassid="&rs("id")&""">"&rs("name")&"</a> "&vbcrlf)
response.Write("( <a href=""?id="&rs("id")&"&mode=xiugai"">编辑</a> "&vbcrlf)
response.Write("<a href=""?id="&rs("id")&"&mode=del"" onClick=""javascript:if(confirm('确定删除吗?')){return true;}else{return false;}"">删除</a> )</div>"&vbcrlf)
site_class_show rs("id")
response.write("</div>"&vbcrlf)
rs.movenext
wend
rs.close
set rs=nothing
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -