www.gusucode.com > cso中国seo优化html整站源码程序 > manage/class/c_fei886_small.asp

    <!--#include file="../include/head.asp"-->
<%
flagstr = "c_fei886_small"
call checkflag(flagstr)
session("curpage") = "info/"&flagstr&".asp"
main_title = "内容小类"
%>
<table cellspacing="1">
	<thead><tr><th><%=main_title%>管理选项</th></tr></thead>
	<tbody><tr><td>
		<a class="add" href="?act=add">添加<%=main_title%></a>
		<a class="man" href="?act=man">管理<%=main_title%></a>
		<a class="del" href="?act=crt">生成全部<%=main_title%>路径</a>
	</td></tr></tbody>
</table>
<br />
<%
act = request.querystring("act")
nid = request.querystring("nid")
what = request.querystring("what")
page = int(request.querystring("page"))
select case request.querystring("act")
	case "all"
		call so_class_all()
	case "man"
		call so_class_man(page)
	case "add"
		call so_class_edit("add",0)
	case "edit"
		call so_class_edit("edit",nid)
	case "save"
		call so_class_save(what,nid)
	case "delete"
		call so_class_delete(nid)
	case "crt"
		sql = "select * from so_class where typestr = 'fei886_small'"
		rs.open sql,conn,1,1
		idlist = ""
		k = 1
		if not rs.eof then
		do while not rs.eof
			if k = 1 then
				idlist = rs("id")
			else
				idlist = idlist & "," & rs("id")
			end if
		k = k + 1
		rs.movenext
		loop
		end if
		rs.close
		call so_class_create(idlist)
end select

'创建静态路径
sub so_class_create(idlist)
sql = "select * from so_class where typestr = 'fei886_small' and id in ("&idlist&")"
rs.open sql,conn,2,2
if not rs.eof then
	do while not rs.eof
		'创建路径
		folderpath = "/article/"&id2formstr(rs("classid"),"so_class","nickname")&"/"
		call createfolder(folderpath)
		folderpath = folderpath & rs("nickname")&"/"
		call createfolder(folderpath)
		filepath = folderpath & "index.asp"
		call createfile(filepath)
		'写入状态
		rs("reg_html") = 1
		rs("url_html") = folderpath
		rs.update
		'读取参数
		curid = rs("id")
		title = rs("title")
		page_title = rs("page_title")
		page_keywords = rs("page_keywords")
		page_description = rs("page_description")
		lv2str = ">> <a href="""&id2formstr(rs("classid"),"so_class","url_html")&""">"&id2formstr(rs("classid"),"so_class","title")&"</a>"
		lv3str = ">> <strong>"&title&"</strong>"
		'读取模板
		myhtml = readfile("/template/small.asp","gb2312")
		'替换模板中参数
		myhtml = replace(myhtml,"{$curid}",curid)
		myhtml = replace(myhtml,"{$title}",title)
		myhtml = replace(myhtml,"{$page_title}",page_title)
		myhtml = replace(myhtml,"{$page_keywords}",page_keywords)
		myhtml = replace(myhtml,"{$page_description}",page_description)
		myhtml = replace(myhtml,"{$lv2str}",lv2str)
		myhtml = replace(myhtml,"{$lv3str}",lv3str)
		'写入目标文件
		call write2file(filepath,myhtml,"gb2312")
	rs.movenext
	loop
end if
rs.close
call redir("?act=man")
end sub

'存储表单
sub so_class_save(what,nid)
select case what
	case "add"
		sql = "select * from so_class"
		rs.open sql,conn,2,2
		rs.addnew
		rs("typestr") = "fei886_small"
	case "edit"
		sql = "select * from so_class where id = "&nid
		rs.open sql,conn,2,2
		rs("reg_html") = 2
end select

rs("title") = trim(request.form("title"))
rs("orderid") = trim(request.form("orderid"))
rs("page_title") = trim(request.form("page_title"))
rs("page_keywords") = trim(request.form("page_keywords"))
rs("page_description") = trim(request.form("page_description"))
rs("classid") = trim(request.form("classid"))
rs("pic_min") = trim(request.form("pic_min"))
rs("nickname") = trim(request.form("nickname"))

rs.update
rs.close
call redir("?act=man")
end sub

'编辑表单
sub so_class_edit(act,nid)
select case act
	case "edit"
		actstr = "编辑"
		sql = "select * from so_class where id = "&nid
		rs.open sql,conn,1,1
		title = rs("title")
		orderid = rs("orderid")
		page_title = rs("page_title")
		page_keywords = rs("page_keywords")
		page_description = rs("page_description")
		classid = rs("classid")
		pic_min = rs("pic_min")
		nickname = rs("nickname")
		rs.close
	case "add"
		actstr = "添加"
		title = ""
		orderid = 0
		page_title = ""
		page_keywords = ""
		page_description = ""
		classid = null
		pic_min = ""
		nickname = ""
end select
%>
<table cellspacing="1">
	<thead><tr><th colspan="2"><%=main_title%>——<%=actstr%></th></tr></th>
	<form method="post" name="add" action="?act=save&what=<%=act%>&nid=<%=nid%>">
	<tbody>
		<tr>
			<td><b>分类名称:</b></td>
			<td><input type="text" name="title" value="<%=title%>" size="26" /></td>
		</tr>
		<tr>
			<td><b>路径名:</b></td>
			<td><input type="text" name="nickname" value="<%=nickname%>" size="16" /></td>
		</tr>
		<tr>
			<td><b>所属大类:</b></td>
			<td><%=classlist("fei886",classid)%></td>
		</tr>
		<tr>
			<td><b>排序:</b></td>
			<td><input type="text" name="orderid" value="<%=orderid%>" size="4" /><em>数字越大越靠前</em></td>
		</tr>
		<tr>
			<td><b>页面标题:</b></td>
			<td><input type="text" name="page_title" value="<%=page_title%>" size="48" /><em>title标签</em></td>
		</tr>
		<tr>
			<td><b>页面关键字:</b></td>
			<td><input type="text" name="page_keywords" value="<%=page_keywords%>" size="36" /><em>meta元素</em></td>
		</tr>
		<tr>
			<td><b>页面摘要:</b></td>
			<td><textarea name="page_description" cols="78" rows="4"><%=page_description%></textarea></td>
		</tr>
		<tr>
			<td><b>图片:</b></td>
			<td><input type="text" name="pic_min" value="<%=pic_min%>" size="36" />
			<input type="button" value="上传图片" name="upload" class="button" onclick="window.open('../upload.asp?uppath=<%=server.urlencode("/upload")%>&formname=add&editname=pic_min','upload','width=420,height=100')" /><em>图片大小:宽100像素、高100像素</em></td>
		</tr>
		<tr>
			<td width="20%"></td>
			<td width="80%"><input type="submit" value="确认提交" /></td>
		</tr>
	</tbody>
	</form>
</table>
<%
end sub

'管理列表
sub so_class_man(page)
%>
<table cellspacing="1">
	<thead><tr>
		<th width="5%">选择</th>
		<th width="5%">排序</th>
		<th width="5%">导航</th>
		<th width="5%">静态</th>
		<th width="10%">所属大类</th>
		<th width="10%">分类名称</th>
		<th width="25%">路径</th>
		<th width="5%">内容</th>
		<th width="20%">关键词</th>
		<th width="10%">操作</th>
	</tr></thead>
	<form action="?act=all" method="post" id="allc">
<%
sql = "select * from so_class where typestr = 'fei886_small' order by classid desc,orderid desc,id asc"
rs.open sql,conn,1,1
if rs.eof then
%>
	<tbody><tr><td align="center" colspan="20">暂无内容!</td></tr></tbody>
<%
else
rs.pagesize = config_manpage
if page = 0 then page = 1
if page = "" then page = 1
rs.AbsolutePage = page
pagec = rs.pagecount
for i = 1 to rs.pagesize
if rs("reg") = 1 then
	regstr = "<i>显示</i>"
else
	regstr = "<u>隐藏</u>"
end if
if rs("reg_html") = 1 then
	htmlstr = "<i>静态</i>"
	urlstr = rs("url_html")
elseif rs("reg_html") = 2 then
	htmlstr = "<u>编辑</u>"
	urlstr = rs("url_html")
else
	htmlstr = "<u>动态</u>"
	urlstr = "/list.asp?c="&rs("classid")&"&s="&rs("id")
end if
%>
	<tbody><tr>
		<td align="center"><input type="checkbox" value="<%=rs("id")%>" name="allid" /></td>
		<td align="center"><%=rs("orderid")%></td>
		<td align="center"><%=regstr%></td>
		<td align="center"><%=htmlstr%></td>
		<td><%=id2formstr(rs("classid"),"so_class","title")%></td>
		<td><a href="?act=edit&nid=<%=rs("id")%>" class="mod"><%=rs("title")%></a></td>
		<td><a href="<%=urlstr%>" target="_blank" class="add"><%=urlstr%></a></td>
		<td align="center"><%=db_count("select * from so_article where smallid = "&rs("id"))%>篇</td>
		<td><%=rs("page_keywords")%></td>
		<td align="center">
			<a href="?act=edit&nid=<%=rs("id")%>" class="mod">编辑</a>
			<a href="?act=delete&nid=<%=rs("id")%>" class="del" onclick="return del()">删除</a>
		</td>
	</tr></tbody>
<%
rs.movenext
if rs.eof then exit for
next
%>
	<tbody><tr><td colspan="20"><div id="dispartpage"><%=dispartpage(page,pagec,"act=man&")%></div></td></tr></tbody>
	<tbody><tr><td colspan="20">
		<input type="button" value="全选" name="allid" id="allbtn" />
		<select name="opt">
			<option value="crt">生成静态路径</option>
			<option value="reg_no">导航隐藏</option>
			<option value="reg">导航显示</option>
			<option value="delete">删除</option>
		</select>
		<input type="submit" value="批量操作" />
	</td></tr></tbody>
	</form>
<%
end if
rs.close
%>
</table>
<%
end sub

sub so_class_all()
opt = request.form("opt")
allid = request.form("allid")
select case opt
	case "delete"
		conn.execute "delete * from so_class where id in ("&allid&")"
	case "reg"
		conn.execute "update so_class set reg = 1 where id in ("&allid&")"
	case "reg_no"
		conn.execute "update so_class set reg = 0 where id in ("&allid&")"
	case "crt"
		call so_class_create(allid)
end select
call redir("?act=man")
end sub

sub so_class_delete(nid)
conn.execute "delete * from so_class where id = "&nid
call redir("?act=man")
end sub
%>
<!--#include file="../include/foot.asp"-->