<!--#include file="../../fy.Function.asp"-->
<%
	Dim Save_Rs,cidValue,Save_Rs1,Getrootid,Articleadd,EnName,ShowErr,Save_SQL,Save_SQL1,cid
	Dim title,Extension,ClassKeywords,ClassDescription,ChangesLinkUrl 
	dim ismenu,tg,classename,ConTentTemplate,sitepath,moresite,siteurl,ACTlink
	Dim TGGroupID,OrderID,FolderTemplate,ModeID,FilePathName,content,makehtmlname,pageTemplate
	dim ClassPurview,ClassArrGroupID,ClassReadPoint,ClassChargeType ,ClassPitchTime,ClassReadTimes,ClassDividePercent
	Dim SEOtitle,ClassPicUrl,labelfor,classmake ,classTemplate
	 ModeID = ChkNumeric(Request("ModeID"))
	 labelfor= ChkNumeric(Request("labelfor"))
	 if ModeID=0 or ModeID="" Then ModeID=1
		If Not fycms.fycms_QXYZ(ModeID,"","") Then   Call fycms.Alert("对不起，您没有"&fycms.ACT_C(ModeID,1)&"系该项操作权限！","")
	ClassPicUrl=Request.Form("ClassPicUrl")
	TGGroupID=Request.Form("TGGroupID")
 	SEOtitle=Request.form("SEOtitle")
	classTemplate=Request.form("classTemplate")
	OrderID = ChkNumeric(Request.form("OrderID"))
	cid = ChkNumeric(Request.form("cid"))
	
	Getrootid = Request.form("rootid")
	title = Trim(Request.Form("title"))
	Extension = Trim(Request.Form("Extension"))
	If Extension<>"" Then Extension="index.html"
	ClassDescription = Request.Form("ClassDescription")
	ClassKeywords = Request.Form("ClassKeywords")
	FolderTemplate = Request.Form("FolderTemplate")
	ChangesLinkUrl = Request.Form("ChangesLinkUrl")
	ismenu = ChkNumeric(Request.Form("ismenu"))
	tg = ChkNumeric(Request.Form("tg"))
	ACTlink = ChkNumeric(Request.Form("ACTlink"))

 
	FolderTemplate = Request.Form("FolderTemplate")
	ConTentTemplate = Request.Form("ConTentTemplate")
	FilePathName = fycms.S("FilePathName")

 
	ClassPurview = ChkNumeric(Request.form("ClassPurview"))
	ClassReadPoint = ChkNumeric(Request.form("ClassReadPoint"))
	ClassChargeType = ChkNumeric(Request.form("ClassChargeType"))
	ClassPitchTime = ChkNumeric(Request.form("ClassPitchTime"))
	ClassReadTimes = ChkNumeric(Request.form("ClassReadTimes"))
	ClassDividePercent = ChkNumeric(Request.form("ClassDividePercent"))
	ClassArrGroupID = Request.form("ClassArrGroupID")
 
	content= fycms.S("content")
	makehtmlname= fycms.S("makehtmlname")
	pageTemplate= fycms.S("pageTemplate")

	If ActLink="2"  Then  makehtmlname=fycms.S("LinkUrl")
 '----------------------------------------------------------
	moresite = ChkNumeric(Request.Form("moresite"))
	siteurl = Request.Form("siteurl")
	sitepath = Request.Form("sitepath")
'----------------------------------------------------------




	Dim IF_NULL
	IF_NULL=fycms.Act_MX_Arr(888,5)

  	If IsArray(IF_NULL) Then
		For I=0 To Ubound(IF_NULL,2)
		 If IF_NULL(8,I)=0  And Trim(fycms.S(IF_NULL(0,I)))<>""  Then  Call fycms.checkValueOnly(ID,ModeID,IF_NULL(0,I),IF_NULL(1,I),IF_NULL(3,I))
 		 If IF_NULL(2,I)=0 And Trim(fycms.S(IF_NULL(0,I)))="" Then  Call  fycms.ALERT(IF_NULL(1,I)&"不能为空","")
		Next
	End If


 



	If Trim(TGGroupID)="" Then TGGroupID=0
	IF Trim(title) = ""  Then
		ShowErr = "请填写文章分类名称"
		Call fycms.ActErr(ShowErr,"","1")
		Response.End
	End If

 
 
	

	Set Save_SQL = server.CreateObject("adodb.recordset")
 	
		Dim TemplateContent,makenames
		Dim MakePage,namearr,i,namearrs
 	IF Request("Action") = "add" Then
		 
		
  	cid = fycms.MakeRandom(9)'随机生成15位字符
	 
		
		Set Save_Rs1 = server.CreateObject("adodb.recordset")
		
  		Save_SQL1 = "Select * from bookclass_fy where 1=2"
		Save_SQL.Open Save_SQL1,Conn,1,3
		Save_SQL.AddNew
		Save_SQL("title") = title
 		Save_SQL("rootid") = Getrootid
		Save_SQL("OrderID") = OrderID
		Save_SQL("cid") = cid
		Save_SQL("classTemplate") = classTemplate
 
 		Save_SQL.update
  		Dim rs:Set rs=fycms.actexe("Select top 1 id,cid from bookclass_fy order by id desc")
		If Not rs.eof Then cid = rs("cid")
   		
   		Application.Contents.RemoveAll
 		Call fycms.ActErr("栏目添加成功","Sys_fy/book/index.asp?ModeID="&ModeID&"","")
 	ElseIF  Request("Action") = "edit" Then
  		Save_SQL1 = "Select * from bookclass_fy where cid="&cid &""
		Save_SQL.Open Save_SQL1,Conn,1,3
		Save_SQL("title") = title
  		Save_SQL("OrderID") = OrderID
		Save_SQL("classTemplate") = classTemplate

		Save_SQL.update
		ShowErr = "栏目保存成功"
	End If


	Application.Contents.RemoveAll
	Save_SQL.close:set Save_SQL = Nothing
	Call fycms.ActErr(ShowErr,"Sys_fy/book/index.asp?ModeID="&ModeID&"","")
   %>