<!--#include file="setup.asp"-->
<!--#include file="../inc/Create_ArticleCls.Asp"-->
<!--#include file="../inc/NC_HtmlEditCls.Asp" -->
<%
Dim DelArticleHtml
Dim isEdit
Dim Rs1
Dim Rs2
Dim ArticleTitle
Dim ClassName
Dim classid
Dim rootid
Dim selarticleid
Dim keyword
Dim findword
Dim ArticleID
Dim datNowTime
Dim strClassid
Dim ParentID
Dim strParent
Dim Child
Dim depth
Dim strclassname
Dim j
Dim TxtContent
Dim maxperpage
Dim CurrentPage
Dim totalnumber
Dim TotalPageNum
Dim i
Dim ii
Dim pagestart
Dim pageend
Dim maxpagecount
Dim pagination
Dim GotoPageType
Dim ArticleType
Dim WhereSQL
Dim writer,source
Server.ScriptTimeout = 9999
NC_Admin.AdminChk = "21"
NC_Admin.Check
DownsysClass.admin_header
pagination = 0
GotoPageType = 0
Set Rs = Server.CreateObject("adodb.recordset")
Set Rs1 = Server.CreateObject("adodb.recordset")
Set Rs2 = Server.CreateObject("adodb.recordset")
Select Case Trim(Request("Action"))
	Case "add"
		isEdit = False
		Call setclass(isEdit)
	Case "edit"
		isEdit = True
		Call setclass(isEdit)
	Case "save"
		Call saveAdd
	Case "modify"
		Call savemodify
	Case Else
		Call InfoMain
End Select
If Founderr = True Then
	NC_Admin.Error_Msg (ErrMsg)
End If
DownsysClass.admin_footer
NothingObject

Private Sub InfoMain()
	Dim srtClassMenu
	Dim bookmark
	Dim srtClassList
	If Not IsEmpty(Request("selarticleid")) Then
		selarticleid = Request("selarticleid")
		Select Case Request("type")
			Case "del"
				Call batdel
			Case "dele"
				Call batdele
			Case "move"
				Call batmove
			Case "indate"
				Call upindate
			Case "isCommend"
				Call isCommend
			Case "noCommend"
				Call noCommend
			Case "istop"
				Call isTop
			Case "notop"
				Call noTop
			Case "CreateHtml"
				Call BatCreateHtml
			Case Else
				Response.Write "无效参数！"
		End Select
	End If
	Response.Write "<script language=""JavaScript"">" & vbCrLf
	Response.Write "<!--//" & vbCrLf
	Response.Write "function SelectAll() {" & vbCrLf
	Response.Write Chr(9) & "for (var i=0;i<document.selform.selarticleid.length;i++) {" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "var e=document.selform.selarticleid[i];" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "e.checked=!e.checked;" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf
	Response.Write "}" & vbCrLf
	Response.Write "//-->" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script language=""JavaScript"">" & vbCrLf
	Response.Write "<!--//" & vbCrLf
	Response.Write "function Juge(myform)" & vbCrLf
	Response.Write "{" & vbCrLf
	Response.Write "if (myform.keyword.value == """")" & vbCrLf
	Response.Write Chr(9) & "{" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "alert(""请输入要查询的关键字!"");" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "myform.keyword.focus();" & vbCrLf
	Response.Write Chr(9) & Chr(9) & "return (false);" & vbCrLf
	Response.Write Chr(9) & "}" & vbCrLf
	Response.Write "}" & vbCrLf
	Response.Write "//-->" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<table border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""tableBorder"">"
	Response.Write " <tr>"
	Response.Write " <th colspan=""5"">文章管理</th></tr>"
	Response.Write " <tr><form method=Post name=""myform"" action=""admin_article.asp"" onSubmit=""return Juge(this)"">"
	Response.Write " <td class=forumrow height=""22"" colspan=""5"">"
	Response.Write "查询： <input align=""absmiddle"" name=""keyword"" type=""text"" id=""keyword"" size=""30""> &nbsp;查询方法:"
	Response.Write " <select size=""1"" name=""key"">"
	Response.Write " <option value=""topic"">文章标题</option>"
	Response.Write " <option value=""body"">文章内容</option>"
	Response.Write " <option value="""">不限条件</option>"
	Response.Write " </select>"
	Response.Write " <input type=""submit"" name=""Submit"" align=""absmiddle"" value=""查 询..."" class=button>"
	Response.Write " </td></tr></form>"
	Response.Write " <tr>"
	Response.Write " <th width=""5%"" nowrap>选择</th><th width=""70%"">文章标题　"
	srtClassMenu = ClassJumpMenu
	srtClassMenu = Replace(srtClassMenu, "{ClassID=" & Request("clasid") & "}", "selected")
	Response.Write srtClassMenu
	Response.Write Chr(9) & " </th><th nowrap>修改文章</th><th nowrap>推 荐</th><th nowrap>整理时间</th></tr>"
	If Request("clasid") <> "" Then
		SQL = "select classid,classname,rootid,depth,ParentID,strParent,Child from [NC_Class] where classid=" & Request("clasid")
		Rs.Open SQL, Conn, 1, 1
		If Rs.bof And Rs.EOF Then
			Response.Write "Sorry！没有找到任何文章。或者您选择了错误的系统参数!"
			Response.End
		Else
			strclassname = Rs("classname")
			classid = Rs("classid")
			rootid = Rs("rootid")
			depth = Rs("depth")
			ParentID = Rs("ParentID")
			strParent = Rs("strParent")
			Child = Rs("Child")
		End If
		Rs.Close
	Else
		strclassname = "全部文章"
	End If
	maxperpage = 20 '###每页显示数
	keyword = Server.HTMLEncode(Request("keyword"))
	If Not IsNumeric(Request("page")) And Len(Request("page")) <> 0 Then
		Response.Write ("错误的系统参数!请输入整数")
		Response.Write
	End If
	If Not IsEmpty(Request("page")) And Len(Request("page")) <> 0 Then
		CurrentPage = CInt(Request("page"))
	Else
		CurrentPage = 1
	End If
	If CInt(CurrentPage) = 0 Then CurrentPage = 1
	If Not IsNull(keyword) And keyword <> "" Then
		keyword = Replace(Replace(Replace(keyword, "'", "‘"), "<", "&lt;"), ">", "&gt;")
		If Request("key") = "topic" Then
			findword = "Where title like '%" & keyword & "%' and isLock=0"
		ElseIf Request("key") = "body" Then
			findword = "Where content like '%" & keyword & "%'and isLock=0"
		Else
			findword = "Where title like '%" & keyword & "%' or content like '%" & keyword & "%'and isLock=0"
		End If
		WhereSQL = findword
	Else
		If Request("clasid") <> "" Then
			If depth <> 0 Then
				Dim Rs_c, AllClassID,ParentStr
				Set Rs_c = DownsysClass.Execute("select * from NC_Class where strParent like '%"& classid &"%'")
				If Rs_c.EOF And Rs_c.BOF Then
					AllClassID = classid
				Else
					Do While Not Rs_c.EOF
						ParentStr = Split(Rs_c("strParent"), ",")
						For i = 0 To UBound(ParentStr)
							If CLng(ParentStr(i)) = classid Then
								AllClassID = AllClassID & Rs_c("classid") &","
								Exit For
							End If
						Next
						Rs_c.movenext
					Loop
					AllClassID = AllClassID & classid
				End If
				Rs_c.Close
				Set Rs_c = Nothing
				WhereSQL = "where isLock=0 and classid in (" & AllClassID & ")"
			Else
				WhereSQL = "where isLock=0 and rootid=" & rootid & ""
			End If
		Else
			WhereSQL = "where isLock=0"
		End If
	End If
	TotalNumber = Conn.Execute("Select count(id) from [NC_Article] "& WhereSQL &"")(0)
	TotalPageNum = CInt(TotalNumber / maxperpage)  '得到总页数
	If TotalPageNum < TotalNumber / maxperpage Then TotalPageNum = TotalPageNum + 1
	If CurrentPage < 1 Then CurrentPage = 1
	If CurrentPage > TotalPageNum Then CurrentPage = TotalPageNum
	SQL = "select * from NC_Article "& WhereSQL &" order by isTop desc, infotime desc ,id desc"
	Rs.Open SQL, Conn, 1
	DownsysClass.SqlQueryNum = DownsysClass.SqlQueryNum + 1
	If Rs.bof And Rs.EOF Then
		Response.Write "<tr><td colspan=5 class=forumrow>还没有找到任何文章！</td></tr>"
	Else
		If TotalPageNum > 1 then Rs.Move (CurrentPage - 1) * maxperpage
		i = 0
		j = (CurrentPage - 1) * maxperpage + 1
		Response.Write " <tr>"
		Response.Write " <td height=""22"" colspan=""5"" class=""forumRowHighlight"">"
		Call showpage
		Response.Write "</td></tr>"
		Response.Write "<form name=""selform"" method=""post"" action="""">"
		Do While Not Rs.EOF And i < CInt(maxperpage)
			Response.Write " <tr>"
			Response.Write " <td class=forumrow nowrap align=""center""><input type=""checkbox"" name=""selarticleid"" value="""
			Response.Write Rs("id")
			Response.Write """>"
			Response.Write j
			Response.Write "</td>"
			Response.Write " <td height=""22"" class=""forumrow"">"
			If Rs("istop") = 0 Or Rs("istop") = Empty Then
				Response.Write "<IMG SRC=""images/folder.gif"" WIDTH=""16"" HEIGHT=""16"" BORDER=0 ALT=""开放的文章"">"
			Else
				Response.Write "<IMG SRC=""images/istop.gif"" WIDTH=""15"" HEIGHT=""17"" BORDER=0 ALT=""置顶的文章"">"
			End If
			Response.Write Chr(9) & " [<a href=?clasid="
			Response.Write Rs("Classid")
			Response.Write ">"
			Response.Write Rs("classname")
			Response.Write "</a>] <a href='"
			If CInt(DownsysClass.Setting(5)) = 0 Then
				Response.Write "../article/catalog"
				Response.Write Rs("classid")
				Response.Write "/"
				Response.Write Rs("id")
				Response.Write ".html"
			Else
				Response.Write "../article.asp?id="
				Response.Write Rs("id")
			End If
			Response.Write "' target=_blank>"
			Response.Write Rs("title")
			Response.Write "</a></td>"
			Response.Write " <td class=forumrow align=""center""><a href=?action=edit&id="
			Response.Write Rs("id")
			Response.Write "&classid="
			Response.Write Rs("Classid")
			Response.Write ">编 辑</a></td>"
			Response.Write " <td class=forumrow align=""center"">"
			Response.Write Chr(9) & " "
			If Rs("isCommend") = 0 Then
				Response.Write Chr(9) & " <IMG SRC=""images/folder.gif"" WIDTH='16' HEIGHT='16' BORDER=0 ALT='开放文章'>"
				Response.Write Chr(9) & " "
			Else
				Response.Write Chr(9) & " <IMG SRC='images/jing.gif' WIDTH='18' HEIGHT='18' BORDER=0 ALT='推荐文章'>"
				Response.Write Chr(9) & " "
			End If
			Response.Write "</td>"
			Response.Write " <td class=forumrow align=""center"" nowrap>"
			If Rs("infotime") >= Date Then
				Response.Write "<font color=""#FF3300"">"
				Response.Write FormatDateTime(Rs("infotime"), 2)
				Response.Write "</font>"
			Else
				Response.Write FormatDateTime(Rs("infotime"), 2)
			End If
			Response.Write "</td></tr>"
			Rs.movenext
			i = i + 1
			j = j + 1
			If i >= maxperpage Then Exit Do
		Loop
	End If
	Rs.Close
	Response.Write " <tr>"
	Response.Write " <td height=""22"" class=""forumrow"">管理</td>"
	Response.Write " <td height=""22"" colspan=""3"" class=""forumrow""><a href=""javascript:SelectAll()"">全选/反选</a><input type=""checkbox"" name=""checkbox"" value=""checkbox"" onClick=""javascript:SelectAll()"">"
	Response.Write " <input type=""radio"" name=""type"" value=""move"">批量移动 ->"
	srtClassList = DownsysClass.ClassJumpList
	srtClassList = Replace(srtClassList, "{ClassID=" & Request("classid") & "}", "selected")
	Response.Write srtClassList
	If CInt(DownsysClass.Setting(5)) = 0 Then Response.Write "<input type=""radio"" name=""type"" value=""CreateHtml"">批量生成(HTML)"
	Response.Write "　<BR>"
	Response.Write "<BR style=""OVERFLOW: hidden; LINE-HEIGHT: 5px"">"
	Response.Write Chr(9) & "<input type=""radio"" name=""type"" value=""del"">彻底删除"
	Response.Write Chr(9) & "<input type=""radio"" name=""type"" value=""dele"">放入回收站"
	Response.Write Chr(9) & "<input type=""radio"" name=""type"" value=""isCommend"">设置推荐"
	Response.Write Chr(9) & "<input type=""radio"" name=""type"" value=""noCommend"">取消推荐"
	Response.Write Chr(9) & "<input type=""radio"" name=""type"" value=""istop"">文章置顶"
	Response.Write Chr(9) & "<input type=""radio"" name=""type"" value=""notop"">取消置顶"
	Response.Write Chr(9) & "<input type=""radio"" name=""type"" value=""indate"">更新时间"
	Response.Write "</td>"
	Response.Write " <td height=""22"" class=""forumrow""><input type=""submit"" name=""Submit"" value=""执行操作"" class=button onclick=""{if(confirm('您确定执行的操作吗?')){this.document.selform.submit();return true;}return false;}""></td>"
	Response.Write " </tr></form>"
	Response.Write " <tr>"
	Response.Write " <td height=""22"" colspan=""5"" class=""forumRowHighlight"">"
	Call showpage
	Response.Write "</td></tr>"
	Response.Write "</table>"
End Sub

Private Sub setclass(isEdit)
	Dim NC_HtmlEdit
	Dim srtClassList
	Set NC_HtmlEdit = New HtmlEditor_Cls
	If isEdit Then
		SQL = "select * from NC_Article where id=" & Request("id")
		Rs.Open SQL, Conn, 1, 1
		DownsysClass.SqlQueryNum = DownsysClass.SqlQueryNum + 1
		'If Err.Number <> 0 Then Response.Write "数据库出错"
		classid = CStr(Rs("classid"))
		rootid = CStr(Rs("rootid"))
		ArticleTitle = "编辑文章"
	Else
		ArticleTitle = "添加文章"
	End If
	Response.Write "<script src=images/checksave.js type=text/javascript></script>"
	Response.Write "<div onkeydown=CtrlEnter()>"
	Response.Write "<table border=""0"" align=""center"" cellpadding=""0"" cellspacing=""1"" class=""tableBorder"">"
	Response.Write "<form name=""myform"" method=""post"" action=""admin_article.asp"" onSubmit=""return CheckArticle(this)"">"
	Response.Write " <input type=""Hidden"" name=""action"" value='"
	If isEdit Then
		Response.Write "modify"
	Else
		Response.Write "save"
	End If
	Response.Write "'>"
	If CInt(DownsysClass.Setting(19)) = 1 Then
		Response.Write Chr(9) & Chr(9) & " <input type=""hidden"" name=""content1"" id=Body value="""
		If isEdit Then
			Response.Write Server.HTMLEncode(Rs("Content"))
		End If
		Response.Write """>"
		Response.Write Chr(9) & Chr(9) & " "
	End If
	If isEdit Then
		Response.Write " <input type=""Hidden"" name=""id"" value='"
		Response.Write CStr(Request("id"))
		Response.Write "'>"
	End If
	Response.Write " <tr>"
	Response.Write " <th colspan=""2"">"
	Response.Write ArticleTitle
	Response.Write " 注意事项</th>"
	Response.Write " </tr>"
	Response.Write "<tr>"
	Response.Write "<td colspan=""2"" class=""forumRowHighlight"">"
	Response.Write "<p><B>注意</B>：<BR>①添加文章时请先选择分类，不能选择一级分类做为文章内容分类；<BR>"
	Response.Write "②添加或者修改文章时需要HTML语法支持，请在基本设置开启HTML编辑器，文本编辑器会过滤所有的HTML标签；如果您以前添加的文章使用了HTML编辑器，请修改的时候一定要使用HTML编辑器；<BR>"
	Response.Write "③HTML编辑器和文本编辑器都不支持UBB代码。"
	Response.Write "</td>"
	Response.Write "</tr>"
	Response.Write " <tr>"
	Response.Write " <th colspan=""2"">"
	Response.Write ArticleTitle
	Response.Write "</th>"
	Response.Write " </tr>"
	Response.Write " <tr>"
	Response.Write " <td width=""20%"" height=""22"" align=""right"" nowrap class=""forumRowHighlight"">文章分类：</td>"
	Response.Write " <td width=""80%"" class=""forumRow"">"
	srtClassList = DownsysClass.ClassJumpList
	srtClassList = Replace(srtClassList, "{ClassID=" & Request("classid") & "}", "selected")
	Response.Write srtClassList
	Response.Write "</td>"
	Response.Write " </tr>"
	Response.Write " <tr>"
	Response.Write " <td height=""22"" align=""right"" class=""forumRowHighlight"">文章标题：</td>"
	Response.Write " <td class=""forumRow""><input name=""topic"" type=""text"" id=""topic"" size=""60"" value="""
	If isEdit Then
		Response.Write Rs("title")
	End If
	Response.Write """></td>"
	Response.Write " </tr>"
	Response.Write " <tr>"
	Response.Write " <td height=""22"" align=""right"" class=""forumRowHighlight"">文章类型：</td>"
	Response.Write " <td class=""forumRow"">"
	ArticleType = Split(DownsysClass.Setting(36), ",")
	For i = 0 To UBound(ArticleType)
		Response.Write "<input type=""radio"" name=""ArticleType"" value=""" & Trim(ArticleType(i)) & """ "
		If isEdit Then
			If ArticleType(i) = Rs("ArticleType") Then Response.Write " checked"
		Else
			If i = 0 Then Response.Write " checked"
		End If
		Response.Write ">" & Trim(ArticleType(i)) & " "
		If i = 6 Then Response.Write "<br>"
	Next
	Response.Write "</td>"
	Response.Write " </tr>"
	Response.Write " <tr>"
	Response.Write " <td class=""forumHeaderBackgroundAlternate"" height=""22"" colspan=""2"" align=""center""><font color=#FFFFFF><B>"
	If CInt(DownsysClass.Setting(19)) = 1 Then
		Response.Write "HTML编辑器 (不支持UBB代码)"
	Else
		Response.Write "您现在使用的编辑器不支持HTML语法，如果需要HTML语法支持，请在基本设置开启HTML编辑器功能。"
	End If
	Response.Write " </B></fort></td>"
	Response.Write " </tr>"
	Response.Write " <tr>"
	Response.Write " <td class=""forumRow"" colspan=""2"" align=""center"">"
	If CInt(DownsysClass.Setting(19)) = 1 Then
		Response.Write Chr(9)
		NC_HtmlEdit.Init_HtmlEditor
		Response.Write Chr(9)
	Else
		Response.Write Chr(9) & "<textarea name=content1 style=""width:100%;"" rows=18>"
		If isEdit Then
			Response.Write Rs("Content")
		End If
		Response.Write "</textarea>"
		Response.Write Chr(9)
	End If
	Response.Write "</td>"
	Response.Write " </tr>"
	Response.Write " <tr>"
	Response.Write " <td height=""22"" align=""right"" class=""forumRowHighlight"">文章推荐图片：</td>"
	Response.Write " <td class=""forumRow""><input name=""images"" id=image1 type=""text"" size=""60"" value="""
	If isEdit Then
		Response.Write Rs("images")
	End If
	Response.Write """></td>"
	Response.Write " </tr>"
	Response.Write " <tr>"
	Response.Write " <td colspan=2 class=""forumRow""><iframe name=""image"" frameborder=0 width=100% height=42 scrolling=no src=upfile.asp?type=image&upnum=1></iframe></td>"
	Response.Write " </tr>"
	Response.Write " <tr>"
	Response.Write " <td height=""22"" align=""right"" class=""forumRowHighlight"">文章作者：</td>"
	Response.Write " <td class=""forumRow""><input name=""writer"" type=""text"" size=""35"" "
	If isEdit Then
		Response.Write "value="""
		Response.Write Rs("writer")
		Response.Write """"
	End If
	Response.Write "></td>"
	Response.Write " </tr>"
	Response.Write " <tr>"
	Response.Write " <td height=""22"" align=""right"" class=""forumRowHighlight"">文章来源：</td>"
	Response.Write " <td class=""forumRow""><input name=""source"" type=""text"" size=""35"" "
	If isEdit Then
		Response.Write "value="""
		Response.Write Rs("source")
		Response.Write """"
	Else
		Response.Write "onblur=""if (value ==''){value='"
		Response.Write DownsysClass.Setting(0)
		Response.Write "'}"" onmouseover=this.focus() onfocus=this.select() onclick=""if(this.value=='"
		Response.Write DownsysClass.Setting(0)
		Response.Write "')this.value=''"" value="""
		Response.Write DownsysClass.Setting(0)
		Response.Write """"
	End If
	Response.Write "></td>"
	Response.Write " </tr>"
	Response.Write " <tr>"
	Response.Write " <td height=""21"" align=""right"" class=""forumRowHighlight"">是否置顶：</td>"
	Response.Write " <td class=""forumRow""> <input name=""isTop"" type=""radio"" value=""0"" "
	If isEdit Then
		If CInt(Rs("isTop")) = 0 Then
			Response.Write "checked"
		End If
	Else
		Response.Write "checked"
	End If
	Response.Write ">"
	Response.Write " 取消置顶　<input type=""radio"" name=""isTop"" value=""1"" "
	If isEdit Then
		If CInt(Rs("isTop")) = 1 Then
			Response.Write "checked"
		End If
	End If
	Response.Write ">"
	Response.Write " 文章置顶</td>"
	Response.Write " </tr>"
	Response.Write " <tr>"
	Response.Write " <td height=""21"" align=""right"" class=""forumRowHighlight"">是否推荐：</td>"
	Response.Write " <td class=""forumRow""> <input name=""isCommend"" type=""radio"" value=""0"" "
	If isEdit Then
		If CInt(Rs("isCommend")) = 0 Then
			Response.Write "checked"
		End If
	Else
		Response.Write "checked"
	End If
	Response.Write ">"
	Response.Write " 不推荐　<input type=""radio"" name=""isCommend"" value=""1"" "
	If isEdit Then
		If CInt(Rs("isCommend")) = 1 Then
			Response.Write "checked"
		End If
	End If
	Response.Write ">"
	Response.Write " 推荐　"
	If isEdit Then
		Response.Write "<input name=""upinfotime"" type=""checkbox"" value=""yes"">更新时间"
	End If
	Response.Write "</td>"
	Response.Write " </tr>"
	Response.Write " <tr>"
	Response.Write " <td height=""21"" align=""right"" class=""forumRowHighlight"">是否图文：</td>"
	Response.Write " <td class=""forumRow""> <input name=""isImg"" type=""radio"" value=""0"" "
	If isEdit Then
		If CInt(Rs("isImg")) = 0 Then
			Response.Write "checked"
		End If
	Else
		Response.Write "checked"
	End If
	Response.Write ">"
	Response.Write " 不是　<input type=""radio"" name=""isImg"" value=""1"" "
	If isEdit Then
		If CInt(Rs("isImg")) = 1 Then
			Response.Write "checked"
		End If
	End If
	Response.Write ">"
	Response.Write " 是　"
	Response.Write Chr(9) & " "
	If CInt(DownsysClass.Setting(5)) = 0 Then Response.Write "<input type=checkbox name='isCreateHtml' value='yes' checked> 同时生成（HTML）"
	Response.Write Chr(9) & " </td>"
	Response.Write " </tr>"
	Response.Write " <tr>"
	Response.Write " <td height=""22"" align=""right"" class=""forumRowHighlight"">&nbsp;</td>"
	Response.Write " <td align=""center"" class=""forumRow"">"
	Response.Write " <input type=button class=button value=""查看内容长度"" name=Button onclick=""checklength(document.myform);"">&nbsp;&nbsp;"
	Response.Write " <input type=reset name=Submit2 class=button value=""清 除"" onclick=""ClearReset()"">&nbsp;&nbsp;"
	Response.Write " <input type=Submit class=button value=""提 交"" name=Submit>&nbsp;&nbsp;"
	Response.Write " </td>"
	Response.Write " </tr></form>"
	Response.Write "</table>"
	Response.Write "</div>"
	If CInt(DownsysClass.Setting(19)) = 0 Then
		Response.Write "<Script language=javascript>" & vbCrLf
		Response.Write "<!--//" & vbCrLf
		Response.Write "document.myform.content1.value = ubbcode(document.myform.content1.value);" & vbCrLf
		Response.Write "function ubbcode(temp) {" & vbCrLf
		Response.Write "temp = temp.replace(/<br>/ig,""\n"");" & vbCrLf
		Response.Write "temp = temp.replace(/<p>/ig,""\n"");" & vbCrLf
		Response.Write "temp = temp.replace(/<\/p>/ig,""\n"");" & vbCrLf
		Response.Write "return (temp);" & vbCrLf
		Response.Write "}" & vbCrLf
		Response.Write "function ClearReset()" & vbCrLf
		Response.Write "{" & vbCrLf
		Response.Write " document.myform.content1.value = '';" & vbCrLf
		Response.Write " focus();" & vbCrLf
		Response.Write "}" & vbCrLf
		Response.Write "function checklength(theform)" & vbCrLf
		Response.Write "{" & vbCrLf
		Response.Write " alert(""您的内容目前有 ""+theform.content1.value.length+"" 字节。"");" & vbCrLf
		Response.Write "}" & vbCrLf
		Response.Write "//-->" & vbCrLf
		Response.Write "</Script>" & vbCrLf
	End If
	Set NC_HtmlEdit = Nothing
	If isEdit Then
		Rs.Close
		Set Rs = Nothing
	End If
End Sub

Private Sub checksave()
	If Trim(Request.Form("topic")) = "" Then
		Founderr = True
		ErrMsg = ErrMsg + "<li>文章标题不能为空！</li>"
		Exit Sub
	End If
	If Trim(Request.Form("classid")) = "" Then
		Founderr = True
		ErrMsg = ErrMsg + "<li>文章分类不能为空！</li>"
		Exit Sub
	Else
		strClassid = Split(Trim(Request.Form("Classid")), ",")
	End If
	If Trim(Request.Form("source")) = "" Then
		source = "不详"
	Else
		source = Trim(Request.Form("source"))
	End If
	If Trim(Request.Form("writer")) = "" Then
		writer = "不详"
	Else
		writer = Trim(Request.Form("writer"))
	End If
	If Trim(Request.Form("content1")) = "" Then
		Founderr = True
		ErrMsg = ErrMsg + "<li>文章内容不能为空！</li>"
		Exit Sub
	End If
	If CInt(DownsysClass.Setting(19)) = 1 Then
		TxtContent = Request.Form("content1")
	Else
		TxtContent = DownsysClass.HTMLEncodes(Request.Form("content1"))
	End If
End Sub

Private Sub saveAdd()
	Call checksave
	If Founderr = False Then
		SQL = "select * from NC_Article where (id is null)"
		Rs.Open SQL, Conn, 1, 3
		Rs.addnew
		Rs("classid") = strClassid(1)
		Rs("title") = DownsysClass.ChkFormStr(Request.Form("topic"))
		Rs("rootid") = strClassid(0)
		Rs("classname") = strClassid(2)
		Rs("content") = TxtContent
		Rs("writer") = writer
		Rs("images") = Request.Form("images")
		Rs("isCommend") = Request.Form("isCommend")
		Rs("isimg") = Request.Form("isimg")
		Rs("source") = source
		Rs("username") = Session(DownsysClass.CacheName & "AdminName")
		Rs("isTop") = Request.Form("isTop")
		Rs("ArticleType") = Request.Form("ArticleType")
		Rs("DayHits") = 0
		Rs("WeekHits") = 0
		Rs("MonthHits") = 0
		Rs("Hits") = 0
		Rs("HitsTime") = DownsysClass.NowTime
		Rs("infotime") = DownsysClass.NowTime
		Rs("isUpdate") = 1
		Rs("isLock") = 0
		Rs.Update
		Rs.Close
		Rs.Open "select top 1 id from NC_Article order by id desc", Conn, 1, 1
		articleid = Rs("id")
		Rs.Close
		Set Rs = Nothing
		SQL = "update NC_class set ArticleNum=ArticleNum+1,isUpdate=1 where depth<>0 and classid=" & strClassid(1)
		DownsysClass.Execute SQL
		SQL = "update NC_class set ArticleNum=ArticleNum+1,isUpdate=1 where depth=0 and rootid=" & strClassid(0)
		DownsysClass.Execute SQL
		'//////生成HTML//////
		If Request.form("isCreateHtml")="yes" then
		Dim DownloadClass
		Set DownloadClass = New Create_Article_Cls
		DownloadClass.GetArticle(articleid)
		Set DownloadClass = Nothing
		End If
		NC_Admin.Succeed_Msg ("<li>添加" & Request.Form("topic") & "成功!</li>")
		Response.Write "<meta http-equiv=""refresh"" content=""2;url='" & Request.ServerVariables("HTTP_REFERER") & "'"">" & vbCrLf
	End If
End Sub

Private Sub savemodify()
	Call checksave
	If Founderr = False Then
		SQL = "select * from NC_Article where id=" & Request("id")
		Rs.Open SQL, Conn, 1, 3
		Rs("classid") = strClassid(1)
		Rs("title") = DownsysClass.ChkFormStr(Request.Form("topic"))
		Rs("rootid") = strClassid(0)
		Rs("classname") = strClassid(2)
		Rs("content") = TxtContent
		Rs("writer") = writer
		Rs("images") = Request.Form("images")
		Rs("isCommend") = Request.Form("isCommend")
		Rs("isimg") = Request.Form("isimg")
		Rs("source") = source
		Rs("isTop") = Request.Form("isTop")
		Rs("ArticleType") = Request.Form("ArticleType")
		Rs("isUpdate") = 1
		Rs("isLock") = 0
		If Trim(Request.Form("upinfotime")) = "yes" Then
			Rs("infotime") = DownsysClass.NowTime
		End If
		Rs.Update
		ArticleID = Rs("id")
		Rs.Close
		Set Rs = Nothing
		SQL = "update NC_class set isUpdate=1 where depth<>0 and classid=" & strClassid(1)
		DownsysClass.Execute SQL
		SQL = "update NC_class set isUpdate=1 where depth=0 and rootid=" & strClassid(0)
		DownsysClass.Execute SQL
		'//////生成HTML//////
		If Request.form("isCreateHtml")="yes" then
		Dim DownloadClass
		Set DownloadClass = New Create_Article_Cls
		DownloadClass.GetArticle(articleid)
		Set DownloadClass = Nothing
		End If
		NC_Admin.Succeed_Msg ("<li>修改" & Request.Form("topic") & "成功!</li>")
		Response.Write "<meta http-equiv=""refresh"" content=""2;url='" & Request.ServerVariables("HTTP_REFERER") & "'"">" & vbCrLf
	End If
End Sub

Private Sub batdel()
	If Founderr = False Then
		DownsysClass.Execute ("delete from NC_Article where id in (" & selarticleid & ")")
		DownsysClass.Execute ("delete from NC_InfoEssay where infoid in (" & selarticleid & ")")
       		If CInt(DownsysClass.Setting(5)) = 0 Then
        	DelArticleHtml=split(selarticleid, ", ")
		Dim DownloadClass
		Set DownloadClass = New Create_Article_Cls
		For j = 0 To Ubound(DelArticleHtml)
			DownloadClass.DelArticle(DelArticleHtml(j))
		Next
			Set DownloadClass = Nothing
		End If
		'NC_Admin.Succeed_Msg ("批量删除操作成功！")
		Response.redirect (Request.ServerVariables("HTTP_REFERER"))
	End If
End Sub

Private Sub batdele()
	If Founderr = False Then
		DownsysClass.Execute ("update NC_Article set isLock=1,isUpdate=1 where id in (" & selarticleid & ")")
       		If CInt(DownsysClass.Setting(5)) = 0 Then
       		DelArticleHtml=split(selarticleid, ", ")
		Dim DownloadClass
		Set DownloadClass = New Create_Article_Cls
		For j = 0 To Ubound(DelArticleHtml)
			DownloadClass.DelArticle(DelArticleHtml(j))
		Next
			Set DownloadClass = Nothing
		End If
		'NC_Admin.Succeed_Msg ("你选择的文件已成功放入回收站！")
		Response.redirect (Request.ServerVariables("HTTP_REFERER"))
	End If
End Sub

Private Sub batmove()
	Dim selclass
	selclass = Split(Trim(Request.Form("classid")), ",")
	If Trim(Request.Form("classid")) <> "" Then
		DownsysClass.Execute ("update NC_Article set rootid='" & selclass(0) & "',classid='" & selclass(1) & "',ClassName='" & selclass(2) & "',isUpdate=1 where id in (" & selarticleid & ")")
		Response.Write ("批量移动操作成功")
	Else
		Response.Write ("不能移动到一级分类，请选择正确的分类！")
	End If
End Sub

Private Sub upindate()
	DownsysClass.Execute ("update [NC_Article] set infotime=" & DownsysClass.SqlString & " where id in (" & selarticleid & ")")
	Response.Write "更新时间成功"
	Response.redirect (Request.ServerVariables("HTTP_REFERER"))
End Sub


Private Sub isCommend()
	DownsysClass.Execute ("update NC_Article set isCommend=1 where id in (" & selarticleid & ")")
	Response.redirect (Request.ServerVariables("HTTP_REFERER"))
End Sub

Private Sub noCommend()
	DownsysClass.Execute ("update NC_Article set isCommend=0 where id in (" & selarticleid & ")")
	Response.redirect (Request.ServerVariables("HTTP_REFERER"))
End Sub

Private Sub isTop()
	DownsysClass.Execute ("update NC_Article set isTop=1 where id in (" & selarticleid & ")")
	Response.redirect (Request.ServerVariables("HTTP_REFERER"))
End Sub

Private Sub noTop()
	DownsysClass.Execute ("update NC_Article set isTop=0 where id in (" & selarticleid & ")")
	Response.redirect (Request.ServerVariables("HTTP_REFERER"))
End Sub

Private Sub BatCreateHtml()
	Dim DownloadClass, GetArticleHtml, o, p
	o = 0
	Response.Write "<table width=""400"" border=""0"" cellspacing=""1"" cellpadding=""1"">" & vbCrLf
	Response.Write "<tr> " & vbCrLf
	Response.Write "<td bgcolor=000000>" & vbCrLf
	Response.Write " <table width=""400"" border=""0"" cellspacing=""0"" cellpadding=""1"">" & vbCrLf
	Response.Write "<tr> " & vbCrLf
	Response.Write "<td bgcolor=ffffff height=9><img src=""images/bar9.gif"" width=0 height=16 id=img2 name=img2 align=absmiddle></td></tr></table>" & vbCrLf
	Response.Write "</td></tr></table></td></tr><tr> " & vbCrLf
	Response.Write "<td align=center bgcolor=000000> <span id=txt2 name=txt2 style=""font-size:9pt"">0</span><span style=""font-size:9pt"">%</span>  <span id=txt3 name=txt3 style=""font-size:9pt"">0</span></td></tr>" & vbCrLf
	Response.Write "</table>" & vbCrLf
	Response.Flush
	GetArticleHtml = Split(selarticleid, ",")
	p = Ubound(GetArticleHtml)
	Set DownloadClass = New Create_Article_Cls
	Do while o <= p
		DownloadClass.GetArticle(Cint(trim(GetArticleHtml(o))))
		Response.Write "<script>img2.width=" & Fix((o + 1) / (p + 1) * 400) & ";" & vbCrLf
		Response.Write "txt2.innerHTML=""生成进度:" & FormatNumber((o + 1) / (p + 1) * 100, 4, -1) & """;" & vbCrLf
		Response.Write "txt3.innerHTML=""共有 <B><font color=RED>" & p + 1 & "</font></B> 个 　正在生成第 " & o + 1 & " 个"";" & vbCrLf
		Response.Write "img2.title=""(" & o + 1 & ")"";</script>" & vbCrLf
		o = o + 1
	Loop
	Response.Write "<script>txt3.innerHTML=""完成! 总共生成<B><font color=RED>" & p + 1 & "</font></B> 个文件"";</script>" & vbCrLf
	Response.Write "<script>img2.width=400;txt2.innerHTML=""100"";</script>"
	Set DownloadClass = Nothing
	NC_Admin.Succeed_Msg ("完成! 总共生成<B><font color=RED>" & p + 1 & "</font></B> 个文件")
	Response.redirect (Request.ServerVariables("HTTP_REFERER"))
End Sub

Private Sub showpage()
	Dim n
	If pagination = 0 Then
		If totalnumber Mod maxperpage = 0 Then
			n = totalnumber \ maxperpage
		Else
			n = totalnumber \ maxperpage + 1
		End If
		Response.Write "<table cellspacing=1 width='100%' border=0><form method=Post action=?clasid=" & Request("clasid") & "><tr><td align=center> " & vbCrLf
		Response.Write "<font color='red'>" & strclassname & "</font> "
		If CurrentPage < 2 Then
			Response.Write "共有文章 <font COLOR=#FF0000><strong>" & totalnumber & "</strong></font> 篇&nbsp;首 页&nbsp;上一页&nbsp;"
		Else
			Response.Write "共有文章 <font COLOR=#FF0000><strong>" & totalnumber & "</strong></font> 篇&nbsp;<a href=?page=1&clasid=" & Request("calsid") & ">首 页</a>&nbsp;"
			Response.Write "<a href=?page=" & CurrentPage - 1 & "&clasid=" & Request("clasid") & ">上一页</a>&nbsp;"
		End If
		If n - CurrentPage < 1 Then
			Response.Write "下一页&nbsp;尾 页" & vbCrLf
		Else
			Response.Write "<a href=?page=" & (CurrentPage + 1) & "&clasid=" & Request("clasid") & ">下一页</a>"
			Response.Write "&nbsp;<a href=?page=" & n & "&clasid=" & Request("clasid") & ">尾 页</a>" & vbCrLf
		End If
		Response.Write "&nbsp;页次：<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
		Response.Write "&nbsp;转到："
		If GotoPageType = 1 Then
			Response.Write "&nbsp;<select name='page' size='1' style=""font-size: 9pt"" onChange='javascript:submit()'>" & vbCrLf
			For ii = 1 To n
				Response.Write "<option value='" & ii & "' "
				If CurrentPage = CInt(ii) Then
					Response.Write "selected "
				End If
				Response.Write ">第" & ii & "页</option>"
			Next
			Response.Write "</select> " & vbCrLf
		Else
			Response.Write "<input name=page size=3> <input type=submit name=Submit value='GO'>"
		End If
		Response.Write "</td></tr></FORM></table>" & vbCrLf
	Else
		n = CurrentPage
		If n < maxpagecount Then
			n = maxpagecount
		End If
		Response.Write "<table width=""100%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""2"">"
		Response.Write " <tr><form method=""POST"" action='?clasid=" & Request("clasid") & "'>"
		Response.Write " <td align=""center""><font color='red'>" & strclassname & "</font> 共有文章 <font COLOR=#FF0000><strong>"
		Response.Write totalnumber
		Response.Write "</strong></font> 篇 <a href=?page=1&clasid=" & Request("clasid") & " title=返回第一页><font face=""Webdings"">97</font></a> "
		For ii = pagestart To pageend
			If ii = 0 Then ii = 1
			If ii = CurrentPage Then
				Response.Write "<font color='red'><strong>" & ii & "</strong></font> "
			Else
				Response.Write "<a href=?page=" & ii & "&clasid=" & Request("clasid") & " title=第" & ii & "页><strong>" & ii & " </strong></a>"
			End If
		Next
		Response.Write "<a href=?page="
		Response.Write maxpagecount
		Response.Write "&clasid=" & Request("clasid") & " title=尾页><font face=""Webdings"">8:</font></a> 页次:<strong><font color=red>"
		Response.Write CurrentPage
		Response.Write "</font>/"
		Response.Write maxpagecount
		Response.Write "</strong>页 转到:"
		If GotoPageType = 1 Then
			Response.Write "&nbsp;<select name='page' size='1' style=""font-size: 9pt"" onChange='javascript:submit()'>" & vbCrLf
			For ii = 1 To n
				Response.Write "<option value='" & ii & "' "
				If CurrentPage = CInt(ii) Then
					Response.Write "selected "
				End If
				Response.Write ">第" & ii & "页</option>"
			Next
			Response.Write "</select> " & vbCrLf
		Else
			Response.Write "<input name=page size=3> <input type=submit name=Submit value='GO'>"
		End If
		Response.Write " </td></form></tr></table>" & vbCrLf
	End If
End Sub

Private Function ClassJumpMenu()
	Dim CacheJumpMenu
	Dim SQL
	Dim Rs1
	Dim i
	DownsysClass.Name = "ClassJumpMenu"
	If DownsysClass.ObjIsEmpty() Then
		CacheJumpMenu = "<select onchange=""if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}"">" & vbCrLf
		CacheJumpMenu = CacheJumpMenu & "<option value=admin_article.asp>≡全部文章列表≡</option>" & vbCrLf
		Set Rs1 = CreateObject("Adodb.recordset")
		SQL = "select * from NC_Class order by rootid,orders"
		Rs1.Open SQL, Conn, 1, 1
		DownsysClass.SqlQueryNum = DownsysClass.SqlQueryNum + 1
		Do While Not Rs1.EOF
			CacheJumpMenu = CacheJumpMenu & "<option value=""admin_article.asp?clasid=" & Rs1("classid") & """ {ClassID=" & Rs1("classid") & "}"
			If Trim(Request("clasid")) <> "" Then
				If CLng(Request("clasid")) = Rs1("classid") Then CacheJumpMenu = CacheJumpMenu & " selected"
			End If
			CacheJumpMenu = CacheJumpMenu & ">"
			If Rs1("depth") = 1 Then CacheJumpMenu = CacheJumpMenu & "　├ "
			If Rs1("depth") > 1 Then
				For i = 2 To Rs1("depth")
					CacheJumpMenu = CacheJumpMenu & "　"
				Next
				CacheJumpMenu = CacheJumpMenu & "　├ "
			End If
			CacheJumpMenu = CacheJumpMenu & Rs1("ClassName") & "</option>" & vbCrLf
			Rs1.movenext
		Loop
		Rs1.Close
		Set Rs1 = Nothing
		CacheJumpMenu = CacheJumpMenu & "</select>"
		DownsysClass.Value = CacheJumpMenu
	End If
	ClassJumpMenu = DownsysClass.Value
End Function
%>
