📄 admin_article.asp
字号:
<!-- #include file="conn.asp" -->
<!-- #include file="inc/const.asp" -->
<!-- #include file="inc/CHAR.asp" -->
<!-- #include file="inc/function.asp" -->
<!-- #include file="Create_Article_View_inc.asp" -->
<% Response.Cookies("mesky").path=cookies_path
Response.Cookies("mesky").Expires=Date+31
if Trim(Request.QueryString("editor"))="ubb" then
Response.Cookies("mesky")("editor")="ubb"
elseif Trim(Request.QueryString("editor"))="html" then
Response.Cookies("mesky")("editor")="html"
else
if request.Cookies("mesky")("editor")="" then Response.Cookies("mesky")("editor")="html"
end if %>
<HTML><HEAD><TITLE>后台管理 </TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="admin.css" type=text/css rel=stylesheet>
</HEAD>
<SCRIPT LANGUAGE=javascript>
<!--
function CheckForm()
{
if (myform.title.value == "")
{
alert("文章标题不能为空!");
myform.title.focus();
return (false);
}
if (myform.keys.value == "")
{
alert("文章的关键字不能为空!");
myform.keys.focus();
return (false);
}
if (myform.nfrom.value == "")
{
alert("文章出处不能为空!");
myform.nfrom.focus();
return (false);
}
if (myform.catalogid.value == "")
{
alert("文章所属栏目不能为空!");
myform.catalogid.focus();
return (false);
}
if (myform.content.value == "")
{
alert("文章内容不能为空!");
//myform.content.focus();
return (false);
}
}
//-->
</script>
<div style="position:absolute; z-index:0;">
<object id="dlgColHelperTbl" classid="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width="0px" height="0px"></object></div>
<%
if Trim(Request("action"))="add" or Trim(Request("action"))="modify" then
Response.Write("<BODY leftMargin=0 topMargin=0>")
else
if request.Cookies("mesky")("editor")="ubb" then
Response.Write("<BODY leftMargin=0 topMargin=0>")
else
Response.Write("<BODY leftMargin=0 topMargin=0 onload=""initEditor();"">")
end if
end if
%>
<!-- #include file="admin_header.asp" -->
<table width="100%" border="0" cellspacing="2">
<tr>
<td width="20%" align="center" valign="top" class="tdbgleft"><!-- #include file="Admin_Left.asp" --></td>
<td class="b1" valign="top">
<%
if cUserName="" then
msgtitle="添加文章"
msginfo="<li>操作失败!你没有登录网站系统。</li>"
Response.Write("<br>")
call Sysmsg(msgtitle,msginfo)
else
set rs=server.createobject("adodb.recordset")
Set fso = Server.CreateObject("Scripting.FileSystemObject")
select case request("action")
case "add"
call SaveAdd()
case "modify"
call SaveModify()
case "edit"
isEdit=True
call myform(isEdit)
case else
isEdit=False
call myform(isEdit)
end select
Set fso=nothing
set rs=nothing
end if
sub SaveAdd()
'response.write Content
'response.end
sql="select * from info_Article where (ArticleID is null)"
rs.open sql,conn,1,3
rs.addnew
rs("title")=Trim(Request.Form("title"))
rs("keys")=Trim(Request.Form("keys"))
rs("writer")=Trim(Request.Form("writer"))
rs("nfrom")=Trim(Request.Form("nfrom"))
splCatalogID=split(trim(request.form("catalogid")),",")
rs("RootID")=splCatalogID(0)
rs("CatalogID")=splCatalogID(1)
rs("CatalogName")=splCatalogID(2)
if request.form("images")<>"" then rs("images")=trim(request.form("images"))
rs("content")=Content
'rs("Content")=request.form("content")
rs("dateTime")=Now()
rs("Hits")=0
if Trim(Request.Form("isHot"))="yes" then
rs("isHot")=1
else
rs("isHot")=0
end if
if Request.Form("isHtml") then
rs("isHtml")=1
else
rs("isHtml")=0
end if
rs("isShow")=1
rs("UserName")=cUserName
rs("isBest")=0
rs.update
dim articleID
articleID=rs("articleid")
rs.close
sql="update info_Catalog set isUpdate=1,articleNum=articleNum+1 where CatalogId=" & splCatalogID(1)
conn.execute sql
sql="update info_Catalog set isUpdate=1,articleNum=articleNum+1 where CatalogId=" & splCatalogID(0)
conn.execute sql
'读取默认模板
sql="select ID,Article_Head,Article_foot,Article_View from SoftDown_Template where isActive=true"
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
HtmlTemplate=rs("Article_Head")&rs("Article_View")&rs("Article_foot")
isTemplate=true
end if
rs.close
if isTemplate then msginfo=Create_Article_View(articleID,HtmlTemplate)
msgtitle="添加文章"
msginfo="<li>录入文章成功!<li><a href=""Admin_Article.asp"">继续添加新文章</a>" & vbcrlf
msginfo=msginfo & "<li><a href=""Admin_Article.asp?CatalogID="&splCatalogID(1)&""">在分类:“"&splCatalogID(2)&"”中继续添加文章。</a>"
msginfo=msginfo & "<li><a href=""infoview/Article_"&ArticleID&".html"" target=""_blank"">查看文章:"&request.form("title")&"</a></li> "
call Sysmsg(msgtitle,msginfo)
end sub
sub SaveModify()
sql="select * from info_Article where ArticleID="&request.form("ArticleID")
rs.open sql,conn,1,3
rs("title")=Trim(Request.Form("title"))
rs("keys")=Trim(Request.Form("keys"))
rs("writer")=Trim(Request.Form("writer"))
rs("nfrom")=Trim(Request.Form("nfrom"))
splCatalogID=split(trim(request.form("catalogid")),",")
rs("RootID")=splCatalogID(0)
rs("CatalogID")=splCatalogID(1)
rs("CatalogName")=splCatalogID(2)
if request.form("images")<>"" then rs("images")=trim(request.form("images"))
rs("Content")=request.form("content")
if trim(request.form("updateTime"))="yes" then rs("dateTime")=Now()
if Request.Form("isHtml") then
rs("isHtml")=1
else
rs("isHtml")=0
end if
if Trim(Request.Form("isHot"))="yes" then
rs("isHot")=1
else
rs("isHot")=0
end if
rs.update
rs.close
sql="update info_Catalog set isUpdate=1 where CatalogId=" & splCatalogID(1)
if trim(request.form("updateTime"))="yes" then conn.execute sql
sql="update info_Catalog set isUpdate=1 where CatalogId=" & splCatalogID(0)
if trim(request.form("updateTime"))="yes" then conn.execute sql
'读取默认模板
sql="select ID,Article_Head,Article_foot,Article_View from SoftDown_Template where isActive=true"
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
HtmlTemplate=rs("Article_Head")&rs("Article_View")&rs("Article_foot")
isTemplate=true
end if
rs.close
if isTemplate then msginfo= Create_Article_View(request.form("ArticleID"),HtmlTemplate)
msgtitle="保存修改"
msginfo="<li>修改文章成功!<li><a href=""Admin_Article.asp"">添加新文章</a>"& vbcrlf
msginfo=msginfo & "<li><a href=""Admin_Article.asp?CatalogID="&splCatalogID(1)&""">在分类:“"&splCatalogID(2)&"”中继续添加文章。</a>"
msginfo=msginfo & "<li><a href=""infoview/Article_"&request.form("ArticleID")&".html"" target=""_blank"">查看文章:"&request.form("title")&"</a></li> "
call Sysmsg(msgtitle,msginfo)
end sub
sub myform(isEdit)
%>
<div height="0px" style="position:absolute; z-index:0; visibility: hidden;">
<form name="preview" action="preview.asp" method="post" target="_blank">
<input type=hidden name=subject value="">
<input type=hidden name=body value="">
<input type=hidden name=htmledit value="">
<input type=checkbox name=htmlcode value="1">
<input type=checkbox name=htmlcode value="2">
</form>
</div>
<form name="myform" method="post" action="Admin_Article.asp" onSubmit="return CheckForm();">
<%
if isedit then
rs.open "select * from info_Article where ArticleID=" & request("ArticleID"),conn,1,1
CatalogID=rs("CatalogID")
pubTitle="编辑文章"
HtmlBodyUrl="Admin_EditorBody.asp?ArticleID="&request("ArticleID")
else
CatalogID=request("CatalogID")
pubTitle="添加文章"
HtmlBodyUrl="Admin_EditorBody.asp"
end if %>
<input type="Hidden" name="action" value="<% If isedit then%>modify<% Else %>add<% End If %>">
<%If isedit then%>
<input type="Hidden" name="ArticleID" value="<%=request("ArticleID")%>">
<%End If%>
<table width="100%" align="center" cellpadding="3" cellspacing="1">
<tr>
<th colspan="4" bgcolor="#FFFFFF" class="tdbg1"><%=pubTitle%></th>
</tr>
<tr class="tdbg2">
<td>文章标题:</td>
<td>
<input name="title" type="text" id="title" value="<% if isedit then response.write trim(rs("title"))%>" size="35">
<font color="#FF0000">* </font></td>
<td>关 键 字:</td>
<td>
<input name="keys" type="text" id="keys" value="<% if isedit then response.write trim(rs("keys"))%>" size="28">
<font color="#FF0000">* </font></td>
</tr>
<tr class="tdbg2">
<td>文章作者:</td>
<td>
<input name="writer" type="text" id="writer" value="<% if isedit then response.write trim(rs("writer"))%>" size="35"></td>
<td>文章出处:</td>
<td>
<input name="nfrom" type="text" id="nfrom2" value="<% if isedit then response.write trim(rs("nfrom"))%>" size="28">
<font color="#FF0000">* </font></td>
</tr>
<tr class="tdbg2">
<td nowrap>所属栏目:</td>
<td>
<select name="catalogid">
<option value="">↓请选择栏目↓</option>
<%
set crs = server.CreateObject ("Adodb.recordset")
sql = "select * from info_Catalog where CatalogID in ("&getuserflag(cUserName,"article")&") order by rootid,orders"
crs.open sql,conn,1,1
do while not crs.eof
Response.Write "<option value="""&crs("RootID")&","&crs("CatalogID")&","&crs("CatalogName")&""" "
if Trim(Request("CatalogID"))<>"" then
if clng(request("CatalogID"))=crs("CatalogID") then Response.Write "selected"
end if
if isedit then
if rs("CatalogID")=crs("CatalogID") then Response.Write "selected"
end if
Response.Write ">"
if crs("depth") =1 then Response.Write " ├ "
if crs("depth") >1 then
for i=2 to crs("depth")
Response.Write " │"
next
Response.Write " ├ "
end if
Response.Write crs("CatalogName")&"</option>" & vbcrlf
crs.MoveNext
loop
crs.Close
set crs=nothing
%>
</select>
<font color="#FF0000">* </font> </td>
<td>推荐文章:</td>
<td><input name="isHot" type="checkbox" value="yes" <% if isedit then
if rs("isHot")=1 then Response.Write(" checked")
end if %>></td>
</tr>
<tr class="tdbg2">
<td nowrap>文章图片:</td>
<td colspan="3">
<input type="text" name="images" size="28" value="<% if isedit then response.write trim(rs("images"))%>">
(文章首页略缩图)</td>
</tr>
<tr class="tdbg2">
<td>文件上传:</td>
<td colspan="3">
<iframe name="ad" frameborder=0 width=100% height=40 scrolling=no src=upload.asp></iframe>
</td>
</tr>
<%
dim strContent
strContent=""
if request.Cookies("mesky")("editor")="ubb" then
if isedit then strContent=rs("content")
call UbbEditor(strContent)
else
call htmlEditor(HtmlBodyUrl)
end if
%>
</table>
<% if isedit then rs.close%>
</form>
<% end sub %>
</td>
</tr>
</table>
<!-- #include file="admin_footer.asp" -->
</BODY></HTML>
<% CloseDatabase %><!--#include file="inc/UbbEditor.asp" --><!--#include file="inc/HtmlEditor.asp" -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -