<!--#include file="../ACT_inc/ACT.User.asp"-->
<% 
Dim AHHFCHCls
Set AHHFCHCls = New ShowClass
AHHFCHCls.Execute()
Set AHHFCHCls = Nothing
'Class-543275815814183.html
'Class-543275815814183-3.html

  Class ShowClass
		Private ACT_L,ClassID,RsClass,SqlStr,UserHS,TemplateContent,CurrPage,PageStyle,PerPageNumber,ACT_Lable
		Private Sub Class_Initialize()
		  Set ACT_L = New ACT_Code
		  Set UserHS = New ACT_User
		End Sub
		Private Sub Class_Terminate()
		 Set AcTCMS=Nothing
		 Set ACT_L=Nothing
		 Set UserHS=Nothing 
		End Sub


		Public Sub Execute()
			 ClassID = ACTCMS.Rsql(ACTCMS.S("ClassID"))
			 CurrPage=ACTCMS.ChkNumeric(request("Page"))
			 If CurrPage<=0 Then CurrPage=CurrPage+1
			 If  ClassID = "" Then Exit Sub 
			 Set RsClass=actcms.actexe("Select FolderTemplate,Classid,Extension,ParentID,GroupIDClass,ModeID,ChangesLinkUrl From Class_ACT Where ClassID='" & ClassID & "'")
			 IF RsClass.Eof And RsClass.Bof Then
			  Call ACTCMS.Alert("非法参数!",AcTCMS.ActCMSDM)
			  Exit Sub
			 End If
			 If RsClass("ChangesLinkUrl")<>"" Then 
				response.Redirect RsClass("ChangesLinkUrl")
				response.end
			 End If 
			If ACTCMS.ACT_L(RsClass("ClassID"),6)<>"" Then
				If UserHS.GroupID<>ACTCMS.ACT_L(RsClass("ClassID"),6) Then
					  Call ACTCMS.Alert("对不起，你所在的用户组没有查看的权限!",AcTCMS.ActCMSDM)
				End If 
			Else 
			End If
			Application(AcTCMSN & "ClassID")=  RsClass("ClassID")
			Application(AcTCMSN & "ModeID")= RsClass("ModeID")
			Application(AcTCMSN & "ACTCMS_TCJ_Type")= "Folder"
			Application(AcTCMSN & "Make")="No"
			If Trim(RsClass("ParentID")) = "0" Then	Application(AcTCMSN & "ModeHome") = True	Else Application(AcTCMSN & "ModeHome") = False
			 TemplateContent = ACT_L.LoadTemplate(RsClass("FolderTemplate"))
			 TemplateContent = ACT_L.LabelReplaceAll(TemplateContent)
		     TemplateContent=Replace(TemplateContent,"{$PageList}" ,ACT_GetPage("?ClassID=" & ClassID,Application("PageStyle"),CurrPage,Application("PageNum"),true))
			Dim PageParamArr:PageParamArr=Split(Application("PageParam"),"§")
			If Ubound(PageParamArr)>0  Then
			  If PageParamArr(0)="GetLastArticleList" Then
			       PageStyle=PageParamArr(3)
				   Dim ArticleSql,CurrPageStr,ClassID
				Dim Parameter
				Select Case PageParamArr(2) 
					Case "","0":Parameter=""
					Case "1":Parameter="ClassID='" & Application(AcTCMSN & "ClassID") & "' And" 
					Case Else
						If InStr(PageParamArr(2), ",") > 0 Then
							 Parameter="ClassID In (" & PageParamArr(2) & ") And"
						Else
							 Parameter="ClassID='" & PageParamArr(2) & "' And"
						End If 
				End Select
				 ArticleSql = "SELECT ID FROM "&ACTCMS.ACT_C(RsClass("ModeID"),2)&" Where " & Parameter & " isAccept=0 AND delif=0 order by IsTop Desc," &PageParamArr(4) &" ,ID Desc"
				  Dim RS:Set RS=Server.CreateObject("ADODB.RECORDSET")
				 RS.Open ArticleSql, Conn, 1, 1
				If RS.EOF And RS.BOF Then
						TempStr = "<p>此栏目下没有文章</p>"
				Else
						   PerPageNumber=cint(PageParamArr(6))
						   Dim PageNum, I, J, k, TempStr, SqlStr,totalput,TempIDArr
							TotalPut = RS.recordcount
							if (TotalPut mod PerPageNumber)=0 then
								PageNum = TotalPut \ PerPageNumber
							else
								PageNum = TotalPut \ PerPageNumber + 1
							end if
							If CurrPage = 1 Then
									TempIDArr=IDArr(RS)
							Else
									If (CurrPage - 1) * PerPageNumber < totalPut Then
										RS.Move (CurrPage - 1) * PerPageNumber
										TempIDArr=IDArr(RS)
									Else
										CurrPage = 1
										TempIDArr=IDArr(RS)
									End If
							End If
							SqlStr = "SELECT ID,Classid,Title,UpdateTime,ChangesLink,FileName,GroupID_ACT,Score_ACT FROM "&ACTCMS.ACT_C(RsClass("ModeID"),2)&"   Where ID in (" & TempIDArr & ") AND isAccept=0 AND delif=0  order by IsTop Desc," &PageParamArr(4) &" ,ID Desc"
							TempStr =  ACT_L.ACTCMS_Page_SQL(SqlStr,PageParamArr(5), PageParamArr(6),PageParamArr(8), PageParamArr(9), PageParamArr(10),PageParamArr(11), PageParamArr(12), PageParamArr(13), PageParamArr(14),  PageParamArr(15), PageParamArr(16), PageParamArr(17), PageParamArr(18), PageParamArr(1), PageParamArr(19), PageParamArr(20), PageParamArr(21), PageParamArr(22), PageParamArr(23), PageParamArr(24))
							TempStr = TempStr & AcTCMS.GetPageList(PageStyle,"篇",PageNum,CurrPage,TotalPut,PerPageNumber)& ACT_GetPage("?ClassID=" & ClassID,PageStyle,CurrPage,PageNum, True) 
					 End If
				  RS.Close:Set RS = Nothing
			  End If
			End If
			 TemplateContent=Replace(TemplateContent,Application("PageParam"),TempStr)
			response.write TemplateContent&vbcrlf & "<!-- Created Page at " & Now() & " ,By ActCMS.Com ,ACT Content Management System(ActCMS)  -->" & vbCrLf
		End Sub 


	 Function ACT_GetPage(FileName,PageStyle,CurrPage,TotalPage, TypeSelect)
			Dim PageStr, I, J, SelectStr
			 If PageStyle=0 Then PageStyle=1
			 Select Case PageStyle
			  Case 1
			   If CurrPage = 1 And CurrPage <> TotalPage Then
				PageStr = "首页  上一页 <a href=""" & FileName & "&Page=" & CurrPage + 1 & """>下一页</a>  <a href= """ & FileName & "&Page=" & TotalPage & """>尾页</a>"
			   ElseIf CurrPage = 1 And CurrPage = TotalPage Then
				PageStr = "首页  上一页 下一页 尾页"
			   ElseIf CurrPage = TotalPage And CurrPage <> 2 Then  
				 PageStr = "<a href=""" & FileName & """>首页</a>  <a href=""" & FileName & "&Page=" & CurrPage - 1 & """>上一页</a> 下一页  尾页"
			   ElseIf CurrPage = TotalPage And CurrPage = 2 Then
				 PageStr = "<a href=""" & FileName & """>首页</a>  <a href=""" & FileName & """>上一页</a> 下一页  尾页"
			   ElseIf CurrPage = 2 Then
				PageStr = "<a href=""" & FileName & """>首页</a>  <a href=""" & FileName & """>上一页</a> <a href=""" & FileName & "&Page=" & CurrPage + 1 & """>下一页</a>  <a href= """ & FileName & "&Page=" &TotalPage & """>尾页</a>"
			   Else
				PageStr = "<a href=""" & FileName & """>首页</a>  <a href=""" & FileName & "&Page=" & CurrPage - 1 & """>上一页</a> <a href=""" & FileName & "&Page=" & CurrPage + 1 & """>下一页</a>  <a href= """ & FileName & "&Page=" & TotalPage & """>尾页</a>"
			   End If
			 Case 2
			 	If CurrPage=1 Then
			     PageStr="首页 上一页"
				ElseIf CurrPage=2 Then
			     PageStr="<a href=""" & FileName & """ title=""首页"">首页</a> <a href=""" & FileName & """ title=""上一页"">上一页</a>"& vbcrlf
				Else
				 PageStr="<a href=""" & FileName & """ title=""首页"">首页</a> <a href=""" & FileName & "&Page="&  CurrPage - 1 &""" title=""上一页"">上一页</a> "& vbcrlf
				End If
				 For J=CurrPage To CurrPage+9
				    If J>TotalPage Then Exit For
				    If J= CurrPage Then
				     PageStr=PageStr & " <font color=red>[" & J &"]</font>"& vbcrlf
				    Else
				     PageStr=PageStr & " <a href=""" & FileName & "&Page=" & J&""">[" & J &"]</a>"& vbcrlf
					End If
				 Next
				 If CurrPage=TotalPage Then
				  PageStr=PageStr & " 下一页 尾页"
				 Else
				  PageStr=PageStr & " <a href=""" & FileName & "&Page=" & CurrPage + 1 & """ title=""下一页"">下一页</a> <a href=""" & FileName & "&Page=" & TotalPage & """>尾页</a> "
				 End If
			 Case 3
			 	If CurrPage=1 Then
			     PageStr="<font face=webdings>9</font> <font face=webdings>7</font>"
				ElseIf CurrPage=2 Then
			     PageStr="<a href=""" & FileName & """ title=""首页""><font face=webdings>9</font></a> <a href=""" & FileName & """ title=""上一页""><font face=webdings>7</font></a>"
				Else
				 PageStr="<a href=""" & FileName & """ title=""首页""><font face=webdings>9</font></a> <a href=""" & FileName & "&Page="&  CurrPage - 1 &""" title=""上一页""><font face=webdings>7</font></a> "
				End If
				 If CurrPage=TotalPage Then
				  PageStr=PageStr & " <font face=webdings>8</font> <font face=webdings>:</font>"
				 Else
				  PageStr=PageStr & " <a href=""" & FileName & "&Page=" & CurrPage + 1 & """ title=""上一页""><font face=webdings>8</font></a> <a href=""" & FileName & "&Page=" & TotalPage & """><font face=webdings>:</font></a> "
				 End If
			 End Select
			   If CBool(TypeSelect) = True Then
				  PageStr = PageStr & " 转到：<select name=""page"" size=""1"" onchange=""javascript:window.location=this.options[this.selectedIndex].value;"">"& vbcrlf
				  For J = 1 To TotalPage
				   If J = CurrPage Then
					 SelectStr = " selected"
				   Else
					 SelectStr = ""
				   End If
				   If J = 1 Then
					 PageStr = PageStr & "<option value=""" & FileName & """" & SelectStr & ">第" & J & "页</option>"& vbcrlf
				   Else
					 PageStr = PageStr & "<option value=""" & FileName & "&Page=" & J & """" & SelectStr & ">第" & J & "页</option>"& vbcrlf
				   End If
			   Next
				  PageStr = PageStr & "</select>"
			   End If
			   	ACT_GetPage=PageStr	&"</div></div>"	   
		End Function
  
   Function IDArr(rs)
	     Dim I
	     Do While Not RS.Eof
		 IDArr = IDArr &RS(0) & ","
		 RS.MoveNext
		 I = I + 1
		  If I >= PerPageNumber Then Exit Do
		 Loop
		 IDArr = Left(IDArr, Len(IDArr) - 1)
	   End Function
  End Class 

 %>
