<!--#include file = "../inc/dbconn.asp"-->
<!--#include file = "CheckLogin.asp"-->
<!--#include file = "../inc/cache.asp"-->
<!--#include file = "../inc/function.asp"-->
<% LOADING_BUFFER_INI %>
<% LOADING_ADMIN_HEAD %>
<% call dbconn %>
<%
if gqv("do") = "addGBClassSave" then
	if gfv("ClassID") = "" then
		call alertbox("[栏目ID(英文名)]不能为空!",2)
	elseif gfv("ClassName") = "" then
		call alertbox("[栏目名称(中文名)]不能为空!",2)
	elseif gfv("ClassExp") = "" then
		call alertbox("[栏目说明]不能为空!",2)
	end if
	dim rs,sql
	set rs = server.createobject (G_654_RS)
	sql = "select * from GB654_Class where ClassID='" & gfv("ClassID") & "'"
	rs.open sql,conn,1,3
	if not rs.eof then		
        rs.update
	    rs.close:set rs = nothing
		call alertbox("抱歉!该分类存在!",2)
	end if	
    dim rsn,nsql
	set rsn = server.createobject(G_654_RS)
	    nsql = "select top 1 * from GB654_Class"
	    rsn.open nsql,conn,1,3
	    rsn.addnew
	    rsn("ClassID") = gfv("ClassID")
	    rsn("ClassName") = gfv("ClassName")
	    rsn("ClassExp") = gfv("ClassExp")
	    rsn("Author") = session("uname")
	    rsn("AddDate") = now()
        rsn.update
	    rsn.close:set rsn = nothing
	call alertbox("恭喜!添加成功!",2)
elseif gqv("do") = "editSave" then
    dim ID,ClassID,ClassName,ClassExp
	ID = trim(gfv("ID"))
	ClassID = trim(gfv("ClassID"))
	ClassName = trim(gfv("ClassName"))
	ClassExp = trim(gfv("ClassExp"))
	if ClassID = "" or ClassName = "" or  ClassExp = "" then
		call alertbox("请完整填写信息!",2)
	end if
	set rs = server.createobject (G_654_RS)
	sql = "select * from GB654_Class where ID=" & ID & ""
	rs.open sql,conn,1,3
	if not rs.eof then
	    rs("ClassID") = ClassID
	    rs("ClassName") = ClassName
	    rs("ClassExp") = ClassExp
	    rs("Author") = session("uname")
	    rs("AddDate") = now()
		rs.update
		rs.close:set rs = nothing
		call alertbox("恭喜!修改分类成功!",2)
	else
		call alertbox("抱歉!填写错误!",2)
	end if
elseif gqv("do") = "del" then
    if not Check_Popedom("H402") then call alertbox("你没有权限操作",2)
	conn.execute("delete * from GB654_Class where id=" & ChkNum(gqv("id")))
	call alertbox("恭喜!删除分类成功!",2)
end if
    LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" border=""0"">"
	LINE "<tr>"
	LINE "<td align=""center"" valign=""middle"">"
    LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" class=""tbl"" id=tbl>"
    LINE "<tr>"
    LINE "<td height=""30"" class=""tbl_head"">ID</td>"
	LINE "<td height=""30"" class=""tbl_head"">栏目ID(英文名)</td>"
    LINE "<td height=""30"" class=""tbl_head"">栏目名称</td>"
    LINE "<td height=""30"" class=""tbl_head"">栏目说明</td>"
    LINE "<td height=""30"" class=""tbl_head"">添加者</td>"
    LINE "<td height=""30"" class=""tbl_head"">添加时间</td>"
	LINE "<td height=""30"" class=""tbl_head"">修改</td>"
	LINE "<td height=""30"" class=""tbl_head"">删除</td>"
    LINE "</tr>"
  	dim ors
	set ors = new cls_vbspage
	set ors.conn = conn
	with ors
		.pagesize = 20
		.pagename = "page"
		.dbtype = "ac"
		.rectype = 0
		.jsurl = "../inc"
		.pkey = "id"
		.field = "id,ClassID,ClassName,ClassExp,Author,AddDate"
		.table = "GB654_Class"
		.condition = "id > 0" 
		.orderby = "id desc"
	end with
	dim ireccount,irs
		ireccount = ors.reccount()
		irs = ors.resultset()
	if ireccount < 1 then
	LINE "<tr>"
	LINE "<td bgcolor=""#ffffff"" align=""center""  height=""30"" colspan=""8""><font color=""red"">暂时没有留言分类!</font></td>"
	LINE "</tr>"
	else
	dim i
	for i = 0 to ubound(irs,2)
    LINE "<tr>"
    LINE "<td bgcolor=""#ffffff"">"&irs(0,i)&"</td>"
	LINE "<td bgcolor=""#ffffff"">"&irs(1,i)&"</td>"
    LINE "<td bgcolor=""#ffffff"">"&irs(2,i)&"</td>"
    LINE "<td bgcolor=""#ffffff"">"&irs(3,i)&"</td>"
    LINE "<td bgcolor=""#ffffff"">"&irs(4,i)&"</td>"
    LINE "<td bgcolor=""#ffffff"">"&irs(5,i)&"</td>"
	LINE "<td bgcolor=""#ffffff""><input name=""submit1"" type=""button"" value=""编辑"" onclick=""window.location.href('?do=editGBClass&id=" & irs(0,i) & "');""></td>"
    LINE "<td bgcolor=""#ffffff""><input name=""submit2"" type=""button"" value=""删除"" onclick=""if(confirm('确定要删除此分类?')){window.location.href('?do=del&id=" & irs(0,i) & "');}""></td>"
    LINE "</tr>"
    next
	LINE "<tr>"
	%><td bgcolor="#ffffff" align="right" height="30" colspan="8"><% = ors.showpage() %></td><%
	LINE "</tr>"
	end if
	LINE "</table>"
	LINE "</td>"
	LINE "</tr>"
	LINE "</table>"%>
<%select case gqv("do")
	case "addGBClass"
        if not Check_Popedom("H402") then call alertbox("你没有权限操作",2)
	    Call addGBClass
	    Call cursor("#addGBClass",0)
	case "editGBClass"
        if not Check_Popedom("H402") then call alertbox("你没有权限操作",2)
	    Call editGBClass
	    Call cursor("#editGBClass",0)
end select%>


<%sub addGBClass
	LINE "<a name=""addGBClass""></a>"
	LINE "<form name=""form"" action=""?do=addGBClassSave"" method=""post"">"
	LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" border=""0"">"
	LINE "<tr>"
	LINE "<td align=""center"" valign=""middle"">"
	LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" class=""tbl"" id=tbl>"
	LINE "<tr>"
	LINE "<td width=""10%"" align=""center"" height=""30"" colspan=""2"" class=""tbl_top0"">添加留言簿分类</td>"
	LINE "</tr>"
	LINE "<tr>"
	LINE "<td class=""tbl_head"" align=""right"">栏目ID(英文名):</td>"
	LINE "<td bgcolor=""#ffffff"" width=""75%""><input name=""ClassID"" type=""text"" value="""" style=""width:200px;""></td>"
	LINE "</tr>"
	LINE "<tr>"
	LINE "<td class=""tbl_head"" align=""right"">栏目名称(中文名):</td>"
	LINE "<td bgcolor=""#ffffff"" width=""75%""><input name=""ClassName"" type=""text"" value="""" style=""width:200px;""></td>"
	LINE "</tr>"
	LINE "<tr>"
	LINE "<td class=""tbl_head"" align=""right"">栏目说明:</td>"
	LINE "<td bgcolor=""#ffffff"" width=""75%""><input name=""ClassExp"" type=""text"" value="""" style=""width:200px;""></td>"
	LINE "</tr>"
	LINE "<tr>"
	LINE "<td align=""right"" bgcolor=""#ffffff""></td>"
	LINE "<td bgcolor=""#ffffff"">"
	LINE "<input name=""submit1"" type=""submit"" value=""添加分类"" onclick=""this.disabled=true;document.form.submit();"">&nbsp;"
	LINE "<input name=""submit2"" type=""reset"" value=""重新填写"">&nbsp;"
	LINE "<input name=""submit3"" type=""button"" value=""返回"" onclick=""window.history.back();"">"
	LINE "</td>"
	LINE "</tr>"
	LINE "</table>"
	LINE "</td>"
	LINE "</tr>"
	LINE "</table>"
	LINE "</form>"
end sub%>

<%sub editGBClass
	dim rs,databox
	set rs = conn.execute("select top 1 * from GB654_Class where id=" & ChkNum(gqv("id")))
	if rs.eof then
		rs.close:set rs = nothing
		call alertbox("抱歉!系统没有找到相关记录!",2)
	else
		databox = rs.getrows()
		rs.close:set rs = nothing
	end if
	LINE "<a name=""editGBClass""></a>"
	LINE "<form name=""form"" action=""?do=editSave"" method=""post"">"
	LINE "<input name=""ID"" type=""hidden"" value=""" & ChkNum(gqv("id"))&""">"
	LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" border=""0"">"
	LINE "<tr>"
	LINE "<td align=""center"" valign=""middle"">"
	LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" class=""tbl"" id=tbl>"
	LINE "<tr>"
	LINE "<td width=""10%"" align=""center"" height=""30"" colspan=""2"" class=""tbl_top0"">修改留言簿分类</td>"
	LINE "</tr>"
	LINE "<tr>"
	LINE "<td class=""tbl_head"" align=""right"">栏目ID(英文名):</td>"
	LINE "<td bgcolor=""#ffffff"" width=""75%""><input name=""ClassID"" type=""text"" value=""" & databox(1,0) & """ style=""width:200px;""></td>"
	LINE "</tr>"
	LINE "<tr>"
	LINE "<td class=""tbl_head"" align=""right"">栏目名称(中文名):</td>"
	LINE "<td bgcolor=""#ffffff"" width=""75%""><input name=""ClassName"" type=""text"" value=""" & databox(2,0) & """ style=""width:200px;"">&nbsp;<font color=""red"">必填</font></td>"
	LINE "</tr>"
	LINE "<tr>"
	LINE "<td class=""tbl_head"" align=""right"">栏目说明:</td>"
	LINE "<td bgcolor=""#ffffff"" width=""75%""><input name=""ClassExp"" type=""text"" value=""" & databox(3,0) & """ style=""width:200px;"">&nbsp;<font color=""red"">必填</font></td>"
	LINE "</tr>"
	LINE "<tr>"
	LINE "<td align=""right"" bgcolor=""#ffffff""></td>"
	LINE "<td bgcolor=""#ffffff"">"
	LINE "<input name=""submit1"" type=""submit"" value=""保存修改"" onclick=""this.disabled=true;document.form.submit();"">&nbsp;"
	LINE "<input name=""submit2"" type=""reset"" value=""重新填写"">&nbsp;"
	LINE "<input name=""submit3"" type=""button"" value=""返回"" onclick=""window.history.back();"">"
	LINE "</td>"
	LINE "</tr>"
	LINE "</table>"
	LINE "</td>"
	LINE "</tr>"
	LINE "</table>"
	LINE "</form>"
	databox = ""
end sub%>
<% LOADING_ADMIN_FOOT %>
