<!--#include file="../plus/Preview.asp"-->
<!--#include file="FsoCls.asp"-->

<%
If Session("Admin")="" then
Response.Redirect("Login.asp")
End if
dim FsoCls
Set FsoCls=New UsCMS_FsoCls
if request.QueryString("action")="MakeIndex" then
Previewindex
Response.Write("{message:'生成首页成功',type:1}")  
End if
if request.QueryString("action")="setCount" then
  Articleid=funstr(request.QueryString("Articleid"))
  ArticleCount=funstr(request.QueryString("ArticleCount"))
  if IsNumeric(ArticleCount) then
  set rs=server.CreateObject("adodb.recordset")
  sql="select * from UsCMSArticle where Articleid="&Articleid
  rs.open sql,conn,1,3
  rs("ArticleCount")=ArticleCount
  rs.update
  rs.close  
  set rs=nothing  
	Response.Write("{message:'设置文章点击数成功："&ArticleCount&"',type:1}")      
  else	
	Response.Write("{message:'请输入数字："&ArticleCount&"',type:0}")    
 end if    
end if

if request.QueryString("action")="setBuild" then
  Articleid=funstr(request.QueryString("Articleid"))
  ArticleBuild=request.QueryString("ArticleBuild")
  set rs=server.CreateObject("adodb.recordset")
  sql="select * from UsCMSArticle where Articleid="&Articleid
  rs.open sql,conn,1,3
  ArtBuild=Rs("ArticleBuild")
  ArticleDir=Rs("ArticleDir")
  Articlex=Rs("Articlex")
    If Articlex=1 Then
	  Typeid=Rs("ArticleTypeid")
	Else
	  Typeid=Rs("ArticleTypexid")	  
	End If  
  if ArtBuild=0 Then
	Response.Write("{message:'动态文章不能设置成伪静态或静态',type:0}")     
  else
  rs("ArticleBuild")=ArticleBuild
  rs.update
  rs.close  
  set rs=nothing  
   if ArticleBuild=1 then
	createfiles server.MapPath(ArticleDir),PreviewArticle(Articleid,Typeid)	   
	Response.Write("{message:'设置文章属性成功,生成静态文件成功',type:1}")      
   elseif ArticleBuild=0 then
    if ArtBuild=1 then
set fso = server.CreateObject("scripting.filesystemobject")
fso.deletefile server.mappath(ArticleDir)
set fso = nothing      
	Response.Write("{message:'设置文章属性成功,删除静态文件成功',type:1}")         
	else
	Response.Write("{message:'设置文章属性成功',type:1}")   	
	end if
   else
set fso = server.CreateObject("scripting.filesystemobject")
fso.deletefile server.mappath(ArticleDir)
set fso = nothing   
  
	Response.Write("{message:'设置文章属性成功,删除静态文件成功',type:1}")  
   end if
  End if
end if

if request.QueryString("action")="setRecommend" then
  Articleid=funstr(request.QueryString("Articleid"))
  ArticleRecommend=request.QueryString("ArticleRecommend")
  set rs=server.CreateObject("adodb.recordset")
  sql="select * from UsCMSArticle where Articleid="&Articleid
  rs.open sql,conn,1,3
  rs("ArticleRecommend")=ArticleRecommend
  rs.update
  rs.close  
  set rs=nothing  
	Response.Write("{message:'设置文章属性成功',type:1}")      
end if

if request.QueryString("action")="setColor" then
  Articleid=funstr(request.QueryString("Articleid"))
  Color=request.QueryString("Color")
  set rs=server.CreateObject("adodb.recordset")
  sql="select * from UsCMSArticle where Articleid="&Articleid
  rs.open sql,conn,1,3
  rs("ArticleColor")=Color
  rs.update
  rs.close  
  set rs=nothing  
	Response.Write("{message:'设置文章颜色成功',type:1}")      
end if

if request.querystring("action")="show" then
  Articleid=funstr(request.QueryString("Articleid"))
  set rs=server.CreateObject("adodb.recordset")
  sql="select * from UsCMSArticle where Articleid="&Articleid
  rs.open sql,conn,1,3
  
  if  request.QueryString("ac")="hide" then
  rs("ArticleDisplay")=False
  rs.update
  rs.close
  set rs=nothing  
	Response.Write("{message:'设置文章隐藏成功',type:1}")  
  else
  rs("ArticleDisplay")=True
  rs.update
  rs.close
  set rs=nothing  
	Response.Write("{message:'设置文章显示成功',type:1}")  
  end if
end if

if Request.QueryString("action")="OnePageAll" then
  Pageid=funstr(request.QueryString("Pageid"))
  Set Rs=Server.CreateObject("Adodb.Recordset")
  sql="select top 1 * from UsCMSOnePage where Pageid>"&Pageid&" order by Pageid asc"  
  rs.open sql,conn,1,1
	if not rs.eof then
    Pageid=Rs("Pageid")
	PageUrls=Rs("PageUrl")
    createfiles server.MapPath("../htm/"&PageUrls),PreviewOnePage(Pageid)
    Response.Redirect ("Content.asp?action=OnePageAll&Pageid="&pageid)
	else
	end if
	rs.close
	set rs=nothing  
	Response.Write("{message:'生成独立页面成功',type:1}")
end if

if request.QueryString("action")="AddOnePage" then
  PageName=funstr(Request.Form("PageName"))
  PageUrl=funstr(Request.Form("PageUrl"))
  PageDisplay=funstr(Request.Form("PageDisplay"))
  PageContent=Request.Form("PageContent")
  PageTemp=funstr(Request.Form("PageTemp")) 
  PageStatus=funstr(Request.Form("PageStatus"))    
    Set Rs=Server.CreateObject("Adodb.Recordset")
    sql="select * from UsCMSOnePage"
    rs.open sql,conn,1,3
    rs.addnew
	Rs("PageName")=PageName
	Rs("PageUrl")=PageUrl
	Rs("PageContent")=PageContent
	Rs("PageTemp")=PageTemp
	Rs("PageStatus")=PageStatus
	Rs("PageDate")=date()
	rs.update
    rs.close
    set rs=nothing

if PageStatus=1 then  
    set rs1=server.CreateObject("adodb.recordset")
    sql1="select top 1 * from UsCMSOnePage order by Pageid desc"
    rs1.open sql1,conn,1,3
	if not rs1.eof then
	PageUrl="../htm/"&rs1("PageUrl")
	Pageid=rs1("Pageid")
'	fsocls.createfile PageUrl,PreviewOnePage(Pageid)
	PageUrls=Rs1("PageUrl")
    createfiles server.MapPath("../htm/"&PageUrls),PreviewOnePage(Pageid)
	end if
	rs1.close
    set rs1=nothing
	
		a="{message:'生成独立静态页面成功',type:1}"
else
    	a="{message:'生成独立页面成功',type:1}"
end if    

  Response.Write a
end if

'删除独立页面
if request.querystring("action")="delonepage" then
  Pageid=funstr(request.QueryString("Pageid"))
  Set Rs=Server.CreateObject("Adodb.Recordset")
  sql="select * from UsCMSOnepage where Pageid="&Pageid
  rs.open sql,conn,1,3
    if Rs("PageStatus")="1" then
	PageUrl="../htm/"&Rs("PageUrl")
	FsoCls.DelFile(PageUrl)
	end if
  rs.delete 	
  rs.update
  rs.close
  set rs=nothing
	Response.Write("{message:'删除独立页面成功',type:1}")
end if
'删除独立页面

'删除文章
if request.querystring("action")="delarticle" then
  Articleid=funstr(request.QueryString("Articleid"))
  Set Rs=Server.CreateObject("Adodb.Recordset")
  sql="select * from UsCMSArticle where Articleid="&Articleid
  rs.open sql,conn,1,3
  if rs.eof then
	Response.Write("{message:'没有这篇文章，可能已经删除',type:0}")  
  else
  ArticleTypexid=rs("ArticleTypexid")
  ArticleSN=rs("ArticleSN")
  
set fso = server.CreateObject("scripting.filesystemobject")
fso.deletefile server.mappath(Rs("ArticleDir"))
set fso = nothing

  conn.execute("update UsCMSArticle set ArticleSN=ArticleSN-1 where ArticleTypexid="&ArticleTypexid&" and  ArticleSN>"&ArticleSN&"")
  rs.delete 	
  rs.update
  rs.close
  set rs=nothing
	Response.Write("{message:'删除文章成功',type:1}")
	end if
end if
'删除文章

'
if request.querystring("action")="order1" then
  classid=funstr(request.QueryString("classid"))
  orders=funstr(request.QueryString("orders"))  

  if orders="asc" then
  Set Rs=Server.CreateObject("Adodb.Recordset")  
  sql="select * from UsCMSType where Typeid="&classid
  rs.open sql,conn,1,3
  TSN=Rs("TypeSN")

  SET RS1=server.CreateObject("adodb.recordset")  
  sql1="select * from UsCMSType where Typex=1 and TypeSN="&TSN+1
  rs1.open sql1,conn,1,3
if not rs1.eof then    
  rs1("TypeSN")=rs1("TypeSN")-1
  rs1.update
  rs1.close
  set rs1=nothing  
  Rs("TypeSN")=Rs("TypeSN")+1
  rs.update
  rs.close
  set rs=nothing
	Response.Write("{message:'上升成功',type:1}")  
else
	Response.Write("{message:'已经到顶部了',type:0}")   
end if  
  else
  Set Rs=Server.CreateObject("Adodb.Recordset")    
  sql="select * from UsCMSType where Typeid="&classid
  rs.open sql,conn,1,3
  TSN=Rs("TypeSN")
  SET RS1=server.CreateObject("adodb.recordset")  
  sql1="select * from UsCMSType where Typex=1 and TypeSN="&TSN-1

  rs1.open sql1,conn,1,3
if not rs1.eof then      
  rs1("TypeSN")=rs1("TypeSN")+1
  rs1.update
  rs1.close
  set rs1=nothing     
  Rs("TypeSN")=Rs("TypeSN")-1
  rs.update
  rs.close
  set rs=nothing
	Response.Write("{message:'下降成功',type:1}")    
else
	Response.Write("{message:'已经到尾部了',type:0}")     
end if  
  end if
end if
'
'
if request.querystring("action")="order2" then
  Typeid=funstr(request.QueryString("Typeid"))
  Typexid=funstr(request.QueryString("Typexid"))
  orders=funstr(request.QueryString("orders"))  

  if orders="asc" then
  Set Rs=Server.CreateObject("Adodb.Recordset")  
  sql="select * from UsCMSType where Typeid="&Typeid
  rs.open sql,conn,1,3
  TSN=Rs("TypeSN")

  SET RS1=server.CreateObject("adodb.recordset")  
  sql1="select * from UsCMSType where Typexid="&Typexid&" and TypeSN="&TSN+1
  rs1.open sql1,conn,1,3
if not rs1.eof then    
  rs1("TypeSN")=rs1("TypeSN")-1
  rs1.update
  rs1.close
  set rs1=nothing  
  Rs("TypeSN")=Rs("TypeSN")+1
  rs.update
  rs.close
  set rs=nothing
	Response.Write("{message:'上升成功',type:1}")  
else
	Response.Write("{message:'已经到顶部了',type:0}")    
end if  

  else
  Set Rs=Server.CreateObject("Adodb.Recordset")    
  sql="select * from UsCMSType where Typeid="&Typeid
  rs.open sql,conn,1,3
  TSN=Rs("TypeSN")
  SET RS1=server.CreateObject("adodb.recordset")  
  sql1="select * from UsCMSType where Typexid="&Typexid&" and TypeSN="&TSN-1

  rs1.open sql1,conn,1,3
if not rs1.eof then      
  rs1("TypeSN")=rs1("TypeSN")+1
  rs1.update
  rs1.close
  set rs1=nothing     
  Rs("TypeSN")=Rs("TypeSN")-1
  rs.update
  rs.close
  set rs=nothing
	Response.Write("{message:'下降成功',type:1}")    
else
	Response.Write("{message:'已经到尾部了',type:0}")     
end if 
 
  end if
end if
'
if request.querystring("action")="orderArt" then
  Articleid=funstr(request.QueryString("Articleid"))
  orders=funstr(request.QueryString("orders"))  

  if orders="asc" then
  Set Rs=Server.CreateObject("Adodb.Recordset")  
  sql="select * from UsCMSArticle where Articleid="&Articleid
  rs.open sql,conn,1,3
  ASN=Rs("ArticleSN")
  ArticleTypexid=Rs("ArticleTypexid")

  SET RS1=server.CreateObject("adodb.recordset")  
  sql1="select * from UsCMSArticle where ArticleTypexid="&ArticleTypexid&" and ArticleSN="&ASN+1
  rs1.open sql1,conn,1,3
if not rs1.eof then    
  rs1("ArticleSN")=rs1("ArticleSN")-1
  rs1.update
  rs1.close
  set rs1=nothing  
  Rs("ArticleSN")=Rs("ArticleSN")+1
  rs.update
  rs.close
  set rs=nothing
	Response.Write("{message:'上升成功',type:1}")  
else
	Response.Write("{message:'已经到本分类顶部',type:0}")   
end if  
  else
  Set Rs=Server.CreateObject("Adodb.Recordset")    
  sql="select * from UsCMSArticle where Articleid="&Articleid
  rs.open sql,conn,1,3
  ASN=Rs("ArticleSN")
  ArticleTypexid=Rs("ArticleTypexid")
  
  SET RS1=server.CreateObject("adodb.recordset")  
  sql1="select * from UsCMSArticle where ArticleTypexid="&ArticleTypexid&" and ArticleSN="&ASN-1

  rs1.open sql1,conn,1,3
if not rs1.eof then      
  rs1("ArticleSN")=rs1("ArticleSN")+1
  rs1.update
  rs1.close
  set rs1=nothing     
  Rs("ArticleSN")=Rs("ArticleSN")-1
  rs.update
  rs.close
  set rs=nothing
	Response.Write("{message:'下降成功',type:1}")    
else
	Response.Write("{message:'已经到本分类尾部',type:0}")     
end if  
  end if
end if
'
'
if request.querystring("action")="deltype1" then
  Typeid=funstr(request.QueryString("Typeid"))
  
  Set Rs=Server.CreateObject("Adodb.Recordset")    
  sql="select * from UsCMSType where Typexid="&Typeid
  rs.open sql,conn,1,1
  if not rs.eof then
  rs.close
  set rs=nothing
	Response.Write("{message:'该顶级分类下级分类不为空，请先删除该顶级分类下二级分类',type:0}")    
  else
  SET RS1=server.CreateObject("adodb.recordset")    
  sql1="select * from UsCMSType where Typeid="&Typeid
  rs1.open sql1,conn,1,3 
  TSN=rs1("TypeSN")
  conn.execute("update UsCMSType set TypeSN=TypeSN-1 where Typex=1 and  TypeSN>"&TSN&"") 
  TypeDir=Rs1("TypeDir")
  FsoCls.DeleteFolder TypeDir
  rs1.delete
  rs1.update
  rs1.close
  set rs1=nothing 
  rs.close
  set rs=nothing  
	Response.Write("{message:'成功删除顶级分类',type:1}")    
  end if
end if

'
if request.querystring("action")="deltype2" then
  Typeid=funstr(request.QueryString("Typeid"))
  SET RS1=server.CreateObject("adodb.recordset")    
  sql1="select * from UsCMSType where Typeid="&Typeid
  rs1.open sql1,conn,1,3 
  if not rs1.eof then
  TSN=rs1("TypeSN")
  Typexid=rs1("Typexid")
  conn.execute("update UsCMSType set TypeSN=TypeSN-1 where Typexid="&Typexid&" and  TypeSN>"&TSN&"")  
  rs1.delete
  rs1.update
  rs1.close
  set rs1=nothing 
	Response.Write("{message:'成功删除二级分类',type:1}")    
  else
	Response.Write("{message:'删除二级分类失败',type:0}")      
  end if
end if
'

'
If Request.QueryString("action")="AddClass1" Then
  Set Rs=Server.CreateObject("Adodb.Recordset")
    Sql="Select Top 1 * From UsCMSType where Typex=1 order by TypeSN desc"
	  Rs.Open Sql,Conn,1,1
	    If Not Rs.Eof Then 
		  TSN=Rs("TypeSN")
		Else
		  TSN=0
		End if	
	  Rs.Close
  Set Rs=Nothing

  TypeTitle=Request.Form("TypeTitle")
  TypeKeyword=Request.Form("TypeKeyword")
  TypeDescription=Request.Form("TypeDescription")
  TypeTemp=Request.Form("TypeTemp")
  TypeFrom=Request.Form("TypeFrom")
  TypeHide=Request.Form("TypeHide")
  TypeLimit=Request.Form("TypeLimit")
  TypeLocation=Request.Form("TypeLocation")
  TypeLocation0=Request.Form("TypeLocation0")
  TypeBuild=Request.Form("TypeBuild")
  TypeIndex=Request.Form("TypeIndex")
  TypeList=Request.Form("TypeList")
  TypeArticle=Request.Form("TypeArticle")
  If TypeBuild=0 Then
  	  TypeDir="0"
  Else
    If TypeLocation0="/" Then
	  TypeDir="/"&TypeLocation	
	  Else
	  TypeDir=TypeLocation0&"/"&TypeLocation
    End If
  End If	


  Set Rs=Server.CreateObject("Adodb.Recordset")
  If TypeBuild=0 Then
    Sql="select * from UsCMSType"  
  Else
    Sql="select * from UsCMSType where Typedir='"&Typedir&"'"
  End If	
    Rs.Open Sql,Conn,1,3

  If TypeBuild<>0 Then 

  If Not Rs.Eof Then
    Response.Write("{message:'增加分类失败,请检查生成位置',type:0}")  
  Else
    Rs.Addnew
      Rs("TypeTitle")=TypeTitle
      Rs("TypeKeyword")=TypeKeyword
      Rs("TypeDescription")=TypeDescription
      Rs("TypeTemp")=TypeTemp
      'Rs("TypeFrom")=TypeFrom
      Rs("TypeHide")=TypeHide
      Rs("TypeLimit")=TypeLimit
      Rs("TypeIndex")=TypeIndex
      Rs("TypeList")=TypeList
      Rs("TypeArticle")=TypeArticle
      Rs("TypeDir")=TypeDir
      Rs("TypeSN")=TSN+1
      Rs("Typex")=1
      Rs("Typexid")=0
      Rs("TypeBuild")=TypeBuild		  
	Rs.Update
	Rs.Close
  Set Rs=Nothing
  End If	
  
  Else
    Rs.Addnew
      Rs("TypeTitle")=TypeTitle
      Rs("TypeKeyword")=TypeKeyword
      Rs("TypeDescription")=TypeDescription
      Rs("TypeTemp")=TypeTemp
      Rs("TypeFrom")=TypeFrom
      Rs("TypeHide")=TypeHide
      Rs("TypeLimit")=TypeLimit
      Rs("TypeIndex")=TypeIndex
      Rs("TypeList")=TypeList
      Rs("TypeArticle")=TypeArticle
      Rs("TypeDir")=TypeDir
      Rs("TypeSN")=TSN+1
      Rs("Typex")=1
      Rs("Typexid")=0
      Rs("TypeBuild")=TypeBuild		  
	Rs.Update
	Rs.Close
  Set Rs=Nothing  
  End If  
  
    If TypeBuild=1 Then
      Set Rs=Server.CreateObject("Adodb.Recordset")
        Sql="Select top 1 * from UsCMSType order by TypeSN desc"
        Rs.Open Sql,Conn,1,3
	  	  TypeDir=Rs("TypeDir")
		  Typeid=RS("Typeid")
  	    Rs.Close
      Set Rs=Nothing		  
	  Path=Server.MapPath(TypeDir)
  
	  Set Fso=Server.CreateObject("Scripting.FileSystemObject") 
		If Fso.FolderExists(Path) Then
	      createfiles server.MapPath(TypeDir&"/index.htm"),PreviewType(Typeid)
		Else
	      Fso.CreateFolder(Path)
	      createfiles server.MapPath(TypeDir&"/index.htm"),PreviewType(Typeid)
		End If
	  Set Fso=Nothing  
		Response.Write("{message:'增加顶级分类成功,生成分类页面成功',type:1}")  
     Elseif  TypeBuild=2 Then
		Response.Write("{message:'增加顶级分类成功,伪静态成功',type:1}")	 
	 Else
		Response.Write("{message:'增加顶级分类成功,动态成功',type:1}")  	
    End If  
	
End If

if request.QueryString("action")="Update" then
Typeid=Request.QueryString("Typeid")
      Set Rs=Server.CreateObject("Adodb.Recordset")
        Sql="Select * from UsCMSType where typeid="&Typeid
        Rs.Open Sql,Conn,1,3
	  	  TypeDir=Rs("TypeDir")
  	    Rs.Close
      Set Rs=Nothing		  
	  Path=Server.MapPath(TypeDir)
  
	  Set Fso=Server.CreateObject("Scripting.FileSystemObject") 
		If Fso.FolderExists(Path) Then
	      createfiles server.MapPath(TypeDir&"/index.htm"),PreviewType(Typeid)
		Else
	      Fso.CreateFolder(Path)
	      createfiles server.MapPath(TypeDir&"/index.htm"),PreviewType(Typeid)
		End If
	  Set Fso=Nothing  
	  
		Response.Write("{message:'更新顶级分类成功,生成分类页面成功',type:1}")  

end if

if request.QueryString("action")="Update2" then
Typeid=Request.QueryString("Typeid")
      Set Rs=Server.CreateObject("Adodb.Recordset")
        Sql="Select * from UsCMSType where typeid="&Typeid
        Rs.Open Sql,Conn,1,3
	  	  TypeDir=Rs("TypeDir")
  	    Rs.Close
      Set Rs=Nothing		  
'	  Path=Server.MapPath(TypeDir)
  
'	  Set Fso=Server.CreateObject("Scripting.FileSystemObject") 
'		If Fso.FolderExists(Path) Then
'	      createfiles server.MapPath(TypeDir&"/index.htm"),PreviewType(Typeid)
'		Else
'	      Fso.CreateFolder(Path)
'	      createfiles server.MapPath(TypeDir&"/index.htm"),PreviewType(Typeid)
'		End If
'	  Set Fso=Nothing  
	  PreviewType(Typeid)
		Response.Write("{message:'更新二级分类成功,生成分类页面成功',type:1}")  

end if


If Request.QueryString("action")="AddClass22" Then
  Typeid=Request.Form("Typeid")
  Set Rs=Server.CreateObject("Adodb.Recordset")
    Sql="Select Top 1 * From UsCMSType where Typexid="&Typeid&" order by TypeSN desc"
	  Rs.Open Sql,Conn,1,1
	    If Not Rs.Eof Then 
		  TSN=Rs("TypeSN")
		Else
		  TSN=0
		End if	
	  Rs.Close
  Set Rs=Nothing
  TypeTitle=Request.Form("TypeTitle")
  TypeKeyword=Request.Form("TypeKeyword")
  TypeDescription=Request.Form("TypeDescription")
  TypeTemp=Request.Form("TypeTemp")
  TypeFrom=Request.Form("TypeFrom")
  TypeHide=Request.Form("TypeHide")
  TypeLimit=Request.Form("TypeLimit")
  TypeLocation=Request.Form("TypeLocation")
  TypeLocation0=Request.Form("TypeLocation0")
  TypeBuild=Request.Form("TypeBuild")
  TypeIndex=Request.Form("TypeIndex")
  TypeList=Request.Form("TypeList")
  TypeArticle=Request.Form("TypeArticle")
  If TypeBuild=0 Then
  	  TypeDir="0"
  Else
    If TypeLocation0="/" Then
	  TypeDir="/"&TypeLocation	
	  Else
	  TypeDir=TypeLocation0&"/"&TypeLocation
    End If
  End If	

  Set Rs=Server.CreateObject("Adodb.Recordset")
  If TypeBuild=0 Then
    Sql="select * from UsCMSType"  
  Else
    Sql="select * from UsCMSType where Typedir='"&Typedir&"'"
  End If	
    Rs.Open Sql,Conn,1,3
  If TypeBuild<>0 Then 
  	  
  If Not Rs.Eof Then
    Response.Write("{message:'增加分类失败,请检查生成位置',type:0}")  
  Else
    Rs.Addnew

      Rs("TypeTitle")=TypeTitle
      Rs("TypeKeyword")=TypeKeyword
      Rs("TypeDescription")=TypeDescription
      Rs("TypeTemp")=TypeTemp
      Rs("TypeFrom")=TypeFrom
      Rs("TypeHide")=TypeHide
      Rs("TypeLimit")=TypeLimit
      Rs("TypeIndex")=TypeIndex
      Rs("TypeList")=TypeList
      Rs("TypeArticle")=TypeArticle
      Rs("TypeDir")=TypeDir
      Rs("TypeSN")=TSN+1
      Rs("Typex")=2
      Rs("Typexid")=Typeid
      Rs("TypeBuild")=TypeBuild		  
	Rs.Update
	Rs.Close
  Set Rs=Nothing
  End If	
  Else
    Rs.Addnew

      Rs("TypeTitle")=TypeTitle
      Rs("TypeKeyword")=TypeKeyword
      Rs("TypeDescription")=TypeDescription
      Rs("TypeTemp")=TypeTemp
      Rs("TypeFrom")=TypeFrom
      Rs("TypeHide")=TypeHide
      Rs("TypeLimit")=TypeLimit
      Rs("TypeIndex")=TypeIndex
      Rs("TypeList")=TypeList
      Rs("TypeArticle")=TypeArticle
      Rs("TypeDir")=TypeDir
      Rs("TypeSN")=TSN+1
      Rs("Typex")=2
      Rs("Typexid")=Typeid	
      Rs("TypeBuild")=TypeBuild		  
	Rs.Update
	Rs.Close
  Set Rs=Nothing  
  End If  
    If TypeBuild=1 Then
      Set Rs=Server.CreateObject("Adodb.Recordset")
        Sql="Select top 1 * from UsCMSType order by TypeSN desc"
        Rs.Open Sql,Conn,1,3
	  	  TypeDir=Rs("TypeDir")
		  Typeid=RS("Typeid")
  	    Rs.Close
      Set Rs=Nothing		  
	  Path=Server.MapPath(TypeDir)
	  Set Fso=Server.CreateObject("Scripting.FileSystemObject") 
		If Fso.FolderExists(Path) Then
	      'createfiles server.MapPath(TypeDir&"/index.htm"),PreviewType(Typeid)
		Else
	      'Fso.CreateFolder(Path)
	      'createfiles server.MapPath(TypeDir&"/index.htm"),PreviewType(Typeid)
		End If
	  Set Fso=Nothing  
		Response.Write("{message:'增加二级分类成功,生成分类页面成功',type:1}")  
     Elseif  TypeBuild=2 Then
		Response.Write("{message:'增加二级分类成功,伪静态成功',type:1}")	 
	 Else
		Response.Write("{message:'增加二级分类成功,动态成功',type:1}")  	
    End If  
End If

Function ShowType()
  Set Rs=Server.CreateObject("Adodb.RecordSet")
    Sql="Select * From UsCMSType Where Typex=1"
	Rs.Open Sql,Conn,1,1
      Do While Not Rs.eof
		ShowType=ShowType&"<option value="&Rs("Typeid")&">├"&Rs("TypeTitle")&"</option>"
      Rs.MoveNext
	  Loop
	Rs.Close
  Set Rs=Nothing  
End Function

Function ShowTypes()
  Set Rs=Server.CreateObject("Adodb.RecordSet")
    Sql="Select * From UsCMSType Where Typex=1"
	Rs.Open Sql,Conn,1,1
      Do While Not Rs.eof
		ShowTypes=ShowTypes&"<option style='color:#000000;' value="&Rs("Typeid")&">├─"&Rs("TypeTitle")
		  Set Rs1=Server.CreateObject("Adodb.RecordSet")
            Sql1="Select * From UsCMSType Where Typexid="&Rs("Typeid")
         	  Rs1.Open Sql1,Conn,1,1
		        Do While Not Rs1.eof			  
		          ShowTypes=ShowTypes&"<option value="&Rs1("Typeid")&">├─"&Rs1("TypeTitle")&"</option>"
			    Rs1.MoveNext
			  Loop			  			  
		      Rs1.Close
      Rs.MoveNext
	  Loop
	Rs.Close
  Set Rs=Nothing  
End Function  


%>
<%if request.QueryString("action")="AddClass2" then%>
<!--#include file="py.asp"-->
<%
  Typeid=Request.QueryString("Typeid")
  Set Rs=Server.CreateObject("Adodb.RecordSet")
    Sql="Select * From UsCMSType Where Typeid="&Typeid
	Rs.Open Sql,Conn,1,1
	    TypeTitle=Rs("TypeTitle")	
		TypeBuild=Rs("TypeBuild")
	  If Rs("TypeBuild")=0 Then
	    TypeDir="0"
	  Else
	    TypeDir=Rs("TypeDir")
	  End IF
	Rs.Close
  Set Rs=Nothing  
   	
%>
<div class="list">
<form id="form1" name="form1" method="post" action="Content.asp?action=AddClass22">
<table width="100%">
  <tr>
    <th>新增二级分类</th>
    <th colspan="2">
 <select name="Select" onChange="ShowDiv='result_content';getPageContent('Content.asp?action=AddClass2&Typeid='+this.value+'');ST(0,0);"><option selected="selected">重新选择</option><%=ShowType%></select>  -- 当前 <%=TypeTitle%></th>
  </tr>
  <tr>
    <td style="width:20%;"><h6>分类名称:</h6></td>
    <td style="width:70%;">
    <input type="text" name="TypeTitle" size="50" maxlength="50" />
    <input type="hidden" name="Typeid" value="<%=Typeid%>" /></td>
    <td><label style="display:none" for="TypeTitle" class="error" metaDone="true" generated="true"></label></td>
  </tr>     
  <tr>
    <td style="width:20%;"><h6>分类关键字:</h6></td>
    <td style="width:70%;"><input type="textarea" name="TypeKeyword" size="50" maxlength="50" /></td>
    <td></td>
  </tr> 
  <tr>
    <td style="width:20%;"><h6>分类描述:</h6></td>
    <td style="width:70%;"><input type="text" name="TypeDescription" size="50" maxlength="50" /></td>
    <td></td>
  </tr> 
  <tr>
    <td style="width:20%;"><h6>分类风格:</h6></td>
    <td style="width:70%;"><select name="TypeTemp"><%=Gettemp%></select></td>
    <td></td>
  </tr> 
  <tr>
    <td style="width:20%;"><h6>分类封面:</h6></td>
    <td style="width:70%;"><input type="text" name="TypeIndex" size="50" maxlength="50" value="Type_index.htm"/></td>
    <td></td>
  </tr> 
  <tr>
    <td style="width:20%;"><h6>分类列表:</h6></td>
    <td style="width:70%;"><input type="text" name="TypeList" size="50" maxlength="50" value="Type_List.htm"/></td>
    <td></td>
  </tr> 
  <tr>
    <td style="width:20%;"><h6>分类文章:</h6></td>
    <td style="width:70%;"><input type="text" name="TypeArticle" size="50" maxlength="50" value="Type_Article.htm"/></td>
    <td></td>
  </tr>       
  <tr>
    <td height="27" style="width:20%;"><h6>是否支持投稿:</h6></td>
    <td style="width:70%;"><input type="radio" name="TypeFrom" size="50" maxlength="50" value="True"/> 是 <input type="radio" name="TypeFrom" size="50" maxlength="50" value="False" checked="checked"/> 否</td>
    <td></td>
  </tr> 
  <tr>
    <td style="width:20%;"><h6>是否隐藏栏目:</h6></td>
    <td style="width:70%;"><input type="radio" name="TypeHide" size="50" maxlength="50" value="True"/> 是 <input type="radio" name="TypeHide" size="50" maxlength="50" value="False" checked="checked"/> 否 浏览权限:<select name="TypeLimit"><option value="0" selected="selected">开放浏览</option><option value="1">注册会员</option><option value="2">中级会员</option><option value="3">高级会员</option></select></td>
    <td></td>
  </tr>       
  <tr>
    <td style="width:20%;"><h6>列表:</h6></td>
    <td style="width:70%;">
    <input type="radio" name="TypeBuild" value="0" onClick="TypeLocation.disabled=true;TypeLocation.value='';document.getElementById(TypeLocation);TypeLocation0.disabled=true;document.getElementById(TypeLocation0);"/> 动
    <input type="radio" name="TypeBuild" value="1" onClick="TypeLocation.disabled=false;document.getElementById(TypeLocation)" /> 静 
    <input type="radio" name="TypeBuild" value="2" onClick="TypeLocation.disabled=false;document.getElementById(TypeLocation)" checked="checked"/> 伪</td>
    <td></td>
  </tr>  
<%
str=openfile(server.MapPath("site/Config.asp"))
web=split(str,chr(13))
%>
  
  <tr name="TypeDir" valign="top">
    <td style="width:20%;"><h6>保存位置:</h6></td>
    <td style="width:70%;">
    <input type="text" name="TypeLocation" size="50" maxlength="50"/> <input type="checkbox" id="py"/> 拼音  
     </td>
    <td>
    <label style="display:none" for="TypeLocation" class="error" metaDone="true" generated="true"></label>
    </td>
  </tr> 
<tr>
  <td style="width:20%;"><label style="display:none" for="TypeLocation0" class="error" metaDone="true" generated="true"></label></td>
  <td style="width:70%;">
<!--    <input type="radio" name="TypeLocation0" value="/"/> 站点根目录-->
    <input type="radio" name="TypeLocation0" value="../<%=web(5)%>"/> CMS根目录
	<%if TypeBuild=0 then%>    
    <input type="radio" name="TypeLocation0" value="/"/> 上级目录(为动态,本级目录将在根目录下)   
	<%else%>
    <input type="radio" name="TypeLocation0" value="<%=TypeDir%>" checked="checked"/> 上级目录   
	<%end if%>  
  </td>
  <td></td>
</tr>  
  <tr>
    <td></td>
    <td colspan="2"><button type="submit"><img src="images/save.png" /></button> </td>
  </tr>  
</table>  
</form>
  

</div>

<script language="javascript">
$('#py').click(function() {
	var cName=document.form1.TypeTitle.value;
	bb(cName)
});
function bb(str){
var url = 'py.asp?cns='+encodeURI(str);
  var xhttp = null; 
  if(window.XMLHttpRequest){
  xhttp = new XMLHttpRequest();} 
  else if(window.ActiveXObject){ 
  try{ xhttp = new ActiveXObject("Msxml2.XMLHTTP");} catch (e){ ; } 
  if( xhttp == null) try { xhttp = new ActiveXObject("Microsoft.XMLHTTP");} catch (e){; }}
xhttp.open("get",url,false);
xhttp.send(null);
document.form1.TypeLocation.value=xhttp.responseText;}
</script>

<script>
$(document).ready(function() {
	var options = {
	beforeSubmit:function(){showLoading(showSaveText);},
	 	 success:function(msg){
				 hideLoading();
				 showMessage(msg.message,msg.type);
						  if(msg.type == '1'){
						  ST(0,0);
						  ShowDiv = "result_content";
						  getPageContent("Content.asp?action=Class");
							   }
						},
		type:      'post',
		dataType:  'json'
	};
	$("#form1").validate({
		errorClass: "wrong",
		rules: {
			TypeTitle: {required:true},
			TypeLocation0: {required:true},
			TypeLocation: {required:true}
		},
		messages: {
			TypeTitle: {required: "请填写分类名称"},
			TypeLocation0: {required: "请选择位置"},
			TypeLocation: {required: "请填写位置"}
		},
		submitHandler: function() {
			$('#form1').ajaxSubmit(options);
		}
	});
});
</script>
<%end if%>










<%if request.QueryString("action")="AddClass" then%>
<!--#include file="py.asp"-->
		<script type="text/javascript">
			$(function(){
				$('#doClass a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>  
<div class="list" id="dialog_link">
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-hover" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=AddClass');ST(0,0)" title="新增顶级分类"><span class="ui-icon ui-icon-pencil" ></span>新增顶级分类</a>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=Class&Type=Recycle');ST(0,0)" title="回收站"><span class="ui-icon ui-icon-trash"></span>回收站</a>        
      </td>
    </tr>
  </table>  

<form id="form1" name="form1" method="post" action="Content.asp?action=AddClass1">
<table width="100%">
  <tr>
    <th colspan="3">新增顶级分类</th>
  </tr>
  <tr>
    <td style="width:20%;"><h6>分类名称:</h6></td>
    <td style="width:70%;"><input id="TypeTitles" type="text" name="TypeTitle" size="50" maxlength="50" /></td>
    <td><label style="display:none" for="TypeTitle" class="error" metaDone="true" generated="true"></label></td>
  </tr>     
  <tr>
    <td style="width:20%;"><h6>分类关键字:</h6></td>
    <td style="width:70%;"><input type="textarea" name="TypeKeyword" size="50" maxlength="50" /></td>
    <td></td>
  </tr> 
  <tr>
    <td style="width:20%;"><h6>分类描述:</h6></td>
    <td style="width:70%;"><input type="text" name="TypeDescription" size="50" maxlength="50" /></td>
    <td></td>
  </tr> 
  <tr>
    <td style="width:20%;"><h6>分类风格:</h6></td>
    <td style="width:70%;"><select name="TypeTemp"><%=Gettemp%></select></td>
    <td></td>
  </tr> 
  <tr>
    <td style="width:20%;"><h6>分类封面:</h6></td>
    <td style="width:70%;"><input type="text" name="TypeIndex" size="50" maxlength="50" value="Type_index.htm"/></td>
    <td></td>
  </tr> 
  <tr>
    <td style="width:20%;"><h6>分类列表:</h6></td>
    <td style="width:70%;"><input type="text" name="TypeList" size="50" maxlength="50" value="Type_List.htm"/></td>
    <td></td>
  </tr> 
  <tr>
    <td style="width:20%;"><h6>分类文章:</h6></td>
    <td style="width:70%;"><input type="text" name="TypeArticle" size="50" maxlength="50" value="Type_Article.htm"/></td>
    <td></td>
  </tr>       
  <tr>
    <td style="width:20%;"><h6>是否支持投稿:</h6></td>
    <td style="width:70%;"><input type="radio" name="TypeFrom" size="50" maxlength="50" value="True" disabled="disabled"/> 是 <input type="radio" name="TypeFrom" size="50" maxlength="50" value="False" checked="checked" disabled="disabled"/> 否</td>
    <td></td>
  </tr> 
  <tr>
    <td style="width:20%;"><h6>是否隐藏栏目:</h6></td>
    <td style="width:70%;"><input type="radio" name="TypeHide" size="50" maxlength="50" value="True"/> 是 <input type="radio" name="TypeHide" size="50" maxlength="50" value="False" checked="checked"/> 否 浏览权限:<select name="TypeLimit"><option value="0" selected="selected">开放浏览</option><option value="1">注册会员</option><option value="2">中级会员</option><option value="3">高级会员</option></select></td>
    <td></td>
  </tr>       
  <tr>
    <td style="width:20%;"><h6>列表:</h6></td>
    <td style="width:70%;">
    <input type="radio" name="TypeBuild" value="0" onClick="TypeLocation.disabled=true;TypeLocation.value='';document.getElementById(TypeLocation);"/>动态
    <input type="radio" name="TypeBuild" value="1" onClick="TypeLocation.disabled=false;document.getElementById(TypeLocation)" checked="checked"/>静态 
    <input type="radio" name="TypeBuild" value="2" onClick="TypeLocation.disabled=false;document.getElementById(TypeLocation)"/>伪静态</td>
    <td></td>
  </tr>  
<%
str=openfile(server.MapPath("site/config.asp"))
web=split(str,chr(13))
%>
  
  <tr name="TypeDir">
    <td style="width:20%;"><h6>保存位置:</h6></td>
    <td style="width:70%;">
    <input type="text" name="TypeLocation" size="50" maxlength="50" /> 

<!--    <input type="radio" name="TypeLocation0" value="/"/> 站点根目录-->

    <input type="radio" name="TypeLocation0" value="../<%=web(5)%>" checked="checked"/> CMS根目录
     </td>
    <td><label style="display:none" for="TypeLocation" class="error" metaDone="true" generated="true"></label><input type="checkbox" id="py"/>拼音</td>
  </tr> 
  <tr>
    <td></td>
    <td colspan="2" id="doClass">
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onClick="$('#form1').submit();"><span class="ui-icon ui-icon-check"></span>保存</a>
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onClick="document.form1.reset();"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>重置</a>     
    </td>
  </tr>  
    <tr>
      <td style="height:5px;" colspan="3">
      </td>
    </tr>  
</table>  
</form>
  

</div>

<script language="javascript">
$('#py').click(function() {
	var cName=document.form1.TypeTitle.value;
	bb(cName)
});
function bb(str){
var url = 'py.asp?cns='+encodeURI(str);
  var xhttp = null; 
  if(window.XMLHttpRequest){
  xhttp = new XMLHttpRequest();} 
  else if(window.ActiveXObject){ 
  try{ xhttp = new ActiveXObject("Msxml2.XMLHTTP");} catch (e){ ; } 
  if( xhttp == null) try { xhttp = new ActiveXObject("Microsoft.XMLHTTP");} catch (e){; }}
xhttp.open("get",url,false);
xhttp.send(null);
document.form1.TypeLocation.value=xhttp.responseText;}
</script>





<script>
$(document).ready(function() {
	var options = {
	beforeSubmit:function(){showLoading(showSaveText);},
	 	 success:function(msg){
				 hideLoading();
				 showMessage(msg.message,msg.type);
						  if(msg.type == '1'){
						  ST(0,0);
						  ShowDiv = "result_content";
						  getPageContent("Content.asp?action=Class");
							   }
						},
		type:      'post',
		dataType:  'json'
	};
	$("#form1").validate({
		errorClass: "wrong",
		rules: {
			TypeTitle: {required:true},
			TypeLocation: {required:true}
		},
		messages: {
			TypeTitle: {required: "请填写分类名称"},
			TypeLocation: {required: "请填写位置"}
		},
		submitHandler: function() {
			$('#form1').ajaxSubmit(options);
		}
	});
});
</script>
<%end if%>

<%if request.QueryString("action")="Class" then%>
		<script type="text/javascript">
			$(function(){
				$('#dialog_link a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);
			});
		</script>




<div class="list" id="dialog_link">

  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ajax_do('action=MakeIndex');" title="生成首页"><span class="ui-icon ui-icon-home" ></span>生成首页</a>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=AddClass');ST(0,0)" title="新增顶级分类"><span class="ui-icon ui-icon-pencil" ></span>新增顶级分类</a>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=Class&Type=Recycle');ST(0,0)" title="回收站"><span class="ui-icon ui-icon-trash"></span>回收站</a>        
      </td>
    </tr>
  </table> 

  <%if request.QueryString("Type")="Recycle" then%>
  <table width="100%">
    <tr height="24">
      <td>该功能已关闭</td>
    </tr>
  </table> 

<%end if%>  
<form id="form3" name="form3" method="post" action="query.asp?rel=class_all">

<table width="100%">
  <tr height="24">
  <th>ID </th>
  <th>名称</th>

  <th>管理</th>
  <th>排序</th>
  </tr>
  <tr>
  <td colspan="4" style="height:5px;">
   </td>
  </tr>  
<%  

set rs1=server.CreateObject("adodb.recordset")
sql1="select * from UsCMSType where Typexid=0 order by TypeSN desc"
rs1.open sql1,conn,1,1
tsnn=rs1.recordcount
do while not rs1.eof
%>
<tr height="24">
<td height="30"><%= rs1("Typeid") %></td>
<td>
 
<a class="ui-state-default ui-corner-all" href="javascript:;" onClick="show_table<%=rs1("Typeid")%>();"><span class="ui-icon ui-icon-circlesmall-plus"></span>+</a> 
<a class="ui-state-default ui-corner-all" href="javascript:;" onClick="hide_table<%=rs1("Typeid")%>();"><span class="ui-icon ui-icon-circlesmall-minus"></span>-</a>  <%= rs1("TypeTitle") %> </td>

<td>
<a class="ui-state-default ui-corner-all"href="javascript:;" onClick="ajax_do('action=Update&Typeid=<%=rs1("Typeid")%>');"><span class="ui-icon ui-icon-play"></span>更新</a>
<a class="ui-state-default ui-corner-all"href="javascript:;"onclick="ShowDiv='result_content';getPageContent('Content.asp?action=AddArticle&Typeid=<%=rs1("Typeid")%>');ST(1,1)"><span class="ui-icon ui-icon-pencil"></span>增加文章</a>
<a class="ui-state-default ui-corner-all" href="<%= rs1("TypeDir")%>"><span class="ui-icon ui-icon-search"></span>预览</a>
<a class="ui-state-default ui-corner-all"href="javascript:;" onClick="ajax_deltype1('action=deltype1&Typeid=<%=rs1("Typeid")%>');"><span class="ui-icon ui-icon-trash"></span>删除</a>
<a class="ui-state-default ui-corner-all"href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=AddClass2&Typeid=<%=rs1("Typeid")%>');ST(0,0)"><span class="ui-icon ui-icon-folder-collapsed"></span>增加子分类</a>
</td>



<td>

<a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ajax_order1('action=order1&orders=desc&classid=<%=rs1("Typeid")%>');" title="下降"><span class="ui-icon ui-icon-arrowthick-1-s"></span>降序</a>
<a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ajax_order1('action=order1&orders=asc&classid=<%=rs1("Typeid")%>');" title="提升"><span class="ui-icon ui-icon-arrowthick-1-n"></span>升序</a>

</td>
</tr>
<script type="application/x-javascript">
function show_table<%=rs1("Typeid")%>(){var show = document.getElementById("t<%=rs1("Typeid")%>");show.style.display="";}
</script> 
<script type="application/x-javascript"> 
function hide_table<%=rs1("Typeid")%>(){var hide = document.getElementById("t<%=rs1("Typeid")%>");hide.style.display="none";} 
</script> 


<tbody id="t<%=rs1("Typeid")%>">
<%  
set rs2=server.CreateObject("adodb.recordset")
sql2="select * from UsCMSType where Typexid="&rs1("Typeid")&" order by TypeSN desc"
rs2.open sql2,conn,1,1
do while not rs2.eof
%>

<tr>
<td style="background:#EAF4FC;"></td>
<td style="background:#cbe1ef;float:right;"><span> <%= rs2("TypeTitle") %></span></td>

<td style="background:#fff;">
<a class="ui-state-default ui-corner-all"href="javascript:;" onClick="ajax_do('action=Update2&Typeid=<%=rs2("Typeid")%>');"><span class="ui-icon ui-icon-play"></span>更新</a>
<a class="ui-state-default ui-corner-all"href="javascript:;"onclick="ShowDiv='result_content';getPageContent('Content.asp?action=AddArticle&Typeid=<%=rs2("Typeid")%>');ST(1,1)"><span class="ui-icon ui-icon-pencil"></span>增加文章</a>
<a class="ui-state-default ui-corner-all" href="<%= rs2("TypeDir")%>"><span class="ui-icon ui-icon-search"></span>预览</a>
<a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ajax_deltype2('action=deltype2&Typeid=<%=rs2("Typeid")%>');"><span class="ui-icon ui-icon-trash"></span>删除</a>
</td>
<td style="background:#fff;">
<a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ajax_order2('action=order2&orders=desc&Typexid=<%=rs2("Typexid")%>&Typeid=<%=rs2("Typeid")%>');"><span class="ui-icon ui-icon-arrowthick-1-s"></span>降序</a>
<a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ajax_order2('action=order2&orders=asc&Typexid=<%=rs2("Typexid")%>&Typeid=<%=rs2("Typeid")%>');"><span class="ui-icon ui-icon-arrowthick-1-n"></span>升序</a></td>
</tr>

<% 
rs2.movenext:loop:rs2.close:set rs2=nothing%></tbody>
<%
rs1.movenext:loop:rs1.close:set rs1=nothing
%>
  <tr>
  <td colspan="4" style="height:5px;">
   </td>
  </tr>

</table>
</form>
<div class="digg">
</div>
</div>
<script>
function ajax_do(str){
	$.ajax({
		url: "Content.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('Content.asp?action=Class');
			}
		}
	});
	return false;
}

function ajax_deltype1(str){
	$.ajax({
		url: "Content.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('Content.asp?action=Class');
			}
		}
	});
	return false;
}

function ajax_deltype2(str){
	$.ajax({
		url: "Content.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('Content.asp?action=Class');
			}
		}
	});
	return false;
}


function ajax_order1(str){
	$.ajax({
		url: "Content.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('Content.asp?action=Class');
			}
		}
	});
	return false;
}

function ajax_order2(str){
	$.ajax({
		url: "Content.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('Content.asp?action=Class');
			}
		}
	});
	return false;
}
</script>
<%end if%>



<%
if request.QueryString("action")="SaveArticle" then
	ArticleContent=Request.Form("ArticleContent")
	ArticleTitle=Request.Form("ArticleTitle")
	ArticleKeyword=Request.Form("ArticleKeyword")
	ArticleDescription=Request.Form("ArticleDescription")
	ArticleFrom=Request.Form("ArticleFrom")
	ArticleAuthor=Request.Form("ArticleAuthor")
	Articleid=Request.Form("Articleid")
  if len(ArticleDescription)=0 then
    ArticleContentStr=ArticleContent
	ArticleContentStr=clearhtml(ArticleContentStr)
    ArticleDescription=getstrlen(trim(ArticleContentStr),198)
  end if
  if nohtml="1" then
    ArticleContent=clearhtml(ArticleContent)
  end if
  Set Rs=Server.CreateObject("Adodb.RecordSet")
    Sql="Select * From UsCMSArticle Where Articleid="&Articleid
	Rs.Open Sql,Conn,1,3
	Rs("ArticleTitle")=ArticleTitle	
	Rs("ArticleContent")=ArticleContent
	Rs("ArticleKeyword")=ArticleKeyword
	Rs("ArticleDescription")=ArticleDescription
	Rs("ArticleFrom")=ArticleFrom
	Rs("ArticleAuthor")=ArticleAuthor	
	Rs.UPdate	
	Rs.Close			
	Set Rs=Nothing
	Response.Write("{message:'修改文章成功："&ArticleCount&"',type:1}")
end if
%>
<%
if request.QueryString("action")="EditArticle" then
page=int(request.QueryString("page"))
Typeid=funstr(request.QueryString("Typeid"))
  Articleid=request.QueryString("Articleid")
  Set Rs=Server.CreateObject("Adodb.RecordSet")
    Sql="Select * From UsCMSArticle Where Articleid="&Articleid
	Rs.Open Sql,Conn,1,1
	ArticleContent=Rs("ArticleContent")
	ArticleTitle=Rs("ArticleTitle")
	ArticleKeyword=Rs("ArticleKeyword")
	ArticleDescription=Rs("ArticleDescription")
	Rs.Close
	Set Rs=Nothing	

%>	

<div class="list" id="dialog_link">
  <form id='form1' name='form1' method='post' action='content.asp?action=SaveArticle'>
  <input type=hidden name="Articleid" value="<%=Articleid%>" />
    <table width="100%" align="center">
      <tr><td colspan="4">内　容：</td></tr>
      <tr>
        <td colspan="4" style='width:80%;padding-left:0px;'><input type="hidden" name="ArticleContent" value="<%= server.HTMLEncode(ArticleContent) %>"/>
        <iframe id="FCK_Frame" src="../fckeditor/editor/fckeditor.html?InstanceName=ArticleContent&amp;Toolbar=Default" width="100%" height="318px" frameborder="no" scrolling="no"></iframe>        </td>
      </tr>
      <tr>
        <td width=10%>标　题：</td>
        <td width=40%><input type="text" name="ArticleTitle" value='<%=ArticleTitle%>' style="width:60%;"/><label style="display:none" for="ArticleTitle" class="error" metaDone="true" generated="true"></label></td>
        <td width=10%>关键字：</td>
        <td width=40%><input type="text" name="ArticleKeyword" value="<%=ArticleKeyword%>" style="width:60%;"/></td>
      </tr>

      <tr>
        <td>摘　要：</td>
        <td><textarea name="ArticleDescription" size="40" rows="5" id="description" style="width:60%;height:50px"><%=ArticleDescription%></textarea><label style="display:none" for="ArticleDescription" class="error" metaDone="true" generated="true"></label></td>
        <td><input type=submit value="保存"/></td><td>　<input type=reset value="重置"/></td>
      </tr>
    </table>
  </form>
</div>

<script>

	var options = {
	beforeSubmit:function(){showLoading(showSaveText);},

	 	 success:function(msg){
				 hideLoading();
			 
				 showMessage(msg.message,msg.type);

						  if(msg.type == '1'){
						  ST(1,1);
						  ShowDiv = "result_content";
						  getPageContent("Content.asp?action=Article&Typeid=<%=Typeid%>&page=<%=page%>");
							   }
						},
		type:      'post',
		dataType:  'json'
	};
	$("#form1").validate({
		errorClass: "wrong",
		rules: {
		    ArticleDescription:{maxlength:200},
			ArticleTitle: {required:true,maxlength:20}
		       },
		submitHandler: function() {
		$("#floatBoxBg").hide("show");		
		$("#floatBox").hide("show");
		$('#form1').ajaxSubmit(options);
		                          }
	                   });

</script>
<%End if%>
<%
if request.QueryString("action")="NewArticle" then 

	ArticleTitle=Request.Form("ArticleTitle")
	ArticleDescription=Request.Form("ArticleDescription")
	ArticleKeyword=Request.Form("ArticleKeyword")
	ArticleAuthor=Request.Form("ArticleAuthor")
	'ArticleComments=Request.Form("ArticleComments")
	ArticleDir=Request.Form("ArticleDir")
	ArticleFrom=Request.Form("ArticleFrom")		
	ArticleBuild=Request.Form("ArticleBuild")
  If ArticleBuild=0 Then
	ArticleDir="0"
  End if	
	ArticleContent=Request.Form("ArticleContent")
	ArticleTypexid=Request.Form("ArticleTypexid")
	ArticleTypeid=Request.Form("ArticleTypeid")
	Articlex=Request.Form("Articlex")	
  if len(ArticleDescription)=0 then
    ArticleContentStr=ArticleContent
	ArticleContentStr=clearhtml(ArticleContentStr)
    ArticleDescription=getstrlen(trim(ArticleContentStr),198)
  end if
    n = 200
    Randomize()
	
  Set Rs=Server.CreateObject("Adodb.Recordset")
    Sql="Select Top 1 * From UsCMSArticle where ArticleTypexid="&ArticleTypexid&" order by ArticleSN desc"
	  Rs.Open Sql,Conn,1,1
	    If Not Rs.Eof Then 
		  ASN=Rs("ArticleSN")
		Else
		  ASN=0
		End if	
	  Rs.Close
  Set Rs=Nothing
  	
  Set Rs=Server.CreateObject("Adodb.RecordSet")
    Sql="Select * From UsCMSArticle"
	Rs.Open Sql,Conn,1,3
	Rs.AddNew
	Rs("ArticleTitle")=ArticleTitle
	Rs("ArticleKeyword")=ArticleKeyword
	Rs("ArticleDescription")=ArticleDescription
	Rs("ArticleAuthor")=ArticleAuthor
	'Rs("ArticleComments")=ArticleComments
	Rs("ArticleBuild")=ArticleBuild
	Rs("ArticleDir")=ArticleDir
	Rs("ArticleContent")=ArticleContent
	Rs("ArticleAddDate")=Date()
	Rs("ArticleTypeid")=ArticleTypeid
	Rs("ArticleTypexid")=ArticleTypexid
	Rs("Articlex")=Articlex
	Rs("ArticleFrom")=ArticleFrom
	Rs("ArticleSN")=ASN+1
	Rs("ArticleCount")=int(n*rnd)+1  
	Rs.Update
	Rs.Close
  Set Rs=Nothing



  If ArticleBuild=1 Then  
  Set Rs=Server.CreateObject("Adodb.RecordSet")
    Sql="Select top 1 * From UsCMSArticle order by Articleid desc"
        Rs.Open Sql,Conn,1,1
		  Articleid=Rs("Articleid")
    	  Articlex=Rs("Articlex")
		  If Articlex=1 Then
		   Typeid=Rs("ArticleTypeid")
		  Else
		   Typeid=Rs("ArticleTypexid")	  
		  End If
  		Rs.close
  	set Rs=Nothing
call	PreviewArticle(Articleid,Typeid,ArticleDir)			
call	PreviewType(Typeid)		
	Response.Write("{message:'新增文章成功，静态成功',type:1}")
	else
	Response.Write("{message:'新增文章成功',type:1}")
  end if	


end if

if request.QueryString("action")="UpdateArt" then
Articleid=Request.QueryString("Articleid")
      Set Rs=Server.CreateObject("Adodb.Recordset")
        Sql="Select * from UsCMSArticle where Articleid="&Articleid

        Rs.Open Sql,Conn,1,1

		if rs("ArticleBuild")=1 then
    	  Articlex=Rs("Articlex")
		  ArticleDir=Rs("ArticleDir")
		  If Articlex=1 Then
		   Typeid=Rs("ArticleTypeid")
		  Else
		   Typeid=Rs("ArticleTypexid")	  
		  End If
  		Rs.close
  	set Rs=Nothing
	  
'	createfiles server.MapPath(ArticleDir),PreviewArticle(Articleid,Typeid)	
call	PreviewArticle(Articleid,Typeid,ArticleDir)		
	Response.Write("{message:'更新文章成功，静态成功',type:1}")
	else
	Response.Write("{message:'伪静态与动态文章不需要生成',type:0}")	
	end if

end if
%>

<%if request.QueryString("action")="AddArticle" then%>
<!--#include file="py.asp"-->
<script type="text/javascript" src="lhgcore.js"></script>
<script type="text/javascript" src="lhgdialog/lhgdialog.js"></script>
<%
bbb="<script>"
%>
<script type="text/javascript">
function SelectAuthor()
{
J.dialog.get({id: 'SelectAuthor', title:'选择作者', page: 'Content.Asp?action=SelectAuthor', rang: true,cover:true });
}
function SelectKeyword()
{J.dialog.get({ id: 'SelectKeyword',title:'选择关键字', page: 'Content.Asp?action=SelectKeyword', rang: true,cover:true });}
function SelectFrom()
{J.dialog.get({ id: 'SelectFrom', title:'选择来源',page: 'Content.Asp?action=SelectFrom', rang: true,cover:true });}

function s()

   { J.dialog.get({ id: 's', title: 's', html: '<a href="javascript:;" onclick=alert("ok");reload();>确定</a>' });   

}
</script>

 



<%
  Typeid=Request.QueryString("Typeid")
  Set Rs=Server.CreateObject("Adodb.RecordSet")
    Sql="Select * From UsCMSType Where Typeid="&Typeid
	Rs.Open Sql,Conn,1,1
	    Typex=Rs("Typex")
		TypeTitle=Rs("TypeTitle")
		TypeDir=Rs("TypeDir")	
	  If Rs("Typex")=1 Then
	    Articlex=1
	    ArticleTypeid=Rs("Typeid")
	  Else
	    Articlex=2 
	    ArticleTypeid=Rs("Typexid")
	  End IF
	Rs.Close
  Set Rs=Nothing  
   	
%>
<div class="list" id="dialog_link"> 
		<script type="text/javascript">
			$(function(){
				$('#ArtAdd a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>  
<form id="form1" name="form1" method="post" action="Content.asp?action=NewArticle">
<table width="100%">
  <tr>
    <th>新增文章</th>
    <th>
 <select name="Select" onChange="ShowDiv='result_content';getPageContent('Content.asp?action=AddArticle&Typeid='+this.value+'');ST(1,1);"><option selected="selected">重新选择</option><%=ShowTypes%></select>  -- 当前 <%=TypeTitle%></th>
  </tr>
  <tr>
    <td style="width:10%;"><h6>标　题:</h6></td>
    <td style="width:80%;">
    <input type="text" name="ArticleTitle" size="50" maxlength="50" />
    <input type="hidden" name="ArticleTypexid" value="<%=Typeid%>" />
    <input type="hidden" name="ArticleTypeid" value="<%=ArticleTypeid%>" />    
    <input type="hidden" name="Articlex" value="<%=Articlex%>" />        
    </td>
   
    <label style="display:none" for="ArticleTitle" class="error" metaDone="true" generated="true"></label>
  </tr>     
  <tr>
    <td style="width:10%;"><h6>关键字:</h6></td>
    <td style="width:80%;"><input type="textarea" name="ArticleKeyword" size="50" maxlength="50" />　<input type="button" onClick="SelectKeyword()" value="选关键字"/> 
</td>
  </tr> 
 
  <tr>
    <td style="width:10%;"><h6>来　源:</h6></td>
    <td style="width:80%;"><input type="textarea" name="ArticleFrom" size="50" maxlength="50" />　<input type="button" value="选择来源" onClick="SelectFrom()"/> 
</td>
  </tr>   
  <tr>
    <td style="width:10%;"><h6>作　者:</h6></td>
    <td style="width:80%;"><input type="textarea" name="ArticleAuthor" size="50" maxlength="50" />　<input type="button" value="选择作者" onClick="SelectAuthor()"/> 
</td>
  </tr>     
  <tr>
    <td style="width:10%;"><h6>描　述:</h6></td>
    <td style="width:80%;"><input type="text" name="ArticleDescription" size="50" maxlength="50" /></td>
  </tr>
  <tr>
    <td style="width:10%;"><h6>评　论:</h6></td>
    <td style="width:80%;"><input type="radio" name="ArticleComments" size="50" maxlength="50" value="True"/> 是 <input type="radio" name="ArticleComments" size="50" maxlength="50" value="False" checked="checked"/> 否 </td>
  </tr>       
  <tr>
    <td style="width:10%;"><h6>权　限:</h6></td>
        <td style="width:80%;"><select name="ArticleLimit"><option value="0" selected="selected">开放浏览</option><option value="1">注册会员</option><option value="2">中级会员</option><option value="3">高级会员</option></select> </td>
  </tr>   
  <tr>
    <td style="width:10%;"><h6>生　成:</h6></td>
    <td style="width:80%;">
    <input type="radio" name="ArticleBuild" value="0" onClick="ArticleDir.disabled=true;ArticleDir.value='';document.getElementById(ArticleDir);"/> 动
    <input type="radio" name="ArticleBuild" value="1" onClick="ArticleDir.disabled=false;document.getElementById(ArticleDir)"checked="checked" /> 静 
    <input type="radio" name="ArticleBuild" value="2" onClick="ArticleDir.disabled=false;document.getElementById(ArticleDir)" /> 伪</td>
  </tr>  
  <tr name="ArticleDir" valign="top">
    <td style="width:10%;"><h6>文件名:</h6></td>
    <td style="width:80%;">
    <input type="text" id="ArticleDir" name="ArticleDir" size="50" maxlength="100" value=""/> <input type="checkbox" id="py"/> 拼音　<input type="checkbox" id="sz"/> 数字 
     </td>

    <label style="display:none" for="ArticleDir" class="error" metaDone="true" generated="true"></label>
  </tr> 
  <tr>
  <td colspan="2" style="height:5px;"></td>
  </tr>   
  <tr>
    <td style="width:10%;background:#EAF4FC;"><h6>内　容:</h6></td>
    <td style="width:80%;background:#EAF4FC;"><input type="hidden" name="ArticleContent" value="请输入内容"/>
        <iframe id="FCK_Frame" src="../fckeditor/editor/fckeditor.html?InstanceName=ArticleContent&amp;Toolbar=Default" width="98%" height="300px" frameborder="no" scrolling="no"></iframe>
	</td>

  </tr>    
  <tr>
  <td colspan="2" style="height:5px;"></td>
  </tr>     
  <tr>
    <td></td>
    <td ><button type="submit"><img src="images/save.png" /></button> </td>
  </tr>  
  <tr>
  <td colspan="2" style="height:5px;"></td>
  </tr>  
</table>  
</form>
</div>
<script language="javascript">
$('#sz').click(function() {
document.form1.ArticleDir.value='<%=Typedir%>/<%=Year(Now())&Month(Now())&Day(Now())&Hour(Now())&Minute(Now())&Second(Now())%>' + '.html';
});

$('#py').click(function() {
	var ArticleTitle=document.form1.ArticleTitle.value;
	var ArticleDir=document.form1.ArticleDir.value;	
	if (ArticleTitle=="")
	{  
alert("请输入标题!");
document.getElementById("ArticleTitle").focus(); return false;
 
}else{

	bb(ArticleTitle)}
});

function bb(str){
var url = 'py.asp?cns='+encodeURI(str);
  var xhttp = null; 
  if(window.XMLHttpRequest){
  xhttp = new XMLHttpRequest();} 
  else if(window.ActiveXObject){ 
  try{ xhttp = new ActiveXObject("Msxml2.XMLHTTP");} catch (e){ ; } 
  if( xhttp == null) try { xhttp = new ActiveXObject("Microsoft.XMLHTTP");} catch (e){; }}
xhttp.open("get",url,false);
xhttp.send(null);
document.form1.ArticleDir.value="<%=TypeDir%>/" + xhttp.responseText + ".html";}
</script>

<script>
$(document).ready(function() {
	var options = {
	beforeSubmit:function(){showLoading(showSaveText);},
	 	 success:function(msg){
				 hideLoading();
				 showMessage(msg.message,msg.type);
						  if(msg.type == '1'){
						  ST(1,1);
						  ShowDiv = "result_content";
						  getPageContent("Content.asp?action=Article&Typeid=<%=TYpeid%>");
							   }
						},
		type:      'post',
		dataType:  'json'
	};
	$("#form1").validate({
		errorClass: "wrong",
		rules: {
			ArticleKeyword:{required:true},
			ArticleFrom:{required:true},
			ArticleAuthor:{required:true},
			ArticleTitle: {required:true},
			ArticleDir: {required:true,remote: "check.asp?ArticleTypexid=<%=TYpeid%>"}
		},
		messages: {
		
			ArticleTitle: {required: "请填写标题"},
			ArticleDir: {required: "请填写文件名",remote: jQuery.format("文件名已经存在")}
		},
		submitHandler: function() {
			$('#form1').ajaxSubmit(options);
		}

	});
});
</script>
<%end if%>

<%
if request.QueryString("action")="Article" then
%>
<script type="text/javascript" src="dialog.js"></script>
		<script type="text/javascript">
			$(function(){
				$('#dialog_link a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);
			});
		</script>
<style type="text/css">

#floatBoxBg{display:none;width:100%;height:100%;background:#29a1d9;position:absolute;top:0;left:0;}
.floatBox{border:#29a1d9 0px solid;position:absolute;top:2000px;left:0%;}
.floatBox .title{height:23px;padding:7px 10px 0;background:#29a1d9;color:#fff;}
.floatBox .title h4{float:left;padding:0;margin:0;font-size:14px;line-height:16px;}
.floatBox .title span{float:right;cursor:pointer;}
.floatBox .content{padding:0px 0px;background:#cbe1ef;}

</style>
<%
starttime=timer()
	Typeid=Funstr(request.QueryString("Typeid"))
	if Typeid="" Then
	TypeTitle="全部"
	Else
  Set Rs=Server.CreateObject("Adodb.RecordSet")
    Sql="Select * From UsCMSType Where Typeid="&Typeid
	Rs.Open Sql,Conn,1,1
	    TypeTitle=Rs("TypeTitle")
		Typex=Rs("Typex")	
	Rs.Close
  Set Rs=Nothing  
  End if
%>

<div class="list" id="dialog_link">
<table width="100%" style="border-top:1px #cbe1ef solid;">

  <tr>
  <td style="height:35px;width:10%;">
<select size="1" name="Selects" onChange="ShowDiv='result_content';getPageContent('Content.asp?action=Article&Typeid='+this.value+'');ST(1,1);">
<option selected="selected">&nbsp;重新选择</option>
<option value="" style='color:#ff0000;'>┌─全部</option>
<%=ShowTypes%>
<option value="" style='color:#ff0000;'>└─全部</option>
</select>
   </td>
   <td colspan="8">
<%if TypeTitle="全部" then%>
<a class="ui-state-default" href="javascript:;"><span class="ui-icon ui-icon-circlesmall-minus"></span>当前：<%=Typetitle%></a>
<%Else%>
 <%if Typex="1" then%>
 <a class="ui-state-default" href="javascript:;" ><span class="ui-icon ui-icon-circlesmall-minus"></span>当前：<%=Typetitle%></a>
 <%else%>
<a class="ui-state-default" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=AddArticle&Typeid=<%=Typeid%>');ST(1,1)"><span class="ui-icon ui-icon-circlesmall-plus"></span>当前：<%=Typetitle%></a>
 <%end if%>
<%End if%>
     点击+号可直接在当前分类下添加文章</td>   
  </tr>
</table>
<table width="100%">
  <tr height="24">
    <th><input type="checkbox" /></th>  
    <th>加入时间</th>
    <th>文章标题</th>    
    <th>点击</th>    
	<th>类别</th> 
    <th>状态</th>    
    <th>推荐</th>
	<th>颜色</th>            
    <th>管理</th>
  </tr>

	<%

	Set Rs=Server.CreateObject("Adodb.Recordset")
	if Typeid<>"" Then
	if Typex=1 then
	sql="select * from UsCMSArticle where ArticleTypeid="&Typeid&" order by ArticleSN desc"	
	else
	sql="select * from UsCMSArticle where ArticleTypexid="&Typeid&" order by ArticleSN desc"
	end if
	else
	sql="select * from UsCMSArticle order by ArticleSN desc"	
	end if
	rs.open sql,conn,1,3 
		if not rs.eof then
	    all=rs.recordcount
		rs.pagesize=10
		pagecount=rs.pagecount
		page=int(request.QueryString("page"))
			if page<=0 then page=1
				if request.QueryString("page")="" then 
					page=1
				end if
			rs.absolutepage=page
				for i=1 to rs.PageSize
					if rs.EOF then 
				exit for
			end if

	%>  
    
<script type="text/javascript">



$("#Art<%=rs("Articleid")%>").click(function(){
  $("#dialog_link").style="display:none";
  var str=$("#str<%=rs("Articleid")%>").val();
  dialog("修改文章","url:get?Content.asp?action=EditArticle&page=<%=page%>&tTypeid=<%=Typeid%>&Articleid="+str+"","100%","auto","form");
  return false;
});
</script>

  <tr height="24">
    <td><%=Rs("Articleid")%></td>  

    <td><%= Rs("ArticleAddDate")%></td>
    <td><%= Left(Rs("ArticleTitle"),10) %></td>    
    <td>
    <input size="5" name="ArticleCount" id="ArtCount" type=text value="<%= Rs("ArticleCount") %>" onKeyUp="ajax_setArticle('action=setCount&Typeid=<%=Typeid%>&Articleid=<%=rs("Articleid")%>&ArticleCount='+this.value+'')" title="直接输入数字" />
    <label style="display:none" for="ArticleCount" class="error" metaDone="true" generated="true"></label>
    </td>    
    <td><%Tid=Rs("ArticleTypexid")%><%iGetType(Tid)%>
    </td>
    <td>
    <select name="ArticleBuild" onChange="ajax_setArticle('action=setBuild&Typeid=<%=Typeid%>&Articleid=<%=rs("Articleid")%>&ArticleBuild='+this.value+'')">
    <option>
    <%if Rs("ArticleBuild")=0 then%>动<% elseif Rs("ArticleBuild")=1 then%>静<%else%>伪<% end if %>
    </option>
    <%if Rs("ArticleBuild")=0 then%>
    <option value="1">静</option>    
    <option value="2">伪</option>       
    <% elseif Rs("ArticleBuild")=1 then%>
    <option value="0">动</option>    
    <option value="2">伪</option>     
    <%else%>
    <option value="0">动</option>    
    <option value="1">静</option>     
    <% end if %>
         
    </select>	
	</td>    
    <td>
    <select name="ArticleRecommend" onChange="ajax_setArticle('action=setRecommend&Typeid=<%=Typeid%>&Articleid=<%=rs("Articleid")%>&ArticleRecommend='+this.value+'')">
    <option>
    <% if Rs("ArticleRecommend") then %><font color="#green">荐</font><% else %><font color="#29a1d9">普</font><% end if %>
    </option>
    <option value="<% if Rs("ArticleRecommend") then %>False<% else %>True<% end if %>">
	<% if Rs("ArticleRecommend") then %><font color="#green">普</font><% else %><font color="#29a1d9">荐</font><% end if %></option>

                
    </select>    
    </td>
	<td >
    <select name="ArticleColor" onChange="ajax_setArticle('action=setColor&Typeid=<%=Typeid%>&Articleid=<%=rs("Articleid")%>&Color='+this.value+'')">
    <option style="color:<%=rs("ArticleColor")%>;">Ａ</option>
    <option style="color:#ff0000;" value="#ff0000">红</option>
    <option style="color:#00ff00;" value="#00ff00">绿</option>
    <option style="color:#0000ff;" value="#0000ff">蓝</option>
    <option style="color:#000000;" value="#000000">黑</option>                
    </select>
    </td>    
    <td>
<a class="ui-state-default ui-corner-all"href="javascript:;" onClick="ajax_do('action=UpdateArt&Articleid=<%=rs("Articleid")%>');"><span class="ui-icon ui-icon-play"></span>生</a>    	
<!--<a id="Art<%=rs("Articleid")%>" class="ui-state-default ui-corner-all" href="javascript:;" title="编辑"><span class="ui-icon ui-icon-pencil" ></span><input type=hidden id="str<%=rs("Articleid")%>" value="<%=rs("Articleid")%>" />编</a>-->
<% if Rs("ArticleDisplay") then %>
<a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ajax_show('action=show&ac=hide&Articleid=<%=rs("arTicleid")%>');" title="隐藏"><span class="ui-icon ui-icon-locked"></span>显</a>
<% else %>
<a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ajax_show('action=show&ac=show&Articleid=<%=rs("arTicleid")%>');" title="显示"><span class="ui-icon ui-icon-unlocked"></span>隐</a>
<% end if %>

<% if Rs("ArticleBuild")=0 then %>
	<a class="ui-state-default ui-corner-all" target="_blank" href="../plus/view.asp?aid=<%= rs("Articleid")%>" title="预览"><span class="ui-icon ui-icon-search"></span>预</a>    
<% else %>
	<a class="ui-state-default ui-corner-all" target="_blank" href="<%= rs("ArticleDir")%>" title="预览" style="font:#ff0000"><span class="ui-icon ui-icon-search"></span>预</a>  
<% end if %>
	<a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ajax_del('action=delarticle&Articleid=<%=Rs("Articleid")%>');" title="删除"><span class="ui-icon ui-icon-trash"></span>删</a>     
    <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ajax_order('action=orderArt&orders=desc&Articleid=<%=rs("Articleid")%>');" title="下降"><span class="ui-icon ui-icon-arrowthick-1-s"></span>降</a>
<a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ajax_order('action=orderArt&orders=asc&Articleid=<%=rs("Articleid")%>');" title="提升"><span class="ui-icon ui-icon-arrowthick-1-n"></span>升</a>
</td>
    </tr>
<%rs.movenext:next:rs.close:set rs=nothing:%>  
  <tr>
  <td colspan="9" style="height:5px;">
   </td>
  </tr>
</table>
</div>  


<div class="digg">
<span class="disabled" href="javascript:;">   总计：<b><font color="#ff0000"><%=all%></font></b> 条记录，<b><font color="#ff0000"><%=pagecount%></font></b> 页，当前第 <b><font color="#FF0000"><%= page %> </font></b>页 </span>

<%if page=1 then%>
<span class="disabled"> 首&nbsp;页</span>
<%else%>
<span><a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=Article&Typeid=<%=Typeid%>&page=1');ST(1,1)"> 首&nbsp;页</a></span>
<%end if%>

<%if page=1 then%>
<span class="disabled">上一页&nbsp;</span>
<%else%>
<a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=Article&Typeid=<%=Typeid%>&page=<%=page-1%>');ST(1,1)">上一页&nbsp;</a>
<%end if%>

<%
for i=page to page+9
if i=page then
%>
<span class="current"><a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=Article&Typeid=<%=Typeid%>&page=<%=i%>');ST(1,1)"><%=i%></a></span>
<%elseif i>pagecount then%>
<span class="disabled"><%=i%></span>
<%else%>
<a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=Article&Typeid=<%=Typeid%>&page=<%=i%>');ST(1,1)"><%=i%></a>
<%end if:next%>
<%if pagecount<page+1 then%>
<span class="disabled">下一页&nbsp;</span>
<%else%>
<a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=Article&Typeid=<%=Typeid%>&page=<%=page+1%>');ST(1,1)">下一页&nbsp;</a>
<%end if%>
<%if pagecount<page+1 then%>
<span class="disabled"> 尾&nbsp;页</span>
<%else%>
<a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=Article&Typeid=<%=Typeid%>&page=<%=pagecount%>');ST(1,1)"> 尾&nbsp;页</a>
 
<%end if:endtime=timer()%>
<%=FormatNumber(EndTime - StartTime,4,-1,-1,0)%>秒
</div> 
<% else %>
</table></div><div class="digg">暂时没有记录!</div>
<%
page=Request.QueryString("page")
%>

<%
end if
%>
<script>
function ajax_do(str){
	$.ajax({
		url: "Content.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('Content.asp?action=Article&Typeid=<%=Typeid%>&page=<%=page%>');
			}
		}
	});
	return false;
}

function ajax_del(str){
	$.ajax({
		url: "Content.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('Content.asp?action=Article&Typeid=<%=Typeid%>&page=<%=page%>');
			}
		}
	});
	return false;
}
function ajax_order(str){
	$.ajax({
		url: "Content.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('Content.asp?action=Article&Typeid=<%=Typeid%>&page=<%=page%>');
			}
		}
	});
	return false;
}
function ajax_setArticle(str){
	$.ajax({
		url: "Content.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('Content.asp?action=Article&Typeid=<%=Typeid%>&page=<%=page%>');
			}
		}
	});
	return false;
}
function ajax_show(str){
	$.ajax({
		url: "Content.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('Content.asp?action=Article&Typeid=<%=Typeid%>&page=<%=page%>');
			}
		}
	});
	return false;
}
</script>

<%
end if
%>

<%if request.QueryString("action")="Comments" then%>
<div class="list">
<table width="100%">
<tr>
<td>
因考虑到评论管理问题,该功能关闭!
</td>
</tr>
</table>
</div>
<%end if%>
<%if request.QueryString("action")="fsornew" then
Fname=server.MapPath("/"&Request.Form("old"))
ToName=Request.Form("rnew")

if toname="" then
	Response.Write("{message:'文件名不合法！',type:0}")      

End if
Set oFso=Server.CreateObject("Scripting.FileSystemObject")
		Set oFile=oFso.GetFile(Fname)
		Fname=oFile.Path

		FDir=Left(Fname,InstrRev(Fname,"\"))

		ToName=FDir & ToName
	
		On Error Resume Next
		Err.Clear
		Err=False
			oFso.MoveFile Fname,ToName
		If Err Then


	Response.Write("{message:'文件名不合法！',type:0}")    		
		Else

	Response.Write("{message:'修改成功！',type:1}")    
		End If

		
end if%>
<%if request.QueryString("action")="Files" then%>

<div class="list">

    <script type="text/javascript" src="up/js/AnPlus.js"></script>
    <script type="text/javascript" src="up/js/AjaxUpload.js"></script>
    <script type="text/javascript" src="up/js/custom.js"></script>
    <link rel="stylesheet" type="text/css" href="up/css/style.css" />
<script>
$(document).ready(function() {

	var options = {
		beforeSubmit:  function(){showLoading(showSaveText);},
		success:       function(msg){

            if(msg.error){_.$("AnErrMsg").innerHTML="文件夹已存在"}
            if(msg.succeed){showMessage("成功创建文件夹",1);loadFolder();closeDialog();}
						},
		type:      'get',
		dataType:  'json'
	};
});	

var fselected="";
function fselect(obj)	//选中文件夹或文件
{
	var flen=document.all("g").length;
	for(var i=0;i<flen;i++)
	{
		document.all("g").item(i).style.backgroundColor="";
	}
	obj.style.backgroundColor="#BBBBBB";
	fselected=obj.value;
}
	
    var x1,y1;
     $(document).ready(function(){
     $("#uploader_Title").mousedown(
     function(event){
      var offset=$("#upload_Box").offset();
      x1=event.clientX-offset.left;
      y1=event.clientY-offset.top;
      var witchButton=false;
      if(document.all&&event.button==1){witchButton=true;}
      else{if(event.button==0)witchButton=true;}
      if(witchButton)//按左键,FF是0，IE是1
      {
       $(document).mousemove(function(event){
        $("#upload_Box").css("left",(event.clientX-x1)+"px"); 
        $("#upload_Box").css("top",(event.clientY-y1)+"px"); 
       })
      }
     })
     $("#uploader_Title").mouseup(
     function(event){
      $(document).unbind("mousemove");
     })

    }
   );   
</script>
 <div id="dialog"></div>

<div id="uploadDiv"></div>

<div id="upload_Box" style="position:absolute;padding:0px;width:420px;display:none;background-color:#fff;border:solid 1px #29a1d9;">
	<div id="uploader_Title" style="background: url(../templates/uscms/images/bg_tab.png) repeat-x;padding:10px 0 0px 5px;height:37px;">UsCMS 文件管理器－无组件上传文件 </div>
	<div id="uploadContenter" style="background:#336633;"><button class="managerbutton" onClick="this.parentNode.parentNode.style.display='none';"><img src="images/submit.gif" /> 关 闭</button><br /><br /></div>
</div>
<iframe style="display:none;" name="AnUploader"></iframe>

<div id="middle">
    <div id="rights">
        <div class="lists">
            <a class="fdelete" href="javascript:void(0);" onClick=""></a>
            <a class="ftype" href="javascript:void(0);" onClick=""></a>
            <a class="fname" href="javascript:void(0);" onClick="">名称</a>
            <a class="ftypes" href="javascript:void(0);" onClick="">类型</a>            
            <a class="fsize" href="javascript:void(0);" onClick="">大小</a>
            <a class="fcdate" href="javascript:void(0);" onClick="">创建日期</a>
            <a class="fmdate" href="javascript:void(0);" onClick="">修改日期</a>            
        </div>
    </div>
    <div id="right">    
        <div class="lists cen"></div>    
    </div>

<div id="footer"><input type="button" readyonly class="ManagerButton" id="fname" href="javascript:void(0);" size="12" onClick="toParentFolder();" value="返回上级目录"/></div>




</div>
<%end if%>


<%if request.QueryString("action")="OnePageAdd" then%>

<div class="list" id="dialog_link"> 
		<script type="text/javascript">
			$(function(){
				$('#doOnepage a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>   
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-hover" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=OnePageAdd');ST(4,4)" title="新增"><span class="ui-icon ui-icon-pencil" ></span>新增页面</a>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=doOnePage&Type=Recycle');ST(4,4)" title="回收站"><span class="ui-icon ui-icon-trash"></span>回收站</a>      
      </td>
    </tr>
  </table> 

<form id="form1" name="form1" method="post" action="Content.asp?action=AddOnePage">
<table width="100%">
  <tr>
    <td style="width:10%;"><h6>页面名称:</h6></td>
    <td style="width:80%;"><input type="text" name="PageName" size="50" maxlength="50" /><label style="display:none" for="PageName" class="error" metaDone="true" generated="true"></label></td>
    <td></td>
  </tr>
  <tr>
    <td><h6>生成方式:</h6></td>
    <td>
<input name="PageStatus" type="radio" value="1" onClick="PageUrl.disabled=false;document.getElementById(PageUrl);"/>:纯静态 <input name="PageStatus" type="radio" value="2" />:伪静态  <input name="PageStatus" type="radio" value="3" onClick="PageUrl.disabled=true;document.getElementById(PageUrl);"/>:纯动态 
    </td>
    <td></td>
  </tr>   
  <tr>
    <td><h6>文件名称:</h6></td>
    <td><input type="text" name="PageUrl" size="50" maxlength="50" id="PageUrl" /></td>
    <td></td>
  </tr>
  <tr>
    <td><h6>是否显示:</h6></td>
    <td><input type="checkbox" name="PageDisplay" value="True" checked="checked" /></td>
    <td></td>
  </tr>
  <tr>
    <td><h6>模板选择:</h6></td>
    <td><select name="PageTemp"><%=Gettemp%></select></td>
    <td></td>
  </tr>  
 
  <tr>
    <td colspan="1" style="background:#EAF4FC"><h6>页面内容:</h6></td>
    <td colspan="2" style="background:#EAF4FC"><input type="hidden"  name="PageContent" value="页面内容"></input><iframe id="FCK_Frame" src="../fckeditor/editor/fckeditor.html?InstanceName=PageContent&amp;Toolbar=Default" width="97%" height="300px" frameborder="no" scrolling="no"></iframe></td>

  </tr>

  <tr>
    <td></td>

      <td id=doOnepage style="height:40px;" colspan="2">
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onClick="$('#form1').submit();"><span class="ui-icon ui-icon-check"></span>保存</a>
      <a class="ui-state-default ui-corner-all"  href="javascript:;" onClick="document.form1.reset();"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>重置</a>
    </td>
  </tr>
    <tr>
      <td colspan="3" style="height:5px;"></td>
    </tr>  
</table>
</form>
</div>
<script>
$(document).ready(function() {

	var options = {
		beforeSubmit:  function(){showLoading(showSaveText);},
		success:       function(msg){
							hideLoading();
							showMessage(msg.message,msg.type);
							if(msg.type == '1'){
								ST(4,4);
								ShowDiv = "result_content";
								getPageContent("Content.asp?action=OnePage");
							}
						},
		type:      'post',
		dataType:  'json'
	};
	$("#form1").validate({
		errorClass: "wrong",
		rules: {
			PageName: {required:true}
		},
		messages: {
			PageName: {required: "请填写页面名称"}
		},
		submitHandler: function() {
			$('#form1').ajaxSubmit(options);
		}
	});
});
</script>
<%end if%>


<%if request.QueryString("action")="doOnePage" and request.QueryString("Type")="Recycle" then%>

<div class="list" id="dialog_link"> 
		<script type="text/javascript">
			$(function(){
				$('#doOnepage a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>   
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=OnePageAdd');ST(4,4)" title="新增"><span class="ui-icon ui-icon-pencil" ></span>新增页面</a>
        <a class="ui-state-hover" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=doOnePage&Type=Recycle');ST(4,4)" title="回收站"><span class="ui-icon ui-icon-trash"></span>回收站</a>      
      </td>
    </tr>
  </table>    
  <table width="100%">  
    <tr>
      <td>该功能已关闭</td>
    </tr>
  </table>
<%end if%>


<%if request.QueryString("action")="OnePage" then%>
		<script type="text/javascript">
			$(function(){
				$('#dialog_link a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>  
<div class="list" id="dialog_link">
  <table width="100%" style="border-top:1px #cbe1ef solid;">
    <tr>
      <td style="height:35px;">
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=OnePageAdd');ST(4,4)" title="新增"><span class="ui-icon ui-icon-pencil" ></span>新增页面　</a>
        <a class="ui-state-default ui-corner-all"href="javascript:;" onClick="ajax_all('action=OnePageAll&Pageid=8')" title="生成全部"><span class="ui-icon ui-icon-play" ></span>生成全部</a>
        <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=doOnePage&Type=Recycle');ST(4,4)" title="回收站"><span class="ui-icon ui-icon-trash"></span>回收站</a>        
      </td>
    </tr>
  </table>
<table width="100%">
  <tr height="24">
    <th>ID</th>
    <th>页面名称</th>
    <th>文件地址</th>
    <th>加入时间</th>
    <th>是否显示</th>
    <th><div align="left">管理  </div></th>
  </tr>

	<%
	Set Rs=Server.CreateObject("Adodb.Recordset")
	sql="select * from UsCMSOnePage order by Pageid asc"
	  Rs.open sql,conn,1,3 
	    If Not Rs.Eof Then
 	      Rs.Pagesize=15
		  Pagecount=Rs.pagecount
		  Page=int(request.QueryString("page"))
		  If page<=0 then page=1
		    If request.QueryString("page")="" then 
			  page=1
		    End if
		    Rs.absolutepage=page
		    For i=1 to rs.PageSize
			  If rs.EOF then 
		    Exit for
	      End if
    %>  
  <tr height="24">
    <td><%= Rs("Pageid") %></td>
    <td><%= Rs("PageName") %></td>
    <td><%= Rs("PageUrl") %></td>
    <td><%= Rs("PageDate") %></td>
    <td><% if Rs("PageDisplay") then %>底部显示<% else %>不显示<% end if %></td>
    <td>

    <a class="ui-state-default ui-corner-all" href=../plus/Preview.asp?Action=PreviewOnePage&Pageid=<%= Rs("Pageid")%>><span class="ui-icon ui-icon-search"></span>预览</a>
    
    <a class="ui-state-default ui-corner-all" href="javascript:;" onClick="ajax_del('action=delonepage&Pageid=<%=Rs("Pageid")%>');" title="删除"><span class="ui-icon ui-icon-trash"></span>删除</a>    
    </td>
    </tr>
    <%
      Rs.movenext
  	  Next
	  Rs.close
	  Set Rs=Nothing
    %>  
    <tr>
      <td colspan="9" style="height:5px;"></td>
    </tr>
  </table>
</div>  

<div class="digg">
  <span class="disabled" href="javascript:;">总计：<b><%=pagecount%></b> 页，当前第 <b><font color="#29a1d9"><%= page %> </font></b>页 </span>

  <%if page=1 then%><span class="disabled"> 首&nbsp;页</span><%else%>
  <span><a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=OnePage&page=1');ST(4,4)"> 首&nbsp;页</a></span><%end if%>
  
  <%if page=1 then%><span class="disabled">上一页&nbsp;</span><%else%>
  <a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=OnePage&page=<%=page-1%>');ST(4,4)">上一页&nbsp;</a><%end if%>

  <%for i=page to page+9:if i=page then%>
  <span class="current"><a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=OnePage&page=<%=i%>');ST(4,4)"><%=i%></a></span>
  <%elseif i>pagecount then%><span class="disabled"><%=i%></span><%else%>
  <a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=OnePage&page=<%=i%>');ST(4,4)"><%=i%></a><%end if:next%>

  <%if pagecount<page+1 then%><span class="disabled">下一页&nbsp;</span><%else%>
  <a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=OnePage&page=<%=page+1%>');ST(4,4)">下一页&nbsp;</a><%end if%>

  <%if pagecount<page+1 then%><span class="disabled"> 尾&nbsp;页</span><%else%>
  <a href="javascript:;" onClick="ShowDiv='result_content';getPageContent('Content.asp?action=OnePage&page=<%=pagecount%>');ST(4,4)"> 尾&nbsp;页</a><%end if%>
</div> 

<% else %>
  </table>
</div>
<div class="digg">暂时没有记录!</div>
<%page=Request.QueryString("page")%>
<%end if%>
<script>
//删除页面

function ajax_del(str){
	$.ajax({
		url: "Content.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('Content.asp?action=OnePage');
			}
		}
	});
	return false;
}

function ajax_all(str){
	$.ajax({
		url: "Content.asp",
		data: str,
		type:'get',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('Content.asp?action=OnePage');
			}
		}
	});
	return false;
}

</script>
<%end if%>



<%if request.QueryString("action")="SelectAuthor" then%>

<script type="text/javascript">
var P = window.parent, D = P.loadinndlg(); 
</script>
<table width="100%">
<script type="text/javascript">
	<%
	Set Rs=Server.CreateObject("Adodb.Recordset")
	sql="select * from UsCMSAuthor"
	  Rs.open sql,conn,1,3 
	    Do While Not Rs.Eof
	%>
  function to<%=Rs("Authorid")%>()
  {
    D.J('articleauthor').val( D.J('#articleauthor<%=Rs("Authorid")%>',document).value );
    P.cancel();
  }
    <%
      Rs.movenext
  	  Loop
	  Rs.close
	  Set Rs=Nothing
    %>
</script>
	<%
	Set Rs=Server.CreateObject("Adodb.Recordset")
	sql="select * from UsCMSAuthor"
	  Rs.open sql,conn,1,3 
	    Do While Not Rs.Eof
	%>    		  
  <Tr>
    <td>
      <input id="articleauthor<%=Rs("Authorid")%>" value=<%=Rs("AuthorName")%> />
      <input onClick="to<%=Rs("Authorid")%>();" type="button" value="选择" />    
    </td>
  </Tr>
    <%
      Rs.movenext
  	  Loop
	  Rs.close
	  Set Rs=Nothing
    %>  
</table>
<%end if%>

<%if request.QueryString("action")="SelectFrom" then%>


<SCRIPT type=text/javascript src="lhgcore.js"></SCRIPT> 
<SCRIPT type=text/javascript src="lhgdialog/lhgdialog.js"></SCRIPT> 
<script type="text/javascript">
var P = window.parent, D = P.loadinndlg(); 
</script>
<table width="100%">
<script type="text/javascript">
	<%
	Set Rs=Server.CreateObject("Adodb.Recordset")
	sql="select * from UsCMSFrom"
	  Rs.open sql,conn,1,3 
	    Do While Not Rs.Eof
	%>
  function to<%=Rs("Fromid")%>()
  {
    D.J('ArticleFrom').val( D.J('#Autour<%=Rs("Fromid")%>',document).value );
    P.cancel();
  }
    <%
      Rs.movenext
  	  Loop
	  Rs.close
	  Set Rs=Nothing
    %>
</script>
	<%
	Set Rs=Server.CreateObject("Adodb.Recordset")
	sql="select * from UsCMSFrom"
	  Rs.open sql,conn,1,3 
	    if Not Rs.Eof Then
	%>    		  
  <Tr>
    <td>
      <input id="Autour<%=Rs("Fromid")%>" value=<%=Rs("FromTitle")%> />
      <input onClick="to<%=Rs("Fromid")%>();" type="button" value="选择" />    
    </td>
  </Tr>
    <%
	   End if
	   Rs.close
	  Set Rs=Nothing
    %>  
   
</table>
<%end if%>

<%if request.QueryString("action")="SelectKeyword" then%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script language="JavaScript" type="text/javascript" src="../js/jquery-1.2.6.min.js"></script>

<link href="../templates/uscms/css/default.css" rel="stylesheet" type="text/css" />
<link href="../templates/uscms/css/admincp.css" rel="stylesheet" type="text/css" />
<link type="text/css" href="../js/css/custom-theme/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
		<style type="text/css">
			#dialog_link a{padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}
			#dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
		</style>
<script type="text/javascript">
var P = window.parent;
var D = P.loadinndlg();
window.onload = function()
{
	P.crebtn( 'rese', '清 除', doreset );
	P.crebtn( 'ok', '完成', doc );	

}

function doreset()
{
D.J('#ArticleKeyword').value='';
}
function doc()
{
D.J('#py').click();
    P.cancel();
}


</script>
		<script type="text/javascript">
			$(function(){
				$('#dialog_link a').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);				
			});
		</script>  

    


<script type="text/javascript">
	<%
	Set Rs=Server.CreateObject("Adodb.Recordset")
	sql="select * from UsCMSKeyword"
	  Rs.open sql,conn,1,3 
	    Do While Not Rs.Eof
	%>
  function to<%=Rs("Keywordid")%>()
  {

    D.J('ArticleKeyword').val( ','+D.J('#Keyword<%=Rs("Keywordid")%>',document).value +D.J('#ArticleKeyword').value );

  }
    <%
      Rs.movenext
  	  Loop
	  Rs.close
	  Set Rs=Nothing
    %>
</script> 
        </head>
<body style="background:#EAF4FC">  

<div class="list" id="dialog_link">
<table width="100%" style="border:none">
 <Tr>
	<%
	Set Rs=Server.CreateObject("Adodb.Recordset")
	sql="select * from UsCMSKeyword order by len(Keywordtitle) asc"

	  Rs.open sql,conn,1,3 
i=1
do while not rs.eof
if i mod 3 = 1 then

end if
%>
		  

    <td >
       <a class="ui-state-defaults" href="javascript:;" onClick="to<%=Rs("Keywordid")%>();" title="选择"><span class="ui-icon ui-icon-check"></span><%=Rs("Keywordtitle")%></a>    

      <input type=hidden id="Keyword<%=Rs("Keywordid")%>" value=<%=Rs("Keywordtitle")%> />
</td>
<%

if i mod 3 =0 then
response.write "</tr>" 
end if
rs.movenext
i = i + 1
if i = 4 then i = 1
loop
%>
</Table>
</div>

</body>

</html>
<%end if%>