<% 	
	Dim ID,action,LabelRS,LabelName,LabelContent,SQLStr,Description,ShowErr,LabelC,SQL,LabelDetailed_warning_page
	dim labeltype, PageStyle,ProjectUnit,LabelFlag,SK_Lable_Dataearly,SK_Lable_Replacedata

		action = Request.QueryString("action")
	  Set LabelRS = Server.CreateObject("Adodb.Recordset")
		If action = "EditLabel" Then
			ID = skweboa.Return_to_numerical(Request.QueryString("ID"))
			Set LabelRS = Server.CreateObject("Adodb.Recordset")
			SQLStr = "SELECT * FROM Label_skweb Where ID=" & ID & ""
			LabelRS.Open SQLStr, Conn, 1, 1
			LabelName = Replace(Replace(LabelRS("LabelName"), "{skwebSQL_", ""), "}", "")
						LabelFlag = Clng(LabelRS("LabelFlag"))
			Description = LabelRS("Description")
			LabelContent = Replace(Replace(LabelRS("LabelContent"), "{$skwebSQL(", ""), "", "")
 			LabelContent = Replace(LabelContent, """", "") 
			LabelDetailed_warning_page = Split(LabelContent, "§")
			labeltype=LabelDetailed_warning_page(0)
			ProjectUnit=LabelDetailed_warning_page(1)
			PageStyle=LabelDetailed_warning_page(2)
 		 	SK_Lable_Dataearly=LabelDetailed_warning_page(3)
			
			
			if SK_Lable_Dataearly="0" then 
				SK_Lable_Replacedata="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=数据库.mdb"
			else 
		 		SK_Lable_Replacedata=LabelDetailed_warning_page(4)
			end if
			SQL=LabelDetailed_warning_page(5)
			LabelContent=LabelRS("Description")
			LabelRS.Close
 		Else
		  If LabelContent="" Then LabelContent="[loop=10]请在此输入循环内容[/loop]"
			ProjectUnit="篇"
	 
			labeltype=0
			SK_Lable_Replacedata="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=数据库.mdb"
			sql="Select TOP 10 ID,ClassID,Title,UpdateTime,skwebLink,FileName,Content,Intro From  article_skweb  Where  isAccept=0 AND delif=0 "
		End If
		
	 
		
	Select Case Request.Form("action")
 
		 Case "AddNewSubmit"
			LabelName = Replace(Replace(Trim(Request.Form("LabelName")), """", ""), "'", "")
			labeltype=Request.Form("labeltype")
			SQL = Trim(Request.Form("Sql"))
			ProjectUnit=Request.Form("ProjectUnit")
			SK_Lable_Dataearly=Request.Form("SK_Lable_Dataearly")
			SK_Lable_Replacedata=Request.Form("SK_Lable_Replacedata")
			PageStyle=skweboa.Return_to_numerical(Request("PageStyle"))
			LabelC=labeltype&"§"&ProjectUnit&"§"&PageStyle&"§"&SK_Lable_Dataearly&"§"&SK_Lable_Replacedata&"§"&SQL
			LabelContent=Request.Form("Content")
			
			If LabelName = "" Then
 			   Call skweboa.SK_window("","","1","3")
			  Response.End
			End If
			If LabelContent = "" Then Call skweboa.SK_window("内容不能为空","","1","3"): Response.End
			LabelName = "{skwebSQL_" & LabelName & "}"
			LabelFlag = Trim(Request.Form("LabelFlag"))
			LabelRS.Open "Select LabelName From Label_skweb Where LabelName='" & LabelName & "'", Conn, 1, 1
			If Not LabelRS.EOF Then
			  Call skweboa.SK_window("标签名称已经存在","","","3")
 			  LabelRS.Close
			  Conn.Close
			  Set LabelRS = Nothing
			  Set Conn = Nothing
			  Set ClsMain = Nothing
			  Response.End
			Else
				LabelRS.Close
				LabelRS.Open "Select * From Label_skweb", Conn, 1, 3
				LabelRS.AddNew
				 LabelRS("LabelName") = LabelName
				 LabelRS("LabelContent") = LabelC
				 LabelRS("Description") = LabelContent
				 LabelRS("AddDate") = Now
				 LabelRS("LabelFlag") = LabelFlag
				 LabelRS("LabelType") = 3
				 LabelRS.Update
				 Application.Contents.RemoveAll
				 		Call skweboa.SK_window("添加标签成功",""&MyDbPath&"SKCMS/dialog.asp?action=closmain","","3")
 			End If
			
			
		Case "EditSubmit"
 
			ID = skweboa.Return_to_numerical(Trim(Request.Form("ID")))
			LabelName = Replace(Replace(Trim(Request.Form("LabelName")), """", ""), "'", "")
			labeltype=Request.Form("labeltype")
			SQL = Trim(Request.Form("Sql"))
			ProjectUnit=Request.Form("ProjectUnit")
			SK_Lable_Dataearly=Request.Form("SK_Lable_Dataearly")
			SK_Lable_Replacedata=Request.Form("SK_Lable_Replacedata")
 			PageStyle=skweboa.Return_to_numerical(Request("PageStyle"))
			LabelC=labeltype&"§"&ProjectUnit&"§"&PageStyle&"§"&SK_Lable_Dataearly&"§"&SK_Lable_Replacedata&"§"&SQL
			LabelContent=Request.Form("Content")
			If LabelName = "" Then
			   Call skweboa.SK_window(ShowErr,"","1")
			  Response.End
			End If
  
	
			If LabelContent = "" Then Call skweboa.SK_window(ShowErr,"","1",""): Response.End
			LabelName = "{skwebSQL_" & LabelName & "}"
			LabelFlag = Trim(Request.Form("LabelFlag"))
			LabelRS.Open "Select LabelName From Label_skweb Where ID <>" & ID & " AND LabelName='" & LabelName & "'", Conn, 1, 1
			
			If Not LabelRS.EOF Then
  			  Call skweboa.SK_window("标签名称已经存在","","1","")
			  Response.End
			Else
				LabelRS.Close
				LabelRS.Open "Select * From Label_skweb Where ID=" & ID & "", Conn, 1, 3
				 LabelRS("LabelName") = LabelName
				 LabelRS("LabelContent") = LabelC
				 LabelRS("Description") = LabelContent
				 LabelRS("AddDate") = Now
				 LabelRS("LabelFlag") = LabelFlag			 
	 
				 LabelRS.Update
				 Application.Contents.RemoveAll
				 Call skweboa.SK_window("标签修改成功",""&MyDbPath&"SKCMS/dialog.asp?action=closmain","","3")
 			End If
		End Select
		
		

 %>