📄 send.inc
字号:
'' 以下根据MsgId取出msg_serial
pMsgSerial = DLookUp(dbLocal, "t_msg", "serial", "msg_id = " & ToSQL(sMsgId, "Text"))
else '' 再次保存到草稿箱,作更新动作
sSQL = "update t_msg" & _
" set subject = " & ToSQL(sSubject, "Text") & _
", content = " & ToSQL(sContent, "Text") & _
", send_time = " & ToSQL(now, "Text") & _
", receiver = " & ToSQL(sReceiver, "Text") & _
" where serial = " & ToSQL(pMsgSerial, "Number")
''Response.Write sSQL & "<br>"
call ExecuteSQL(dbLocal, sSQL)
end if
end sub
Sub SendMessage()
dim sSQL, sFolder, sEmpSerial
dim sParentMsgId : sParentMsgId = GetParam("parent_msg_id")
dim sMsgType : sMsgType = GetParam("msg_type")
dim sSubject : sSubject = GetParam("subject")
dim sContent : sContent = GetParam("content")
dim sSender : sSender = GetEmpSerial()
dim sReceiver : sReceiver = GetParam("receiver_serial")
' dim sSendTime : sSendTime = now()
' dim sStatus
if IsEmpty(sSubject) and IsEmpty(sContent) then sSubject = "(无内容)"
'' 调用../include/message.inc中的函数CommonSendMsg发送消息
call CommonSendMsg(MSG_COMMON, sParentMsgId, sSubject, sContent, sSender, sReceiver)
' dim sMsgId : sMsgId = NewMsgId
'' 如果pMsgSerial为空,则不是从草稿箱的消息,发送消息的过程为 insert 到我的发件箱,insert 到其他人的收件箱
'' 如果pMsgSerial为空,则是从草稿箱中取出的消息,发送的过程为将消息从草稿箱中移到我的发件箱中,
'' 即更新folder, msg_id 和 send_time(也可以在我的发件箱中 insert 一条记录,从草稿箱中删除一条记录),并insert 到其他人的收件箱
' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' '' 一条记录保存到我的发件箱
' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' sEmpSerial = GetEmpSerial() '' 消息的主人是我自己
' sFolder = OUT_BOX '' 常量 OUT_BOX 在 msg.inc 中有定义,表示发件箱
' sStatus = MSG_READ '' 常量 MSG_READ 在 msg.inc 中有定义,表示状态为已读
' sSQL = "insert into t_msg(emp_serial, msg_id, msg_type, subject, content, folder, sender, receiver, send_time, parent_msg_id, status)" & _
' " values(" & ToSQL(sEmpSerial, "Number") & _
' ", " & ToSQL(sMsgId, "Text") & _
' ", " & ToSQL(sMsgType, "Number") & _
' ", " & ToSQL(sSubject, "Text") & _
' ", " & ToSQL(sContent, "Text") & _
' ", " & ToSQL(sFolder, "Number") & _
' ", " & ToSQL(sSender, "Number") & _
' ", " & ToSQL(sReceiver, "Text") & _
' ", " & ToSQL(sSendTime, "Text") & _
' ", " & ToSQL(sParentMsgId, "Text") & _
' ", " & ToSQL(sStatus, "Number") & _
' ")"
' ''Response.Write sSQL & "<br><br>"
' call ExecuteSQL(dbLocal, sSQL)
'
' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' '' 分解sReceiver为多个emp_serial,每个emp_serial 插入一条记录,放到收件箱中
' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' dim arrayEmpSerial : arrayEmpSerial = split(sReceiver, ",")
' dim j
' for j = 0 to UBound(arrayEmpSerial) step 1
' sEmpSerial = arrayEmpSerial(j) '' 消息的主人是收件人
' sFolder = IN_BOX '' 常量 IN_BOX 在 msg.inc 中有定义,表示收件箱
' sStatus = MSG_UNINFORMED '' 常量 MSG_UNINFORMED 在msg.inc 中有定义,表示状态为未通知的新消息
' sSQL = "insert into t_msg(emp_serial, msg_id, msg_type, subject, content, folder, sender, receiver, send_time, parent_msg_id, status)" & _
' " values(" & ToSQL(sEmpSerial, "Number") & _
' ", " & ToSQL(sMsgId, "Text") & _
' ", " & ToSQL(sMsgType, "Number") & _
' ", " & ToSQL(sSubject, "Text") & _
' ", " & ToSQL(sContent, "Text") & _
' ", " & ToSQL(sFolder, "Number") & _
' ", " & ToSQL(sSender, "Number") & _
' ", " & ToSQL(sReceiver, "Text") & _
' ", " & ToSQL(sSendTime, "Text") & _
' ", " & ToSQL(sParentMsgId, "Text") & _
' ", " & ToSQL(sStatus, "Number") & _
' ")"
' ''Response.Write sSQL & "<br>"
' call ExecuteSQL(dbLocal, sSQL)
' next
'' 从我的草稿箱中删除
if Not IsEmpty(pMsgSerial) then
sSQL = "delete from t_msg where serial = " & pMsgSerial
''Response.Write sSQL & "<br>"
call ExecuteSQL(dbLocal, sSQL)
end if
Response.Write "<script language=""javascript"">" & vbLF & _
"if (typeof(window.opener)!='undefined')" & vbLF & _
"{ " & vbLF & _
" window.close();" & vbLF & _
"}" & vbLF & _
"else" & vbLF & _
"{" & vbLF & _
" document.write(""<center style='font-size:9pt;color:blue'>消息发送成功</center>"");" & vbLF & _
"}" & vbLF & _
"</script>"
Response.end
End Sub
''************************************************************************************************************
'' GetReplyReceivers
'' 根据原消息的收件人和发件人构造全部回复时的收件人
'' 参数:sReceivers : 原消息的收件人列表(以逗号分隔的t_employee表中的serial,即用户/员工的唯一标识)
'' sSender : 原消息的发件人
'' 返回:本消息的收件人
''************************************************************************************************************
function GetReplyReceivers(sReceivers, sSender)
dim arrayEmp, j, sEmpSerial
dim sMyEmpSerial : sMyEmpSerial = CStr(GetEmpSerial) '' 我自己
dim sTemp : sTemp = "" '' sTemp中存放最终的收件人
'' 首先如果Receiver中包含了sSender,则不需要再增加sSender了,也不需要包含我自己
'' 最后在接收者中滤去用户自己,当然如果收件人中只有用户自己,则不能滤去了,否则就没有收件人了
sSender = Trim(sSender)
arrayEmp = Split(sReceivers, ",")
for j = 0 to UBound(arrayEmp) step 1 '' 逐个与sSender和sMyEmpSerial比较
sEmpSerial = CStr(Trim(arrayEmp(j)))
if sEmpSerial = sSender then
' do nothing '' sReceivers中的确包含sSender,暂时不要把发送者放到收件人列表中去
elseif sEmpSerial = sMyEmpSerial then
' do nothing '' 暂时不要把我自己放到收件人列表中去
else
if sTemp <> "" then sTemp = sTemp & ","
sTemp = sTemp & sEmpSerial '' 收件人中增加该用户
end if
next
'' 现在收件人中不包含原消息的发件人,如果原消息的发件人不是我,则把原消息的发件人增加到收件人中去
if sSender <> sMyEmpSerial then
if sTemp <> "" then sTemp = sTemp & ","
sTemp = sTemp & sSender
end if
'' 如果到现在sTemp还是空,也就是说,原消息是我自己发给自己的,原消息的收件人和发件人都是我自己,那么回复消息的收件人就是我自己了
if sTemp = "" then sTemp = sMyEmpSerial
GetReplyReceivers = sTemp
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -