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

📄 classarticle.asp

📁 依蓝旅游网站管理系统Elan2008.SP2
💻 ASP
📖 第 1 页 / 共 5 页
字号:
<%
Class ClassArticle

   Private HTML, CommonRegExp, EL_Channel, ClassID, ShowClassType
   Private EL_Flag, CurrentPage, URLParameters, ReplaceKeyType
   
   Private Sub Class_Initialize
      Set CommonRegExp = New RegExp
	  CommonRegExp.IgnoreCase = True 
      CommonRegExp.Global = True 	
	  EL_Flag = True  
	  ReplaceKeyType = 0 '内容页字符替换模式 0:站内链接  1:字符过滤  2:两者
	  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.ChannelModule <> 1 Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("BaseConfig.ChannelModuleError", "频道模块错误"))
		 Call ApplicationTerminate()
	  End If
	  
	  If EL_Channel.Disabled Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("BaseConfig.Disabled", "该频道已被禁用"))
		 Call ApplicationTerminate()
	  End If
	  CurrentPage = EL_Common.ELRequest("page", 2)
	  ShowClassType = EL_Common.ELRequest("ShowType", 2) 
	  URLParameters = request.ServerVariables("QUERY_STRING")
	  If CurrentPage<1 Then
	     CurrentPage = 1
	  Else
	     URLParameters = EL_Common.ReplaceText(URLParameters, "\&{0,}page=[0-9]*", "")
		 If URLParameters <> "" And Left(URLParameters, 1) = "&" Then URLParameters = Right(URLParameters, Len(URLParameters)-1) 
	  End If
   End Sub
   
   Private Sub Class_Terminate
      Set CommonRegExp = Nothing
	  Set EL_Channel = Nothing
   End Sub 
   
   Private Function ChannelCommonLabels(ByVal HTML)
      '频道通用标签
	  Dim TempHTML
	  
	  TempHTML = HTML
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ChannelID}", ChannelID)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ChannelName}", EL_Channel.ChannelName)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ChannelPictrue}", EL_Channel.ChannelPictrue)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ChannelDir}", EL_Channel.ChannelDir)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ItemName}", EL_Channel.ItemName)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ItemUnit}", EL_Channel.ItemUnit)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ClassItemName}", EL_Channel.ClassItemName)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$UploadDir}", EL_Channel.UploadDir)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$MetaKeywords}", "<meta name=""keywords"" content="""& EL_Channel.MetaKeywords &""" />")
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$MetaDescription}", "<meta name=""description"" content="""& EL_Channel.MetaDescription &""" />")
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ShowClassMenu}", "<script language='JavaScript1.2' type='text/JavaScript' src='"& InstallDir & EL_Channel.ChannelDir &"/Js/ShowClassMenu.js'></script>")
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ShowSearchForm}", "<script language='JavaScript' type='text/JavaScript' src='"& InstallDir & EL_Channel.ChannelDir &"/Js/ShowSearchForm.js'></script>")
	  ChannelCommonLabels = TempHTML
   End Function
   
   Public Sub CreateIndex()	  
	  ClassID = 0
	  
	  HTML = EL_Common.Template(ChannelID, 1, 0)
	  HTML = EL_Common.ReplaceCommonLabels(HTML)	
	  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$PageTitle}", EL_Common.Join2String(EL_Channel.ChannelName, SiteTitle, EL_Common.TitleDivide))
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$DefaultSkin}", EL_Common.Skin(ChannelID, 0, 0))
	  
	  EL_Common.ShowPath = EL_Common.ShowPath & EL_Common.Lang("BaseConfig.Path", "&nbsp;&gt;&gt;&nbsp;") & EL_Channel.ChannelName
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPath}", EL_Common.ShowPath)
	  
	  HTML = ChannelCommonLabels(HTML)	
	  HTML = Label_ArrClassList(HTML)  
	  HTML = Label_GetArticleList(HTML)
	  HTML = Label_GetArticlePhoto(HTML)
	  
	  
	  Response.Write HTML
   End Sub
   
   Public Sub ShowClass()
      Dim ClassCmd, ClassType, ItemCount
	  Dim PageTitle, ClassName, ArrChildID, SkinID, TemplateID, StrPath
	  ClassID = EL_Common.ELRequest("ClassID", 2)	  
	  Call EL_Common.InitCommand(ClassCmd, "EL_SP_GetClassInfo")
	  With ClassCmd
	     .Parameters.Append .CreateParameter("RETURN", 2, 4)
		 .Parameters.Append .CreateParameter("@ClassID", 3, 1, 4, ClassID)
		 .Parameters.Append .CreateParameter("@ChannelID", 3, 1, 4, ChannelID)
		 .Parameters.Append .CreateParameter("@ClassName", 200, 2, 50)
		 .Parameters.Append .CreateParameter("@SkinID", 3, 2, 4)
		 .Parameters.Append .CreateParameter("@TemplateID", 3, 2, 4)
		 .Parameters.Append .CreateParameter("@ClassType", 3, 2, 4)
		 .Parameters.Append .CreateParameter("@ItemCount", 3, 2, 4)
		 .Execute()
	  End With
	  Select Case ClassCmd(0)
	     Case 40: EL_Common.ShowErrorMsg(EL_Common.Lang("BaseConfig.ChannelError", "频道参数错误")) : Set ClassCmd = Nothing : Exit Sub
		 Case 0, 41: EL_Common.ShowErrorMsg(EL_Common.RegExpStaticLabel(EL_Common.Lang("BaseConfig.ClassError", "指定{$ClassItemName}不存在"), "{$ClassItemName}", EL_Channel.ClassItemName)) : Set ClassCmd = Nothing : Exit Sub
	  End Select
	  If ClassCmd(0) <> 1 Then
	     EL_Common.ShowErrorMsg(EL_Common.RegExpStaticLabel(EL_Common.Lang("BaseConfig.ClassError", "指定{$ClassItemName}不存在"), "{$ClassItemName}", EL_Channel.ClassItemName))
		 Set ClassCmd = Nothing
		 Exit Sub
	  End If
	  ClassName = ClassCmd(3)
	  SkinID = ClassCmd(4)
	  TemplateID = ClassCmd(5)
	  ClassType = ClassCmd(6)
	  ItemCount = ClassCmd(7)
	  Set ClassCmd = Nothing
	  
	  Dim ArrTemplate
	  HTML = EL_Common.Template(ChannelID, 2, TemplateID)
	  ArrTemplate = EL_Common.ELSplit(HTML, "{$$$Template$$$}")
	  If ClassType = 1 Then
	     HTML = ArrTemplate(1) '小类模板
	  Else '大类模板
	     If ShowClassType = 1 Then
		    HTML = ArrTemplate(1)
		 Else
		    HTML = ArrTemplate(0) 
		 End If
	  End If
	  
	  
	  HTML = EL_Common.ReplaceCommonLabels(HTML)
	  
	  PageTitle = EL_Common.Join2String(ClassName, EL_Channel.ChannelName, EL_Common.TitleDivide)
	  PageTitle = EL_Common.Join2String(PageTitle, SiteTitle, EL_Common.TitleDivide)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$PageTitle}", PageTitle)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$DefaultSkin}", EL_Common.Skin(ChannelID, ClassID, SkinID))
	  
	  StrPath = EL_Common.Lang("BaseConfig.Path", "&nbsp;&gt;&gt;")
	  EL_Common.ShowPath = EL_Common.ShowPath & StrPath &"<a href='"& InstallDir & EL_Channel.ChannelDir &"/Index.asp'>"& EL_Channel.ChannelName &"</a>"& EL_Common.GetParentPath(ChannelID, EL_Channel.ChannelDir, ClassID)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPath}", EL_Common.ShowPath)
	  HTML = ChannelCommonLabels(HTML)
	  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ClassName}", ClassName)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ClassID}", ClassID)
	  
	  If ClassType = 0 Then
	     HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowChildClass}", GetChildClass())
		 HTML = Label_CurrentClass(HTML, ClassName, ItemCount)
	  End If	  
	  
	  HTML = Label_ArrClassList(HTML)
	  HTML = Label_GetArticleList(HTML)
	  HTML = Label_GetArticlePhoto(HTML)   
	  
	  Response.Write HTML	  
   End Sub
   
   Public Sub Search()
	  Dim SearchCmd, rsSearch, RowCount, i, SearchResultTitle
	  Dim PageTitle, SearchTitle, StrPath, PageSizes, PageCounts, TotalRowCount
	  Dim FieldName, Keyword	  
	  
	  If IsDate(Session("EL_LastSearchDateTime")) Then
	     If DateDiff("s", Session("EL_LastSearchDateTime"), Now()) < SearchInterval Then
		    EL_Common.ShowErrorMsg(EL_Common.RegExpStaticLabel(EL_Common.Lang("Search.Error1", "为节省系统资源,请在{$SearchInterval}秒后再执行搜索……"), "{$SearchInterval}", SearchInterval))
			Exit Sub
		 End If
	  End If
	  
	  FieldName = EL_Common.ELRequest("Field", 3)
	  ClassID = EL_Common.ELRequest("ClassID", 2)
	  Keyword = EL_Common.ELRequest("Keyword", 3)
	  
	  Select Case LCase(FieldName)
	     Case "title":   SearchResultTitle = EL_Common.Lang("Search.f0", "标题中含有 <font color='red'>{$Keyword}</font> 的{$ItemName}")
		 Case "content": SearchResultTitle = EL_Common.Lang("Search.f1", "内容中含有 <font color='red'>{$Keyword}</font> 的{$ItemName}")
		 Case "author":  SearchResultTitle = EL_Common.Lang("Search.f2", "作者姓名中含有 <font color='red'>{$Keyword}</font> 的{$ItemName}")
		 Case "inputer": SearchResultTitle = EL_Common.Lang("Search.f3", "<font color='red'>{$Keyword}</font> 录入的{$ItemName}")
		 Case Else:      
		       FieldName = "Title" : SearchResultTitle = EL_Common.Lang("Search.f0", "标题中含有 <font color='red'>{$Keyword}</font> 的{$ItemName}")
	  End Select
	  
	  If Trim(Keyword) = "" Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("Search.Error2", "搜索关键字不能为空"))
		 Exit Sub
	  End If
	  
	  Call EL_Common.InitCommand(SearchCmd, "EL_SP_SearchArticle")
	  With SearchCmd
	     .Parameters.Append .CreateParameter("RETURN", 2, 4)
		 .Parameters.Append .CreateParameter("@ChannelID", 3, 1, 4, ChannelID)
		 .Parameters.Append .CreateParameter("@Field", 200, 1, 100, FieldName)
		 .Parameters.Append .CreateParameter("@ClassID", 3, 1, 4, ClassID)
		 .Parameters.Append .CreateParameter("@Keyword", 200, 1, 255, Keyword)
		 .Parameters.Append .CreateParameter("@CurrentPage", 3, 1, 4, CurrentPage)
		 .Parameters.Append .CreateParameter("@PageSizes", 3, 2, 4)
		 .Parameters.Append .CreateParameter("@TotalRowCount", 3, 2, 4)
		 .Parameters.Append .CreateParameter("@PageCount", 3, 2, 4)
		 .Parameters.Append .CreateParameter("@RowCount", 3, 2, 4)
		 Set rsSearch = .Execute()
	  End With
	  rsSearch.Close()  
	  PageSizes = SearchCmd(6)
	  TotalRowCount = SearchCmd(7)
	  PageCounts = SearchCmd(8)
	  RowCount = SearchCmd(9)
	  
  
	  HTML = EL_Common.Template(ChannelID, 5, 0)	  
	  
	  HTML = EL_Common.ReplaceCommonLabels(HTML)
	  
	  SearchTitle = EL_Common.RegExpStaticLabel(EL_Common.Lang("Search.Title", "{$ItemName}搜索"), "{$ItemName}", EL_Channel.ItemName)
	  PageTitle = EL_Common.Join2String(SearchTitle, EL_Channel.ChannelName, EL_Common.TitleDivide)
	  PageTitle = EL_Common.Join2String(PageTitle, SiteTitle, EL_Common.TitleDivide)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$PageTitle}", PageTitle)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$DefaultSkin}", EL_Common.Skin(ChannelID, 0, 0))
	  
	  StrPath = EL_Common.Lang("BaseConfig.Path", "&nbsp;&gt;&gt;")
	  EL_Common.ShowPath = EL_Common.ShowPath & StrPath &"<a href='"& InstallDir & EL_Channel.ChannelDir &"/Index.asp'>"& EL_Channel.ChannelName &"</a>"& StrPath & SearchTitle
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPath}", EL_Common.ShowPath)
	  HTML = ChannelCommonLabels(HTML)	  	  
	  
	  SearchResultTitle = EL_Common.RegExpStaticLabel(SearchResultTitle, "{$ItemName}", EL_Channel.ItemName)
	  SearchResultTitle = EL_Common.RegExpStaticLabel(SearchResultTitle, "{$Keyword}", EL_Common.ServerHTMLEncode(Keyword))	  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$SearchResultTitle}", SearchResultTitle)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$Keyword}", EL_Common.ServerHTMLEncode(Keyword))
	  
	  Dim Match, Matches, ReturnString
	  Dim TempString, MatchString, NoList	  
	  
	  CommonRegExp.Pattern = "\[ArrSearchResult\][\w\W]*\[\/ArrSearchResult\]"        
      Set Matches = CommonRegExp.Execute(HTML)
	  
	  NoList = EL_Common.RegExpStaticLabel(EL_Common.Lang("Search.NoList", "<p>&nbsp;</p>搜索不到任何{$ItemName}<p>&nbsp;</p>"), "{$ItemName}", EL_Channel.ItemName)
	  If RowCount = 0 Then
	     For Each Match in Matches	
		    HTML = Replace(HTML, Match.Value, NoList)
         Next
		 HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPage}", "")
	  Else
	     rsSearch.Open()
		 For Each Match in Matches		    
			rsSearch.MoveFirst
			MatchString = Match.Value
			MatchString = EL_Common.ReplaceText(MatchString, "\[ArrSearchResult\]", "")
			MatchString = EL_Common.ReplaceText(MatchString, "\[\/ArrSearchResult\]", "")
			ReturnString = ""
			Dim ItemHTML, Field_Title, Field_Content, Field_Author

⌨️ 快捷键说明

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