<!--#include file="base.asp"-->
<%
''' EYCMS 内容
''' ==================================================================
	sub loadlist()
		dim ids:ids=eycms.enhtml(eycms.fget("ids",1))
		If eycms.strlen(ids)>0 then
			dim t1
			t1=eycms.db.dbload(10,"id,title","ey_content","islock=1 and id in("&ids&")","ontop desc,id desc")
			if ubound(t1)<0 then
				eycms.echo "0&#27809;&#26377;&#30456;&#20851;&#20449;&#24687;"
			else
				dim i,t2
				t2="1"
				for i=0 to ubound(t1,2)
					t2=t2&"<li>[ "&t1(0,i)&" ]　"&eycms.cutstr(t1(1,i),42,1)&"</li>"
				next
				eycms.echo t2
			end If
		Else
			eycms.echo "1"
		End if
	end Sub
	
	sub getcategory02(byval t0,byval t1)
		dim i
		for i=0 to ubound(data,2)
			if t0=data(3,i) Then
				If getcatestatus(data(0,i)) then
					get_category02=get_category02&"<option value="""
					get_category02=get_category02&""&data(0,i)&""
					get_category02=get_category02&""" "&eycms.iif(t1=data(0,i),"selected","")&" "
					get_category02=get_category02&">"&string(data(4,i)-1,"　")&eycms.iif(data(3,i)>0,"├ ","")&""&data(1,i)&"</option>"
				End if
				getcategory02 data(0,i),t1
			end if
		next
	end Sub

	islogin
	dim act:act=lcase(eycms.fget("act",0))
	dim modeid:modeid=eycms.getint(eycms.fget("modeid",0),0)
	dim classid:classid=eycms.getint(eycms.fget("classid",0),0)
	dim lx:lx=eycms.getint(eycms.fget("lx",0),0)
	dim uf:uf=eycms.enhtml(eycms.fget("uf",1))
	Dim uv:uv=eycms.enhtml(eycms.fget("uv",1))
	If eycms.strlen(uv)=0 Then uv=0
	If Left(uv,1)="," Then uv=Right(uv,Len(uv)-1)
	If Right(uv,1)="," Then uv=left(uv,Len(uv)-1)
	If classid=0 Then classid=eycms.db.dbloadone("cateid","ey_category","modeid="&CLng(modeid)&" and followid=0")
	dim sta,order,keyword
	order=eycms.getint(eycms.fget("order",0),0)
	sta=eycms.getint(eycms.fget("sta",0),0)
	keyword=eycms.enhtml(eycms.fget("keyword",1))
	select case act
	Case "loadlist":loadlist
	Case else
		dim data,rootid,sonids,parents,sqlwhere,orderby,ordtitle,statitle,wherekey,tablename
		sonids=eycms.get_sonid_one(classid)
		parents=eycms.get_parentid(classid)
		rootid=split(parents,"]")(0)
		rootid=replace(rootid,"[","")
		rootid=CInt(rootid)
		If InStr(sonids,",")>0 And classid<>rootid Then
			sqlwhere="left(parentid,"&Len(parents)&")='"&parents&"'"
			if admingroupid>0 Then    '普通管理员
				sqlwhere=sqlwhere&" and classid in("&admin_cate_array&")"
			end if
		Else
			sqlwhere="islock=1 and modeid="&modeid
		End If

		tablename="view_content"

		statitle="按状态"
		select case sta
			case "1":sqlwhere=sqlwhere&" and id in("&uv&")"
			case "2":sqlwhere=sqlwhere&" and id not in("&uv&")"
		end Select

		ordtitle="按排序"
		select case order
			case "1":orderby="hits desc,id desc"
			case "2":orderby="hits,id"
			case "3":orderby="createdate desc,id desc"
			case "4":orderby="createdate,id"
			case "5":orderby="comments desc,id desc"
			case "6":orderby="comments,id"
			case else:orderby="ontop desc,id desc"
		end Select

		if eycms.strlen(keyword)>0 then
			if datatype then
				wherekey=" and (instr(lcase(title),lcase('"&keyword&"'))>0 or instr(lcase(intro),lcase('"&keyword&"'))>0) "
			else
				wherekey=" and (title like '%"&keyword&"%' or intro like '%"&keyword&"%') "
			end if
		end If
		
		dim get_category02
		
		data=eycms.categorydata
		if ubound(data)>=0 then
			get_category02="<option value="""
			get_category02=get_category02&""&rootid&""
			get_category02=get_category02&""" "&eycms.iif(classid=rootid,"selected","")&" "
			get_category02=get_category02&">"&""&eycms.getcatename(rootid)&"</option>"
			getcategory02 rootid,classid
		end If
		load theme_popuplist_model
	End select
	eycms.db.dbclose
%>