<!--#include file="base.asp"-->
<%
''' EYCMS 分类
''' ==================================================================

	sub adddb()
		dim t0,t1
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=eycms.getint(eycms.fpost("t1",0),0)
	
		if eycms.strlen(t0)=0 then eycms.ajaxjson "&#31867;&#21035;&#21517;&#31216;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		if t0="云链" then eycms.ajaxjson "&#35831;&#21247;&#20351;&#29992;&#31995;&#32479;&#20445;&#20462;&#31867;&#21517;",0:exit sub
		dim data:data=array(array("classname",t0,52),array("ordnum",t1,10),array("followid",followid,10))
		if eycms.db.dbnew("ey_expand_class",data,"classname='"&t0&"' and followid="&followid&"")=0 then
			eycms.ajaxjson "&#31867;&#21035;&#21517;&#31216;&#24050;&#23384;&#22312;&#65292;&#35831;&#25442;&#20010;&#35797;&#35797;",0
			exit sub
		else
			eycms.ajaxjson "保存成功",1
		end if
	end sub
	
	sub editdb()
		dim t0,t1
		t0=eycms.enhtml(eycms.fpost("t0",0))
		t1=eycms.getint(eycms.fpost("t1",0),0)
		
		if eycms.strlen(t0)=0 then eycms.ajaxjson "&#31867;&#21035;&#21517;&#31216;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		dim data,id
		id=eycms.getint(eycms.fget("id",0),0)
		data=array(array("classname",t0,50,1),array("ordnum",t1,10,0))
		if eycms.db.dbupdate("ey_expand_class","classid="&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_class","classid="&id
		eycms.echo "1"
	end sub
	
	sub orderdb()
		dim t0,t1,t2,t3,i
		t0=eycms.enhtml(eycms.fpost("cid",0))
		t1=eycms.enhtml(eycms.fpost("ordnum",0))
		
		t0=replace(t0," ","")
		t1=replace(t1," ","")
		t2=split(t0,",")
		t3=split(t1,",")
		if ubound(t2)-ubound(t3)<>0 then eycms.ajaxjson "&#21442;&#25968;&#38169;&#35823;",0:exit sub
		for i=0 to ubound(t2)
			if eycms.isnum(t2(i)) then
				eycms.db.dbupdate "ey_expand_class","classid="&t2(i)&"",array(array("ordnum",t3(i),10,0))
			end if
		next
		eycms.ajaxjson "保存成功",1
	end sub

	islogin
	checkpagelever 16
	dim act:act=lcase(eycms.fget("act",0))
	dim followid:followid=eycms.getint(eycms.fget("followid",0),0)
	dim gourl:gourl=eycms.fget("gourl",0)
	select case act
		case "add":load eval("theme_expand_class_"&act)
		case "adddb":adddb
		case "edit"
			dim datadb,id
			id=eycms.getint(eycms.fget("id",0),0)
			datadb=eycms.db.dbload("","classname,ordnum","ey_expand_class","classid="&id&"","")
			load eval("theme_expand_class_"&act)
		case "editdb":editdb
		case "del":deldb
		case "order":orderdb
		case else
			load theme_expand_class
	end select
	eycms.db.dbclose
%>
