admin_article.asp
来自「多用户管理分权限发布、管理软件信息; 自由选择系统默认为静态HTML或动态A」· ASP 代码 · 共 916 行 · 第 1/3 页
ASP
916 行
End If
If Trim(Request.Form("content1")) = "" Then
Founderr = True
ErrMsg = ErrMsg + "<li>文章内容不能为空!</li>"
Exit Sub
End If
If CInt(Newasp.Setting(19)) = 1 Then
TxtContent = Request.Form("content1")
Else
TxtContent = Newasp.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") = Newasp.HTMLEncodes(Request.Form("topic"))
Rs("rootid") = strClassid(0)
Rs("classname") = strClassid(2)
Rs("content") = TxtContent
Rs("writer") = Request.Form("writer")
Rs("images") = Request.Form("images")
Rs("isCommend") = Request.Form("isCommend")
Rs("isimg") = Request.Form("isimg")
Rs("source") = Request.Form("source")
Rs("username") = Session(Newasp.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") = Newasp.NowTime
Rs("infotime") = Newasp.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)
Newasp.Execute SQL
SQL = "update NC_class set ArticleNum=ArticleNum+1,isUpdate=1 where depth=0 and rootid=" & strClassid(0)
Newasp.Execute SQL
NC_Admin.Succeed_Msg ("<li>添加" & Request.Form("topic") & "成功!</li>")
'//////生成HTML//////
If Request("isCreateHtml") = "yes" Then NC_Create.CreateArticle (articleid)
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") = Newasp.HTMLEncodes(Request.Form("topic"))
Rs("rootid") = strClassid(0)
Rs("classname") = strClassid(2)
Rs("content") = TxtContent
Rs("writer") = Request.Form("writer")
Rs("images") = Request.Form("images")
Rs("isCommend") = Request.Form("isCommend")
Rs("isimg") = Request.Form("isimg")
Rs("source") = Request.Form("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") = Newasp.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)
Newasp.Execute SQL
SQL = "update NC_class set isUpdate=1 where depth=0 and rootid=" & strClassid(0)
Newasp.Execute SQL
NC_Admin.Succeed_Msg ("<li>修改" & Request.Form("topic") & "成功!</li>")
'//////生成HTML//////
If Request("isCreateHtml") = "yes" Then NC_Create.CreateArticle (ArticleID)
Response.Write "<meta http-equiv=""refresh"" content=""2;url='admin_article.asp'"">" & vbCrLf
End If
End Sub
Private Sub batdel()
Newasp.Execute ("delete from NC_Article where id in (" & selarticleid & ")")
Newasp.Execute ("delete from NC_InfoEssay where infoid in (" & selarticleid & ")")
Response.Write DelHtmlFile(selarticleid)
Response.Write ("批量删除操作成功!")
End Sub
Private Sub batdele()
Newasp.Execute ("update NC_Article set isLock=1,isUpdate=1 where id in (" & selarticleid & ")")
Response.Write DelHtmlFile(selarticleid)
Response.Write ("你选择的文件已成功放入回收站!")
End Sub
Private Sub batmove()
Dim selclass
selclass = Split(Trim(Request.Form("classid")), ",")
If Trim(Request.Form("classid")) <> "" Then
Newasp.Execute ("update NC_Article set rootid='" & selclass(0) & "',classid='" & selclass(1) & "',ClassName='" & selclass(2) & "',isUpdate=1 where id in (" & selarticleid & ")")
Response.Write DelHtmlFile(selarticleid)
Response.Write ("批量移动操作成功")
Else
Response.Write ("不能移动到一级分类,请选择正确的分类!")
End If
End Sub
Private Sub upindate()
Newasp.Execute ("update [NC_Article] set infotime=" & Newasp.SqlString & " where id in (" & selarticleid & ")")
Response.Write "更新时间成功"
End Sub
Private Sub isCommend()
Newasp.Execute ("update NC_Article set isCommend=1 where id in (" & selarticleid & ")")
Response.redirect (Request.ServerVariables("HTTP_REFERER"))
End Sub
Private Sub noCommend()
Newasp.Execute ("update NC_Article set isCommend=0 where id in (" & selarticleid & ")")
Response.redirect (Request.ServerVariables("HTTP_REFERER"))
End Sub
Private Sub isTop()
Newasp.Execute ("update NC_Article set isTop=1 where id in (" & selarticleid & ")")
Response.redirect (Request.ServerVariables("HTTP_REFERER"))
End Sub
Private Sub noTop()
Newasp.Execute ("update NC_Article set isTop=0 where id in (" & selarticleid & ")")
Response.redirect (Request.ServerVariables("HTTP_REFERER"))
End Sub
Private Sub BatCreateHtml()
SQL = "select id,title from NC_Article Where id in (" & selarticleid & ")"
Rs.Open SQL, Conn, 1, 1
If Rs.EOF And Rs.bof Then
Response.Write "<p align='center'>近期没有新文章</p>"
Else
ii = 1
Do While Not Rs.EOF
NC_Create.CreateArticle (CLng(Rs("id")))
Response.Flush
Response.Write "<table cellpadding=0 cellspacing=0 border=0 width=90% align=center><tr><td colspan=2 class=forumrow> 生成文章 [" & Rs(1) & " ] 完成。</td></tr></table>"
Response.Flush
Rs.movenext
ii = ii + 1
Loop
End If
Rs.Close
Response.Write "<meta http-equiv=""refresh"" content=""0;url='admin_article.asp'"">" & vbCrLf
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> 篇 首 页 上一页 "
Else
Response.Write "共有文章 <font COLOR=#FF0000><strong>" & totalnumber & "</strong></font> 篇 <a href=?page=1&clasid=" & Request("calsid") & ">首 页</a> "
Response.Write "<a href=?page=" & CurrentPage - 1 & "&clasid=" & Request("clasid") & ">上一页</a> "
End If
If n - CurrentPage < 1 Then
Response.Write "下一页 尾 页" & vbCrLf
Else
Response.Write "<a href=?page=" & (CurrentPage + 1) & "&clasid=" & Request("clasid") & ">下一页</a>"
Response.Write " <a href=?page=" & n & "&clasid=" & Request("clasid") & ">尾 页</a>" & vbCrLf
End If
Response.Write " 页次:<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
Response.Write " 转到:"
If GotoPageType = 1 Then
Response.Write " <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 " <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
Newasp.Name = "ClassJumpMenu"
If Newasp.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
Newasp.SqlQueryNum = Newasp.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>"
Newasp.Value = CacheJumpMenu
End If
ClassJumpMenu = Newasp.Value
End Function
Private Function DelHtmlFile(FileID)
Dim FSO
Dim FilePath
Dim Rs_Obj
If CInt(Newasp.Setting(5)) = 1 Then Exit Function
Set FSO = Server.CreateObject(Newasp.Script_FSO)
Set Rs_Obj = CreateObject("adodb.recordset")
SQL = "select id,classid from NC_Article where id in (" & FileID & ")"
Rs_Obj.Open SQL, Conn, 1, 1
Do While Not Rs_Obj.EOF
FilePath = Newasp.SetupDir & "article/catalog" & Rs_Obj(1) & "/" & Rs_Obj(0) & ".html"
If FSO.FileExists(Server.MapPath(FilePath)) Then
FSO.DeleteFile Server.MapPath(FilePath), True
End If
Rs_Obj.movenext
Loop
Rs_Obj.Close
Set Rs_Obj = Nothing
Set FSO = Nothing
End Function
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?