<%
'**************************************
'* 最后更新 2012-05-18 by 56770.kingdge
'* Copyright www.56770.com
'**************************************
Dim Showpath1,sql,getclassname,Pathbackurl,Pathbackurl2,script_name,id,arr_category,category_i,categoryid,page
'Showpath = "<a href='"& Eshop_url & url_1 &"'>"& www56770com_word(0) &"</a> → <a href='"& Eshop_url & url_7 &"'>"& www56770com_word(18) &"</a>"

Public Function NewsList(showheadpage,showfootpage)
		Dim strFile,RLoadStyle(9),LoadNewsList,TmpLoadNewsList,headpage,footpage,icon_top,icon_pic
		strFile = Eshop_url& Style_folder &"Lebi.NewsList."
	    Dim sql,ors,DataCount,DataList,Filename,i
		showheadpage = checknum(showheadpage,0) : showfootpage = checknum(showfootpage,0)
	    Set ors=new Cls_vbsPage
	    Set ors.Conn=conn
	    With ors
		    .PageSize=top23
		    .PageName="Page"
			If IsSqlDataBase = 0 Then
		            .DbType="AC"
			Else
			        .DbType="MSSQL"
			End If
		    .RecType=-1
		    .Pkey="id"
    	    .Field="id,pic,title"& LangTxt &",infotime,n_tj,hits,content"& LangTxt &",content_view"& LangTxt &",strcolor,n_filename"
		    .Table="[Lebi_news]"
			sql = "1=1"
			If classid <> 0 And IsSqlDataBase = 1 Then sql = sql &" and charindex(',"&classid&",',classid)>0"
			If classid <> 0 And IsSqlDataBase = 0 Then sql = sql &" and instr(classid,',"&classid&",')>0"
			If keyword <> "" Then sql = sql &" and title"& LangTxt &" like '%"& keyword &"%'"
			.Condition=sql
            .OrderBy="n_tj desc,infotime desc"
	    End With
	    DataCount=ors.RecCount()
	    DataList=ors.ResultSet()
		If show_html = 0 Then
                Filename = ""
		Else
				Filename = Eshop_url & LangPath & Folder(1) & n_filename
				If s_classid<>0 Then Filename = Filename &"."& n_filename
		End If
		RLoadStyle(0) = LoadStyle(strFile&"0.style")
		RLoadStyle(3) = LoadStyle(strFile&"3.style")
		RLoadStyle(4) = splits(LoadStyle(strFile&"4.style"))
		RLoadStyle(5) = LoadStyle(strFile&"5.style")
		RLoadStyle(7) = LoadStyle(strFile&"7.style")
		NewsList = RLoadStyle(0)
		If showheadpage = 1 Then
		        RLoadStyle(2) = LoadStyle(strFile&"2.style")
				headpage = RLoadStyle(2)
		        ReplaceStyle "headpage",ors.ShowPageHead(Filename),headpage
		End If
		If DataCount > 0 Then
				RLoadStyle(8) = splits(LoadStyle(strFile&"8.style"))
		        RLoadStyle(9) = splits(LoadStyle(strFile&"9.style"))
		        For i = 0 To Ubound(DataList,2)
						LoadNewsList = RLoadStyle(4)
						If DataList(4,i) = 1 Then
						        icon_top = RLoadStyle(8)
					    Else
					            icon_top = ""
						End If
						If DataList(1,i) = 1 Then
						        icon_pic = RLoadStyle(9)
					    Else
					            icon_pic = ""
						End If
						ReplaceStyle "title",DataList(2,i),LoadNewsList
						Select Case show_html
							   Case "0"
									Select Case ISAPI_Rewrite
										   Case "0"
												Select Case Config_Lebi_Eshop(16)
													   Case "0" : ReplaceStyle "url",LangPath & "zhuanti.asp?action=news_list&id="& DataList(0,i),LoadNewsList
													   Case "1" : ReplaceStyle "url",LangPath & "news/list/?id="& DataList(0,i),LoadNewsList
													   Case "2" : ReplaceStyle "url",LangPath & "news/list/default.asp?id="& DataList(0,i),LoadNewsList
												End Select
										   Case "1" ReplaceStyle "url",LangPath & "news_list-"& DataList(0,i) &".html",LoadNewsList
									End Select
							   Case "1" : ReplaceStyle "url",LangPath & Folder(1) &"info/"& DataList(9,i) &"."& Sys_Ext,LoadNewsList
						End Select
						ReplaceStyle "color",DataList(8,i),LoadNewsList
						ReplaceStyle "top",icon_top,LoadNewsList
						ReplaceStyle "pic",icon_pic,LoadNewsList
						ReplaceStyle "time",DataList(3,i),LoadNewsList
						ReplaceStyle "num",DataList(5,i),LoadNewsList
						If trim(DataList(7,i))<>"" Then
								ReplaceStyle "content",DataList(7,i),LoadNewsList
						Else
								ReplaceStyle "content",cutchar(RemoveHTML(DataList(6,i)),200),LoadNewsList
						End If
						ReplaceStyle "loop_num",i+1,LoadNewsList
						TmpLoadNewsList = TmpLoadNewsList & LoadNewsList
		        Next
		Else
		        RLoadStyle(1) = splits(LoadStyle(strFile&"1.style"))
				TmpLoadNewsList = RLoadStyle(1)
        End If
		If showfootpage = 1 Then
		        RLoadStyle(6) = LoadStyle(strFile&"6.style")
				footpage = RLoadStyle(6)
		        ReplaceStyle "footpage",ors.ShowPageFoot(Filename),footpage
		End If
		NewsList = NewsList & headpage & RLoadStyle(3) & TmpLoadNewsList & RLoadStyle(5) & footpage
		NewsList = NewsList & RLoadStyle(7)
End Function

Function NewsInfoPrev()
        Dim url,strFile,RLoadStyle(1)
		strFile = Eshop_url& Style_Folder &"Lebi.NewsInfoPrev."
		RLoadStyle(0) = splits(LoadStyle(strFile&"0.style"))
		RLoadStyle(1) = splits(LoadStyle(strFile&"1.style"))
        sql="select top 1 title"& LangTxt &",id,n_filename from [Lebi_news] where id < "& id &" order by id desc"
        set Rs = conn.execute(Sql)
        if Not (rs.eof and rs.bof) Then
                NewsInfoPrev = RLoadStyle(0)
                Select Case show_html
                       Case "0"
							Select Case ISAPI_Rewrite
								   Case "0"
										Select Case Config_Lebi_Eshop(16)
											   Case "0" : url = "zhuanti.asp?action=news_list&id="& rs(1)
											   Case "1" : url = "news/list/?id="& rs(1)
											   Case "2" : url = "news/list/default.asp?id="& rs(1)
										End Select
								   Case "1" url = "news_list-"& rs(1) &".html"
							End Select
		               Case "1" : url = Folder(1) &"info/"& rs(2)&"."& Sys_Ext
		        End Select
				ReplaceStyle "url",LangPath & url,NewsInfoPrev
				ReplaceStyle "title",rs(0),NewsInfoPrev
		Else
		        NewsInfoPrev = RLoadStyle(1)
        End If
        rs.close:Set rs=Nothing
End Function

Function NewsInfoNext()
        Dim url,strFile,RLoadStyle(1)
		strFile = Eshop_url& Style_folder &"Lebi.NewsInfoNext."
		RLoadStyle(0) = splits(LoadStyle(strFile&"0.style"))
		RLoadStyle(1) = splits(LoadStyle(strFile&"1.style"))
        sql="select top 1 title"& LangTxt &",id,n_filename from [Lebi_news] where id > "& id &""
        set Rs = conn.execute(Sql)
        if Not (rs.eof and rs.bof) Then
                NewsInfoNext = RLoadStyle(0)
                Select Case show_html
                       Case "0"
							Select Case ISAPI_Rewrite
								   Case "0"
										Select Case Config_Lebi_Eshop(16)
											   Case "0" : url = "zhuanti.asp?action=news_list&id="& rs(1)
											   Case "1" : url = "news/list/?id="& rs(1)
											   Case "2" : url = "news/list/default.asp?id="& rs(1)
										End Select
								   Case "1" url = "news_list-"& rs(1) &".html"
							End Select
		               Case "1" : url = Folder(1) &"info/"& rs(2)&"."& Sys_Ext
		        End Select
				ReplaceStyle "url",LangPath & url,NewsInfoNext
				ReplaceStyle "title",rs(0),NewsInfoNext
		Else
		        NewsInfoNext = RLoadStyle(1)
        End If
        rs.close:Set rs=Nothing
End Function

Public Function NewsInfoProduct()
		Dim strFile,RLoadStyle(2),LoadNewsInfoProduct,TmpLoadNewsInfoProduct
		Dim App_NewsInfoProduct,DataCount,i,pic_width,pic_height,pic_url,pic_enlage_url,pic_enlage_width,url
		strFile = Eshop_url& Style_folder &"Lebi.NewsInfoProduct."
		If Trim(NewsInfoProductValue(0)) <> "" Then
				cache.name="NewsInfoProduct"& LangTxt & id
				cache.reloadtime= 5000
				If cache.objisempty() Then
						Set rs = conn.execute("select id,product_name"& LangTxt &",pic,pic_size,cpic,p_filename from [Lebi_product] where id in ("& NewsInfoProductValue(0) &")")
						If Not rs.eof Then
								cache.value = rs.getrows
								cache.DataCount = 1
						Else
								cache.value = ""
								cache.DataCount = 0
						End If
				        rs.close : Set rs = Nothing
				End If
				App_NewsInfoProduct = cache.value
				DataCount = cache.DataCount
				If DataCount = 1 Then
				        RLoadStyle(0) = LoadStyle(strFile&"0.style")
						RLoadStyle(1) = splits(LoadStyle(strFile&"1.style"))
						RLoadStyle(2) = LoadStyle(strFile&"2.style")
						NewsInfoProduct = RLoadStyle(0)
						For i = 0 To UBound(App_NewsInfoProduct,2)
						        LoadNewsInfoProduct = RLoadStyle(1)
								Select Case pic_zt
									   Case "1"
											pic_width=Split(showpicsize(Split(App_NewsInfoProduct(3,i),"|")(0),Split(App_NewsInfoProduct(3,i),"|")(1),pic_xw,pic_xh),"|")(0)
											pic_height=Split(showpicsize(Split(App_NewsInfoProduct(3,i),"|")(0),Split(App_NewsInfoProduct(3,i),"|")(1),pic_xw,pic_xh),"|")(1)
									   Case "0"
											pic_width=pic_xw
											pic_height=pic_xh
								End Select
								If InStr(App_NewsInfoProduct(4,i),"@@") > 0 Then
										pic_enlage_url = Split(App_NewsInfoProduct(4,i),"@@")(0)
										If pic_enlage_url = "" Then pic_enlage_url = Split(App_NewsInfoProduct(4,i),"@@")(1)
								Else
										pic_enlage_url = App_NewsInfoProduct(4,i)
								End If
								Select Case show_html
									   Case "0"
											Select Case ISAPI_Rewrite
												   Case "0" Url = PagePath(10) &"?id="& App_NewsInfoProduct(0,i)
												   Case "1" Url = LangPath &"product-"& App_NewsInfoProduct(0,i) &".html"
											End Select
									   Case "1" : Url = LangPath & Folder(0) & App_NewsInfoProduct(5,i)&".1."& Sys_Ext
								End Select
								ReplaceStyle "div_width",pic_xw+10,LoadNewsInfoProduct
								ReplaceStyle "url",LangPath & Url,LoadNewsInfoProduct
								ReplaceStyle "target",Config_Lebi_Eshop(9),LoadNewsInfoProduct
								ReplaceStyle "pic_url",PicturePath & App_NewsInfoProduct(2,i),LoadNewsInfoProduct
								ReplaceStyle "pic_width",pic_width,LoadNewsInfoProduct
								ReplaceStyle "pic_height",pic_height,LoadNewsInfoProduct
								ReplaceStyle "pic_enlage_url",Eshop_url & PicturePath & pic_enlage_url,LoadNewsInfoProduct
								ReplaceStyle "pic_enlage_width",pic_dw,LoadNewsInfoProduct
								ReplaceStyle "name",App_NewsInfoProduct(1,i),LoadNewsInfoProduct
								ReplaceStyle "loop_num",i+1,LoadNewsInfoProduct
								TmpLoadNewsInfoProduct = TmpLoadNewsInfoProduct & LoadNewsInfoProduct
						Next
						NewsInfoProduct = NewsInfoProduct & TmpLoadNewsInfoProduct & RLoadStyle(2)
				End If
		End If
End Function

Sub SetShowPath(cid)
	Dim rs_ssp
	If cid <> 0 Then
		sql = "select classname"& LangTxt &",classid,parentid,n_foldername,n_filename from [Lebi_newsclass] where classid = "& cid &""
		set rs_ssp = conn.execute(sql)
		If not rs_ssp.eof Then
			Select Case show_html
				   Case "0"
						Select Case ISAPI_Rewrite
							   Case "0"
									Select Case Config_Lebi_Eshop(16)
										   Case "0" : ShowPath1 = " → <a href='"& LangPath & "zhuanti.asp?action=news_class&classid="& rs_ssp(1) &"'>"& rs_ssp(0) &"</a>" & ShowPath1
										   Case "1" : ShowPath1 = " → <a href='"& Eshop_url & LangPath & "news/"& rs_ssp(3) &"/'>"& rs_ssp(0) &"</a>" & ShowPath1
										   Case "2" : ShowPath1 = " → <a href='"& Eshop_url & LangPath & "news/"& rs_ssp(3) &"/default.asp'>"& rs_ssp(0) &"</a>" & ShowPath1
									End Select
							   Case "1" ShowPath1 = " → <a href='"& LangPath & "news_class-"& rs_ssp(1) &".html'>"& rs_ssp(0) &"</a>" & ShowPath1
						End Select
				   Case "1" : ShowPath1 = " → <a href="""& Eshop_url & LangPath & Folder(1) & rs_ssp(4) &".1."& Sys_Ext &""">"& rs_ssp(0) &"</a>" & ShowPath1
			End Select
			If CInt(rs_ssp(2)) <> 0 Then SetShowPath(rs_ssp(2))
		End If
	Else
		Exit Sub
	End If
	rs_ssp.close : set rs_ssp=nothing
End Sub

Function NewsContentPage(content,pageline,page)
		On Error Resume Next
		dim pagecount,pagecount_i,plinenum,blinenum,allline,pallline,ballline,PageUrl
		Dim strFile,RLoadStyle(6),firstpage,provpage,pagelist,looppagelist,nextpage,lastpage
		strFile = Eshop_url& Style_Folder &"Lebi.ShowPageFoot."	
		plinenum = split(content,"<p>")
		blinenum = split(content,"<br />")
		pallline = ubound(plinenum)+1
		ballline = ubound(blinenum)+1
		If pallline > ballline Then
				allline=pallline
		Else
				allline=ballline
		End If
		pagecount = int(allline\pageline)+1 '计算总页数
		Select Case Config_Lebi_Eshop(16)
			   Case "0" : PageUrl = LangPath & "?action=news_list&id="& id
			   Case "1" : PageUrl = LangPath & "news/list/?id="& id
			   Case "2" : PageUrl = LangPath & "news/list/default.asp?id="& id
		End Select
		for pagecount_i=0 to allline
				if pagecount_i+1>CLng(page)*pageline-pageline and pagecount_i<CLng(page)*pageline then
						If pallline > ballline Then
								NewsContentPage = NewsContentPage &"<p>"& plinenum(pagecount_i) '输出分页后的内容
						Else
								NewsContentPage = NewsContentPage & blinenum(pagecount_i) &"<br />" '输出分页后的内容
						End If
				end if
		Next
		RLoadStyle(5) = LoadStyle(strFile&"5.style")
		RLoadStyle(6) = LoadStyle(strFile&"6.style")
		for pagecount_i=1 to pagecount
				if CLng(page) = CLng(pagecount_i) Then
						pagelist = RLoadStyle(5)
						ReplaceStyle "pagenum",pagecount_i,pagelist
						pagelist = splits(pagelist)
	    	    Else
						pagelist = RLoadStyle(6) 
						Select Case show_html
							   Case "0"
									Select Case ISAPI_Rewrite
										   Case "0" StrPageUrl = Eshop_url & PageUrl &"&page="&pagecount_i
										   Case "1" StrPageUrl = Eshop_url & LangPath &"news_list-"& id &"-"& pagecount_i	&".html"
									End Select
							   Case "1"
									If pagecount_i = 1 Then
											StrPageUrl = Eshop_url & LangPath & folder(1) &"info/"& id &"."& Sys_Ext
									Else
											StrPageUrl = Eshop_url & LangPath & folder(1) &"info/"& id &"."& pagecount_i &"."& Sys_Ext
									End If
						End Select
						ReplaceStyle "pageurl",StrPageUrl,pagelist
						ReplaceStyle "pagenum",pagecount_i,pagelist
				end If
				looppagelist = looppagelist & pagelist
		Next
		If CLng(page) > 1 And pagecount > 1 Then
		        RLoadStyle(2) = LoadStyle(strFile&"2.style")
				provpage = RLoadStyle(2)
				Select Case show_html
					   Case "0"
							Select Case ISAPI_Rewrite
								   Case "0" StrProvUrl = PageUrl &"&page="&page-1
								   Case "1" StrProvUrl = LangPath &"news_list-"& id &"-"& page-1	&".html"
							End Select
					   Case "1"
							If CLng(page) = 2 Then
									StrProvUrl = LangPath & folder(1) &"info/"& id &"."& Sys_Ext
							Else
									StrProvUrl = LangPath & folder(1) &"info/"& id &"."& page - 1 &"."& Sys_Ext
							End If
				End Select
				ReplaceStyle "provurl",StrProvUrl,provpage
			    provpage = splits(provpage)
		Else 
		        provpage = ""
		End If
		If CLng(page) < CLng(pagecount) Then
		        RLoadStyle(3) = LoadStyle(strFile&"3.style")
				nextpage = RLoadStyle(3)
				Select Case show_html
					   Case "0"
							Select Case ISAPI_Rewrite
								   Case "0" StrNextUrl = PageUrl &"&page="&page+1
								   Case "1" StrNextUrl = LangPath &"news_list-"& id &"-"& page+1	&".html"
							End Select
					   Case "1" StrNextUrl = LangPath & folder(1) &"info/"& id &"."& page + 1 &"."& Sys_Ext
				End Select
				ReplaceStyle "nexturl",StrNextUrl,nextpage
			    nextpage = splits(nextpage)
		Else 
		        Nextpage = ""	
		End If
		RLoadStyle(0) = splits(LoadStyle(strFile&"0.style"))
        NewsContentPage = NewsContentPage & RLoadStyle(0)
		ReplaceStyle "first",firstpage,NewsContentPage
		ReplaceStyle "prov",provpage,NewsContentPage
		ReplaceStyle "next",nextpage,NewsContentPage
		ReplaceStyle "last",lastpage,NewsContentPage
		ReplaceStyle "pagelist",looppagelist,NewsContentPage
		ReplaceStyle "page",page,NewsContentPage
		ReplaceStyle "turnpage",turnpage,NewsContentPage
		ReplaceStyle "totalpage",pagecount,NewsContentPage
		ReplaceStyle "pagesize",pageline,NewsContentPage
		ReplaceStyle "datacount",allline,NewsContentPage
		ReplaceStyle "pageurl",PageUrl,NewsContentPage
		'NewsContentPage = NewsContentPage & "page:"& page &"pagecount:"& pagecount &"allline:"&allline&"pageline:"&pageline
		'总共"&allline&"行 "&pagecount&"页 每页"&pageline&"行
'		NewsContentPage = NewsContentPage & "<div style=""float:right;text-align:right""><div class=""page"">"
'		for pagecount_i=1 to pagecount
'				if CLng(page) = pagecount_i then
'						NewsContentPage = NewsContentPage &"<p class=""onpagenumbody"">"& pagecount_i & "</p>"
'				else
'						NewsContentPage = NewsContentPage &"<p class=""pagenumbody""><a href="""
'						Select Case show_html
'							   Case "0"
'									Select Case ISAPI_Rewrite
'										   Case "0" NewsContentPage = NewsContentPage & PageUrl &"&page="& pagecount_i
'										   Case "1" NewsContentPage = NewsContentPage & Eshop_url & LangPath &"news_list-"& id &"-"& pagecount_i &".html"
'									End Select
'							   Case "1"
'									If pagecount_i = 1 Then
'											NewsContentPage = NewsContentPage & Eshop_url & LangPath & folder(1) &"info/"& id &"."& Sys_Ext
'									Else
'											NewsContentPage = NewsContentPage & Eshop_url & LangPath & folder(1) &"info/"& id &"."& pagecount_i &"."& Sys_Ext
'									End If
'						End Select
'						NewsContentPage = NewsContentPage & """>"&pagecount_i&"</a></p>"
'				end if
'		next
'		If CLng(page) > 1 And pagecount > 1 Then
'				NewsContentPage = NewsContentPage &"<p class=""pagebody""><a href="""
'				Select Case show_html
'					   Case "0"
'							Select Case ISAPI_Rewrite
'								   Case "0" NewsContentPage = NewsContentPage & PageUrl &"&page="& page-1
'								   Case "1" NewsContentPage = NewsContentPage & Eshop_url & LangPath &"news_list-"& id &"-"& page-1 &".html"
'							End Select
'					   Case "1"
'							If CLng(page) = 2 Then
'									NewsContentPage = NewsContentPage & Eshop_url & LangPath & folder(1) &"info/"& id &"."& Sys_Ext
'							Else
'									NewsContentPage = NewsContentPage & Eshop_url & LangPath & folder(1) &"info/"& id &"."& page - 1 &"."& Sys_Ext
'							End If
'				End Select
'				NewsContentPage = NewsContentPage & """><img src="""& Eshop_url &"skins/"& skin_folder &"/page/pre.gif"" alt="""& Lebi_page(0) &""" align=""absmiddle"" border=""0"" /></a></p>"
'		End If
'		If CLng(page) < CLng(pagecount) Then
'				NewsContentPage = NewsContentPage &"<p class=""pagebody""><a href="""
'				Select Case show_html
'					   Case "0"
'							Select Case ISAPI_Rewrite
'								   Case "0" NewsContentPage = NewsContentPage & PageUrl &"&page="& page+1
'								   Case "1" NewsContentPage = NewsContentPage & Eshop_url & LangPath &"news_list-"& id &"-"& page+1 &".html"
'							End Select
'					   Case "1" NewsContentPage = NewsContentPage & Eshop_url & LangPath & folder(1) &"info/"& id &"."& page + 1 &"."& Sys_Ext
'				End Select
'				NewsContentPage = NewsContentPage & """><img src="""& Eshop_url &"skins/"& skin_folder &"/page/next.gif"" alt="""& Lebi_page(1) &""" align=""absmiddle"" border=""0"" /></a></p>"
'		End If
'		NewsContentPage = NewsContentPage &"<p class=""pagetotal"" title=""当前页"">"&page&"/"&pagecount&"</p></div></div><div class=""both""></div>"
End Function
%>