<!--#include file="sdcms_check.asp"-->
<%
set sdcms=new Sdcms_Admin
sdcms.Check_admin
sdcms.Check_lever 5
set sdcms=nothing
select case action
case "add":title="添加分类"
case "edit":title="修改分类"
case "batch":title="批量设置"
case else:title="分类管理"
end select
sd_table="sd_class"
followid=trim(request("followid"))
ordnum=trim(request("ordnum"))
sdcms_head
Function clear_bad(t0)
clear_bad=Replace(t0,"""","")
End Function
%>
<div class="sdcms_notice"><span>管理操作：</span><a href="?action=add">添加分类</a>　┊　<a href="?">分类管理</a>　┊　<a href="?action=batch">批量设置</a></div>
<br>
<ul id="sdcms_sub_title">
	<li class="sub"><%=title%></li>
</ul>
<div id="sdcms_right_b">
<%
select case action
case "add":add
case "edit":edit
case "batch":batch
case "batchsave":batchsave
case "save":save
case "make_c_list":make_c_list
case "up":up
case "down":down
case "del":del
case else:main
end select
sub main
%>
  <table border="0" align="center" cellpadding="3" cellspacing="1" class="table_b">
    <tr>
      <td width="30" class="title_bg">ID</td>
      <td class="title_bg">名称</td>
      <td class="title_bg">排序</td>
      <td class="title_bg">管理</td>
    </tr>
<%sdsort(0)%>
  </table>
<%
end sub
sub add
check_info
%>
  <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1">
  <form name="add" method="post" action="?action=save&act=add" onSubmit='return checkadd()'>
    <tr>
      <td width="12%" align="center" class="tdbg">分类名称：      </td>
      <td class="tdbg"><input name='title' class="input" type='text' id='title' size='30' maxlength='50'></td>
    </tr>
	<tr>
      <td align="center" class="tdbg">生成目录：      </td>
      <td class="tdbg"><input type='text' name='classname' class="input" maxlength='50' style='ime-mode:disabled' onselectstart='return false'  onpaste='return false'> <span>只能是字母或字母和数字的组合,不能重复,不可更改</span></td>
    </tr>
    <tr class="tdbg">
      <td align="center">类别选择：</td>
      <td>        <select name="classid" >
          <option value='0' >作为一级分类</option>
<%ssort(0)%>
        </select></td>
    </tr>
	<tr class="tdbg">
      <td align="center">首页模板：</td>
      <td>   <select name='indexshow'><option value='0'>不启用频道首页</option>
		<%set temprs=conn.execute("select id,title from sd_temp where classid=0 order by id desc")
		while not temprs.eof
		echo "<option value='"&temprs(0)&"'>"&temprs(1)&"</option>"
		temprs.movenext
		wend%></select>
	  </td>
    </tr>
    <tr class="tdbg">
      <td align="center">列表模板：</td>
      <td>   <select name='listshow'>
	  <option value='-1'>默认文字式</option>
	  <option value='0'>默认图片式</option>
	  <%set temprs=conn.execute("select id,title from sd_temp where classid=1 order by id desc")
while not temprs.eof
echo "<option value='"&temprs(0)&"'>"&temprs(1)&"</option>"
temprs.movenext
wend%></select>
	  </td>
    </tr>
	<tr class="tdbg">
      <td align="center">页面模板：</td>
      <td>   <select name='infoshow'><option value='0'>默认模板</option>
	  <%set temprs=conn.execute("select id,title from sd_temp where classid=2 order by id desc")
while not temprs.eof
echo "<option value='"&temprs(0)&"'>"&temprs(1)&"</option>"
temprs.movenext
wend%></select>
	  </td>
    </tr>
	<tr>
      <td align="center" class="tdbg">每页数量：      </td>
      <td class="tdbg"><input name='t1' value="20" class="input" type='text' id='t1' size='30' maxlength='3' onKeyUp="value=value.replace(/[^\d]/g,'');"  onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''));"></td>
    </tr>
	<tr>
      <td align="center" class="tdbg">关 键 字：      </td>
      <td class="tdbg"><textarea name="keyword" cols="60" rows="4" class="inputs"></textarea></td>
    </tr>
	<tr>
      <td align="center" class="tdbg">描　　述：      </td>
      <td class="tdbg"><textarea name="t0" cols="60" rows="4" class="inputs"></textarea><br><%all_set="生成分类|生成地图":all_set=split(all_set,"|"):for i=0 to ubound(all_set)%><input name="up<%=i+1%>" type="checkbox" value="1" <%if instr(", "&sdcms_create_set&", ",", "&i+4&", ")>0 then echo "checked"%> id="<%=i+4%>"><label for="<%=i+4%>"><%=all_set(i)%></label><%next%></td>
    </tr>
    <tr class="tdbg">
	  <td>&nbsp;</td>
      <td><input name="Submit" type="submit" class="bnt" value="保 存">
        <input name="Submit23" type="button" onClick="history.go(-1)" class="bnt" value="返 回"></td>
    </tr>
	</form>
  </table>
<%
end sub
sub edit
set rs=conn.execute("select title,indexshow,listshow,infoshow,keyword,class_desc,pagenum from "&sd_table&" where id="&id&"")
if rs.eof then
echo "请勿非法提交参数":Died
end if
%>
  <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1">
  <form method="post" action="?action=save&act=save&id=<%=id%>">
        <tr>
      <td width="12%" align="center" class="tdbg">分类名称：      </td>
      <td class="tdbg"><input name='title' value="<%=rs(0)%>" class="input" type='text' id='title' size='30' maxlength='50'></td>
    </tr>
	<tr class="tdbg">
      <td align="center">首页模板：</td>
      <td>   <select name='indexshow'><option value='0'>不启用频道首页</option>
	  <%set temprs=conn.execute("select id,title from sd_temp where classid=0 order by id desc")
while not temprs.eof
echo "<option value='"&temprs(0)&"' "&w_select(rs(1),temprs(0))&">"&temprs(1)&"</option>"
temprs.movenext
wend%></select>
	  </td>
    </tr>
    <tr class="tdbg">
      <td align="center">列表模板：</td>
      <td>   <select name='listshow'>
	  <option value='-1' <%=w_select(rs(2),-1)%>>默认文字式</option>
	  <option value='0' <%=w_select(rs(2),0)%>>默认图片式</option>
	  <%set temprs=conn.execute("select id,title from sd_temp where classid=1 order by id desc")
while not temprs.eof
echo "<option value='"&temprs(0)&"' "&w_select(rs(2),temprs(0))&">"&temprs(1)&"</option>"
temprs.movenext
wend%></select>
	  </td>
    </tr>
	<tr class="tdbg">
      <td align="center">页面模板：</td>
      <td>   <select name='infoshow'><option value='0'>默认模板</option>
	  <%set temprs=conn.execute("select id,title from sd_temp where classid=2 order by id desc")
while not temprs.eof
echo "<option value='"&temprs(0)&"' "&w_select(rs(3),temprs(0))&">"&temprs(1)&"</option>"
temprs.movenext
wend%></select>
	  </td>
    </tr>
	<tr>
      <td align="center" class="tdbg">每页数量：      </td>
      <td class="tdbg"><input name='t1' value="<%=rs(6)%>" class="input" type='text' id='t1' size='30' maxlength='3' onKeyUp="value=value.replace(/[^\d]/g,'');"  onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''));"></td>
    </tr>
	<tr>
      <td align="center" class="tdbg">关 键 字：      </td>
      <td class="tdbg"><textarea name="keyword" cols="60" rows="4" class="inputs"><%=rs(4)%></textarea></td>
    </tr>
	<tr>
      <td align="center" class="tdbg">描　　述：      </td>
      <td class="tdbg"><textarea name="t0" cols="60" rows="4" class="inputs"><%=rs(5)%></textarea><br><%all_set="生成分类|生成地图":all_set=split(all_set,"|"):for i=0 to ubound(all_set)%><input name="up<%=i+1%>" type="checkbox" value="1" <%if instr(", "&sdcms_create_set&", ",", "&i+4&", ")>0 then echo "checked"%> id="<%=i+4%>"><label for="<%=i+4%>"><%=all_set(i)%></label><%next%></td>
    </tr>
    <tr class="tdbg">
	  <td>&nbsp;</td>
      <td><input name="Submit" type="submit" class="bnt" value="保 存">
        <input name="Submit232" type="button" onClick="history.go(-1)" class="bnt" value="返 回"></td>
    </tr>
	</form>
  </table>
<%
end sub
sub batch
%>
  <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1">
  <form name="add" method="post" action="?action=batchsave" onSubmit='return checkadd()'>
    <tr>
      <td width="12%" align="center">类别选择：</td>
      <td><select name="t0" size="10" multiple="multiple" id="t0" style="width:60%;"><%ssort(0)%>
        </select>
      </td>
    </tr> 
	<tr class="tdbg">
      <td align="center"><input name="up1" id="up1" type="checkbox" value="1" checked="checked" /><label for="up1">首页模板：</label></td>
      <td>   <select name='t1'><option value='0'>不启用频道首页</option>
	  <%set temprs=conn.execute("select id,title from sd_temp where classid=0 order by id desc")
while not temprs.eof
echo "<option value='"&temprs(0)&"'>"&temprs(1)&"</option>"
temprs.movenext
wend%></select>
	  </td>
    </tr>
    <tr class="tdbg">
      <td align="center"><input name="up2" id="up2" type="checkbox" value="1" checked="checked" /><label for="up2">列表模板：</label></td>
      <td>   <select name='t2'>
	  <option value='-1'>默认文字式</option>
	  <option value='0'>默认图片式</option>
	  <%set temprs=conn.execute("select id,title from sd_temp where classid=1 order by id desc")
while not temprs.eof
echo "<option value='"&temprs(0)&"'>"&temprs(1)&"</option>"
temprs.movenext
wend%></select>
	  </td>
    </tr>
	<tr class="tdbg">
      <td align="center"><input name="up3" id="up3" type="checkbox" value="1" checked="checked" /><label for="up3">页面模板：</label></td>
      <td>   <select name='t3'><option value='0'>默认模板</option>
	  <%set temprs=conn.execute("select id,title from sd_temp where classid=2 order by id desc")
while not temprs.eof
echo "<option value='"&temprs(0)&"'>"&temprs(1)&"</option>"
temprs.movenext
wend%></select>
	  </td>
    </tr>
    <tr>
      <td align="center" class="tdbg"><input name="up4" type="checkbox" id="up4" value="1" checked="checked" />
      <label for="up4">关键字：</label></td>
      <td class="tdbg"><textarea name="t4" cols="60" rows="4" class="inputs"></textarea></td>
    </tr>
	<tr>
      <td align="center" class="tdbg"><input name="up5" type="checkbox" id="up5" value="1" checked="checked" />
      <label for="up5">描　述：</label></td>
      <td class="tdbg"><textarea name="t5" cols="60" rows="4" class="inputs"></textarea></td>
    </tr>
    <tr class="tdbg">
	  <td align="center"><span style="font-weight: bold">勾选的才更新</span></td>
      <td><input name="Submit" type="submit" class="bnt" value="保 存">
        <input name="Submit23" type="button" onClick="history.go(-1)" class="bnt" value="返 回"></td>
    </tr>
	</form>
  </table>
<%
end sub
sub save
title=trim(request("title"))
classid=trim(request("classid"))
indexshow=trim(request("indexshow"))
listshow=trim(request("listshow"))
infoshow=trim(request("infoshow"))
keyword=trim(request("keyword"))
classname=dir_check(trim(request("classname")))
t0=clear_bad(trim(request("t0")))
t1=trim(request("t1"))
'visited=trim(request("visited"))
act=trim(request("act"))
up1=trim(request("up1"))
up2=trim(request("up2"))
sys_dir="admin|inc|editor|data|upfile|skins|plug|other|notice"
sys_dir=split(sys_dir,"|")
for i=0 to ubound(sys_dir)
 if classname=""&sys_dir(i)&"" then echo "此目录为系统目录，请换其他的试试！":Died
next
 
set rs=server.CreateObject("adodb.recordset")
sql="select title,followid,ordnum,listshow,infoshow,keyword,filename,indexshow,class_desc,id,pagenum from "&sd_table&""
if act="add" then
sql=sql&" where filename='"&classname&"'"
else
sql=sql&" where id="&id&""
end if
rs.open sql,conn,1,3
if act="add" then
	if not rs.eof then
		echo "该类别的目录名称已存在，请换个试试！":Died
	end if
	rs.addnew
else
	rs.update
end if
rs(0)=title
if act="add" then 
rs(1)=classid
  if classid<>0 then
    set rs2=conn.execute("select top 1 ordnum from "&sd_table&" where followid="&classid&" order by ordnum desc")
      if rs2.eof and rs2.bof then
		  ordnum1=1
      else
        if rs2(0)<>"" then
        ordnum1=rs2(0)+1
        else
        ordnum1=1
      end if
  end if
 rs(2)=ordnum1
 else
    set rs1=conn.execute("select top 1 ordnum from "&sd_table&" where followid=0 order by ordnum desc")
     if rs1.eof then
		 ordnum1=1
     else
       if rs1(0)<>"" then
       ordnum1=rs1(0)+1
       else
       ordnum1=1
       end if
     end if
	rs(2)=ordnum1
  end if
end if  
rs(3)=listshow
rs(4)=infoshow
rs(5)=keyword
if act="add" then
rs(6)=classname
end if
rs(7)=indexshow
rs(8)=t0
if isnumeric(t1) then
rs(10)=t1
end if
rs.update
if act="save" then
remove_app(sdcms_cookies&rs(9))
end if
id=rs(9)
remove_app id
if act="add" then
'更新类别绝对路径，并建立文件夹
set sdcms_f=new sdcms_function
	if classid=0 then
		partent_dir=classname&"/"
		conn.execute("update "&sd_table&" set classdir='"&partent_dir&"' where id="&id&"")
		sdcms_f.Create_upfile sdcms_root&sdcms_htmdir&classname
	else
		partent_dir=sdcms_f.LoadRecord("classdir",sd_table,classid)&classname&"/"
		conn.execute("update "&sd_table&" set classdir='"&partent_dir&"' where id="&id&"")
		sdcms_f.Create_upfile sdcms_root&sdcms_htmdir&partent_dir
	end if
set sdcms_f=nothing
end if
if act="add" then
	this_id=id
	if classid=0 then
	   conn.execute("update  "&sd_table&" set allclassid='"&this_id&"',partentid='"&this_id&"' where id="&this_id&"")
	else
	   conn.execute("update "&sd_table&" set class_num=class_num+1 where id="&classid&"")
	'计算分类之间的关系，将下级分类id添加到上级id中去 
	 conn.execute("update  "&sd_table&" set allclassid='"&this_id&"',partentid='"&this_id&"' where id="&this_id&"")
	 set rs1=conn.execute("select partentid from "&sd_table&" where id="&classid&"")
	 partent_id=this_id&","&rs1(0)
	 conn.execute("update "&sd_table&" set partentid='"&partent_id&"'  where id="&this_id&"")
	'向父目录中添加子目录的id号,先检测是否存在，存在就跳过
	add_classid this_id,classid
	end if
	if len(up1&up2)>0 then
		set sdcms_c=new sdcms_create
		if len(up1)>0 then sdcms_c.Create_class_list id
		if len(up2)>0 then sdcms_c.Create_map
		set sdcms_c=nothing
	end if
	conn.execute("Insert into sd_log (sdcms_name,ip,content) values('"&sdcms_adminname&"','"&sdcms_adminip&"','添加类别："&title&"')")
	echo "添加成功":Died
else
    if len(up1&up2)>0 then
		set sdcms_c=new sdcms_create
		if len(up1)>0 then sdcms_c.Create_class_list id
		if len(up2)>0 then sdcms_c.Create_map
		set sdcms_c=nothing
	end if
	conn.execute("Insert into sd_log (sdcms_name,ip,content) values('"&sdcms_adminname&"','"&sdcms_adminip&"','修改类别："&title&"')")
	echo "修改成功":Died
end if

end sub

sub batchsave
t0=trim(request("t0"))
t1=trim(request("t1"))
t2=trim(request("t2"))
t3=trim(request("t3"))
t4=trim(request("t4"))
t5=trim(request("t5"))
up1=trim(request("up1"))
up2=trim(request("up2"))
up3=trim(request("up3"))
up4=trim(request("up4"))
up5=trim(request("up5"))
if t0="" then 	echo "<script>alert('至少选择一个类别');location.href='?action=batch';</script>":Died
if instr(t0,", ")>0 then
t00=split(t0,", ")
	for i=0 to ubound(t00)
	if len(up1&up2&up3&up4&up5)>0 then
		set rs=server.CreateObject("adodb.recordset")
		sql="select indexshow,listshow,infoshow,keyword,class_desc from "&sd_table&" where id="&t00(i)&""
		rs.open sql,conn,1,3
		rs.update
		if len(up1)>0 then rs(0)=t1
		if len(up2)>0 then rs(1)=t2
		if len(up3)>0 then rs(2)=t3
		if len(up4)>0 then rs(3)=t4
		if len(up5)>0 then rs(4)=t5
		rs.update
	end if
	next
else
	if len(up1&up2&up3&up4&up5)>0 then
		set rs=server.CreateObject("adodb.recordset")
		sql="select indexshow,listshow,infoshow,keyword,class_desc from "&sd_table&" where id="&t0&""
		rs.open sql,conn,1,3
		rs.update
		if len(up1)>0 then rs(0)=t1
			if len(up2)>0 then rs(1)=t2
			if len(up3)>0 then rs(2)=t3
			if len(up4)>0 then rs(3)=t4
			if len(up5)>0 then rs(4)=t5
		rs.update
	end if
end if
	echo "<script>alert('设置成功');location.href='?';</script>"
end sub

sub del
set rs=conn.execute("select class_num,followid,classdir from "&sd_table&" where id="&id&"")
if rs(0)>0 then
echo "不能删除有下级分类的分类":Died
else
conn.execute("Insert into sd_log (sdcms_name,ip,content) values('"&sdcms_adminname&"','"&sdcms_adminip&"','删除分类："&conn.execute("select title from "&sd_table&" where id="&id&"")(0)&"')")
conn.execute("update "&sd_table&" set class_num=class_num-1 where id="&rs(1)&"")
set sdcms_f=new sdcms_Function
sdcms_f.Delfile sdcms_root&sdcms_htmdir&rs(2)
set sdcms_f=nothing
conn.execute("delete from "&sd_table&" where id="&id&"")
conn.execute("delete from sd_info where classid="&id&"")
'严格意义上来讲，这里还应该更新下全站，暂时先空着
 
end if
'create_index
response.Redirect("?")
end sub

sub up
sql="select top 1 id,ordnum from "&sd_table&" where followid="&followid&"   and ordnum>"&ordnum&" order by ordnum"
set rs=conn.execute(sql)
if not rs.eof then
conn.execute("update "&sd_table&" set ordnum="&rs(1)&" where id="&id&"")
conn.execute("update "&sd_table&" set ordnum="&rs(1)&"-1 where id="&rs(0)&"")
end if
response.redirect("?")
end sub

sub down
sql="select top 1 id,ordnum from "&sd_table&" where followid="&followid&"   and ordnum<"&ordnum&" order by ordnum desc"
set rs=conn.execute(sql)
if not rs.eof then
conn.execute("update "&sd_table&" set ordnum="&rs(1)&" where id="&id&"")
conn.execute("update "&sd_table&" set ordnum="&rs(1)&"+1 where id="&rs(0)&"")
end if
response.redirect("?")
end sub

dim ii
ii=0
sub sdsort(selec)
with response
if session(sdcms_cookies&"sdcms_admin")=1 then
sql="Select id,title,ordnum,followid,classdir,indexshow From ["&sd_table&"] where followid="&selec&"  order by ordnum desc"
else
 if selec=0  then
   sql="Select id,title,ordnum,followid,classdir,indexshow From ["&sd_table&"] where  "
   if session(sdcms_cookies&"sdcms_infolever")<>"" then
   sql=sql&" id in ("&session(sdcms_cookies&"sdcms_infolever")&") and followid="&selec&" order by ordnum desc"
   else
   sql=sql&"  followid<"&selec&" order by ordnum desc"
   end if
 else
sql="Select id,title,ordnum,followid,classdir,indexshow From ["&sd_table&"] where followid="&selec&"  order by ordnum desc"

 end if
end if
Set Rs1=Conn.Execute(sql)
do while not rs1.eof
.write(" <tr  onmouseover=this.bgColor='#EBFFDC'; onmouseout=this.bgColor='#ffffff';  bgcolor='#ffffff'>")
.write("      <td align='center' >"&rs1(0)&"</td>")
.write("      <td >&nbsp;")
if selec<>0 then
.write(""&string(ii,"　")&" ")
set rsn=conn.execute("select max(ordnum),min(ordnum) from "&sd_table&" where followid="&Rs1(3)&"")
if rs1(2)=rsn(0) and rs1(2)=rsn(1) then
.write(" └")
elseif rs1(2)=rsn(0) and rs1(2)>rsn(1) then
.write(" ├")
elseif rs1(2)<rsn(0) and rs1(2)=rsn(1) then
.write(" └")
elseif rs1(2)<rsn(0) and rs1(2)>rsn(1) then
.write(" ├")
rsn.close
end if
end if
.write("&nbsp;<a href="""&sdcms_root&sdcms_htmdir&rs1(4)&""" target=""_blank"">"&rs1(1)&"")
.write("	  </td>")
.write("      <td>"&string(ii,"　")&"<a href='?action=up&id="&rs1(0)&"&ordnum="&rs1(2)&"&followid="&rs1(3)&"'>上升</a> <a href='?action=down&id="&rs1(0)&"&ordnum="&rs1(2)&"&followid="&rs1(3)&"'>下降</a></td>")
.write("      <td  align='center'><a href='?action=add&id="&rs1(0)&"'>添加下级分类</a>　<a href='?action=edit&id="&rs1(0)&"'>编辑</a>　<a href='?action=del&id="&rs1(0)&"' onclick='return confirm(""真的要删除?不可恢复!"");'>删除</a>　<a href='?action=make_c_list&id="&rs1(0)&"'>生成</a></td>")
.write("</tr>")
ii=ii+1
sdsort rs1(0)
ii=ii-1
rs1.Movenext
loop
Set Rs1 = Nothing
end with
end sub
dim iii
iii=0
sub ssort(t)
with response
if session(sdcms_cookies&"sdcms_admin")=1 then
sql="Select id,title,ordnum,followid From ["&sd_table&"] where followid="&t&"  order by ordnum desc"
else
if t=0 then
   sql="Select id,title,ordnum,followid From ["&sd_table&"] where  "
   if session(sdcms_cookies&"sdcms_infolever")<>"" then
   sql=sql&" id in ("&session(sdcms_cookies&"sdcms_infolever")&") and followid="&t&" order by ordnum desc"
   else
   sql=sql&"  followid<"&t&" order by ordnum desc"
   end if
 else
sql="Select id,title,ordnum,followid From [sd_class] where followid="&t&"   order by ordnum desc"

 end if
end if
 Set rs1=Conn.Execute(sql)
do while not rs1.eof
.write("<option value='"&rs1(0)&"' ")
if id=""&rs1(0)&"" then
.write("selected")
end if
.write(">")
if t<>0 then
.write(""&string(iii,"　")&" ")
set rsn=conn.execute("select max(ordnum),min(ordnum) from "&sd_table&" where followid="&Rs1(3)&"")
if rs1(2)=rsn(0) and rs1(2)=rsn(1) then
.write("└")
elseif rs1(2)=rsn(0) and rs1(2)>rsn(1) then
.write("├")
elseif rs1(2)<rsn(0) and rs1(2)=rsn(1) then
.write("└")
elseif rs1(2)<rsn(0) and rs1(2)>rsn(1) then
.write("├")
rsn.close
end if
end if
.write("&nbsp;"&rs1(1)&"</option>")
iii=iii+1
ssort rs1(0)
iii=iii-1
rs1.Movenext
loop
Set Rs1 = Nothing
end with
end sub

'向上级分类中添加子目录的id
sub add_classid(this_id,classid)
partent_id=conn.execute("select allclassid from "&sd_table&" where id="&classid&"")(0)
   if not instr(partent_id,this_id)>0 then
    partent=partent_id&","&this_id
      conn.execute("update "&sd_table&" set allclassid='"&partent&"' where id="&classid&" ")
	   set rs1=conn.execute("select followid from "&sd_table&" where id="&classid&"")
	    if rs1(0)<>0 then
	    add_classid this_id,rs1(0)
	   end if  
  end if
end sub

sub make_c_list
	set sdcms_c=new sdcms_create
	conn.execute("Insert into sd_log (sdcms_name,ip,content) values('"&sdcms_adminname&"','"&sdcms_adminip&"','生成分类：编号为"&request("id")&"')")
	    if clng(request("id"))<>0 then
		tj="where id="&id&" "
		end if
	    set rs_c=conn.execute("select id from sd_class "&tj&" order by id ")
		while not rs_c.eof
			sdcms_c.Create_class_list rs_c(0)
			response.Flush()
		rs_c.movenext
		wend
	set sdcms_c=nothing
	echo "生成完毕"
end sub

sub check_info
with response
.write("	<script>")
.write("	function checkadd()")
.write("	{")
.write("	if (document.add.title.value=='')")
.write("	{")
.write("	alert('分类名称不能为空');")
.write("	document.add.title.focus();")
.write("	return false")
.write("	}")
.write("	if (document.add.classname.value=='')")
.write("	{")
.write("	alert('生成的目录不能为空');")
.write("	document.add.classname.focus();")
.write("	return false")
.write("	}")
.write("	}")
.write("	</script>")
end with
end sub
%>  
</div>
</body>
</html>