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

📄 admin_announce.asp

📁 个人网站比较简短
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!--#include file="Admin_Common.asp"-->
<!--#include file="Admin_CommonCode_ContentEx.asp"-->
<%
'**************************************************************
' Software name: PowerEasy SiteWeaver
' Web: http://www.powereasy.net
' Copyright (C) 2005-2008 佛山市动易网络科技有限公司 版权所有
'**************************************************************

Const NeedCheckComeUrl = True   '是否需要检查外部访问

Const PurviewLevel = 2      '0--不检查,1--超级管理员,2--普通管理员
Const PurviewLevel_Channel = 0   '0--不检查,1--频道管理员,2--栏目总编,3--栏目管理员
Const PurviewLevel_Others = "Announce"   '其他权限

Dim ItemName, ID


strFileName = "Admin_Announce.asp?Action=" & Action
ItemName = "公告"
ID = Trim(Request("ID"))
If IsValidID(ID) = False Then
    ID = ""
End If

Response.Write "<html><head><title>公告管理</title>" & vbCrLf
Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbCrLf
Response.Write "<link href='Admin_Style.css' rel='stylesheet' type='text/css'>" & vbCrLf
Response.Write "</head>" & vbCrLf
Response.Write "<body leftmargin='2' topmargin='0' marginwidth='0' marginheight='0'>" & vbCrLf
Response.Write "<table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>" & vbCrLf
Call ShowPageTitle("网 站 公 告 管 理", 10023)
Response.Write "  <tr class='tdbg'>" & vbCrLf
Response.Write "    <td width='70' height='30'><strong>管理导航:</strong></td>" & vbCrLf
Response.Write "    <td><a href='Admin_Announce.asp'>公告管理首页</a>&nbsp;|&nbsp;<a href='Admin_Announce.asp?Action=Add'>添加新公告</a>"
Response.Write "    </td>" & vbCrLf
Response.Write "  </tr>" & vbCrLf
Response.Write "</table>" & vbCrLf

Select Case Action
Case "Add"
    Call Add
Case "Modify"
    Call Modify
Case "SaveAdd", "SaveModify"
    Call SaveAnnounce
Case "SetNew", "CancelNew", "SetShowType", "Move", "Del"
    Call SetProperty
Case Else
    Call main
End Select
If FoundErr = True Then
    Call WriteEntry(2, AdminName, "公告管理操作失败,失败原因:" & ErrMsg)
    Call WriteErrMsg(ErrMsg, ComeUrl)
End If
Response.Write "</body></html>"
Call CloseConn


Sub main()
    Dim rs, sql
    Call ShowJS_Main(ItemName)
    Response.Write "<br><table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "  <tr class='title'>"
    Response.Write "    <td height='22'>" & GetChannelList(ChannelID) & "</td>"
    Response.Write "  </tr>"
    Response.Write "</table><br>"
    Response.Write "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>"
    Response.Write "  <tr>"
    Response.Write "    <td height='22'>"
    Call ShowManagePath(ChannelID)
    Response.Write "  </td></tr>"
    Response.Write "</table>"
    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr>"
    Response.Write "  <form name='myform' method='Post' action='Admin_Announce.asp' onsubmit='return ConfirmDel();'>"
    Response.Write "  <td><table class='border' border='0' cellspacing='1' width='100%' cellpadding='0'>"
    Response.Write "  <tr class='title'>"
    Response.Write "    <td width='30' height='22' align='center'><strong>选中</strong></td>"
    Response.Write "    <td width='30' height='22' align='center'><strong>ID</strong></td>"
    Response.Write "    <td height='22' align='center'><strong>标 题</strong></td>"
    Response.Write "    <td width='60' height='22' align='center'><strong>最新公告</strong></td>"
    Response.Write "    <td width='60' height='22' align='center'><strong>显示方式</strong></td>"
    Response.Write "    <td width='60' height='22' align='center'><strong>发布人</strong></td>"
    Response.Write "    <td width='120' height='22' align='center'><strong>发布时间</strong></td>"
    Response.Write "    <td width='60' height='22' align='center'><strong>有效期</strong></td>"
    Response.Write "    <td width='150' height='22' align='center'><strong>操作</strong></td>"
    Response.Write "  </tr>"

    sql = "select * from PE_Announce"
    If ChannelID >= -1 Then
        sql = sql & " where ChannelID=" & ChannelID
    End If
    sql = sql & " order by IsSelected desc,ID desc"
    Set rs = Conn.Execute(sql)
    If rs.BOF And rs.EOF Then
        Response.Write "<tr class='tdbg'><td colspan='20' align='center'><br>没有任何公告!<br><br></td></tr>"
    Else
        Do While Not rs.EOF
            Response.Write "    <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
            Response.Write "      <td width='30' align='center'><input name='ID' type='checkbox' onclick='unselectall()' value='" & rs("ID") & "'></td>"
            Response.Write "      <td width='30' align='center'>" & rs("ID") & "</td>"
            Response.Write "      <td><a href='Admin_Announce.asp?Action=Modify&ID=" & rs("ID") & "'"
            Response.Write "      title='公告内容:" & Left(nohtml(rs("content")), 200) & "'>" & rs("Title") & "</a></td>"
            Response.Write "      <td width='60' align='center'>"
            If rs("IsSelected") = True Then
                Response.Write "<font color=green>新</font>"
            End If
            Response.Write "      </td>"
            Response.Write "      <td width='60' align='center'>"
            If rs("ShowType") = 0 Then
                Response.Write "全部"
            ElseIf rs("ShowType") = 1 Then
                Response.Write "滚动"
            ElseIf rs("ShowType") = 2 Then
                Response.Write "弹出"
            End If
            Response.Write "      </td>"
            Response.Write "      <td width='60' align='center'>" & rs("Author") & "</td>"
            Response.Write "      <td width='120' align='center'>" & rs("DateAndTime") & "</td>"
            Response.Write "      <td width='60' align='center'>"
            If rs("OutTime") > 0 Then
                Response.Write rs("OutTime") & "天"
            End If
            Response.Write "      </td>"
            Response.Write "      <td width='150' align='center'>"
            Response.Write "      <a href='Admin_Announce.asp?Action=Modify&ID=" & rs("ID") & "'>修改</a>&nbsp;"
            Response.Write "      <a href='Admin_Announce.asp?Action=Del&ID=" & rs("ID") & "' onClick=""return confirm('确定要删除此公告吗?');"">删除</a>&nbsp;"
            If rs("IsSelected") = False Then
                Response.Write "      <a href='Admin_Announce.asp?Action=SetNew&ID=" & rs("ID") & "'>设为最新</a>"
            Else
                Response.Write "      <a href='Admin_Announce.asp?Action=CancelNew&ID=" & rs("ID") & "'>取消最新</a>"
            End If
            Response.Write "      </td>"
            Response.Write "    </tr>"
            rs.MoveNext
        Loop
    End If
    rs.Close
    Set rs = Nothing
    Response.Write "</table>"
    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0'>"
    Response.Write "  <tr>"
    Response.Write "    <td width='130' height='30'><input name='chkAll' type='checkbox' id='chkAll' onclick='CheckAll(this.form)' value='checkbox'>选中所有的公告</td><td>"
    Response.Write "<input type='submit' value='删除选定的公告' name='submit' onClick=""document.myform.Action.value='Del'"">&nbsp;&nbsp;"
    Response.Write "<input type='submit' value='设置选定公告显示方式' name='submit' onClick=""document.myform.Action.value='SetShowType'"">"
    Response.Write "<select name='ShowType'>"
    Response.Write "  <option value='0'>全部</option>"
    Response.Write "  <option value='1'>滚动</option>"
    Response.Write "  <option value='2'>弹出</option>"
    Response.Write "</select>&nbsp;&nbsp;"
    Response.Write "<input type='submit' value='将选定的公告移动到 ->' name='submit' onClick=""document.myform.Action.value='Move'"">"
    Response.Write "<select name='ChannelID' id='ChannelID'>" & GetChannel_Option(0) & "</select>"
    Response.Write "<input name='Action' type='hidden' id='Action' value=''>"
    Response.Write "  </td></tr>"
    Response.Write "</table>"
    Response.Write "</td>"
    Response.Write "</form></tr></table>"
    Response.Write "<br><b>说明:</b><br>&nbsp;&nbsp;&nbsp;&nbsp;只有将公告设为最新公告后才会在前台显示"
    Response.Write "<br><br>"
End Sub

Sub ShowJS_AddModify()
    Response.Write "<script language = 'JavaScript'>" & vbCrLf
    Response.Write "function CheckForm(){" & vbCrLf
    Response.Write "  if (document.myform.Title.value==''){" & vbCrLf
    Response.Write "     alert('公告标题不能为空!');" & vbCrLf
    Response.Write "     document.myform.Title.focus();" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  var CurrentMode=editor.CurrentMode;" & vbCrLf
    Response.Write "  if (CurrentMode==0){" & vbCrLf
    Response.Write "    document.myform.Content.value=editor.HtmlEdit.document.body.innerHTML; " & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  else if(CurrentMode==1){" & vbCrLf
    Response.Write "    document.myform.Content.value=editor.HtmlEdit.document.body.innerText;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.Content.value==''){" & vbCrLf
    Response.Write "     alert('公告内容不能为空!');" & vbCrLf
    Response.Write "     editor.HtmlEdit.focus();" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  return true;  " & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "</script>" & vbCrLf
End Sub

Sub Add()
    Call ShowJS_AddModify
    Response.Write "<form method='POST' name='myform' onSubmit='return CheckForm();' action='Admin_Announce.asp' target='_self'>"
    Response.Write "  <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "    <tr class='title'>"
    Response.Write "      <td height='22' colspan='2' align='center'><strong>添 加 公 告</strong></td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td width='20%' align='right'>所属频道:</td>"
    Response.Write "      <td width='80%'>"
    Response.Write "        <select name='ChannelID' id='ChannelID'>" & GetChannel_Option(0) & "</select>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td align='right'>标题:</td>"
    Response.Write "      <td>"
    Response.Write "        <input type='text' name='Title' size='66' id='Title' value=''>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td align='right'>内容:</td>"
    Response.Write "      <td>"
    Response.Write "       <textarea name='Content' id='Content' style='display:none' ></textarea>"
    Response.Write "       <iframe ID='editor' src='../editor.asp?ChannelID=1&ShowType=2&tContentid=Content' frameborder='1' scrolling='no' width='480' height='280' ></iframe>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td align='right'>发布人:</td>"
    Response.Write "      <td>"
    Response.Write "        <input name='Author' type='text' id='Author' value='" & AdminName & "' size='20' maxlength='20'>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td align='right'>发布时间:</td>"
    Response.Write "      <td>"
    Response.Write "        <input name='DateAndTime' type='text' id='DateAndTime' value='" & Now() & "' size='20' maxlength='20'>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td align='right'>有效期:</td>"
    Response.Write "      <td>"
    Response.Write "        <input name='OutTime' type='text' id='OutTime' value='1' size='10' maxlength='20'> 天(为0时,表示永远有效)"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td align='right'>显示类型:</td>"
    Response.Write "      <td>" & GetShowType_Option(1) & "</td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td align='right'>&nbsp;</td>"
    Response.Write "      <td>"
    Response.Write "        <input name='IsSelected' type='checkbox' id='IsSelected' value='yes' checked>"
    Response.Write "        设为最新公告</td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td height='40' colspan='2' align='center'>"
    Response.Write "        <input name='Action' type='hidden' id='Action' value='SaveAdd'>"
    Response.Write "        <input type='submit' name='Submit' value=' 添 加 '>"
    Response.Write "      </td>"

⌨️ 快捷键说明

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