⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_news.asp

📁 政府网站集成OA办公考勤新闻发布网站信息管理会员管理
💻 ASP
字号:
<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->
<html>
<head>
<title>管理网站新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript" type="text/JavaScript">
    <!--
    function doSubmit(){
		if (document.NewForm.Title.value==""){
			alert("新闻标题不能为空!");
			return false;
		}		
		if (Content.getHTML()==""){
			alert("新闻内容不能为空!");
			return false;
		}
		return true;
	}
    //-->
</script>
<link href="../HXinclude/HX_Style.css" rel="stylesheet" type="text/css">
</head>
<body topmargin='20' leftmargin='0' bottommargin='0'>
<br>
<%
if WS_S.MemberPriv("WS_FrontSetNews")<>1 then HX_GoBack "对不起,您的权限不够!",""    
    dim CurPage,StartPageNum,EndPageNum,p,spic,pic,delsql
    Set rs = Server.CreateObject("ADODB.Recordset")
    
if request("action")="Edit" then
    id=request.querystring("id")
    rs.Open "Select * From a125_news where id="&id, conn,3,3
%>

<table width='596'  border='0' cellspacing='1' cellpadding='0' align=center bgcolor='#115F8F'><tr><td colspan='2' bgcolor=ffffff>
 <table width='100%'  border='0' cellspacing='0' cellpadding='0'><tr><td height='25' background='../hximages/titleline.gif'><font class='fontmenu'>修改新闻</font></td></tr></table>
 <table width='100%'  border='0' cellspacing='1' cellpadding='3' bgcolor='#A1BBE0'>
<form action="Admin_news.asp?Action=Modify" method="POST" name="NewForm" id="NewForm"> 
 <tr bgcolor='#FFFFFF' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#ffffff'> 
<td height="23">
&nbsp;&nbsp;标题: 
<input type="text" name="Title" size="30" value="<%=rs("Title")%>"> 
<input type=hidden name=id value="<%=rs("id")%>"> 
<input name="New_tuijian" type="checkbox" id="New_tuijian" style="border:0px" value="True" <% if rs("New_tuijian")=true then %>checked <% end if %> >推荐(首页图文显示)支持jpg不支持gif,自动生成略缩图
</td>
</tr>
 <tr bgcolor='#FFFFFF' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#ffffff'> 
<td height="24" align="left" valign="middle">&nbsp;&nbsp;图片地址:<input name="pic" type="text" id="pic" size="30" value="<%=rs("pic")%>">&nbsp;&nbsp;图片大小:<input type="text" name="url" size="15" readonly>&nbsp;&nbsp;*位于内容顶部</td>
</tr>
 <tr bgcolor='#FFFFFF' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#ffffff'> 
<td align="left" height="24" style="padding-left:12"><iframe frameborder=0 width=480 height=25 scrolling=no src="uploadfile.asp?action=news" name="news"></iframe></td>
</tr>
<input name="spic" type="hidden" id="spic" value="<%=rs("spic")%>">  
 <tr bgcolor='#FFFFFF' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#ffffff'> 
<td height="23">&nbsp;&nbsp;内容:&nbsp;&nbsp; <font color="red">*</font>注:图片上传请点图标<img src="../images/edit/Img.gif" width="22" height="22"></td>
</tr>
 <tr bgcolor='#FFFFFF' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#ffffff'> 
<td height="65"> 
<div align="center"></div>
<textarea name="Content" id="Content" style="display:none"><%=rs("Content")%></textarea> 
<IFRAME ID="Content" SRC="../editor.asp?id=Content" FRAMEBORDER="0" SCROLLING="no" WIDTH="590" HEIGHT="425"></IFRAME> 
</td>
</tr>
<tr bgcolor="#F6F6F6">
<td height="24" align=center> <input type="submit" name="Submit" value=" 提交 " onClick="return doSubmit()"> 
<input type="reset" name="reset" value=" 重置 "></td>
</tr></form>
</table>
</td></tr></table><br>
<% end if 

if request("action")="Add" then 
%>

<table width='596'  border='0' cellspacing='1' cellpadding='0' align=center bgcolor='#115F8F'><tr><td colspan='2' bgcolor=ffffff>
 <table width='100%'  border='0' cellspacing='0' cellpadding='0'><tr><td height='25' background='../hximages/titleline.gif'><font class='fontmenu'>添加新闻</font></td></tr></table>
 <table width='100%'  border='0' cellspacing='1' cellpadding='3'  bgcolor='#A1BBE0'>
<form action="Admin_news.asp?Action=Save" method="post" name="NewForm" id="NewForm">
 <tr bgcolor='#FFFFFF' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#ffffff'> 
<td height="24">
&nbsp;&nbsp;标题:
<input name="Title" type="text" id="Title" size="30"> 
<input name="New_tuijian" type="checkbox" id="New_tuijian" style="border:0px" value="True">推荐(首页图文显示) 支持jpg格式不支持gif
</td>
</tr>
 <tr bgcolor='#FFFFFF' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#ffffff'> 
<td height="24" align="left" valign="middle">&nbsp;&nbsp;图片地址:<input name="pic" type="text" id="pic" size="30" >&nbsp;&nbsp;图片大小:<input type="text" name="url" size="15" readonly>&nbsp;&nbsp;*位于新闻内容顶部</td>
</tr>
 <tr bgcolor='#FFFFFF' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#ffffff'> 
<td align="left" height="24" style="padding-left:12"><iframe frameborder=0 width=480 height=25 scrolling=no src="uploadfile.asp?action=news" name="news"></iframe></td>
</tr>
<input name="spic" type="hidden" id="spic">   
 <tr bgcolor='#FFFFFF' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#ffffff'> 
<td height="24">&nbsp;&nbsp;内容:&nbsp;&nbsp; <font color="red">*</font>注:内容图片上传请点图标<img src="../images/edit/Img.gif" width="22" height="22"></td>
</tr>
 <tr bgcolor='#FFFFFF' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#ffffff'> 
<td height="147"> <div align="center"></div>
<textarea name="Content" id="Content" style="display:none"></textarea> 
<IFRAME ID="Content" name="Content" SRC="../editor.asp?id=Content" FRAMEBORDER="0" SCROLLING="no" WIDTH="590" HEIGHT="425"></IFRAME> 
</td>
</tr>
<tr bgcolor="#F6F6F6"> 
<td height="24" align=center> <input type="submit" name="Add" value=" 添加 " onClick="return doSubmit()"><input type="reset" name="Reset" value=" 重置 "></td>
</tr></form>
</table>
</td></tr></table><br>
<% end if %>
<%
    if request("action") = "" then

    If Request.QueryString("CurPage") = "" or Request.QueryString("CurPage") = 0 then
    CurPage = 1
    Else
    CurPage = CINT(Request.QueryString("CurPage"))
    End If
    
    if WS_S.MemberPriv("WS_FrontSetadmin")=1 then
    rs.Open "Select * From a125_news Order By id DESC", conn, 1,1
    else
    rs.Open "Select * From a125_news where writerid="&LOGINUid&" Order By id DESC", conn, 1,1    
    end if
    if rs.eof and rs.bof then
    Response.Write("<P align='center'>暂时没有任何记录!该用户还没添加过新闻</P>")
    else
    RS.PageSize=16 '设置每页记录数
    Dim TotalPages
    TotalPages = RS.PageCount
    If CurPage>RS.Pagecount Then
    CurPage=RS.Pagecount
    end if
    RS.AbsolutePage=CurPage
    rs.CacheSize = RS.PageSize'设置最大记录数  
    Dim Totalcount
    Totalcount =INT(RS.recordcount)
    StartPageNum=1
    do while StartPageNum+10<=CurPage
    StartPageNum=StartPageNum+10
    Loop
    EndPageNum=StartPageNum+9
    If EndPageNum>RS.Pagecount then EndPageNum=RS.Pagecount
%>
<table width='596'  border='0' cellspacing='1' cellpadding='0' align=center bgcolor='#115F8F'><tr><td colspan='2' bgcolor=ffffff>
 <table width='100%'  border='0' cellspacing='0' cellpadding='0'><tr><td height='25' background='../hximages/titleline.gif'><font class='fontmenu'>新闻列表</font></td></tr></table>
 <table width='100%'  border='0' cellspacing='1' cellpadding='3' bgcolor='#f1f1f1'>
    <tr bgcolor='#A1BBE0' class='td4'>
    <td width="258" height="20"><div align="center">标 题</div></td>
    <td width="128" height="20"><div align="center">时 间</div></td>
    <td width="110" height="23"><div align="center">操 作</div></td>
  </tr>
<%
    I=0
    p=RS.PageSize*(Curpage-1)              
    do while (Not RS.Eof) and (I<RS.PageSize)              
    p=p+1
%>
 <tr bgcolor='#FFFFFF' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#ffffff'> 
<td height="19" align=left bordercolorlight="#C0C0C0">&nbsp;<img src="../Images/a125_doc.gif">&nbsp;<a href="../a125_news.asp?id=<%=rs("id")%>" target="_blank"><%=left(rs("Title"),18)%>...</a></td>
    <td  align="center">[<%=rs("time")%>]</td>
    <td height="23" align=middle bordercolorlight="#c0c0c0" bgcolor="#FFFFFF"><div align="center"><a href="Admin_news.asp?Action=Edit&id=<%=rs("id")%>">修改</a> 
| <a href="News_Modify.asp?id=<%=rs("id")%>"></a>
<a href="Admin_news.asp?Action=Del&id=<%=rs("id")%>">删除</a>
<a href="News_Modify.asp?id=<%=rs("id")%>">
</a></div></td>
  </tr>
<%
    I=I+1              
    RS.MoveNext              
    Loop
%>
  <tr bgcolor="#FFFFFF"> 
    <td height="23" colspan=4 align="center" bordercolorlight="#C0C0C0">页次: <font color="#CC0000"><%=CurPage%></font>/<%=TotalPages%> 
      页数: <a href="Admin_news.asp?CurPage=<%=StartPageNum-1%>">&lt;&lt;</a> 
      <% For I=StartPageNum to EndPageNum                
      if I<>CurPage then %>
      <a href="Admin_news.asp?CurPage=<%=I%>"><%=I%></a> 
<% else %>
<%=I%> 
<% end if %>
<% Next %>
<% if EndPageNum<RS.Pagecount then %>
      <a href="Admin_news.asp?CurPage=<%=EndPageNum+1%>">下页</a> 
<%end if%>
|<a href="Admin_news.asp">刷 新</a></td>
  </tr>
</table></td></tr></table>
</body>
</html>
<%
    end if
    rs.close
    set rs=nothing
    end if
%> 
<%
    if request("Action")="Save" then

    Title=WS_s.HX_Replace(request("Title"))
    Content=WS_s.HX_Replace(request("Content"))
    spic=WS_s.HX_Replace(request("spic"))
    pic=WS_s.HX_Replace(request("pic"))
    If Title="" Then
    Response.Write "<script>alert(""请输新闻标题!"");location.href=""javascript:history.back()"";</script>"
    Response.end()
    end if
    If Content="" Then
    Response.Write "<script>alert(""请输新闻内容!"");location.href=""javascript:history.back()"";</script>"
    Response.end()
    end if
    sql="select * from a125_news"
    rs.open sql,conn,3,2
    rs.addnew
    rs("Title")=Title
    rs("Content")=Content

    if Request("New_tuijian")<>"" then
    rs("New_tuijian")=Request("New_tuijian")
    else 
    rs("New_tuijian")=False
    end if
    if Request("sPic")<>""then
    rs("spic")=spic
    rs("Ispic")=1
    else
    rs("Ispic")=0
    end if
    if Request("Pic")<>""then
    rs("pic")=pic
    end if
    rs("time")=Date()
    rs("admin")=LOGINUSERNAME
    rs("department")=LOGdepartment
    rs("writerid")=LOGINUid   
    rs.update
    rs.close
    conn.close
    Set conn=nothing 
    response.redirect "Admin_news.asp"
    end if
%>
<%
    if request("Action")="Modify" then

    id=request.form("id")
    Title=WS_s.HX_Replace(request.form("Title"))
    Content=WS_s.HX_Replace(request.form("Content"))
    sPic=WS_s.HX_Replace(request.form("sPic"))
    Pic=WS_s.HX_Replace(request.form("Pic"))
    If Title="" Then
    Response.Write "<script>alert(""请输新闻标题!"");location.href=""javascript:history.back()"";</script>"
    Response.end()
    end if
    If Content="" Then
    Response.Write "<script>alert(""请输新闻内容!"");location.href=""javascript:history.back()"";</script>"
    Response.end()
    end if
    rs.open "select * from a125_news where id="&id,conn,3,2
    rs("Title")=Title
    rs("Content")=Content

    if Request("New_tuijian")<>"" then
    rs("New_tuijian")=Request("New_tuijian")
    else 
    rs("New_tuijian")=False
    end if
    if Request("sPic")<>""then
    rs("spic")=spic
    rs("Ispic")=1
    else
    rs("Ispic")=0
    end if
    if Request("Pic")<>""then
    rs("pic")=pic
    end if
    'rs("Time")=Date()

    rs.update 
    rs.close 
    conn.close
    Set conn=nothing
    response.Redirect("Admin_news.asp")
    end if 
%>
<%
    if request("Action")="Del" then

    id=Request.QueryString("id")
    delsql="delete from a125_news where id="&id
    conn.execute(delsql)
    conn.close
    Set conn=nothing
    response.redirect"Admin_news.asp"
    end if
%>
<%
    conn.close
Set conn=nothing
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -