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

📄 admin_announce.asp

📁 依蓝旅游网站管理系统Elan2008.SP2
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%
Option Explicit
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
%>
<!--#Include File="../Conn.asp"-->
<!--#Include File="Admin_CheckPurview.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href='Admin_Style.css' type='text/css' rel='stylesheet'>
<title>网站公告管理</title>
<script language="javascript" src="../js/Common.js"></script>
<script language="javascript" src="../js/InstallDir.js"></script>
</head>
<body>
<%
If EL_Admin.Purview <> 1 Then
   If EL_Admin.CheckAdminPurview(4, 3) = False Then
      EL_Admin.ShowPurviewError("对不起!您没有足够的管理权限")
   End If
End If

Dim Search_Keywords, Search_Field, CurrentPath, ArrShowType(2)

ArrShowType(0) = "两者"
ArrShowType(1) = "滚动"
ArrShowType(2) = "弹出"

Search_Keywords = EL_Common.ReplaceBadChar(EL_Common.ELRequest("Search_Keywords", 1))
Search_Field = EL_Common.ReplaceBadChar(EL_Common.ELRequest("Search_Field", 1))

If CurrentPage<1 Then  CurrentPage = 1

CurrentPath = "·您现在的位置:<a href='"& EL_CurrentScriptName &"'>公告管理首页</a> "
%>
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="Border">
  <tr>
    <td align="center" class="top_25"><strong>网站公告管理</strong></td>
  </tr>
  <tr>
    <td class="td_50">管理导航:<a href="Admin_Announce.asp">公告管理首页</a> | <a href="Admin_Announce.asp?Action=Add">添加公告</a></td>
  </tr>
</table>
<br>
<%
Select Case Action
  Case "":             Call ManageAnnounce()
  Case "Add":          Call AddAnnounce()
  Case "Save":         Call SaveAnnounce(0)
  Case "Modify":       Call ModifyAnnounce()
  Case "SaveModify":   Call SaveAnnounce(1)
  Case "SetActive":    Call SaveAnnounce(2)
  Case "Delete":       Call SaveAnnounce(3)  
  Case "SetShowType":  Call SaveAnnounce(4)  
End Select
Call EL_Common.Bottom()
Call ApplicationTerminate()

Sub SaveAnnounce(UpdateType)
  On Error Resume Next
  Dim AnnounceCmd
  Dim AnnounceID, Title, ShowType, Content, Inputer, Actived, SkinID, TemplateID, UpdateTime
  
  AnnounceID = EL_Common.ELRequest("AnnounceID", 2)
  Title = EL_Common.ELRequest("Title", 1)
  ShowType = EL_Common.ELRequest("ShowType", 2)
  Content = EL_Common.ELRequest("Content", 1)
  Inputer = EL_Common.ELRequest("Inputer", 1)
  Actived = EL_Common.ELRequest("Actived", 2)
  SkinID = EL_Common.ELRequest("SkinID", 2)
  TemplateID = EL_Common.ELRequest("TemplateID", 2)
  UpdateTime = EL_Common.ELRequest("UpdateTime", 1)  
  
  If UpdateTime = "" Then UpdateTime = Now()
  Select Case UpdateType
     Case 0, 1:
	    If Not IsDate(UpdateTime) Then
           EL_Common.ShowErrorMsg("发布日期的时间格式错误")
	       Exit Sub
        End If
	 Case Else:
	    Title = EL_Common.ELRequest("CheckObject", 1)
		Actived = EL_Common.ELRequest("SetValue", 2)
		If AnnounceID <> 0 Then Title = EL_Common.Join2String(Title, AnnounceID, ",")
  End Select
	 
  Call EL_Common.InitCommand(AnnounceCmd, "EL_SP_Announce")
  With AnnounceCmd
    .Parameters.Append .CreateParameter("RETURN", 2, 4)
	.Parameters.Append .CreateParameter("@UpdateType", 3, 1, 4, UpdateType)
	If UpdateType = 0 Then
	   .Parameters.Append .CreateParameter("@AnnounceID", 3, 2, 4)
	Else
	   .Parameters.Append .CreateParameter("@AnnounceID", 3, 1, 4, AnnounceID)
	End If
	.Parameters.Append .CreateParameter("@Title", 200, 1, 255, Title)
	.Parameters.Append .CreateParameter("@ShowType", 3, 1, 4, ShowType)
	.Parameters.Append .CreateParameter("@Content", 203, 1, EL_Common.LenParameter(Content), Content)
	.Parameters.Append .CreateParameter("@Inputer", 200, 1, 50, Inputer)
	.Parameters.Append .CreateParameter("@Actived", 11, 1, 1, Actived)
	.Parameters.Append .CreateParameter("@SkinID", 3, 1, 4, SkinID)
	.Parameters.Append .CreateParameter("@TemplateID", 3, 1, 4, TemplateID)
	.Parameters.Append .CreateParameter("@UpdateTime", 135, 1, 8, UpdateTime)
	.Execute()
  End With
  If AnnounceCmd(0) = 40 Then
     EL_Common.ShowErrorMsg("指定公告不存在")
	 Set AnnounceCmd = Nothing
	 Exit Sub
  End If
  If UpdateType = 0 Then AnnounceID = AnnounceCmd(2)
  Set AnnounceCmd = Nothing
  EL_Common.ShowScriptError()
  If UpdateType = 0 Then
     EL_Common.ShowSuccessMsg("添加公告成功<br>标&nbsp;&nbsp;题:"& EL_Common.ServerHTMLEncode(Title) &"<br>发布者:"& Inputer &"<p>【<a href='Admin_Announce.asp'>公告管理</a>】【<a href='Admin_Announce.asp?Action=Modify&AnnounceID="& AnnounceID &"'>修改公告</a>】【<a href='Admin_Announce.asp?Action=Add'>添加公告</a>】</p>")
  ElseIf UpdateType = 1 Then
     EL_Common.ShowSuccessMsg("修改公告成功<br>标&nbsp;&nbsp;题:"& EL_Common.ServerHTMLEncode(Title) &"<br>发布者:"& Inputer &"<p>【<a href='Admin_Announce.asp'>公告管理</a>】【<a href='Admin_Announce.asp?Action=Modify&AnnounceID="& AnnounceID &"'>修改公告</a>】【<a href='Admin_Announce.asp?Action=Add'>添加公告</a>】</p>")
  Else
     If ComeURL = "" Then ComeURL = "Admin_Announce.asp"
	 Response.Redirect ComeURL
  End If    
End Sub


Sub ModifyAnnounce()
On Error Resume Next
Dim AnnounceID, AnnounceCmd, rsAnnounce
AnnounceID = EL_Common.ELRequest("AnnounceID", 2)

Call EL_Common.InitCommonCmd(AnnounceCmd, rsAnnounce, "EL_Announce", "*", "AnnounceID="& AnnounceID)
rsAnnounce.Close()
If AnnounceCmd(0) <> 1 Then
   Set rsAnnounce = Nothing
   Set AnnounceCmd = Nothing
   EL_Common.ShowErrorMsg("指定公告不存在")
End If
rsAnnounce.Open()
%>
<script language="javascript">
function Check(frm){
  var CurrentMode = Editor.CurrentMode;
  if (CurrentMode == 0){
    frm.Content.value = Editor.HtmlEdit.document.body.innerHTML; 
  }
  else if(CurrentMode==1){
    frm.Content.value = Editor.HtmlEdit.document.body.innerText;
  }
  else{
    alert('公告内容处于预览状态不能保存');
    Editor.HtmlEdit.focus();
    return false;
  }
  
  if(frm.Title.value.trim()==""){
     alert("请输入公告标题");
	 frm.Title.focus();
	 return false;
  }
  
  if(frm.Content.value.trim()==""){
     alert("请输入公告内容");
	 Editor.HtmlEdit.focus();
	 return false;
  }
  
  if(frm.Inputer.value.trim()==""){
     alert("请输入发布者");
	 frm.Inputer.focus();
	 return false;
  }
  
  SubmitOnce(frm);
  return;
}
</script>
<form name="myform" action="Admin_Announce.asp" method="post" onSubmit="return Check(this)">
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="Border">
  <tr>
    <td colspan="3" class="top_25"><strong>修改公告</strong></td>
  </tr>
  <tr>
    <td width="18%" class="td_ItemName"><strong>标题</strong></td>
    <td colspan="2" class="td_25"><input name="Title" type="text" class="RulerInput" id="Title" value="<%=EL_Common.HTMLEncode(rsAnnounce("Title"))%>" size="60"></td>
  </tr>
  <tr>
    <td class="td_ItemName"><strong>显示方式</strong></td>
    <td width="30%" class="td_25"><input name="ShowType" type="radio" class="nomargin" value="1" <%=EL_Common.SetObjectChecked(1, rsAnnounce("ShowType"))%>>
      滚动
        <input name="ShowType" type="radio" class="nomargin" value="2" <%=EL_Common.SetObjectChecked(2, rsAnnounce("ShowType"))%>>
        弹出
        <input name="ShowType" type="radio" class="nomargin" value="0" <%=EL_Common.SetObjectChecked(0, rsAnnounce("ShowType"))%>>
      两者</td>
    <td width="52%" class="td_25"><input name="Actived" type="checkbox" class="nomargin" id="Actived" value="<%=EL_True%>" <%=EL_Common.SetObjectChecked("True", rsAnnounce("Actived").value)%>>
    立即激活</td>
  </tr>
  <tr>
    <td class="td_ItemName"><strong>公告内容</strong></td>
    <td colspan="2" class="td_25">
	<textarea name='Content' id="Content" style='display:none'><%=EL_Common.ServerHTMLEncode(rsAnnounce("Content"))%></textarea>
	<iframe ID='Editor' src='../editor.asp?ChannelID=<%=EL_Channel.ChannelID%>&ShowType=2&tContentid=Content' frameborder='1' scrolling='no' width='550' height='300' ></iframe>	</td>
  </tr>
  <tr>
    <td class="td_ItemName"><strong>发布者</strong></td>
    <td colspan="2" class="td_25"><input name="Inputer" type="text" id="Inputer" value="<%=rsAnnounce("Inputer")%>"></td>
  </tr>
  <tr>
    <td class="td_ItemName"><strong>配色风格</strong></td>
    <td colspan="2" class="td_25">
	<select name="SkinID" id="SkinID">
      <option value="0">使用系统默认</option>
      <%=EL_Common.SkinList(rsAnnounce("SkinID"))%>
    </select>
	</td>
  </tr>
  <tr>
    <td class="td_ItemName"><strong>页面模板</strong></td>
    <td colspan="2" class="td_25">
	<select name="TemplateID" id="TemplateID">
      <option value="0">使用系统默认</option>
      <%=EL_Common.TemplateList(0, 19, rsAnnounce("TemplateID"))%>
    </select>
	</td>
  </tr>
  <tr>
    <td class="td_ItemName"><strong>发布日期</strong></td>
    <td colspan="2" class="td_25"><input name="UpdateTime" type="text" id="UpdateTime" value="<%=rsAnnounce("UpdateTime")%>">
      <span class="redText">格式如:2007-1-20 11:20:23</span></td>
  </tr>
  <tr>
    <td class="td_ItemName">&nbsp;</td>
    <td colspan="2" class="td_50"><input type="submit" name="Submit" value="保存修改">
      <input type="button" name="Submit2" value="返回上页" onClick="history.back()">
      <input name="Action" type="hidden" id="Action" value="SaveModify">
      <input name="AnnounceID" type="hidden" id="AnnounceID" value="<%=AnnounceID%>"></td>
  </tr>
</table>
</form>
<%
rsAnnounce.Close()
Set rsAnnounce = Nothing
Set AnnounceCmd = Nothing
EL_Common.ShowScriptError()
End Sub


Sub ManageAnnounce()
On Error Resume Next
Dim ManageCmd, rsAnnounce, StrFields, StrCondition
Dim PageCounts, RowCount, TotalRowCount

StrFields = "AnnounceID,Title,ShowType,Inputer,Actived,UpdateTime"
StrCondition = "1=1 "

If Search_Keywords<>"" And Search_Field<>"" Then 
   StrCondition = StrCondition &"And EL_Announce."& Search_Field &" Like '%"& Search_Keywords &"%' "
End If

Call EL_Common.InitCommand(ManageCmd, "EL_SP_SplitPage")
With ManageCmd
  .Parameters.Append .CreateParameter("RETURN", 3, 4, 4)
  .Parameters.Append .CreateParameter("@Tables", 200, 1, 20, "EL_Announce")
  .Parameters.Append .CreateParameter("@PrimaryKey", 200, 1, 20, "AnnounceID")
  .Parameters.Append .CreateParameter("@Sort", 200, 1, 30, "AnnounceID DESC")
  .Parameters.Append .CreateParameter("@CurrentPage", 3, 1, 4, CurrentPage)
  .Parameters.Append .CreateParameter("@PageSize", 3, 1, 4, PageSizes)
  .Parameters.Append .CreateParameter("@Fields", 200, 1, 1000, StrFields)
  .Parameters.Append .CreateParameter("@Filter", 200, 1, 1000, StrCondition)
  .Parameters.Append .CreateParameter("@Group", 200, 1, 1, "")
  .Parameters.Append .CreateParameter("@TotalRowCount", 3, 2, 4)
  .Parameters.Append .CreateParameter("@PageCount", 3, 2, 4)
  Set rsAnnounce = .Execute()
End With

rsAnnounce.Close()
RowCount = ManageCmd(0)
TotalRowCount = ManageCmd(9)
PageCounts = ManageCmd(10)
If Search_Keywords<>"" And Search_Field<>"" Then 
   CurrentPath = CurrentPath &">> 公告搜索 >> 关键字:<span class=redtext>"& Search_Keywords &"</span>"
End If

%>
<script language="javascript">
function CheckedAll(){
  for (var i=0;i<document.myform.elements.length;i++){
    var e = document.myform.elements[i];
    if (e.type == 'checkbox' && e.name=='CheckObject' && e.disabled == false){
       e.checked = true;
    }
  }
  getObject("myselect").innerHTML = "[<a href='javascript:CancelAll()'>取消</a>]";

⌨️ 快捷键说明

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