<!-- #include file="conn.asp" -->
<!-- #include file="cls_main.asp" -->
<!-- #include file="cls_regExp.asp" -->
<!-- #include file="cls_article_Page.asp" -->
<% dim obj,Mesky
set obj = New ViewCmsInfo
	obj.AspInit()
set obj = nothing

class ViewCmsInfo
	Private strSQL,q
	Private Sub Class_Initialize()
		Set Mesky = New Cls_Main
	End Sub
	Private Sub Class_Terminate()
		Set Mesky = Nothing
	End Sub
	Public Sub AspInit()
		Call Mesky.LoadSetting()
		if Request.QueryString("ID") = "" then
			Mesky.strMsg = "非法操作，ID 参数不能为空。"
			call Mesky.SystemMsg()
			exit sub
		Else
			call show_Cms_Info(clng(Trim(Request.QueryString("ID"))))
		End If
	End Sub
	Public Sub show_Cms_Info(ID)
	
		Dim arrPage, arrMainPage, Rs, MyPage, s, tempStr, i, fso, fout
		If ID = "" Then Exit sub
		Set MyPage = New cls_article_Page
		Set Rs = Mesky.Execute("select * from Mesky_Cms_Resource where ID=" & ID)
		If (Rs.EOF And Rs.BOF) Then
			Set Rs = Nothing
			Exit Sub
		End If
		Mesky.Execute("Update Mesky_Cms_Resource set Hits = Hits + 1 where ID = " & ID)
		arrPage = Split(Mesky.ReadStylePage("Style_Cms_Info"), "<!--|||-->")
		arrMainPage = Split(Mesky.ReadStylePage("Style_Cms_Main"), "<!--|||-->")
		tempStr = Replace(arrMainPage(0), "{$page_title}", Mesky.Setting(0) & " - " & Rs("title")) & arrMainPage(1) & arrMainPage(2)
		tempStr = tempStr & Replace(arrPage(0), "{$site_nav}", Mesky.site_nav(Rs("catalogID"), "Mesky_Cms_catalog", Rs("Title"), ""))
		
		If Rs("PaginationType") = 0 Then '不分页
			s = Replace(arrPage(1), "{$title}", Rs("title"))
			s = Replace(s, "{$dateandtime}", Rs("DateAndTime"))
			s = Replace(s, "{$writer}", Rs("Writer"))
			s = Replace(s, "{$hits}", Rs("Hits"))
			s = Replace(s, "{$nfrom}", "<a href=""" & Split(Rs("nFrom"), "|")(1) & """ target=""_blank"">" & Split(Rs("nFrom"), "|")(0) & "</a>")
			s = Replace(s, "{$content}", Rs("Content"))
			s = Replace(s, "{$showpage}", "")
			tempStr = tempStr & s
			
			'相关文章
			If Rs("mutualitycms") <> "" Then
				tempStr = tempStr & Replace(arrPage(2), "{$article}", Mesky.showMutualityCmsRes(Rs("mutualitycms"),45))
			End If
			'相关软件
			If Rs("mutualitydown") <> "" Then
				tempStr = tempStr & Replace(arrPage(3), "{$software}", Mesky.showMutualityDownRes(Rs("mutualitydown"),45))
			End If
			
			'用户评论
			If Mesky.Setting(114) Then
			's = Replace(arrPage(4),"{$id}",id)
				s = Replace(arrPage(4), "{$comment}", comment_Cms(ID, Rs("commentNum"), Rs("Grade")))
				tempStr = tempStr & Replace(s, "{$title}", Rs("title"))
				s = Null
			End If
			tempStr = tempStr & Replace(arrPage(5), "{$catalogid}", Rs("catalogID")) & arrMainPage(4) '结束
			arrPage = Null
			arrMainPage = Null
		
			tempStr = regExp_showCmsRes(tempStr)
			
			If ID Mod 5 = 0 Then
				Make_Cms_Info = ID & "-OK!..　"
			Else
				Make_Cms_Info = ""
			End If
			'Response.Write( Rs("ResName") & "" & Rs("ResVer") & "<br>")
			'Response.Flush
			Set Rs = Nothing
			Set MyPage = Nothing
			'Exit Function
	
			Response.Write(Replace(tempStr,"../",""))
			tempStr = Null
		
		Else
			dim currentPage
			MyPage.PageType = Rs("PaginationType")
			If Rs("MaxCharPerPage")> 0 then MyPage.MaxPerPage = Rs("MaxCharPerPage")
			MyPage.FileName = "../" & Replace(Mesky.Setting(101), "{$id}", ID & "&Page={Page}")
			If Request("Page")="" then
				currentPage = 1
			Else
				currentPage = Clng(Request("Page"))
			End IF
			MyPage.Page = currentPage
			MyPage.Body = Rs("Content")

				s = arrPage(1)
				s = Replace(s, "{$title}", Rs("title"))
				s = Replace(s, "{$dateandtime}", Rs("DateAndTime"))
				s = Replace(s, "{$writer}", Rs("Writer"))
				s = Replace(s, "{$hits}", Rs("Hits"))
				s = Replace(s, "{$nfrom}", "<a href=""" & Split(Rs("nFrom"), "|")(1) & """ target=""_blank"">" & Split(Rs("nFrom"), "|")(0) & "</a>")
				s = Replace(s, "{$content}", MyPage.ResultBody)
				s = Replace(s, "{$showpage}", MyPage.showPage())
				'相关文章
				If Rs("mutualitycms") <> "" and (Not isNull(Rs("mutualitycms"))) Then
					'Response.Write(Rs("mutualitycms"))
					s = s & Replace(arrPage(2), "{$article}", Mesky.showMutualityCmsRes(Rs("mutualitycms"),45))
				End If
				'相关软件
				If Rs("mutualitydown") <> "" And (Not isNull(Rs("mutualitydown"))) Then
					s = s & Replace(arrPage(3), "{$software}", Mesky.showMutualityDownRes(Rs("mutualitydown"),45))
				End If
				
				'用户评论
				If Mesky.Setting(114) Then
					Dim strcomment
					strcomment = Replace(arrPage(4), "{$comment}", comment_Cms(ID, Rs("commentNum"), Rs("Grade")))
					strcomment = Replace(strcomment, "{$title}", Rs("title"))
					s = s & strcomment
					strcomment = Null
				End If
				s = s & Replace(arrPage(5), "{$catalogid}", Rs("catalogID")) & arrMainPage(4)
	
			
				s = regExp_showCmsRes(s)
			
				Response.Write(Mesky.HtmlHead() & Replace(tempStr,"../","") & s)
				s = Null
				
			arrPage = Null
			arrMainPage = Null
			tempStr = Null
			Set Rs = Nothing
			Set MyPage = Nothing
		End If
	End Sub
	Private Function comment_Cms(ID, commentNum, Grade)
		Dim reval, commentRs, i
		i = commentNum
		reval = reval & "<TABLE width=""100%"" border=""0"" cellPadding=""2"" cellSpacing=""1"" bgColor=""#cccccc"" style=""FONT-SIZE: 9pt"">" & vbCrLf
		reval = reval & "              <TR>" & vbCrLf
		reval = reval & "                <TD width=""80"" align=""middle"" bgColor=""#efefef""><input type=""submit"" name=""Submit"" value=""发表评论"" onclick=""spanComment.style.display=''; comment.content.focus(); return false;""></TD>" & vbCrLf
		reval = reval & "                <TD noWrap align=""center"" bgColor=""#efefef"">评论人</TD>" & vbCrLf
		reval = reval & "                <TD noWrap align=middle bgColor=""#efefef"">评论内容摘要(共 <FONT color=red>" & commentNum & "</FONT> 条，<A href=""../comment_Cms.asp?id=" & ID & """><FONT " & vbCrLf
		reval = reval & "color=#3366cc>查看完整内容</FONT></A>) 得分 <FONT color=red>" & Grade & "</FONT> 分</TD>" & vbCrLf
		reval = reval & "                <TD align=middle bgColor=#efefef>发表时间</TD>" & vbCrLf
		reval = reval & "              </TR>" & vbCrLf
		If commentNum <> 0 And commentNum <> "" Then
			Set commentRs = Mesky.Execute("select top 7 ID,Content,UserName,Email,dateandtime,Graded from Mesky_Cms_Comment where ResourceID=" & ID & " order by dateandtime desc")
			If Not (commentRs.EOF And commentRs.BOF) Then
				Do While Not commentRs.EOF
				reval = reval & "              <TR bgColor=#ffffff>" & vbCrLf
				reval = reval & "                <TD width=""80"" align=right noWrap><NOBR><FONT color=red>" & i & "</FONT> 楼</NOBR> <NOBR>[<A " & vbCrLf
				reval = reval & "onclick=""spanComment.style.display=''; comment.content.focus(); comment.content.value='回复 " & i & " 楼(" & commentRs(2) & ")：'; return false;"" href=""javascript:""><FONT color=#3366cc>回复</FONT></A>]</NOBR><BR></TD>" & vbCrLf
				reval = reval & "                <TD style=""WORD-BREAK: break-all; WORD-WRAP: break-word"" align=center width=50><FONT color=green>" & commentRs(2) & "</FONT></TD>" & vbCrLf
				reval = reval & "                <TD style=""WORD-BREAK: break-all; WORD-WRAP: break-word"">" & Mesky.cutStr(commentRs(1), 180) & "</TD>" & vbCrLf
				reval = reval & "                <TD noWrap align=middle><A style=""BORDER-BOTTOM: #3399cc 1px dotted"" href=""../comment_Cms.asp?id=" & ID & "#commentID" & commentRs(0) & """><FONT color=#3366cc>" & Mesky.FormatMyDate(commentRs(4), "{m}-{d} {h}:{mi}") & "</FONT></A></TD>" & vbCrLf
				reval = reval & "              </TR>" & vbCrLf
				i = i - 1
				commentRs.MoveNext
				Loop
			End If
			Set commentRs = Nothing
		End If
		reval = reval & "              <TR bgcolor=""#FFFFFF"" id=""spanComment"" style=""display:none"">" & vbCrLf
		reval = reval & "                <TD colSpan=4><script language=""javascript"" src=""../js/comment_cms.js""></script>" & vbCrLf
		reval = reval & "               <script language=""javascript"">show_commentForm(" & ID & ")</script>" & vbCrLf
		reval = reval & "               </TD>" & vbCrLf
		reval = reval & "              </TR>" & vbCrLf
		reval = reval & "</TABLE>" & vbCrLf
		comment_Cms = reval
		reval = Null
	End Function

End Class
%>