📄 monitor.inc
字号:
<%
'************************************************************************************************
' 文件名: monitor.inc
' Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司
'
' 创建人 : 周秋舫
' 日 期 : 2002-05-13
' 修改历史 :
' ****年**月**日 ****** 修改内容:**************************************************
' 功能描述 : 监视器(在线人员和实时消息)monitor.asp的包含文件
' SerialOfNewMsgFromDB
' DealNewMsgs(msglist)
' MsgRecords
' OnlineRecords
' 版 本 :
'************************************************************************************************
''*********************************************************************************************
'' 常量定义
'' -------------------------------------------------------------------------------------------------------------------------------------
'Const SHOW_MSG = "1"
'' ***********************************************************************************************
'' 函数名:SerialsOfNewMsgFromDB
'' 功 能:查询数据库中t_msg的收件箱中的未通知新消息
'' 输 入:(无)
'' 输 出:以逗号分隔的各未通知消息的序列号
'' -------------------------------------------------------------------------------------------------------------------------------------
function SerialsOfNewMsgFromDB()
dim sSQL, crs, rs, sMsgSerial
dim sTemp : sTemp = ""
'' 我先找到我所有未通知的消息
sSQL = "select serial from t_msg where emp_serial = " & sMyEmpSerial & _
" and folder in (" & IN_BOX & "," & INBOX_BULLETIN & "," & INBOX_MEETING & "," & INBOX_APPROVE & "," & INBOX_TASK & ")" & _
" and status = " & MSG_UNINFORMED
set crs = New CRecordset
set rs = crs.Open(dbLocal, sSQL)
iRecords = 0
while not rs.eof
iRecords = iRecords + 1
sMsgSerial = crs.GetValue("serial")
if sTemp <> "" then sTemp = sTemp & ","
sTemp = sTemp & sMsgSerial
'' 我取到了这个消息序列号,我就把这条消息更新为已通知未读状态
sSQL = "update t_msg set status = " & MSG_INFORMED & " where serial = " & sMsgSerial
''Response.Write iRecords & ": " & sSQL & "<br>" & vbLF
call ExecuteSQL(dbLocal, sSQL)
rs.movenext
wend
crs.Close()
SerialsOfNewMsgFromDB = sTemp
end function
'' ***********************************************************************************************
'' 函数名:DealNewMsgs
'' 功 能:处理新消息,根据参数option显示最新消息列表和/或最新消息的详细内容
'' 输 入:msglist : 新消息的消息序列号列表,消息序列号之间以逗号分隔
'' 输 出:(无)
'' -------------------------------------------------------------------------------------------------------------------------------------
sub DealNewMsgs(msglist)
dim j, arrayMsg, sMsgSerial, iRecords
arrayMsg = Split(msglist, ",")
iRecords = UBound(arrayMsg) + 1
if iRecords = 0 then exit sub '' 如果没有新消息,则立即返回
Response.Write "<script language=""javascript"">" & vbLF
'' 打开新消息窗口,显示消息详细内容
if Not IsEmpty(pMsgOption) then
for j = 0 to UBound(arrayMsg) step 1
Response.Write vbTab & "window.open('msg_p.asp?msg_serial=" & arrayMsg(j) & "','','width=500,height=400,scrollbar=yes,resizable=yes');" & vbLF
next
end if
Response.Write "</script>" & vbLF
end sub
''*********************************************************************************************
'' 函数名:MsgRecords()
'' 功 能:显示最新的若干条消息
'' 输 入:(无)
'' 输 出:若干条消息
''----------------------------------------------------------------------------------------------------------------------------------
function MsgRecords()
dim sSQL, crs, rs, iCounter
dim sMsgSerial, sSender, sReceiver, sSendTime, sSubject, sContent, sFolder
dim sTemp
dim sMsgImg
'' 选出最新的10条消息
sSQL = "select * from t_msg" & _
" where emp_serial = " & sMyEmpSerial & _
" and folder in (" & IN_BOX & "," & INBOX_BULLETIN & "," & INBOX_MEETING & "," & INBOX_APPROVE & "," & INBOX_TASK & ")" & _
" order by status asc, send_time desc, folder asc"
set crs = New CRecordset
set rs = crs.Open(dbLocal, sSQL)
iCounter = 0
sTemp = ""
while not rs.eof and iCounter < iRows
iCounter = iCounter + 1
sMsgSerial = crs.GetValue("serial")
sSender = crs.GetValue("sender")
sSendTime = crs.GetValue("send_time")
sReceiver = crs.GetValue("receiver")
sSubject = crs.GetValue("subject")
sContent = crs.GetValue("content")
sFolder = crs.GetValue("folder")
sFolder = FolderName(sFolder)
sMsgImg = crs.GetValue("status")
if sMsgImg <= 2 then
sMsgImg = "<img border=0 src=""images/newmail.gif"" height=16 width=16>"
else
sMsgImg = "<img border=0 src=""images/mail.gif"" height=16 width=16>"
end if
sTemp = sTemp & _
"<tr title=""[" & sFolder & "]" & vbLF & _
"发件人 :" & TransEmpSerial(dbLocal, sSender) & vbLF & _
"发送时间:" & FormatDT(sSendTime, "yyyy-mm-dd hh:mm") & vbLF & _
"收件人 :" & TransEmpSerial(dbLocal, sReceiver) & vbLF & _
"主 题 :" & sSubject & vbLF & _
"内 容 :" & sContent & """" & _
" height=20>" & _
"<td align=center>" & sMsgImg & "</td>" & vbLF & _
"<td nowrap><a" & _
" style=""cursor:hand""" & _
" onclick=""javascript:window.open('msg_p.asp?msg_serial=" & sMsgSerial & "&', '','width=500,height=400,scrollbar=yes,resizable=yes')""" & _
" onmouseover=""this.style.color='red';this.style.backgroundColor='yellow';""" & _
" onmouseout=""this.style.color='black';this.style.backgroundColor='#99ccff';"">" & sSubject & "</a></td>" & vbLF & _
"</tr>" & vbLF
rs.movenext
wend
crs.Close()
MsgRecords = sTemp
end function
''*********************************************************************************************
'' 函数名:OnlineRecords()
'' 功 能:显示留言信息
'' 输 入:(无)
'' 输 出:若干条信息
''----------------------------------------------------------------------------------------------------------------------------------
function OnlineRecords()
dim sSQL, crs, rs, iCounter
dim sAccountId, sEmpName, sLeaveTime, sLeaveInfor
dim sTemp
'' 选出所有留言信息
sSQL = "select t1.account_id, hostname, login_status, online_status" & _
", login_time, leave_time, logout_time, leave_infor, t2.name from t_onlinestatus t1" & _
" left join t_employee t2 on t2.serial = t1.emp_serial" & _
" left join t_account t3 on t3.emp_serial = t1.emp_serial" & _
" where t3.status = 0" & _
" and t2.co_id = 1 and t2.isdummy = 0 and t2.dismissed = 0" & _
" and leave_infor <> '' and leave_infor is not null" & _
" order by t2.name"
set crs = New CRecordset
set rs = crs.Open(dbLocal, sSQL)
iCounter = 0
sTemp = ""
while not rs.eof
sAccountId = crs.GetValue("account_id")
sEmpName = crs.GetValue("name")
sLeaveInfor = crs.GetValue("leave_infor")
sLeaveTime = crs.GetValue("leave_time")
sTemp = sTemp & _
"<tr title=""[" & sEmpName & "]" & vbLF & _
"留言时间:" & FormatDT(sLeaveTime, "yyyy-mm-dd hh:mm") & vbLF & _
"留言内容:" & sLeaveInfor & vbLF & _
""" style=""cursor:hand"" height=20>" & vbLF & _
"<td align=right><img border=0 src=""images/toc_endnode.gif"" height=11 width=11> </td>" & vbLF & _
"<td nowrap>" & sEmpName & "·" & sLeaveInfor & " </td>" & vbLF & _
"</tr>" & vbLF
rs.movenext
wend
crs.Close()
OnlineRecords = sTemp
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -