<%
class SiteSystemObject

public object_id '栏目id
public object_open
public object_open_temp
public object_num
public object_customer_grade '栏目id
public object_argument
public object_name
public object_template '栏目
public object_class '栏目
public object_up '栏目
public object_ads '栏目
public object_style_default '栏目
public object_show '栏目
public object_print '栏目
public object_qu '栏目
public object_description '栏目
public object_url '
public object_sum '下级栏目显示总数
public object_steps '下级栏目搜索深度
public file_check '是否检测栏目模版文件
public object_ids 
private objFSO 'FSO
public steps '当前搜索深度
private img '占位图控制数组
private objfile 'file

	Private Sub Class_Initialize()
	
		object_open="object_open"
		object_num="object_num"
		object_sum=0
		object_steps=1
		steps=0
		img="1"
		file_check=1
		set objFSO = Server.CreateObject("Scripting.FileSystemObject")

	End Sub
	
	Private Sub Class_Terminate() 
	
	set objFSO=nothing

	end sub
	
	function GetObject(id)
	
		dim rs_t
		
		if id="" then
		GetObject=false
		exit function
		end if
		
		set rs_t=server.createobject("adodb.recordset")
		rs_t.open "select * from jins_object_list where object_id="&id&" ",conn,1,1
		
		object_id = rs_t("object_id")
		object_open = rs_t("object_open")
		object_open_temp = rs_t("object_open_temp")
		object_num = rs_t("object_num")
		object_customer_grade = rs_t("object_customer_grade") 
		object_argument = rs_t("object_argument")
		object_name = rs_t("object_name")
		object_template  = rs_t("object_template")
		object_class  = rs_t("object_class")
		object_up  = rs_t("object_up")
		object_ads  = rs_t("object_ads")
		object_style_default = rs_t("object_style_default")
		object_show  = rs_t("object_show")
		object_print  = rs_t("object_print")
		object_qu  = rs_t("object_qu")
		object_description  = rs_t("object_description")
		
		rs_t.close
		set rs_t=nothing
		GetObject=true

	end function
	
	function ListUp(id)
		
		dim rs_t
		dim rs_tt
		
		set rs_t=conn.execute("select object_description,object_up from jins_object_list where object_id="&id&" ")
		if not rs_t.eof then
			
			if instr(1,object_url,"$$")<>0 then 
			     object_url=replace(object_url,"$$","$$ >·"&rs_t("object_description"))
			else
			     object_url="$$ >·"&rs_t("object_description")
			end if
			ListUp(rs_t("object_up"))
		
		end if

		set rs_t=nothing
		
		object_url=replace(object_url,"$$","")
		ListUp=true
		
	end function

Function ListObject(id,kind)

    Dim rs_t
    Dim num_t
    Dim num_show
    Dim img_t
	dim i
	dim sql
	
	if kind="ads" then 
	sql=""
    set rs_t=conn.execute("select "&object_open&","&object_num&",object_insert,object_ads,object_template,object_class,object_id,object_name,object_description,object_num,object_up,object_print from jins_object_list where object_up="&id&"  and (object_ads=1 or object_class='objects') order by "&object_num&" ")
    num_t=conn.execute("select count(object_id) from jins_object_list where object_up="&id&" and (object_ads=1 or object_class='objects') ")(0)
	else
    set rs_t=conn.execute("select "&object_open&","&object_num&",object_insert,object_ads,object_template,object_class,object_id,object_name,object_description,object_up,object_print from jins_object_list where object_up="&id&" order by "&object_num&" ")
    num_t=conn.execute("select count(object_id) from jins_object_list where object_up="&id&" ")(0)
	end if

    num_show = 1
    Do While Not rs_t.EOF
	object_ids=object_ids+","&rs_t("object_id")
        %>
        <table cellspacing=0 cellpadding=0 width=100% align=center >
        <tr>
        <td height='1' width='100%' colspan='10' background='images/dot03.gif'></td>
        </tr>
        <tr  onmouseover="this.style.background='#ebebeb';" onmouseout="this.style.background='#ffffff';">

        <td height=30  width='55%' style='padding-left:10px' >
        <%
        '//////////////////////////////////////////////////////////////////////////////
        img_t = Split(img, ",")

        For i = 1 To UBound(img_t)

            If img_t(i) = "0" Then
                response.write "<img border='0'src='Images/class6.gif' align='absmiddle'>"
            Else
                response.write "<img border='0' src='Images/class5.gif' align='absmiddle'>"
            End If

        Next

        If num_show < num_t Then
            response.write "<img border='0' src='Images/class3.gif' align='absmiddle'>"
        Else
            response.write "<img border='0' src='Images/class4.gif' align='absmiddle'>"
        End If

        If rs_t("object_class") = "objects" Then
            response.write "<img "
			if object_steps=0 or steps-object_steps<-1 then 
			response.Write" style='CURSOR: hand' title='点击打开或关闭下级栏目' onclick='opencat(cat_"&rs_t("object_id")&",img_"&rs_t("object_id")&");' "
			end if
			response.Write" id=img_" & rs_t("object_id") & " border='0' src='Images/class1.gif' align='absmiddle'>"
        Else
            response.write "<img border='0' src='Images/class2.gif' align='absmiddle'>"
        End If

        if kind="ads" then
		
			if rs_t("object_class")="objects" then 
			   'response.write "  <input type=text name=object_insert_" & rs_t("object_id") & " value='" & rs_t("object_insert") & "' size=2> " 
				response.write "<a title='点击搜索下级栏目！' href='admin_site_ads_list.asp?id="&rs_t("object_id")&" '> "&rs_t("object_description")&" </a>"
			    'if rs_t("object_insert")=1 then response.write "<a title='点击加入新的广告！' href='admin_site_ads_add.asp?id_up="&rs_t("object_id")&" '> [ 加入新的广告 ] </a>"
			else
				response.write " "&rs_t("object_description")
			end if
		
		else
		
			response.write "  <input type=text name=object_num_" & rs_t("object_id") & " value=" & rs_t(object_num) & " size=2>  " 
			if rs_t("object_class")="objects" then 
			   'response.write "  <input type=text name=object_insert_" & rs_t("object_id") & " value='" & rs_t("object_insert") & "' size=2> " 
				response.write "<a title='点击搜索下级栏目！' href='admin_object_list.asp?id="&rs_t("object_id")&"&index="&request("index")&"&filecheck="&request("filecheck")&"&steps="&request("steps")+1&" '>"&rs_t("object_description")&"</a>"
			else
				if rs_t("object_ads")=1 then 
					response.write rs_t("object_description")&" [ <img alt='广告栏目' border='0' src='Images/ad.gif' align='bottom'> ] "
				else
					response.write rs_t("object_description")
				end if
			end if
		
		end if

        '//////////////////////////////////////////////////////////////////////////////
        %>
        </td>
		
		<td height=30  width='10%' align=center style='font-size:12px;font-family:"Courier New", Courier, mono;color:green'>
		【 <%=rs_t("object_id")%> 】
		</td>
		
        <%
		if kind<>"ads" then
		%>
			<td height=30  width='10%' align=center>
			<select name=object_open_<%=rs_t("object_id")%> >
	
			<option value=1 <%if rs_t(object_open)=1 then response.write "selected"%>>打开</option>
			<option value=0 <%if rs_t(object_open)=0 then response.write "selected"%>>关闭</option>
	
			</select>
			</td>
			<td height=30  width='15%' align=center>
			<a title='点击开始对此栏目进行详细设置！' href="javascript:newwin=window.open('admin_object_edit.asp?id=<%=rs_t("object_id")%>','admin_object_edit','toolbar=no,location=no,status=no, menubar=no,scrollbars=yes,resizable=no,width=800,height=650');newwin.focus();" >
			管理此栏目
			</a>
			</td>
		<%
		else
		%>
			<td height=30  width='25%' align=center>
			<%
			if rs_t("object_class")="objects" and rs_t("object_insert")=1 then
			%>
			<a title='点击开始在此栏目下加入新的广告栏目！' href="admin_site_ads_add.asp?id_up=<%=rs_t("object_id")%>" >
			加入新广告
			</a>
			<%
			elseif rs_t("object_class")<>"objects" then
			%>
			<a title='点击开始管理此广告！' href="admin_site_ads_edit.asp?id=<%=rs_t("object_id")%>" >
			管理此广告
			</a>
			<%end if%>
			</td>
		<%
		end if
		%>
		
        <td height=30 width='10%' align=center>
        <%
		if kind="ads" then
			
			if rs_t("object_class")="object" and rs_t("object_ads")=1 then
			response.write "<a href='admin_site_ads_delete_handle.asp?id="&rs_t("object_id")&"'><img alt='删除此广告栏目！！' border='0'src='Images/delete.gif' align='absmiddle'></a>"
			end if
			
		else
			If file_check = 1 Then
	
				If Not objFSO.FileExists(Server.MapPath("../"&MySys.info.folder_object&"/" & rs_t("object_template") & ".asp")) Then
					response.write "<img border='0'src='Images/no.gif' align='absmiddle'>"
				Else
	
					Set objfile = objFSO.GetFile(Server.MapPath("../"&MySys.info.folder_object&"/" & rs_t("object_template") & ".asp"))
	
					response.write "[ " & FormatNumber(CCur("0" & objfile.Size / 1024), -1, -1) & " ]KB"
					Set objfile = Nothing
	
				End If
	
			End If
		end if

        num_show = num_show + 1

        If object_steps <> 0 And steps - object_steps >= -1 Then
            %>
            </td>
            </tr>
            </table>
            <%
        End If

        If object_steps = 0 Or steps - object_steps < -1 Then
            steps = steps + 1
            If num_show <= num_t Then img = img + ",1" Else img = img + ",0"
            %>
            </td>
            </tr>
            <tr id="cat_<%=rs_t("object_id")%>" style='display:none' >
            <td colspan=10>
            <%
            ListObject rs_t("object_id"),kind 
        End If

        rs_t.movenext
        object_sum = object_sum + 1
    Loop
    %>
    </td>

    </tr>
    </table>
    <%
    steps = steps - 1

    If Len(img) > 1 Then img = Left(img, Len(img) - 2)

    Set rs_t = Nothing

End Function
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

end class
%>