📄 sendnewmessage.asp
字号:
<%@ Language=VBScript %>
<%
'判断用户是否登录
if isempty(Session("ID")) then
Response.Redirect "../login.asp"
end if
'连接系统数据库
set conn = server.createobject ("adodb.connection")
conn.open "ASPData", "sa", "yourpassword"
'用户选择了发送新通知按钮
if not IsEmpty(Request.Form("SendNewMessage")) then
'判断通知发送到的对象
if Request.Form("SendMessageTo") ="Public" then
TheMessageType = "公共通知"
end if
if Request.Form("SendMessageTo") ="Department" then
TheMessageType = Request.Form("DepartmentName")
end if
if Request.Form("SendMessageTo") ="Person" then
TheMessageType =Request.Form("PersonName")
end if
'校验通知的内容
if len(Request.Form("MessageContent"))=0 then
TheMessage="通知内容不能为空,无法发送通知"
else
conn.Execute " insert into MessageBoard (MessageContent, MessageType, " _
& " MessageSender, MessageSendDate, MessageSendTime, "_
& " MessageValidTime) values (" _
& "'" & Request.Form("MessageContent") &"', " _
& "'" & TheMessageType &"', " _
& "'" & Session("Name") &"', " _
& "'" & Date &"', " _
& "'" & Time &"', " _
& "'" & Request.Form("MessageValidTime") & "') "
TheMessage="新通知已成功发送"
end if
else
TheMessage = "请在下面填写您要发送的通知的内容"
end if
set RSDepartments = conn.Execute("select DepartmentName from Departments " _
& "order by DepartmentName")
set RSPersons = conn.Execute("select Name from PSLogins order by Name")
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>内部信息交流系统</TITLE>
<META NAME="Generator" CONTENT="NetObjects Fusion 2.0.2 for Windows">
</HEAD>
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center>
<tr bgcolor=white><td valign=center ><img src="../ASPLogo3.jpg" width=796 height=100></td></tr>
</table>
<table width="800" border="0" bordercolor="#164DA8" align="center" cellpadding="0" cellspacing="0">
<tr><td height="13"><img src=".././image/banner2.jpg" width="800" height="12"></td></tr>
</table>
<br>
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center>
<tr><td colspan=3>
<font color=white>
<P ALIGN="CENTER">公司内部办公信息管理系统->内部信息交流->通知公告牌->发送新通知 [当前用户-<% response.write Session("Name") %>]
</font></td></tr>
<tr bgcolor=white >
<td><a href=".././html/home.asp"><font color="#104DAD">返回内网主页</font></a></td>
<td align=center> <font color="#104DAD" ><% response.write TheMessage %></FONT></td>
<td align=right><a href="MessageBoard.asp"><font color="#104DAD">返回上一级网页</font></a></td></tr></table>
<table width=800 border="0" bordercolor="#164DA8" align="center" cellpadding="0" cellspacing="0">
<tr><td height="13"><img src=".././image/banner2.jpg" width="100%" height="12"></td></tr>
</table>
<br>
<TABLE CELLPADDING=1 CELLSPACING=2 BORDER=1 bordercolor="#164DA8" WIDTH=800 align=center>
<TR VALIGN="center" ALIGN="center">
<TD WIDTH=35% bgcolor=#B5C7EF> <img src="../image/MessageBoard1.jpg"></td>
<td>
<form action="SendNewMessage.asp" method=post>
<table border=1 cellspacing=1 cellpadding=1 width=100%>
<tr><td><font color="#164DA8"> 此通知要发送给</font></td>
<td>
<table CELLPADDING=1 CELLSPACING=1 BORDER=1 align=center width=100%>
<tr><td width=35%><INPUT TYPE="radio" CHECKED NAME="SendMessageTo" VALUE="Public" ><font color="#164DA8">所有员工</font></td><td> </td></tr>
<tr><td><INPUT TYPE="radio" NAME="SendMessageTo" VALUE="Department" ><font color="#164DA8">某个部门</font></td>
<td>
<SELECT NAME="DepartmentName" >
<%
Do Until RSDepartments.EOF
%>
<OPTION VALUE="<% Response.Write RSDepartments("DepartmentName") %>"><% Response.Write RSDepartments("DepartmentName") %></OPTION>
<%
RSDepartments.Movenext
loop
%>
</SELECT>
</td>
</tr>
<tr><td><INPUT TYPE="radio" NAME="SendMessageTo" VALUE="Person" ><font color="#164DA8">某个员工</font></td><td>
<SELECT NAME="PersonName" >
<%
Do Until RSPersons.EOF
%>
<OPTION VALUE="<% Response.Write RSPersons("Name") %>"><% Response.Write RSPersons("Name") %></OPTION>
<%
RSPersons.Movenext
loop
%>
</SELECT>
</td></tr>
</table>
</td></tr>
<tr><td width=35%><font color="#164DA8"> 请在右边填写通知内容</font></td><td><TEXTAREA NAME="MessageContent" ROWS=10 COLS=45 ></TEXTAREA></td></tr>
<tr><td><font color="#164DA8"> 此通知有效天数</font></td>
<td>
<select name=MessageValidTime>
<%
ccounter=1
do until ccounter>31
%>
<OPTION VALUE= <% Response.Write ccounter %> >  <% Response.Write ccounter %>天  </OPTION>
<%
ccounter=ccounter+1
loop
%>
</select>
</td></tr>
</table>
</td></TR></table>
<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=1 WIDTH=800 align=center>
<TR VALIGN="top" ALIGN="center">
<TD WIDTH=100% align=center >
<INPUT TYPE="submit" NAME="SendNewMessage" VALUE="发送新通知" style="border: 1px solid #3466BB; background-color: #B6CAEB; color: #3466BB">
</TD>
</TD>
</TR>
</table>
</td>
</tr>
</table>
</FORM>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -