<!--#include file="base.asp"-->
<%
''' EYCMS 心情
''' ==================================================================

	sub configdb()
		dim t0,t1
		t0=eycms.enhtml(eycms.fpost("t0",0))
		eycms.db.dbupdate "ey_config","setname='eycms.expand' and setkey='expand.mood'",array(array("setvalue",t0,0,1))
		eycms.delcache "eycmsdata"
		eycms.ajaxjson "保存成功",1
	end sub
	
	function get_mood(byval t0)
		select case t0
			case "1":get_mood="高兴"
			case "2":get_mood="感动"
			case "3":get_mood="同情"
			case "4":get_mood="愤怒"
			case "5":get_mood="搞笑"
			case "6":get_mood="难过"
			case "7":get_mood="新奇"
			case "8":get_mood="无聊"
		end select
	end function
	
	sub editdb()
		dim t0,t1
		t0=eycms.getint(eycms.fpost("t0",0),0)
		t1=eycms.getint(eycms.fpost("t1",0),0)
		dim data,id
		id=eycms.getint(eycms.fget("id",0),0)
		data=array(array("moodtype",t0,0,0),array("moodnum",t1,10,0))
		if eycms.db.dbupdate("ey_expand_mood","moodid="&id&"",data)=1 then
			eycms.ajaxjson "保存成功",1
		end if
	end sub
	
	sub deldb()
		dim id:id=eycms.getint(eycms.fget("id",0),0)
		eycms.db.dbdel "ey_expand_mood","moodid="&id
		eycms.echo "1"
	end sub
	
	sub delsome()
		dim id:id=eycms.enhtml(eycms.fget("id",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
				else
					eycms.db.dbdel "ey_expand_mood","moodid="&idarr(i)
				end if
			next
			eycms.echo "1"
		end if
	end sub
	
	islogin
	checkpagelever 36
	dim act:act=lcase(eycms.fget("act",0))
	dim sqlwhere,nattitle,nat
	nat=eycms.getint(eycms.fget("nat",0),0)
	select case act
		case "config"
			dim sitedata,data
			sitedata=eycms.db.dbload(1,"setvalue","ey_config","setname='eycms.expand' and setkey='expand.mood'","")
			data=sitedata(0,0)
			load eval("theme_expand_mood_"&act)
		case "configdb":configdb
		case "edit"
			dim datadb,id
			id=eycms.getint(eycms.fget("id",0),0)
			datadb=eycms.db.dbload("","moodtype,moodnum","ey_expand_mood","moodid="&id&"","")
			load eval("theme_expand_mood_"&act)
		case "editdb":editdb
		case "del":deldb
		case "delsome":delsome
		case else
			select case nat
				case "1":sqlwhere=" and moodtype=1":nattitle="性质:高兴"
				case "2":sqlwhere=" and moodtype=2":nattitle="性质:感动"
				case "3":sqlwhere=" and moodtype=3":nattitle="性质:同情"
				case "4":sqlwhere=" and moodtype=4":nattitle="性质:愤怒"
				case "5":sqlwhere=" and moodtype=5":nattitle="性质:搞笑"
				case "6":sqlwhere=" and moodtype=6":nattitle="性质:难过"
				case "7":sqlwhere=" and moodtype=7":nattitle="性质:新奇"
				case "8":sqlwhere=" and moodtype=8":nattitle="性质:无聊"
				case else:nattitle="按性质↓"
			end select
			load theme_expand_mood
	end select
	eycms.db.dbclose
%>
