⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classcomment.asp

📁 依蓝旅游网站管理系统Elan2008.SP2
💻 ASP
字号:
<%
Class ClassComment
  
   Private InfoID, CommonRegExp, HTML, EL_Channel, CurrentPage, URLParameters
   Private CommentItemName, CommentItemUnit, PointName
   
   Private Sub Class_Initialize()
      InfoID = EL_Common.ELRequest("InfoID", 2)
	  If InfoID < 1 Then
	      EL_Common.ShowErrorMsg(EL_Common.RegExpStaticLabel(EL_Common.Lang("BaseConfig.InfoError", "指定{$ItemName}不存在"), "{$ItemName}", EL_Channel.ItemName))
		  Call ApplicationTerminate()
	  End If
      Set CommonRegExp = New RegExp
	  CommonRegExp.IgnoreCase = True 
      CommonRegExp.Global = True
	  Set EL_Channel = New ClassChannel	 
	  EL_Channel.GetChannelConfig()	  
	  If EL_Channel.ErrorCode = 1 Or EL_Channel.ChannelType = 1 Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("BaseConfig.ChannelError", "找不到指定的频道,或频道已被禁用!"))
		 Call ApplicationTerminate()
	  End If	  
	  
	  If EL_Channel.Disabled Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("BaseConfig.ChannelError", "找不到指定的频道,或频道已被禁用!"))
		 Call ApplicationTerminate()
	  End If  
	  
	  CurrentPage = EL_Common.ELRequest("page", 2) 
	  URLParameters = request.ServerVariables("QUERY_STRING")
	  If CurrentPage<1 Then
	     CurrentPage = 1
	  Else
	     URLParameters = Left(URLParameters, InstrRev(URLParameters, "&")-1)
	  End If
	  CommentItemName = EL_Common.Lang("Comment.ItemName", "评论")
	  CommentItemUnit = EL_Common.Lang("Comment.ItemUnit", "条")
	  PointName = EL_Common.Lang("Comment.Point", "分")
   End Sub
   
   Private Sub Class_Terminate()
	  Set CommonRegExp = Nothing
	  Set EL_Channel = Nothing
   End Sub   
   
   Public Sub Execute()
   
      If Action = "SaveComment" Then
	     Call SaveComment()		 
		 Exit Sub
	  End If
   
      Dim StrPath
	  HTML = EL_Common.Template(ChannelID, 6, 0)
	  HTML = EL_Common.ReplaceCommonLabels(HTML)
	  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ChannelID}", ChannelID)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ChannelName}", EL_Channel.ChannelName)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ChannelPictrue}", EL_Channel.ChannelPictrue)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ChannelDir}", EL_Channel.ChannelDir)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ItemName}", EL_Channel.ItemName)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ItemUnit}", EL_Channel.ItemUnit)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ClassItemName}", EL_Channel.ClassItemName)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$UploadDir}", EL_Channel.UploadDir)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$MetaKeywords}", "<meta name=""keywords"" content="""& EL_Channel.MetaKeywords &""" />")
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$MetaDescription}", "<meta name=""description"" content="""& EL_Channel.MetaDescription &""" />")
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowClassMenu}", "<script language='JavaScript1.2' type='text/JavaScript' src='"& InstallDir & EL_Channel.ChannelDir &"/Js/ShowClassMenu.js'></script>")
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowSearchForm}", "<script language='JavaScript' type='text/JavaScript' src='"& InstallDir & EL_Channel.ChannelDir &"/Js/ShowSearchForm.js'></script>")
	  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$PageTitle}", EL_Common.Join2String(EL_Common.Join2String(SiteTitle, EL_Channel.ChannelName, EL_Common.TitleDivide), EL_Channel.ItemName & CommentItemName, EL_Common.TitleDivide))
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$DefaultSkin}", EL_Common.Skin(ChannelID, 0, 0))
	  
	  StrPath = EL_Common.Lang("BaseConfig.Path", "&nbsp;&gt;&gt;&nbsp;")	  
	  EL_Common.ShowPath = EL_Common.ShowPath & StrPath &"<a href='"& InstallDir & EL_Channel.ChannelDir &"/Index.asp'>"& EL_Channel.ChannelName &"</a>"& StrPath & EL_Channel.ItemName & CommentItemName
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPath}", EL_Common.ShowPath)
	  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$CommentTitle}", GetCommentTitle())
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$InfoID}", InfoID)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowCommentList}", ShowCommentList())
	  
	  Response.Write HTML
   End Sub
   
   Private Sub SaveComment()
      On Error Resume Next
      Dim CommentCmd
	  Dim UserName, UserType, QQ, MSN, Email, Content, Point
	  
	  Dim SendComment
	  SendComment = EL_Common.GetFieldValue("SendComment", "EL_Channel", "ChannelID="& ChannelID)
	  If SendComment = 1 Then
	     If EL_User.UserIsLogin = False Then
		    Response.Redirect InstallDir &"User/User_Login.asp?url="& ComeURL
		 End If
	  ElseIf SendComment = 2 Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("Comment.DisabledSendComment", "该频道禁止发表评论"))
		 Call ApplicationTerminate()
	  End If
	  
	  If EL_User.UserIsLogin = True Then
	     UserType = 0
		 UserName = EL_User.UserName
	  Else
	     UserType = 1
		 UserName = EL_Common.ELRequest("UserName", 3)
	  End If
	  QQ = EL_Common.ReplaceKeyLink(EL_Common.ELRequest("QQ", 1), 1)
	  MSN = EL_Common.ReplaceKeyLink(EL_Common.ELRequest("MSN", 1), 1)
	  Email = EL_Common.ReplaceKeyLink(EL_Common.ELRequest("Email", 1), 1)
	  Content = EL_Common.ReplaceKeyLink(EL_Common.ELRequest("Content", 1), 1)
	  Point = EL_Common.ELRequest("Point", 2)
	  
	  If EL_Common.ELClng(QQ) = 0  And QQ<>"" Then
	     Response.Clear()
	     EL_Common.ShowErrorMsg(EL_Common.Lang("BaseConfig.QQError", "QQ号码错误"))
		 Call ApplicationTerminate()
	  End If
	  	  
	  If EL_Common.CheckEmail(Email) = False And Email<>"" Then
	     Response.Clear()
	     EL_Common.ShowErrorMsg(EL_Common.Lang("BaseConfig.EmailError", "电子邮件格式错误"))
		 Call ApplicationTerminate()
	  End If
	  
	  If Trim(Content) = "" Then
	     Response.Clear()
	     EL_Common.ShowErrorMsg(EL_Common.Lang("Comment.ContentEmpty", "评论内容不能为空"))
		 Call ApplicationTerminate()
	  End If
	  
	  Call EL_Common.InitCommand(CommentCmd, "EL_SP_Comment")
	  With CommentCmd
	     .Parameters.Append .CreateParameter("RETURN", 2, 4)
		 .Parameters.Append .CreateParameter("@InfoID", 3, 1, 4, InfoID)
		 .Parameters.Append .CreateParameter("@ChannelID", 3, 1, 4, ChannelID)
		 .Parameters.Append .CreateParameter("@UserName", 200, 1, 50, UserName)
		 .Parameters.Append .CreateParameter("@UserType", 3, 1, 4, UserType)
		 .Parameters.Append .CreateParameter("@QQ", 200, 1, 20, QQ)
		 .Parameters.Append .CreateParameter("@MSN", 200, 1, 100, MSN)
		 .Parameters.Append .CreateParameter("@Email", 200, 1, 100, Email)
		 .Parameters.Append .CreateParameter("@Content", 203, 1, EL_Common.LenParameter(Content), Content)
		 .Parameters.Append .CreateParameter("@IpAddress", 200, 1, 15, RemoteIp)
		 .Parameters.Append .CreateParameter("@Point", 3, 1, 4, Point)
		 .Execute()
	  End With
	  Select Case CommentCmd(0)
	     Case 40: 
		    Response.Clear()
	        EL_Common.ShowErrorMsg("频道参数错误")
		    Call ApplicationTerminate() 
		 Case 41:
		    Response.Clear()
	        EL_Common.ShowErrorMsg("页面参数错误")
		    Call ApplicationTerminate() 
		 Case 0:
		    Response.Clear()
	        EL_Common.ShowErrorMsg(EL_Common.Lang("Comment.InputError", "保存评论内容发生错误,请检查你输入的内容"))
		    Call ApplicationTerminate() 
	  End Select
	  EL_Common.ShowSuccessMsg(EL_Common.Lang("Comment.InputOk", "发表评论成功!"))
	  Set CommentCmd = Nothing
	  EL_Common.ShowScriptError()
	  Call ApplicationTerminate() 
   End Sub
   
   Private Function ShowCommentList()
      Dim CommentCmd, rsComment, RowCount, i, ReturnString
	  Dim PageSizes, TotalRowCount, PageCounts
	  PageSizes = 10
	  Call EL_Common.InitCommand(CommentCmd, "EL_SP_SplitPage")
	  With CommentCmd
		    .Parameters.Append .CreateParameter("RETURN", 3, 4, 4)
		    .Parameters.Append .CreateParameter("@Tables", 200, 1, 20, "EL_Comment")
		    .Parameters.Append .CreateParameter("@PrimaryKey", 200, 1, 20, "CommentID")
		    .Parameters.Append .CreateParameter("@Sort", 200, 1, 200, "UpdateTime DESC")
		    .Parameters.Append .CreateParameter("@CurrentPage", 3, 1, 4, CurrentPage)
		    .Parameters.Append .CreateParameter("@PageSize", 3, 1, 4, PageSizes)
		    .Parameters.Append .CreateParameter("@Fields", 200, 1, 1000, "*")
		    .Parameters.Append .CreateParameter("@Filter", 200, 1, 1000, "InfoID="& InfoID &" And ChannelID="& ChannelID)
		    .Parameters.Append .CreateParameter("@Group", 200, 1, 1, "")
		    .Parameters.Append .CreateParameter("@TotalRowCount", 3, 2, 4)
		    .Parameters.Append .CreateParameter("@PageCount", 3, 2, 4)
		    Set rsComment = .Execute()
	  End With
	  rsComment.Close()
	  RowCount = CommentCmd(0)
	  TotalRowCount = CommentCmd(9)
	  PageCounts = CommentCmd(10)
	  If RowCount = 0 Then
	     Set rsComment = Nothing
		 Set CommentCmd = Nothing
		 Exit Function
	  End If
	  
	  Dim Title0, Title1, Title2, Title3
	  Dim UserType0, UserType1
	  
	  Title0 = EL_Common.Lang("Comment.Title.t0", "用户类别:")
	  Title1 = EL_Common.Lang("Comment.Title.t1", "电子邮件:")
	  Title2 = EL_Common.Lang("Comment.Title.t2", "QQ&nbsp;&nbsp;号码:")
	  Title3 = EL_Common.Lang("Comment.Title.t3", "MSN&nbsp;地址:")
	  UserType0 = EL_Common.Lang("BaseConfig.UserType0", "会员")
	  UserType1 = EL_Common.Lang("BaseConfig.UserType1", "游客")
	  
	  ReturnString = "<table width='100%' border='0' cellspacing='1' cellpadding='0' class='comment'>"
	  rsComment.Open()
	  For i = 1 To RowCount
	     ReturnString = ReturnString &"<tr class='comment_title'>"
		 ReturnString = ReturnString &"<td>&nbsp;"& EL_Common.Lang("Comment.t0", "评论人") &":<b>"
		 If rsComment("UserType") = 0 Then
		    ReturnString = ReturnString &"<a href='"& InstallDir &"User/ShowUser.asp?UserName="& rsComment("UserName") &"' title='"& Title0 & UserType0 &"&#13;"& Title1 & EL_Common.ServerHTMLEncode(rsComment("Email")) &"&#13;"& Title2 & EL_Common.ServerHTMLEncode(rsComment("QQ")) &"&#13;"& Title3 & EL_Common.ServerHTMLEncode(rsComment("MSN")) &"'>["& UserType0 &"]"& EL_Common.ServerHTMLEncode(rsComment("UserName")) &"</a>"
		 Else
		    ReturnString = ReturnString &"<span style='cursor:hand;' title='"& Title0 & UserType1 &"&#13;"& Title1 & EL_Common.ServerHTMLEncode(rsComment("Email")) &"&#13;"& Title2 & EL_Common.ServerHTMLEncode(rsComment("QQ")) &"&#13;"& Title3 & EL_Common.ServerHTMLEncode(rsComment("MSN")) &"'>["& UserType1 &"]"& EL_Common.ReplaceKeyLink(EL_Common.ServerHTMLEncode(rsComment("UserName")), 1) &"</span> "
		 End If
	     ReturnString = ReturnString &"</b>&nbsp;&nbsp;&nbsp;&nbsp;"& EL_Common.Lang("Comment.t2", "打分") &":"& rsComment("Point")
	     ReturnString = ReturnString &"&nbsp;&nbsp;&nbsp;&nbsp;"& EL_Common.Lang("Comment.t3", "评论时间") &":"& rsComment("UpdateTime") &"</tr>"
		 ReturnString = ReturnString &"<tr class=comment_list>"
		 ReturnString = ReturnString &"<td><br>"& EL_Common.HTMLEncode(EL_Common.ReplaceKeyLink(rsComment("Content"), 1)) &"<p></p></td>"
		 ReturnString = ReturnString &"</tr>"
		 If i<RowCount Then rsComment.MoveNext
	  Next
	  ReturnString = ReturnString &"</table>"
	  rsComment.Close()
	  
	  Dim PageHTML, PageString
	  PageHTML = EL_Common.Lang("BaseConfig.ShowPage", "")
	  PageHTML = EL_Common.ReplaceText(PageHTML, "\{\$PageList\}", EL_Common.ShowPage(URLParameters, CurrentPage, PageSizes, PageCounts, TotalRowCount, CommentItemName, CommentItemUnit))
	  ReturnString = ReturnString & PageHTML
	  
	  Set rsComment = Nothing
	  Set CommentCmd = Nothing
	  ShowCommentList = ReturnString	  
   End Function
   
   Private Function GetCommentTitle()
      Dim TitleCmd, rsTitle
	  Select Case EL_Channel.ChannelModule
	     Case 1: Call EL_Common.InitCommonCmd(TitleCmd, rsTitle, "EL_Article", "Title", "ChannelID="& ChannelID &" And ArticleID="& InfoID &" And Passed="& EL_True &" And Deleted="& EL_False)
		 Case 2: Call EL_Common.InitCommonCmd(TitleCmd, rsTitle, "EL_Hotel", "HotelName", "ChannelID="& ChannelID &" And HotelID="& InfoID &" And Passed="& EL_True &" And Deleted="& EL_False)
		 Case 3: Call EL_Common.InitCommonCmd(TitleCmd, rsTitle, "EL_Product", "ProductName", "ChannelID="& ChannelID &" And ProductID="& InfoID &" And Passed="& EL_True &" And Deleted="& EL_False)
		 Case 5: Call EL_Common.InitCommonCmd(TitleCmd, rsTitle, "EL_Sight", "SightName", "ChannelID="& ChannelID &" And SightID="& InfoID &" And Passed="& EL_True &" And Deleted="& EL_False)
		 Case 6: Call EL_Common.InitCommonCmd(TitleCmd, rsTitle, "EL_Photo", "PhotoName", "ChannelID="& ChannelID &" And PhotoID="& InfoID &" And Passed="& EL_True &" And Deleted="& EL_False)
		 Case 7: Call EL_Common.InitCommonCmd(TitleCmd, rsTitle, "EL_Shop", "ProductName", "ChannelID="& ChannelID &" And ProductID="& InfoID &" And Passed="& EL_True &" And Deleted="& EL_False)
		 Case 8: Call EL_Common.InitCommonCmd(TitleCmd, rsTitle, "EL_Car", "CarName", "ChannelID="& ChannelID &" And CarID="& InfoID &" And Passed="& EL_True &" And Deleted="& EL_False)
		 Case Else: 
		      EL_Common.ShowErrorMsg("频道模块错误")
			  Call ApplicationTerminate()
	  End Select
	  rsTitle.Close()
	  If TitleCmd(0) <> 1 Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("Comment.Error1", "查询评论信息错误"))
		 Set rsTitle = Nothing
		 Set TitleCmd = Nothing
		 Call ApplicationTerminate()
	  End If
	  rsTitle.Open()
	  GetCommentTitle = rsTitle(0)
	  rsTitle.Close()
	  Set rsTitle = Nothing
	  Set TitleCmd = Nothing
   End Function
   
End Class
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -