<!--#include file="conn.asp"-->
<!--#include file="checkright.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
body { margin-left: 0px;margin-top: 0px; background-color:#99FF66}
table {
padding: 2px;
font-style: normal;
color: #0000FF;
font-size: 14px;
font-weight: normal;
}
td { text-align: center;}
.tdleft {
text-align: left;
}
.tdright {
text-align: right;
}
-->
</style>
</head>
<%
dim columnright,statearticleid
columnright=session("userright")
if columnright="" then
response.Redirect"admin_index.asp?errcode=1"
else
usercolumnright=cint(right(trim(columnright),1))
end if
if usercolumnright<"2" then
response.Redirect"admin_index.asp?errcode=1"
end if
if request("articleid")<>"" then
articleid=clng(trim(request("articleid")))
statearticleid=articleid
else
columnid=""
end if
call checkarticleright(statearticleid)
sub articleadd()
response.Write"<tr><td><table>"
response.Write"<tr><td>文章添加</td></tr>"
response.Write"<form name='myform' method='post' action='admin_articleedit.asp?type=add'>"
response.Write"<tr><td>文章所属栏目</td><td><select name=articlecolumnname>"
call getcolumnlist()
for num=1 to ubound(Arraycolumnlist)
response.Write"<option value='"&Arraycolumnlist(num)&"'>"&Arraycolumnlist&"</option>"
next
response.Write"</selet></td></tr>"
response.Write"<tr><td>标题:</td><td><input type='text' name='articletitle'></td></tr>"
response.Write"<tr><td>作者:</td><td><input type='text' name='articleauthor'></td></tr>"
response.Write"<tr><td>关键字:</td><td><input type='text' name='articlekeyword'></td></tr>"
response.Write"<tr><td>摘要:</td><td></td><textarea name='articleabstruct' cols='14' rows='10'></textarea></tr>"
response.Write"<tr><td>内容:</td><td><textarea name='Content' style='display:none'></textarea><iframe ID='editor' src='editor.asp' frameborder=1 scrolling=no width='600' height='405'></iframe></td></tr>"
response.Write"<tr><td><input type='submit' value='提交'></td></tr>"
response.Write"</form></table></tr></td>"
end sub
sub articleaddtrue()
if request.Form("articletitle")<>"" then
articletitle=request.Form("articletitle")
articleauthor=request.Form("articleauthor")
articlekeyword=request.Form("articlekeyword")
articleadstruct=request.Form("articleadstruct")
articlecontent=request.Form("articlecontent")
articleaddername=session("user")
articleinputtime=now()
articlecolumnname=request.Form("articlecolumnname")
set rsarticleadd=Server.CreateObject("Adodb.Recordset")
sqlarticleadd="SELECT * from inf_article"
rsarticleadd.open sqlarticleadd,conn,1,3
rsarticleadd.addnew
rsarticleadd("ArticleTitle")= articletitle
rsarticleadd("ArticleAuthor")= articleauthor
rsarticleadd("ArticleKeyWord")= articlekeyword
rsarticleadd("ArticleAbstruct")= articleadstruct
rsarticleadd("ArticleContent")= articlecontent
rsarticleadd("ArticleAdderName")= articleaddername
rsarticleadd("ArticleInputTime")= articleinputtime
rsarticleadd("ArticleColumnName")= articlecolumnname
rsarticleadd.update
if err.number=0 then
response.Write"添加成功"
else
response.Redirect"admin_index.asp?errcode=3"
end if
end if
end sub
sub articledelete(articleid)
articleid=cint(articleid)
set rsdeletearticle=Server.CreateObject("Adodb.Recordset")
sqldeletearticle="SELECT * from inf_Article where ArticleId="&articleid
rsdeletearticle.open sqldeletearticle,conn,1,3
rsdeletearticle.delete
rsdeletearticle.update
rsdeletearticle.close
set rsdeletearticle=nothing
if err.number=0 then
response.Write"删除成功"
else
response.Redirect"admin_index.asp?errcode=3"
end if
end sub
sub articlemodify(articleid)
set rsmodifyarticle=Server.CreateObject("Adodb.Recordset")
sqlmodifyarticle="SELECT * from inf_Article where ArticleId="&articleid
rsmodifyarticle.open sqlmodifyarticle,conn,1,3
articletitle=rsmodifyarticle("ArticleTitle")
articleauthor=rsmodifyarticle("ArticleAuthor")
articlekeyword=rsmodifyarticle("ArticleKeyWord")
articleadstruct=rsmodifyarticle("ArticleAbstruct")
articlecontent=rsmodifyarticle("ArticleContent")
articlecolumnname=rsmodifyarticle("ArticleColumnName")
response.Write"<tr><td><table>"
response.Write"<tr><td>文章修改</td></tr>"
response.Write"<form name='myform' method='post' action='admin_articleedit.asp?type=add'>"
response.Write"<tr><td>文章所属栏目</td><td><select name='articlecolumnname'>"
call getcolumnlist() ‘
调用函数处,得到栏目列表
for num=0 to ubound(Arraycolumnlist)-1
if instr(Arraycolumnlist(num),articlecolumnname,1)<>0 then
response.Write"<option value='"&Arraycolumnlist(num)&"' selected>"&Arraycolumnlist&"</option>"
else
response.Write"<option value='"&Arraycolumnlist(num)&"'>"&Arraycolumnlist&"</option>"
end if
next
response.Write"</selet></td></tr>"
response.Write"<tr><td>标题</td><td><input type='text' name='articletitle' value='"&articletitle&"'></td></tr>"
response.Write"<tr><td>作者</td><td><input type='text' name='articleauthor' value='"&articleauthor&"'></td></tr>"
response.Write"<tr><td>关键字</td><td><input type='text' name='articlekeyword' value='"&articlekeyword&"'></td></tr>"
response.Write"<tr><td>摘要</td><td></td><textarea name='articleabstruct' cols='14' rows='10'>"&articleadstruct&"</textarea></tr>"
response.Write"<tr><td>内容</td><td><textarea name='Content' style='display:none'>"&articlecontent&"</textarea><iframe ID='editor' src='editor.asp' frameborder=1 scrolling=no width='600' height='405'></iframe></td></tr>"
response.Write"<tr><td><input type='submit' value='提交'></td></tr>"
response.Write"</form></table></tr></td>"
end sub
sub articlemodifytrue()
if request.Form("articletitle")<>"" then
articletitle=request.Form("articletitle")
articleauthor=request.Form("articleauthor")
articlekeyword=request.Form("articlekeyword")
articleadstruct=request.Form("articleadstruct")
articlecontent=request.Form("articlecontent")
articlecolumnname=request.Form("articlecolumnname")
set rsarticlemodify=Server.CreateObject("Adodb.Recordset")
sqlarticlemodify="SELECT * from inf_article"
rsarticlemodify.open sqlarticleadd,conn,1,3
rsarticlemodify.addnew
rsarticlemodify("ArticleTitle")= articletitle
rsarticlemodify("ArticleAuthor")= articleauthor
rsarticlemodify("ArticleKeyWord")= articlekeyword
rsarticlemodify("ArticleAbstruct")= articleadstruct
rsarticlemodify("ArticleContent")= articlecontent
rsarticlemodify("ArticleColumnName")= articlecolumnname
rsarticlemodify.update
if err.number=0 then
response.Write"修改成功"
else
response.Redirect"admin_index.asp?errcode=3"
end if
end if
end sub
%>
<body>
<table width="779" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="779" border="0" cellspacing="0" cellpadding="0" bgcolor="#CCFBAA">
<tr>
<td colspan="4" background="image/columtop.gif" align="left"><span style="font-weight:bolder;font-size:16px">文章管理</span></td>
</tr>
<tr>
<td><span style="font-weight:bolder">管理导航</span></td>
<td>修改文章</td>
<td>添加文章</td>
</tr>
<tr>
<td> </td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="779" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCFBAA">
<tr>
<td background="image/seccolume.gif">文章编辑</td>
</tr>
<%
if request("type")<>"" then
if request("type")="add" then
call articleadd()
else
call articleaddtrue()
end if
if request("type")="del" then
if request("articleid")<>"" then
call articledelete(articleid)
else
response.Redirect"admin_index.asp?errcode=4"
end if
end if
if request("type")="modify" then
if request("articleid")<>"" then
call articlemodify(articleid)
else
call articlemodifytrue()
end if
end if
else
response.Redirect"admin_index.asp?errcode=4"
end if
%>
<tr>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
[此贴子已经被作者于2006-8-22 11:56:35编辑过]