www.gusucode.com > CC校友录贴吧 CCBar源码程序asp编程 > admin/admin_article.asp

    <%
'===================================================================
'= ASP FILENAME	: /admin/admin_article.asp
'= CREATED TIME : Mar,11,2004
'= LAST MODIFIED: Mar,11,2004
'= VERSION INFO : CCASP Framework Ver 2.0.1 ALL RIGHTS RESERVED BY www.cclinux.com
'= DESCRIPTION  : article manage
'= Change Log:
'===================================================================
%>

<!-- #include file = "../inc/inc_class_def.asp" -->

<!-- #include file = "../inc/inc_db_func.asp" -->
<!-- #include file = "../class/class_db.asp" -->

<!-- #include file = "../inc/inc_pub_func.asp" -->
<!-- #include file = "../inc/inc_char_func.asp" -->
<!-- #include file = "../inc/inc_data_check.asp" -->

<!-- #include file = "../class/class_html_form.asp" -->
<!-- #include file = "../class/class_html_table.asp" -->
<!-- #include file = "../main_func.asp" -->
<!-- #include file = "../inc/inc_ubb.asp" -->

<!-- #include file = "./admin_func.asp" -->

<!-- #include file = "../js/comm_func.js" -->
<!-- #include file = "../js/ubbcode.js" -->

<%
Const CONST_PAGE_FILE = "admin/admin_article.asp"
GBL_strHomeURL = "../"

Call AdminCheckExec()

Dim clsPubDB
Set clsPubDB = New classDBOprt

Call SiteHead("文章管理")

Call CheckPostExist("FormAddList,FormSaveAddList,ShowArticle,ShowList,DelList,ShowArticleSort,FormAddArticleSort,FormSaveAddArticleSort,DelArticleSort,FormMdyArticleSort,FormSaveMdyArticleSort,GetArticleNum")

Call ExeSysAdminQst()

Set clsPubDB = Nothing

%>
<%
'=============== FUNCTION BODY BEGIN ===============================
'===================================================================
'= Sub         : FormAddList()
'= Time		   : Created At Jan,13,2003
'= Input       : None

'= Called by   : ShowFuncSwitch()
'= Calls       : ShowFuncSwitch()
'= Description : Add list
'===================================================================
Sub FormAddList()

	Dim clsForm			'== Class of form
	Dim clsTable		'== Class of table
	Dim strHtmlCode
	Dim GetRSId
	Dim strActFlag
	Dim strVer,strStatus,strKey,strTitle,strContent,strType,strAdd1,strAdd2,strAdd3
	Dim intOrder

	strVer = ""
	strStatus = "0"
	strKey = ""
	strTitle = ""
	strContent = ""
	strType = "0"
	strAdd1 = ""
	strAdd2 = ""
	strAdd3 = ""
	intOrder = 0

	strActFlag = Trim(Request.QueryString("pstActFlag"))
	If strActFlag = "LIST_EDIT" Then

		GetRSId = Trim(Request.QueryString("ListId"))
		strAddInfo = "该文章"
		intErrId = DataCheck("DT_ID",GetRSId,strAddInfo,"")
		Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

		clsPubDB.Clear()
		clsPubDB.AllSQL = "SELECT LIST_TITLE,LIST_ADD1,LIST_ADD2,LIST_STATUS,LIST_ORDER,LIST_CONTENT,LIST_KEY,LIST_TYPE FROM CLASS_LIST WHERE LIST_ID=" & GetRSId
		clsPubDB.SQLRSExecute()
		Call ResultExecute(clsPubDB.intErrNum,"get data before add list","ES_ERR")
		If Not ResultExecute(clsPubDB.intRSNum,"该需要修改的文章","ES_DB_NO") Then
			strTitle = clsPubDB.objPubRS("LIST_TITLE")
			strVer = ""
			strType = clsPubDB.objPubRS("LIST_TYPE")
			strStatus = clsPubDB.objPubRS("LIST_STATUS")
			strContent = clsPubDB.objPubRS("LIST_CONTENT")
			strKey = clsPubDB.objPubRS("LIST_KEY")
			intOrder = clsPubDB.objPubRS("LIST_ORDER")
			strAdd1 = clsPubDB.objPubRS("LIST_ADD1")
			strAdd2 = clsPubDB.objPubRS("LIST_ADD2")
		End If

	End If

	Set clsForm = New classForm
	If strActFlag = "LIST_EDIT" Then
		clsForm.Action = "./admin_article.asp?action=FormSaveAddList&pstActFlag=LIST_EDIT&ListId=" & GetRSId
	Else
		clsForm.Action = "./admin_article.asp?action=FormSaveAddList"
	End If
	clsForm.Id = "frmAddList"
	clsForm.Name = "frmAddList"
	clsForm.OnSubmit = "return CheckFormAddList()"
	clsForm.ColumnScale = "20%"
	clsForm.MakeForm()
	clsForm.MakeTable "0","3","1","center","95%",GBL_cssListTable

	clsForm.AddTr GBL_cssFormTitleTd
	clsForm.AddTitle "发表新文章",""

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*文章主题",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddText "iptTitle","240","50"
	clsForm.AddValue strTitle

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*文章类型",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddSelect "rdoType",""
	Call GetArticleSort(clsForm,strType)

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*文章状态",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddRadio "rdoStatus","0","普通&nbsp;",strStatus
	clsForm.AddRadio "rdoStatus","1","固顶&nbsp;",strStatus
	'clsForm.AddRadio "rdoStatus","2","推荐&nbsp;",strStatus
	'clsForm.AddRadio "rdoStatus","3","锁定&nbsp;",strStatus
	'clsForm.AddRadio "rdoStatus","4","隐藏&nbsp;",strStatus

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "排序号",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddText "iptOrder","4","4"
	clsForm.AddValue intOrder

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "关 键 字",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddText "iptKey","250","50"
	clsForm.AddValue strKey
	
	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "UBB代码",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddLine GetUbb()

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "附加1",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddText "iptAdd1","255","50"
	clsForm.AddValue strAdd1

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "附加1说明",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddLine "站长日记:cloudy,sunny,rain,stoc"

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "附加2",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddText "iptAdd2","255","50"
	clsForm.AddValue strAdd2

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*文章内容",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddTextrea "txtContent","70","15"
	clsForm.AddValue FilterHtml(strContent)

	clsForm.AddTr GBL_cssFormSubTr
	clsForm.AddSubTd GBL_cssFormSubTd
	clsForm.AddSub "subAddList","提 交","submit"
	clsForm.AddSub "rstAddList","重 写","reset"

	clsForm.OutPutForm()
	Set clsForm = Nothing

End Sub
'============== End of Function FormAddList() =====================
'===================================================================
'= Sub         : FormSaveAddList() 
'= Time	       : Created At Jan,13,2003
'= Input       : None

'= Called by   : ExecFuncSwitch()
'= Calls       : None
'= Table       : INSERT INTO CLASS_LIST
'= Description : Save user's list
'===================================================================
Sub FormSaveAddList() 

	Dim strTitle,strContent,strVer,intType,intStatus,strKey
	Dim strAddInfo
	Dim intErrId
	Dim GetRSId,strActFlag
	Dim intOrder

	strActFlag = Trim(Request.QueryString("pstActFlag"))
	If strActFlag = "LIST_EDIT" Then
		GetRSId = Trim(Request.QueryString("ListId"))
		strAddInfo = "该文章"
		intErrId = DataCheck("DT_ID",GetRSId,strAddInfo,"")
		Call ResultExecute(intErrId,strAddInfo,"ES_ERR")
	End If

	'== Check title of board
	strTitle = Trim(Request.Form("iptTitle"))
	strAddInfo = "主题"
	intErrId = DataCheck("DT_FIX_LENGTH",strTitle,strAddInfo,"1|DTC_LESS_MORE_LEN|240|")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	strType = Trim(Request.Form("rdoType"))
	strAddInfo = "类型"
	If FindArticleSort(strType) = "NULL" Then
		Call ResultExecute(E_USER_PUB,"类型选择错误","ES_ERR")
		Exit Sub
	End If

	intOrder = Trim(Request.Form("iptOrder"))
	If Not IsNumeric(intOrder) Then
		Call ResultExecute(E_USER_PUB,"排序号错误,应全为数字","ES_ERR")
		Exit Sub
	End If

	strStatus = Trim(Request.Form("rdoStatus"))
	strAddInfo = "状态"
	intErrId = DataCheck("DT_ENUM",strStatus,strStatus,"0,1")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	strKey = Trim(Request.Form("iptKey"))
	strAdd1 = Trim(Request.Form("iptAdd1"))
	strAdd2 = Trim(Request.Form("iptAdd2"))

	'== Check contents
	strContent = RTrim(Request.Form("txtContent"))
	strAddInfo = "内容"
	intErrId = DataCheck("DT_FIX_LENGTH",strContent,strAddInfo,"5|DTC_LESS_MORE_LEN|10000|")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	clsPubDB.Clear()
	clsPubDB.TableName = "CLASS_LIST"
	If strActFlag = "LIST_EDIT" Then
		clsPubDB.SQLType = "UPDATE"
		clsPubDB.Where = "LIST_ID=" & GetRSId
	Else
		clsPubDB.SQLType = "INSERT"
		clsPubDB.AddField "LIST_OWNER_ID",GBL_intUserId
	End If
	'clsPubDB.AddField "LIST_STATUS",strStatus
	clsPubDB.AddField "LIST_TITLE",strTitle
	clsPubDB.AddField "LIST_CONTENT",htmlencode2(strContent)
	clsPubDB.AddField "LIST_TYPE",strType
	clsPubDB.AddField "LIST_KEY",strKey
	clsPubDB.AddField "LIST_ORDER",intOrder
	clsPubDB.AddField "LIST_ADD1",strAdd1
	clsPubDB.AddField "LIST_ADD2",strAdd2

	clsPubDB.SQLExecute()
	Call ResultExecute(clsPubDB.intErrNum,"add or mdy article","ES_ERR")

	If strActFlag = "LIST_EDIT" Then
		Call ResultExecute(1002,"","ES_SUCC")
	Else
		Call ResultExecute(1001,"","ES_SUCC")
	End If
	
End Sub
'=========== End of Sub FormSaveAddList() ==========================
'===================================================================
'= Sub         : DelList()
'= Time		   : Created At June,8,2003
'= Input       : None

'= Called By   : ShowFuncSwitch()
'= Calls	   : ShowPage(),ShowContent(),ShowContentB()
'= Table       : Query CLASS_LIST
'= Description : 
'===================================================================
Sub DelList()

	Dim intErrId
	Dim strAddInfo
	Dim GetRSId

	GetRSId = Trim(Request.QueryString("ListId"))
	strAddInfo = "该要删除的文章"
	intErrId = DataCheck("DT_ID",GetRSId,strAddInfo,"")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	clsPubDB.Clear()
	clsPubDB.TableName = "CLASS_LIST"
	clsPubDB.SQLType = "DELETE"
	clsPubDB.Where = "LIST_ID=" & GetRSId
	clsPubDB.SQLExecute()
	Call ResultExecute(clsPubDB.intErrNum,"del list","ES_ERR")

	Response.Redirect "./admin_article.asp?action=ShowList"

End Sub
'=============== End Of Sub DelList() ==============================
'====================================================================
'= Sub         : ShowContent(objRSCont,intMaxPerPage,intPageNow)
'= Time        : Created At May,17,2003
'= Input       : 记录集游标(objRSCont),每页最大记录,当前页数

'= Called by   : ShowList()
'= Calls       : None
'= Table       : Query CLASS_LIST
'= Description : Show per page's list
'===================================================================
Sub ShowContent(objRSCont,intMaxPerPage,intPageNow)
	Dim i				
	Dim strHtmlCode
	Dim clsTable
	Dim clsTbClass
	Dim strTmp,strType

	i = 0
	Set clsTable = New classTable
	'== Set table prameters
	clsTable.Border = "0"
	clsTable.CellPadding = "3"
	clsTable.CellSpacing = "1"
	clsTable.Width = "95%"
	clsTable.ClassType = GBL_cssListTable
	clsTable.Align = "center"
	clsTable.MakeTable()

	clsTable.AddTitleTr strTbClass
	clsTable.AddTitleTd "类&nbsp;型","CSS_TD_CENTER2","13%"

	clsTable.AddTitleTd "主&nbsp;&nbsp;题","CSS_TD_CENTER2","40%"
	clsTable.AddTitleTd "浏览","CSS_TD_CENTER2","8%"
	clsTable.AddTitleTd "排序号","CSS_TD_CENTER2","8%"

	clsTable.AddTitleTd "加入","CSS_TD_CENTER2",""
	If GBL_strUserAccount = "admin" Then
		clsTable.AddTitleTd "操&nbsp;作","CSS_TD_CENTER2",""
	End If

	Do While Not objRSCont.Eof

		If (i Mod 2) = 0 Then 
			strTbClass = "CSS_TD_CENTER1"
		Else
			strTbClass = "CSS_TD_CENTER2"
		End If

		clsTable.AddTr strTbClass
		clsTable.AddTd objRSCont("ARTICLE_SORT_NAME"),""

		strHtmlCode = MakeLink("admin/admin_article.asp?action=ShowArticle&ListId="&objRSCont("LIST_ID"),objRSCont("LIST_TITLE"),"阅读该文章")
		clsTable.AddTd "&nbsp;" & strHtmlCode,"CSS_TD_LEFT3"
		clsTable.AddTd objRSCont("LIST_HITS"),""
		clsTable.AddTd objRSCont("LIST_ORDER"),""

		clsTable.AddTd TimeFormat(objRSCont("LIST_ADD_TIME"),"YYMMDD"),""

		If GBL_strUserAuthen = 1 Then
			strHtmlCode = MakeLinkClew("admin/admin_article.asp?action=DelList&ListId=" & objRSCont("LIST_ID"),"[删除]","删除该文章"," onclick=""return confirm('您确认删除该文章?');""")
			strHtmlCode = strHtmlCode & "&nbsp;" & MakeLink("admin/admin_article.asp?action=FormAddList&ListId=" & objRSCont("LIST_ID") & "&pstActFlag=LIST_EDIT","[编辑]","编辑该文章")
			clsTable.AddTd strHtmlCode,""
		End If

		i = i + 1
		If i >= intMaxPerPage Then Exit Do
			objRSCont.MoveNext
	Loop

	clsTable.AddInfoTr "CSS_TD_TITLE1","TOP"
	clsTable.AddInfoTd "文 章 列 表",GBL_cssListTitleTd

	clsTable.OutPutTable()
	clsTable.Clear()
	Set clsTable = Nothing

End Sub 
'============== End of Sub ShowContent() ===========================
'====================================================================
'= Sub         : ShowArticle()
'= Time        : Created At May,17,2003
'= Input       : 

'= Called by   : 
'= Calls       : None
'= Table       : Query CLASS_LIST
'= Description : Show per page's list
'===================================================================
Sub ShowArticle()

	Dim GetRSId,strAddInfo,intErrId

	GetRSId = Trim(Request.QueryString("ListId"))
	strAddInfo = "该文章"
	intErrId = DataCheck("DT_ID",GetRSId,strAddInfo,"ES_ERR")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	clsPubDB.Clear()
	clsPubDB.TableName = "CLASS_LIST"
	clsPubDB.SQLType = "SELECT"
	clsPubDB.AddField "*",""
	clsPubDB.Where = "LIST_ID=" & GetRSId
	clsPubDB.SQLRSExecute()
	Call ResultExecute(clsPubDB.intErrNum,"show article","ES_ERR")
	If Not ResultExecute(clsPubDB.intRSNum,"该文章","ES_DB_NO") Then

		Set clsTable = New classTable
		'== Set table prameters
		clsTable.Border = "0"
		clsTable.CellPadding = "3"
		clsTable.CellSpacing = "1"
		clsTable.Width = "95%"
		clsTable.ClassType = GBL_cssListTable
		clsTable.Align = "center"
		clsTable.MakeTable()

		clsTable.AddTitleTr ""
		clsTable.AddTitleTd clsPubDB.objPubRS("LIST_TITLE"),GBL_cssListTitleTd,"100%"

		clsTable.AddTr ""
		clsTable.AddTd ubbcode(clsPubDB.objPubRS("LIST_CONTENT")),"CSS_TD_LEFT2"

		If GBL_strUserAuthen = 1 Then
			strHtmlCode = MakeLinkClew("admin/admin_article.asp?action=DelList&ListId=" & clsPubDB.objPubRS("LIST_ID"),"[删除]","删除该文章"," onclick=""return confirm('您确认删除该文章?');""")
			strHtmlCode = strHtmlCode & "&nbsp;" & MakeLink("admin/admin_article.asp?action=FormAddList&ListId=" & clsPubDB.objPubRS("LIST_ID") & "&pstActFlag=LIST_EDIT","[编辑]","编辑该文章")
		End If

		clsTable.AddTr ""
		clsTable.AddTd strHtmlCode & " 加入时间:" & clsPubDB.objPubRS("LIST_ADD_TIME") & "  浏览:" & clsPubDB.objPubRS("LIST_HITS") & "次","CSS_TD_RIGHT2"

		If clsPubDB.objPubRS("LIST_TYPE") = 7 Then
			clsTable.AddTr ""
			strHtmlCode = MakeLink("list/index.asp?action=SoftDown&ListId=" & clsPubDB.objPubRS("LIST_ID") & "&pstDownUrl=" & clsPubDB.objPubRS("LIST_ADD1"),"目前共下载" & clsPubDB.objPubRS("LIST_ADD4") & "次(点击下载该软件)","点击下载该软件")
			clsTable.AddTd strHtmlCode,"CSS_TD_RIGHT2"
		End If


		clsTable.OutPutTable()
		clsTable.Clear()
		Set clsTable = Nothing

	End If

End Sub
'===================================================================
'= Sub         : ShowList()
'= Time		   : Created At June,8,2003
'= Input       : None

'= Called By   : ShowFuncSwitch()
'= Calls	   : ShowPage(),ShowContent(),
'= Table       : Query CLASS_LIST
'= Description : 
'===================================================================
Sub ShowList()

	Dim strFileName						'== The file post
	Dim strHtmlCode
	Dim intCurPage,intTotalPut
	Dim intMaxPerPage					'== per page board
	Dim i,strAddType,intErrId

	strArticleSortSlt = ArticleSortSlt()

	strAddType = Trim(Request.QueryString("pstAddType"))

	strFileName = "admin_article.asp?action=ShowList&pstAddType=" & strAddType

	'== Get page code
	intMaxPerPage = 15
	If Not IsEmpty(Request("intPageNow")) Then
		intCurPage = Cint(Request("intPageNow"))
	Else
		intCurPage = 1
	End If

	clsPubDB.Clear()
	If strAddType <> "" Then
		strWhere = " AND LIST_TYPE=" & strAddType
	Else
		strWhere = ""
	End If
	clsPubDB.AllSQL = "SELECT L.LIST_ID,L.LIST_TITLE,L.LIST_HITS,L.LIST_ORDER,L.LIST_ADD_TIME,S.ARTICLE_SORT_NAME FROM CLASS_LIST L,CLASS_ARTICLE_SORT S WHERE  S.ARTICLE_SORT_ID=L.LIST_TYPE " & strWhere & " ORDER BY LIST_STATUS DESC,LIST_TYPE DESC,LIST_ORDER DESC,LIST_ID DESC"
	clsPubDB.SQLRSExecute()
	Call ResultExecute(clsPubDB.intErrNum,"","ES_ERR")
	If Not ResultExecute(clsPubDB.intRSNum,"目前本栏目文章","ES_DB_NO") Then

		intTotalPut = clsPubDB.intRSNum

		If intCurPage < 1 then
			  intCurPage = 1
		End If
		If (intCurPage - 1) * intMaxPerPage > intTotalPut Then
			If (intTotalPut Mod intMaxPerPage) = 0 Then
				intCurPage = intTotalPut \ intMaxPerPage
			Else
				intCurPage = intTotalPut \ intMaxPerPage + 1
			End If
		End if

		Response.Write "&nbsp;&nbsp;" & strArticleSortSlt

		If intCurPage = 1 Then
			Call ShowContent(clsPubDB.objPubRS,intMaxPerPage,intCurPage)
			Call ShowPage2(intTotalPut,intMaxPerPage,intCurPage,strFileName,2)
		Else
			If (intCurPage - 1) * intMaxPerPage < intTotalPut Then
				clsPubDB.objPubRS.Move  (intCurPage - 1) * intMaxPerPage
				Dim BookMark
				BookMark = clsPubDB.objPubRS.BookMark
				Call ShowContent(clsPubDB.objPubRS,intMaxPerPage,intCurPage)
				Call ShowPage2(intTotalPut,intMaxPerPage,intCurPage,strFileName,2)
			Else
				intCurPage = 1
				Call ShowContent(clsPubDB.objPubRS,intMaxPerPage,intCurPage)
				Call ShowPage2(intTotalPut,intMaxPerPage,intCurPage,strFileName,2)
			End If
		End If

	End If

End Sub
'=============== End of Sub ShowList() =============================
'===================================================================
'= Sub         : FormAddArticleSort()
'= Time		   : Created At Apr,11,2004
'= Input       : None

'= Called by   : 
'= Calls       : 
'= Description : Add article sort
'===================================================================
Sub FormAddArticleSort()

	Dim clsForm			'== Class of form
	Dim clsTable		'== Class of table
	Dim strHtmlCode

	Set clsForm = New classForm
	clsForm.Action = "./admin_article.asp?action=FormSaveAddArticleSort"

	clsForm.Id = "frmAddArticleSort"
	clsForm.Name = "frmAddArticleSort"
	clsForm.OnSubmit = "return CheckFormAddArticleSort()"
	clsForm.ColumnScale = "30%"
	clsForm.MakeForm()
	clsForm.MakeTable "0","3","1","center","90%",GBL_cssFormTable

	clsForm.AddTr GBL_cssFormTitleTd
	clsForm.AddTitle "增加新的文章类型",""

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*类型名",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddText "iptSortName","20","30"

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*类型描述",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddText "iptSortDesc","100","30"

	clsForm.AddTr GBL_cssFormSubTr
	clsForm.AddSubTd GBL_cssFormSubTd
	clsForm.AddSub "subAddArticleSort","提 交","submit"
	clsForm.AddSub "rstAddArticleSort","重 写","reset"

	clsForm.OutPutForm()
	Set clsForm = Nothing

End Sub
'============== End of Function FormAddArticleSort() ===============
'===================================================================
'= Sub         : FormMdyArticleSort()
'= Time		   : Created At Apr,11,2004
'= Input       : None

'= Called by   : 
'= Calls       : 
'= Description : mdy article sort
'===================================================================
Sub FormMdyArticleSort()

	Dim clsForm			'== Class of form
	Dim clsTable		'== Class of table
	Dim strHtmlCode
	Dim GetRSId

	GetRSId = Trim(Request.QueryString("ArticleSortId"))
	If Not IsNumeric(GetRSId) Then
		Call ResultExecute(E_USER_PUB,"要修改的文章类型ID参数错误","ES_ERR")
		Exit Sub
	End If

	'== get info
	clsPubDB.Clear()
	clsPubDB.AllSQL = "SELECT * FROM CLASS_ARTICLE_SORT WHERE ARTICLE_SORT_ID=" & GetRSId
	clsPubDB.SQLRSExecute()
	Call ResultExecute(clsPubDB.intErrNum,"mdy article sort ","ES_ERR")


	Set clsForm = New classForm
	clsForm.Action = "./admin_article.asp?action=FormSaveMdyArticleSort&ArticleSortId=" & GetRSId

	clsForm.Id = "frmAddArticleSort"
	clsForm.Name = "frmAddArticleSort"
	clsForm.OnSubmit = "return CheckFormAddArticleSort()"
	clsForm.ColumnScale = "30%"
	clsForm.MakeForm()
	clsForm.MakeTable "0","3","1","center","90%",GBL_cssFormTable

	clsForm.AddTr GBL_cssFormTitleTd
	clsForm.AddTitle "修改文章类型",""

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*类型名",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddText "iptSortName","20","30"
	clsForm.AddValue clsPubDB.objPubRS("ARTICLE_SORT_NAME")

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*类型描述",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddText "iptSortDesc","100","30"
	clsForm.AddValue clsPubDB.objPubRS("ARTICLE_SORT_DESC")

	clsForm.AddTr GBL_cssFormTr
	clsForm.AddTd "*排序号",GBL_cssFormTdOne,GBL_cssFormTdTwo
	clsForm.AddText "iptSortOrder","4","30"
	clsForm.AddValue clsPubDB.objPubRS("ARTICLE_SORT_ORDER")

	clsForm.AddTr GBL_cssFormSubTr
	clsForm.AddSubTd GBL_cssFormSubTd
	clsForm.AddSub "subAddArticleSort","提 交","submit"
	clsForm.AddSub "rstAddArticleSort","重 写","reset"

	clsForm.OutPutForm()
	Set clsForm = Nothing

End Sub
'============== End of Function FormMdyArticleSort() ===============
'===================================================================
'= Sub         : FormSaveAddArticleSort()
'= Time		   : Created At Apr,11,2004
'= Input       : None

'= Called by   : 
'= Calls       : 
'= Description : Add article sort save
'===================================================================
Sub FormSaveAddArticleSort()

	Dim strAddInfo
	Dim intErrId
	Dim strSortName,strSortDesc

	intErrId = 0

	'== Check sort name
	strSortName = Trim(Request.Form("iptSortName"))
	strAddInfo = "文章类型名"
	intErrId = DataCheck("DT_FIX_LENGTH",strSortName,strAddInfo,"2|DTC_LESS_MORE_LEN|20|")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	'== Check sort desc
	strSortDesc = Trim(Request.Form("iptSortDesc"))
	strAddInfo = "类型描述"
	intErrId = DataCheck("DT_FIX_LENGTH",strSortDesc,strAddInfo,"2|DTC_LESS_MORE_LEN|20|")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	clsPubDB.Clear()
	clsPubDB.SQLType = "INSERT"
	clsPubDB.TableName = "CLASS_ARTICLE_SORT"
	clsPubDB.AddField "ARTICLE_SORT_NAME",strSortName
	clsPubDB.AddField "ARTICLE_SORT_DESC",strSortDesc
	clsPubDB.SQLExecute()
	Call ResultExecute(clsPubDB.intErrNum,"add new article sort","ES_ERR")

	Set clsPubDB = Nothing
	Response.Write"<script>alert('新的文章类型[" & strSortName & "]被成功提交\n若无变化,请刷新页面');location='admin_article.asp?action=ShowArticleSort'</script>"



End Sub
'=============== End of Sub FormSaveAddArticleSort() ===============
'===================================================================
'= Sub         : FormSaveMdyArticleSort()
'= Time		   : Created At Apr,11,2004
'= Input       : None

'= Called by   : 
'= Calls       : 
'= Description : Add article sort save
'===================================================================
Sub FormSaveMdyArticleSort()

	Dim strAddInfo
	Dim intErrId
	Dim strSortName,strSortDesc,intSortOrder
	Dim GetRSId

	intErrId = 0

	GetRSId = Trim(Request.QueryString("ArticleSortId"))
	If Not IsNumeric(GetRSId) Then
		Call ResultExecute(E_USER_PUB,"要修改的文章类型ID参数错误","ES_ERR")
		Exit Sub
	End If

	'== Check sort name
	strSortName = Trim(Request.Form("iptSortName"))
	strAddInfo = "文章类型名"
	intErrId = DataCheck("DT_FIX_LENGTH",strSortName,strAddInfo,"2|DTC_LESS_MORE_LEN|20|")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	'== Check sort desc
	strSortDesc = Trim(Request.Form("iptSortDesc"))
	strAddInfo = "类型描述"
	intErrId = DataCheck("DT_FIX_LENGTH",strSortDesc,strAddInfo,"2|DTC_LESS_MORE_LEN|20|")
	Call ResultExecute(intErrId,strAddInfo,"ES_ERR")

	'== Check sort order
	intSortOrder = Trim(Request.Form("iptSortOrder"))
	If Not IsNumeric(intSortOrder) Then
		Call ResultExecute(E_USER_PUB,"排序号错误","ES_ERR")
		Exit Sub
	End If

	clsPubDB.Clear()
	clsPubDB.SQLType = "UPDATE"
	clsPubDB.TableName = "CLASS_ARTICLE_SORT"
	clsPubDB.AddField "ARTICLE_SORT_NAME",strSortName
	clsPubDB.AddField "ARTICLE_SORT_DESC",strSortDesc
	clsPubDB.AddField "ARTICLE_SORT_ORDER",Cint(intSortOrder)
	clsPubDB.Where = "ARTICLE_SORT_ID=" & GetRSId
	clsPubDB.SQLExecute()
	Call ResultExecute(clsPubDB.intErrNum,"mdy  article sort","ES_ERR")

	Set clsPubDB = Nothing
	Response.Write"<script>alert('要修改的文章类型[" & strSortName & "]被成功修改\n若无变化,请刷新页面');location='admin_article.asp?action=ShowArticleSort'</script>"



End Sub
'=============== End of Sub FormSaveMdyArticleSort() ===============
'===================================================================
'= Sub         : ShowArticleSort()
'= Time		   : Created At Apr,11,2004
'= Input       : None

'= Called by   : 
'= Calls       : 
'= Description : show article sort save
'===================================================================
Sub ShowArticleSort()

	clsPubDB.Clear()
	clsPubDB.AllSQL = "SELECT * FROM CLASS_ARTICLE_SORT ORDER BY ARTICLE_SORT_ORDER DESC,ARTICLE_SORT_ID DESC"
	clsPubDB.SQLRSExecute()
	Call ResultExecute(clsPubDB.intErrNum,"show article sort","ES_ERR")

	Set clsTable = New classTable
	'== Set table prameters
	clsTable.Border = "0"
	clsTable.CellPadding = "3"
	clsTable.CellSpacing = "1"
	clsTable.Width = "95%"
	clsTable.ClassType = GBL_cssListTable
	clsTable.Align = "center"
	clsTable.MakeTable()

	clsTable.AddTitleTr strTbClass
	clsTable.AddTitleTd "ID号","CSS_TD_CENTER2","10%"
	clsTable.AddTitleTd "排序号","CSS_TD_CENTER2","10%"
	clsTable.AddTitleTd "类型名","CSS_TD_CENTER2","20%"
	clsTable.AddTitleTd "类型描述","CSS_TD_CENTER2","30%"
	clsTable.AddTitleTd "文章数","CSS_TD_CENTER2","10%"
	clsTable.AddTitleTd "操&nbsp;&nbsp;作","CSS_TD_CENTER2",""

	Do While Not clsPubDB.objPubRS.Eof

		clsTable.AddTr strTbClass
		clsTable.AddTd clsPubDB.objPubRS("ARTICLE_SORT_ID"),"CSS_TD_CENTER2"
		clsTable.AddTd clsPubDB.objPubRS("ARTICLE_SORT_ORDER"),"CSS_TD_CENTER1"
		clsTable.AddTd clsPubDB.objPubRS("ARTICLE_SORT_NAME"),"CSS_TD_CENTER2"
		clsTable.AddTd clsPubDB.objPubRS("ARTICLE_SORT_DESC"),"CSS_TD_CENTER1"
		clsTable.AddTd clsPubDB.objPubRS("ARTICLE_SORT_NUM"),"CSS_TD_CENTER2"

		strHtmlCode = "<a href='admin_article.asp?action=DelArticleSort&ArticleSortId=" & clsPubDB.objPubRS("ARTICLE_SORT_ID") & "' onclick=""return confirm('您确认删除该类型及该类型所有文章');"">[删除]</a> <a href='admin_article.asp?action=FormMdyArticleSort&ArticleSortId=" & clsPubDB.objPubRS("ARTICLE_SORT_ID") & "'>[修改]</a>"
		clsTable.AddTd strHtmlCode,"CSS_TD_CENTER1"

		clsPubDB.objPubRS.MoveNext

	Loop

	clsTable.AddInfoTr "CSS_TD_TITLE1","TOP"
	clsTable.AddInfoTd "文 章 类 型 列 表",GBL_cssListTitleTd

	clsTable.AddInfoTr "CSS_TD_TITLE1","BOTTOM"
	clsTable.AddInfoTd "【排序号大的类型将先显示,删除某个类型将删除该类型的所有文章,请慎重选择】","CSS_TD_CENTER2"

	clsTable.AddInfoTr "CSS_TD_TITLE1","BOTTOM"
	clsTable.AddInfoTd "<a href='admin_article.asp?action=GetArticleNum'>【刷新目前各类型文章数目】</a>","CSS_TD_CENTER2"

	clsTable.OutPutTable()
	clsTable.Clear()
	Set clsTable = Nothing
	
End Sub
'=============== End of Sub ShowArticleSort() ======================
'===================================================================
'= Sub         : DelArticleSort()
'= Time		   : Created At Apr,11,2004
'= Input       : None

'= Called by   : 
'= Calls       : 
'= Description : del article sort 
'===================================================================
Sub DelArticleSort()

	Dim GetRSId

	GetRSId = Trim(Request.QueryString("ArticleSortId"))
	If Not IsNumeric(GetRSId) Then
		Call ResultExecute(E_USER_PUB,"要删除的文章类型ID参数错误","ES_ERR")
		Exit Sub
	End If

	'== delete this sort article
	clsPubDB.Clear()
	clsPubDB.AllSQL = "DELETE FROM CLASS_LIST WHERE LIST_TYPE=" & GetRSId
	clsPubDB.SQLExecute()
	Call ResultExecute(clsPubDB.intErrNum,"del article before del sort","ES_ERR")

	'== delete this sort
	clsPubDB.Clear()
	clsPubDB.AllSQL = "DELETE FROM CLASS_ARTICLE_SORT WHERE ARTICLE_SORT_ID=" & GetRSId
	clsPubDB.SQLExecute()
	Call ResultExecute(clsPubDB.intErrNum,"del article sort","ES_ERR")

	Response.Redirect "admin_article.asp?action=ShowArticleSort"

End Sub
'=============== End of Sub DelArticleSort() =======================
'===================================================================
'= Sub         : GetArticleSort(clsObjForm)
'= Time		   : Created At Apr,11,2004
'= Input       : None

'= Called by   : 
'= Calls       : 
'= Description : get sort
'===================================================================
Sub GetArticleSort(ByRef clsObjForm,strSort)

	clsPubDB.Clear()
	clsPubDB.AllSQL = "SELECT ARTICLE_SORT_ID,ARTICLE_SORT_NAME FROM CLASS_ARTICLE_SORT ORDER BY ARTICLE_SORT_ORDER DESC"
	clsPubDB.SQLRSExecute()
	Call ResultExecute(clsPubDB.intErrNum,"get article sort","ES_ERR")
	Do While Not clsPubDB.objPubRS.Eof
		clsObjForm.AddOption Cstr(clsPubDB.objPubRS("ARTICLE_SORT_ID")),clsPubDB.objPubRS("ARTICLE_SORT_NAME"),strSort
		clsPubDB.objPubRS.MoveNext
	Loop
End Sub
'=============== End Sub of GetArticleSort() =======================
'===================================================================
'= Function    : FindArticleSort(intSort)
'= Time		   : Created At Apr,11,2004
'= Input       : None

'= Called by   : 
'= Calls       : 
'= Description : find sort
'===================================================================
Function FindArticleSort(intSort)

	clsPubDB.Clear()
	clsPubDB.AllSQL = "SELECT ARTICLE_SORT_NAME FROM CLASS_ARTICLE_SORT WHERE ARTICLE_SORT_ID=" & Cint(intSort)
	clsPubDB.SQLRSExecute()
	Call ResultExecute(clsPubDB.intErrNum,"find article sort","ES_ERR")
	If clsPubDB.intRSNum <= 0 Then
		FindArticleSort = "NULL"
		Exit Function
	Else
		FindArticleSort = clsPubDB.objPubRS("ARTICLE_SORT_NAME")
	End If

End Function
'=============== End of Function FindArticleSort() =================
'===================================================================
'= Function    : GetArticleNum
'= Time		   : Created At Apr,11,2004
'= Input       : None

'= Called by   : 
'= Calls       : 
'= Description : get article Num
'===================================================================
Function GetArticleNum()

	Dim arrTmp
	Dim i

	clsPubDB.Clear()
	clsPubDB.AllSQL = "SELECT LIST_TYPE,COUNT(LIST_TYPE) FROM CLASS_LIST GROUP BY LIST_TYPE ORDER BY LIST_TYPE DESC"
	clsPubDB.SQLRSExecute()
	Call ResultExecute(clsPubDB.intErrNum,"get article num","ES_ERR")

	arrTmp = clsPubDB.objPubRS.GetRows
	For i = LBound(arrTmp) To UBound(arrTmp)
		clsPubDB.Clear()
		clsPubDB.AllSQL = "UPDATE CLASS_ARTICLE_SORT SET ARTICLE_SORT_NUM=" & arrTmp(1,i) & " WHERE ARTICLE_SORT_ID=" & arrTmp(0,i)
		clsPubDB.SQLRSExecute()
		Call ResultExecute(clsPubDB.intErrNum,"up article num","ES_ERR")
	Next

	Response.Redirect "admin_article.asp?action=ShowArticleSort"

End Function
'=============== End of Function GetArticleNum() ===================
'===================================================================
'= Function    : ArticleSortSlt()
'= Time		   : Created At Apr,12,2004
'= Input       : None

'= Called by   : 
'= Calls       : 
'= Description : find sort
'===================================================================
Function ArticleSortSlt()
	
	Dim strHtmlCode

	strHtmlCode = ""

	clsPubDB.Clear()
	clsPubDB.AllSQL = "SELECT * FROM CLASS_ARTICLE_SORT ORDER BY ARTICLE_SORT_ORDER DESC"
	clsPubDB.SQLRSExecute()
	Call ResultExecute(clsPubDB.intErrNum,"get article sort","ES_ERR")
	
	Do While Not clsPubDB.objPubRS.Eof
		strHtmlCode = strHtmlCode & "<a href='admin_article.asp?action=ShowList&pstAddType=" & clsPubDB.objPubRS("ARTICLE_SORT_ID") & "'>" & clsPubDB.objPubRS("ARTICLE_SORT_NAME") & "</a> | "
		clsPubDB.objPubRS.MoveNext
	Loop

	ArticleSortSlt = strHtmlCode

End Function
'=============== End of Function ArticleSortSlt() ==================
'=============== FUNCTION BODY END =================================
%>