?? 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 align=center cellpadding=2 cellspacing=1 bordercolor="#996633" bgcolor=#164DA8>
<tr bgcolor=white>
<td valign=center bgcolor="#0066CC" >
<div align="center"><font color="#CCCCCC" size="+7" face="華文隸書"><strong>公司內部辦公信息管理系統</strong></font></div></td>
</tr>
</table>
<table width="800" border="0" bordercolor="#164DA8" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="13"> </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"><font size="2">公司內部辦公信息管理系統->內部信息交流->通知公告牌->發送新通知 [當前用戶-
<% response.write Session("Name") %>
] </font></font></td>
</tr>
<tr bgcolor=white >
<td><a href=".././html/home.asp"><font color="#104DAD" size="2">返回內網主頁</font></a></td>
<td align=center> <font color="#104DAD" size="2" >
<% response.write TheMessage %>
</FONT></td>
<td align=right><a href="MessageBoard.asp"><font color="#104DAD" size="2">返回上一級網頁</font></a></td>
</tr>
</table>
<table width=800 border="0" bordercolor="#164DA8" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="13"> </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> </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 + -