📄 admin_newscataadd.asp
字号:
<!--#include file = "../inc/dbclass.inc.asp" -->
<!--#include file = "../inc/syslogincheck.inc.asp" -->
<%
' =============================================================
' made by xiasp & 智多网络 http://www.cq18.com/ qq群:12403617
' =============================================================
%>
<%
response.expires = 0
response.expiresabsolute = now() - 1
response.addheader "pragma","no-cache"
response.addheader "cache-control","private"
response.cachecontrol = "no-cache"
%>
<%
dim action, operate, h_level, duserid
action = getsafestr(trim(request("action")))
h_level = session("sys_level")
if action = "del" then
if h_level <> 3 then
call alertmsg("您的权限不够进行此操作!")
else
call operateuser()
end if
end if
if action = "del_submit" then '删除当前类
if h_level <> 3 then
call alertmsg("您的权限不够进行此操作!")
else
call operateuser()
end if
end if
if action = "cat_add_name" then '添加分类
if h_level <> 3 then
call alertmsg("您的权限不够进行此操作!")
else
call operateuser()
end if
end if
call header("新闻栏目管理")
call content()
call footer()
' 开始写入内容
sub content()
%>
<!--#include file = "admin_index_top.asp" -->
<br>
<script language="javascript">
<!--
function dodel(){
if (confirm("注意:删除一个栏目,其下面的所有子栏目和产品将全部被清空,\n您确定要进行此操作吗?"))
{
document.del.submit();
}
}
//-->
</script>
<%
dim mgetrootid, mtitle, maddtime
mgetrootid = getsafestr(trim(request.querystring("rootid")))
ssql = "select * from newscata where c_rootid='"&mgetrootid&"'"
ors.open ssql, oconn, 1, 1
if not ors.eof then
mtitle = ors("c_title")
maddtime = ors("c_addtime")
end if
ors.close
set ors = nothing
%>
<%
dim mdorootid, maction, mmodtitle, maddtitle
mdorootid = getsafestr(trim(request.querystring("dorootid")))
maction = getsafestr(trim(request.querystring("action")))
mmodtitle = getsafestr(trim(request.form("cat_mod_name")))
maddtitle = getsafestr(trim(request.form("cat_add_name")))
select case maction
case "modify"
if mmodtitle = "" then
call alertmsg("请正确填写栏目名称!")
else
ssql="update newscata set c_title='"&mmodtitle&"' where c_rootid = '"&mdorootid&"'"
oconn.execute ssql
call alertmsg("栏目修改成功!")
end if
case "add"
dim mrootid, mnumber, midlen
if maddtitle="" then
call alertmsg("请填写栏目名称!")
else
if mdorootid = "" then
call alertmsg("你将创建一个新的信息根目录,我们暂时不提供此操作!\n如果您真的需要此功能,我们建议你对库文件直接操作!\n如果你的程序能力有限,建议你直接跟我们取得联系!")
response.end()
else
dim brs, bsql
set brs = server.createobject( "adodb.recordset" )
bsql = "select * from newscata where c_rootid = '"&mdorootid&"'"
brs.open bsql, oconn, 1, 1
if not brs.eof then
mrootid = brs("c_rootid")
mnumber = brs("c_number") + 1
else
call alertmsg("你已经破坏了数据库的原始结构,请与管理员取得联系!")
response.end()
end if
brs.close
set brs = nothing
end if
'计算类别的roorid编码,并且判断当前类别下是否允许继续添加子类别。
midlen = len(trim(mnumber))
if midlen > 4 then
call oktowhere("对不起,此栏目下面已经不能再增加子栏目。","-1")
else
mrootid = mrootid & right(space(4 - midlen) & mnumber,4)
mrootid = replace(mrootid," ",0)
end if
' 保存新闻类别
dim ars, asql
set ars = server.createobject( "adodb.recordset" )
asql = "select * from newscata where c_id is null"
ars.open asql, oconn, 1, 3
ars.addnew
ars("c_title") = maddtitle
ars("c_rootid") = mrootid
ars("c_addtime") = now()
ars.update
ars.close
set ars = nothing
'同时更新当前类别的上级栏目子栏目数目。
ssql="update newscata set c_number="& mnumber &" where c_rootid = '"&mdorootid&"'"
oconn.execute ssql
call alertmsg("栏目添加成功!")
end if
end select
%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="25"><b><%=homepage_title%> - <font color="#ff0000">新闻栏目管理</font></b></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="54%">
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td bgcolor="#efefef">
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10"></td>
</tr>
<tr bgcolor="#ffffff">
<td style="border-left: #8a8a8a 1px solid; line-height: 20px; font-family:verdana, arial, helvetica, sans-serif" bgcolor="#ffffff" valign="top" height="360"> <font color="#ff0000">0</font>-<font color="#ff0000">1</font>-<font color="#ff0000">2</font>-<font color="#ff0000">3</font>-<font color="#ff0000">4</font>-<font color="#ff0000">5</font>-<font color="#ff0000">6</font>-<font color="#ff0000">7</font>-<font color="#ff0000">8</font>-<font color="#ff0000">9</font>---------------------------------------------------><br>
<%
dim crs, csql, i, tempcatastr
set crs = server.createobject( "adodb.recordset" )
csql = "select * from newscata order by c_rootid"
crs.open csql, oconn, 1, 3
do while not crs.eof
tempcatastr=" |"
for i=1 to int(len(trim(crs("c_rootid")))/4)
tempcatastr = tempcatastr&" |"
next
tempcatastr = tempcatastr&"_<a href=admin_newscataadd.asp?rootid="&trim(crs("c_rootid"))&">"&trim(crs("c_title"))&"</a><br>"
response.write tempcatastr
crs.movenext
loop
crs.close()
set crs = nothing
%> </td>
</tr>
<tr>
<td height="10"></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="46%" align="center" valign="top" bgcolor="#799ae1"><br>
<table width="90%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><fieldset>
<legend>信息统计</legend>
栏目名称:<%=mtitle%><br>
发布时间:<%=maddtime%><br>
</fieldset></td>
</tr>
<form name="modify" method="post" action="admin_newscataadd.asp?action=modify&dorootid=<%=mgetrootid%>">
<tr>
<td align="center"><br>
<fieldset>
<legend>修改当前类别</legend>
<br>
<input name="cat_mod_name" type="text" class="button1" value="<%=mtitle%>" size="16">
<input type="submit" value=" 修 改 " name="mod_submit" class="button2">
<br>
<br>
</fieldset></td>
</tr>
</form>
<form name="addcata" method="post" action="admin_newscataadd.asp?action=add&dorootid=<%=mgetrootid%>">
<tr>
<td align="center" height="90"> <br>
<fieldset>
<legend>添加子类别</legend>
<br>
<input type="text" name="cat_add_name" class="button1" value="" size="16">
<input type="submit" value=" 添 加 " name="add_submit" class="button2">
<br>
<br>
</fieldset></td>
</tr>
</form>
<form name="del" method="post" action="admin_newscatadelete.asp?delrootid=<%=mgetrootid%>">
<tr>
<td height="60" align="center"> <br>
<input type="button" name="del_submit" value="删除当前类" class="button2" onclick="dodel()">
<br>
<font color="#ffffff">(注意:删除一个栏目,其下面的所有子栏目和新闻将全部清空,请慎重操作!)</font></td>
</tr>
</form>
</table>
<script language=javascript>
<!--
if (<%=len(mgetrootid)%> < 2)
{
document.modify.mod_submit.disabled = false;
document.del.del_submit.disabled = true;
}
else
{
document.modify.mod_submit.disabled = false;
document.del.del_submit.disabled = false;
}
-->
</script>
</td>
</tr>
</table></td>
</tr>
</table>
<p> </p>
<%
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -