<%
'*************************************************************************
'**模 块 名：SiteObject->[jins/root/inc/class_object.asp]
'**说    明：知诸网络::网聚购物系统::[dushdown(尘埃落地)] 版权所有2006 - 2007(C)
'**创 建 人：李蒙
'**日    期：2006-01-12 21:07:12
'**修 改 人：
'**日    期：
'**描    述：网站栏目类
'**版    本：V1.04
'*************************************************************************
Class SiteObject
	dim p_up '上一级栏目指针
	dim id '栏目id
	dim up '上级栏目id
	dim prints '栏目版面
	dim name '栏目名称
	dim description '栏目描述
	dim show '栏目显示样式
	dim argument '栏目参数
	dim style '栏目样式
	dim image '栏目图片文件夹
	dim template '栏目模版文件
	dim qu '栏目显示记录数
	dim rs '栏目数据库记录集
	dim rs_other(20) '其他栏目数据库记录集
	'//////////////////////////////////////////////////
	Private Sub Class_Initialize() '初始化
		set rs=server.CreateObject("ADODB.RecordSet")
		id=0
	end sub
	
	Private Sub Class_Terminate() 
	    set rs=nothing
	end sub
	
	function Search_Object(object_up,object_name)
	
		dim rs_s_o
		
		if object_up="" or object_name="" then
		Search_Object=false
        exit function
		end if
		
		set rs_s_o=conn.execute("select object_id,object_customer_grade from jins_object_list where object_up="&object_up&" and object_name='"&object_name&"' and  "&site.pageshow.key_open&"=1 ")
		
		if not rs_s_o.eof then
		if not site.temp.customer.check.GradeCheck(rs_s_o("object_customer_grade")) then Search_Object=false else Search_Object=true 
		else
		Search_Object=false
		end if
		
		set rs_s_o=nothing
		
	End function

	function Search_Include(object_up,object_name)
		if object_up="" or object_name="" then
		Search_Include=false
		exit function
		end if
		
		rs.open "select * from jins_object_list where object_up="&object_up&" and object_name='"&object_name&"' and  "&site.pageshow.key_open&"=1 ",conn,1,1
		Object_Init(rs)
		rs.close
		
	End function
	
	'//////////////////////////////////////////////////
	Function Object_Init(rs_fun) '包含栏目
	
		dim p_temp '暂存指针
		dim object_customer_grade
		dim show
		dim template_show
		
		If rs_fun.EOF Then
			Object_Init = False
			Exit Function
		End If
				
		if not site.temp.customer.check.GradeCheck(rs_fun("object_customer_grade")) then
			Object_Init = False
			Exit Function
		End If
		
		If Not rs_fun.EOF Then
			site.object_p = site.object_p+1 '栏目指针加一
			p_temp=site.object_p '指针暂存
			Dim object
			Set object = New SiteObject
			site.SetObject p_temp, object
			'Set site.object(p_temp) = New SiteObject
			'////变量赋值
			site.object(p_temp).p_up = p_temp '上一级栏目指针
			site.object(p_temp).id = rs_fun("object_id")
			site.object(p_temp).up = rs_fun("object_up")
			site.object(p_temp).prints=rs_fun("object_print")
			site.object(p_temp).description = rs_fun("object_description")
			site.object(p_temp).name = rs_fun("object_name")
			site.object(p_temp).argument = rs_fun("object_argument")
			site.object(p_temp).show = rs_fun("object_show")
			site.object(p_temp).qu = rs_fun("object_qu")
			'site.object(p_temp).style = rs_fun("object_style_default")
			site.object(p_temp).template = rs_fun("object_template")
			'////初值处理
			If site.object(p_temp).argument <> "" Then site.object(p_temp).argument = Split(site.object(p_temp).argument, ",")

			If site.object(p_temp).show <> "" Then 
				site.object(p_temp).show = Split(site.object(p_temp).show, ",")
				show=1
			else
				show=0
			end if
			
			If site.object(p_temp).qu <= 0 Then site.object(p_temp).qu = 10
			if site.object(p_temp).style=0 then site.object(p_temp).style=" class='table_"&site.object(p_temp).id&"' " else site.object(p_temp).style=site.object(p_up).style
			
			'if show=0 then
				site.object(p_temp).image = site.info.folder_object + "/images/" + site.object(p_temp).prints + "_" + site.object(p_temp).name + "/"
			    template_show=site.info.folder_object&"/"&site.object(p_temp).template&".asp"
			'else
				'site.object(p_temp).image = site.info.folder_object + "/images/" + site.object(p_temp).prints + "_" + site.object(p_temp).name + "/" + site.object(p_temp).show(0)
			    'template_show=site.info.folder_object&"/template/template_"&replace(site.object(p_temp).template,"_show","_"&site.object(p_temp).show(0))&".asp"
			'end if
			'////执行模版文件
			site.functions.include(template_show)
			'////对象清空
        	site.ClearObject (p_temp)
			'Set site.object(p_temp) = Nothing
			Object_Init = True
		Else
			Object_Init = False
			Exit Function
		End If
	End Function	
	'/////////////////////
	Function Object_Include(id) '包含下一级栏目
		'response.write site.pageshow.key_num
		If id = "" Then
			Object_Include = False
			Exit Function
		End If
		rs.open "select * from jins_object_list where object_up="&site.object(id).id&" and "&site.pageshow.key_open&"=1 order by "&site.pageshow.key_num&" ",conn,1,1
		Do While Not rs.EOF
		    if instr(rs("object_template"),"_handle")=0 then Object_Init (rs)
			rs.movenext
		Loop
		'set site.object(id)=nothing
		rs.Close
		Set rs = Nothing
		Object_Include = True
	End Function

	'/////////////////////
	Function Object_Handle(id) '执行栏目按id
		If id = "" Then
			Object_Handle = False
			Exit Function
		End If
		response.write "<!--栏目 ID:"&id&" 调用开始//-->"&vbcrlf
		rs.open "select * from jins_object_list where object_id="&id&" and "&site.pageshow.key_open&"=1 ",conn,1,1
		if Not rs.EOF then Object_Init (rs)
		response.write vbcrlf&"<!--栏目 ID:"&id&" 调用结束//-->"&vbcrlf
		rs.Close
		'Set rs = Nothing
		Object_Handle = True
	End Function

	'/////////////////////
	Function Object_IncludeTemplate(id) '包含模版栏目
		If id = "" Then
			Object_IncludeTemplate = False
			Exit Function
		End If
		site.functions.include(site.info.folder_object&"/template/template_"&replace(site.object(id).template,"show",site.object(id).show(0))&".asp" )
		Object_IncludeTemplate = True
	End Function
		
End Class
%>