<!--#include file="base.asp"-->
<%
''' EYCMS 投稿
''' ==================================================================

	sub deldb()
		dim id:id=eycms.enhtml(eycms.fget("id",0))
		dim data
		data=eycms.db.dbload(1,"id,(select tablename from view_category where cateid=ey_content.classid) as tablename","ey_content","id="&id&" and (islock=-1 or islock=-2)","")
		if ubound(data)>=0 then
			eycms.db.dbdel data(1,0),"cid="&id&""
			eycms.db.dbdel "ey_content","id="&id&" and (islock=-1 or islock=-2)"
		end if
		eycms.echo "1"
	end sub
	
	sub passdb(byval t0)
		dim t1
		select case t0
			case "1":t1=1
			case else:t1=-2
		end select
		dim id:id=eycms.enhtml(eycms.fget("id",0))
		eycms.db.dbupdate "ey_content","id="&id&" and islock=-1",array(array("islock",t1,2,0))
		if t1=1 then eycms.deal_user_publish_point id,""
		eycms.echo "1"
	end sub
	
	sub doset()
		dim id:id=eycms.enhtml(eycms.fget("id",0))
		dim go:go=eycms.enhtml(eycms.fget("go",0))
		dim idarr:idarr=split(id,",")
		if ubound(idarr)<0 then
			eycms.echo "0&#33267;&#23569;&#36873;&#25321;&#19968;&#26465;&#20449;&#24687;"
		else
			dim i
			for i=0 to ubound(idarr)
				if not isnumeric(idarr(i)) then
					eycms.echo "0&#21442;&#25968;&#65306;"&id(i)&"&#19981;&#27491;&#30830;&#65292;&#35831;&#30830;&#35748;&#21518;&#20877;&#25805;&#20316;"
					exit sub
				end if
			next
			dim result
			select case go
				case "islock":result=1
				case "nolock":result=-2
				case else:eycms.echo "0&#21442;&#25968;&#38169;&#35823;":exit sub
			end select
			eycms.db.dbupdate "ey_content","id in("&id&") and (islock=-1 or islock=-2)",array(array("islock",result,2,0))
			if result=1 then
				for i=1 to ubound(idarr)
					eycms.deal_user_publish_point arr(i),""
				next
			end if
			eycms.echo "1"
		end if
	end sub
	
	sub delsome()
		dim id:id=eycms.enhtml(eycms.fget("id",0))
		dim idarr:idarr=split(id,",")
		dim data
		if ubound(idarr)<0 then
			eycms.echo "0&#33267;&#23569;&#36873;&#25321;&#19968;&#26465;&#20449;&#24687;"
		else
			dim i
			for i=0 to ubound(idarr)
				if not isnumeric(idarr(i)) then
					eycms.echo "0&#21442;&#25968;&#65306;"&id(i)&"&#19981;&#27491;&#30830;&#65292;&#35831;&#30830;&#35748;&#21518;&#20877;&#25805;&#20316;"
					exit sub
				else
					data=eycms.db.dbload(1,"id,(select tablename from view_category where cateid=ey_content.classid) as tablename","ey_content","id="&idarr(i)&" and (islock=-1 or islock=-2)","")
					if ubound(data)>=0 then
						eycms.db.dbdel data(1,0),"cid="&idarr(i)&""
						eycms.db.dbdel "ey_content","id="&idarr(i)&" and (islock=-1 or islock=-2)"
					end if
				end if
			next
			eycms.echo "1"
		end if
	end sub
	
	sub clearall()
		dim data
		data=eycms.db.dbload(1,"id,(select tablename from view_category where cateid=ey_content.classid) as tablename","ey_content","islock=-1 or islock=-2","")
		if ubound(data)>=0 then
			eycms.db.dbdel data(1,0),"cid="&data(0,0)&""
			eycms.db.dbdel "ey_content","islock=-1 or islock=-2"
		end if
		eycms.echo "1"
	end sub
	
	islogin
	checkpagelever 20
	dim act:act=lcase(eycms.fget("act",0))
	dim sta,order,keyword
	sta=eycms.getint(eycms.fget("sta",0),0)
	order=eycms.getint(eycms.fget("order",0),0)
	keyword=eycms.enhtml(eycms.fget("keyword",1))
	select case act
		case "del":deldb
		case "pass":passdb(1)
		case "nopass":passdb(0)
		case "doset":doset
		case "delsome":delsome
		case "clearall":clearall
		case else
			dim sqlwhere,statitle,orderby,ordtitle,wherekey
			select case sta
				case "1":sqlwhere="ey_content.islock=-1":statitle="状态:待审"
				case "2":sqlwhere="ey_content.islock=-2":statitle="状态:退稿"
				case else:sqlwhere="(ey_content.islock=-1 or ey_content.islock=-2)":statitle="按状态↓"
			end select
			select case order
				case "1":orderby="createdate desc,id desc":ordtitle="状态:发布日期↑"
				case "2":orderby="createdate,id":ordtitle="状态:发布日期↓"
				case else:orderby="ontop desc,id desc":ordtitle="按排序↓"
			end select
			if eycms.strlen(keyword)>0 then
				if datatype then
					wherekey=" and instr(lcase(title),lcase('"&keyword&"'))>0 "
				else
					wherekey=" and title like '%"&keyword&"%'"
				end if
			end if
			load theme_contentpublish
	end select
	eycms.db.dbclose
%>
