后台批量添加一、二级分类的修改
作者:cmscn 日期:2005-09-09
解压覆盖即可用,后台>>分类管理
[file=attachments/month_200509/09_092821_yvn32004122010395895.rar]Click to Download[/file]
在admin_nsort.asp里面修改..
1.
<td><a href='?nsort=<%response.write nsort%>&action=addc'>添加一级<%response.write ntit%></a></td>
下面加入
<td width=10></td>
<td><a href='?nsort=<%response.write nsort%>&action=addcer'>批量添加一级<%response.write ntit%></a></td>
2.
(<a href='?nsort=<%response.write nsort%>&action=adds&c_id=<%response.write cid%>'>添加二级分类</a>)
下面加入
(<a href='?nsort=<%response.write nsort%>&action=addser&c_id=<%response.write cid%>'>批量添加二级分类</a>)
3.
在最后一个end sub
sub joekoe_chk_addser()
dim s_order,ncid
sql="select top 1 c_name from jk_class where nsort='"&nsort&"' and c_id="&cid
set rs=joekoe_cms.exec(sql,1)
if rs.eof then
rs.close
call admin_msg("一级"&tit_fir&"ID("&cid&")不存在!","?nsort="&nsort,1)
exit sub
end if
cname=rs(0)
rs.close
%>
<table cellspacing=1 cellpadding=3 class=table0>
<tr>
<td class=td width='20%'></td>
<td class=td width='80%'><%response.write ntit&"("&ntit2&")"%></td>
</tr>
<%
if chk() then
sname=code_admin("s_name",1,0)
if sname="" then
call admin_error("二级"&tit_fir&"名称不能为空!")
response.write "</table>"
exit sub
end if
s_order=1
sql="select top 1 s_order from jk_sort where c_id="&cid&" order by s_order desc"
set rs=joekoe_cms.exec(sql,1)
if not rs.eof then s_order=int(rs(0))+1
rs.close
dim sname_s
sname_s=split(sname,vbcrlf)
for i=0 to ubound(sname_s)
if sname_s(i)<>"" then
sql="insert into jk_sort(c_id,s_name,s_order)
values('"&cid&"','"&sname_s(i)&"',"&s_order&")"
call joekoe_cms.exec(sql,0)
s_order=s_order+1
end if
next
call admin_msg("成功添加二级"&tit_fir&"!","?nsort="&nsort,1)
response.write "</table>"
exit sub
end if
call form_first()
%>
<form action='?nsort=<%response.write nsort%>&action=addser&c_id=<%response.write cid%>'
method=post>
<input type=hidden name=chk value='yes'>
<tr>
<td>一级<%response.write tit_fir%>名称:</td>
<td><font class=blue><b><%response.write cname%></b></font></td>
</tr>
<tr>
<td>二级<%response.write tit_fir%>名称:</td>
<td><textarea name=s_name rows=15 cols=40></textarea></td>
</tr>
<%
call submit_add()
response.write "</table>"
end sub
sub joekoe_chk_addcer()
dim c_order
%>
<table cellspacing=1 cellpadding=3 class=table0>
<tr>
<td class=td width='20%'></td>
<td class=td width='80%'><%response.write ntit&"("&ntit2&")"%></td>
</tr>
<%
if joekoe_cms.chk() then
cname=code_admin("c_name",1,0)
if cname="" then
call admin_error("一级"&tit_fir&"名称不能为空!")
response.write "</table>"
exit sub
end if
c_order=1
sql="select top 1 c_order from jk_class where nsort='"&nsort&"' order by c_order desc"
set rs=joekoe_cms.exec(sql,1)
if not rs.eof then c_order=int(rs(0))+1
rs.close
dim cname_s
cname_s=split(cname,vbcrlf)
for i=0 to ubound(cname_s)
if cname_s(i)<>"" then
sql="insert into jk_class(nsort,c_name,c_order)
values('"&nsort&"','"&cname_s(i)&"',"&c_order&")"
call joekoe_cms.exec(sql,0)
c_order=c_order+1
end if
next
call admin_msg("成功添加一级"&tit_fir&"!","?nsort="&nsort,1)
response.write "</table>"
exit sub
end if
call form_first()
%>
<form name=add_frm action='?jk_mod=<%response.write jk_mod%>&nsort=<%response.write
nsort%>&action=addcer' method=post>
<input type=hidden name=chk value='yes'>
<tr>
<td>一级<%response.write tit_fir%>名称:</td>
<td><textarea name=c_name rows=15 cols=40></textarea></td>
</tr>
<%
call submit_add()
response.write "</table>"
end sub
评论: 7 | 引用: 0 | 查看次数: 690
发表评论