home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 March
/
CHIPCD_3_98.iso
/
software
/
testsoft
/
exchange
/
webdata
/
usa
/
forms
/
report
/
commands.asp
next >
Wrap
Text File
|
1997-08-25
|
8KB
|
256 lines
<!--#include file="../../constant.inc"-->
<!--#include file="../../lib/session.inc"-->
<!--#include file="../../lib/store.inc"-->
<!--#include file="../../lib/delete.inc"-->
<!--#include file="reptext.inc"-->
<!--#include file="../../lib/jsutil.inc"-->
<%
'<!--Microsoft Outlook Web Access-->
'<!--Report.* commands.asp
'<!--Copyright (c) Microsoft Corporation 1993-1997. All rights reserved.-->
On Error Resume Next
'Handles two commands: delete, forward
urlCommand = Request.QueryString("command")
bstrObj = Request.QueryString("obj")
bstrCommand = urlCommand
bstrSaveCopy = Request.QueryString("savecopy")
CheckSession2 bstrVirtRoot + "/forms/report/commands.asp" _
+ "?command=" + bstrCommand + "&obj=" + bstrObj + "&timedout=1"
isResolved = True
bstrBodyTag = "<body text=000000 onLoad=""statusAlert()"">"
bstrNewObj = ""
bstrFormPath = ""
Select Case bstrCommand
Case "forward"
Set objMsg = GenerateResponse(bstrCommand, bstrNewObj, bstrFormPath, bstrBodyTag)
'Need to change the type else the forwarded message will appear as a report also
objMsg.Type="IPM.Note"
Case "delete"
Err.Clear
OpenAllStores
DeleteItemByID bstrObj, False
If Err.Number <> 0 Then
ReportError1 L_errFailDeleteMessage_ErrorMessage
Else
Set Session(bstrObj) = Nothing
RemoveIDFromCache(bstrObj)
bstrBodyTag = "<body onLoad=""self.close()"">"
End If
Case "cancel"
'If the user canels then dismiss the window and kill the session object
Set Session(bstrObj) = Nothing
RemoveIDFromCache(bstrObj)
bstrBodyTag = "<body onLoad=""self.close()"">"
End Select
Function GenerateResponse(bstrResponseType, bstrNewObj, bstrFormPath, bstrBodyTag)
On Error Resume Next
Set objOneMsg = Session(bstrObj)
If objOneMsg Is Nothing then
Set objOneMsg = OpenMessage(bstrObj)
End If
If objOneMsg.ID = "" Then
bstrError = "<b>" + L_Error_ErrorMessage + "<br><br>" _
+ L_errFailOpenMessage_ErrorMessage + "</b><br>" _
+ L_errMessageDeleted_ErrorMessage
End If
'Create a new message in memory
Randomize
bstrNewObj = cstr(int(100000 * Rnd()))
bstrFormPath = "frmRoot.asp"
bstrBodyTag = "<body text=000000 onLoad=""LaunchForm('" + bstrFormPath + "')"">"
Set objNewMsg = objOneMsg.Forward
objNewMsg.Subject = ""
InitResponse objOneMsg, objNewMsg, bstrResponseType
Set Session(bstrNewObj) = objNewMsg
AddIDToCache(bstrNewObj)
'Delete source message in memory
Set Session(bstrObj) = Nothing
RemoveIDFromCache(bstrObj)
Set GenerateResponse = objNewMsg
End Function
Sub InitResponse (srcMsg, newMsg, bstrResponsetype)
On Error Resume Next
If bstrResponsetype = "forward" then
bstrSubjectPrefix = L_ForwardPrefix_Text
Else
bstrSubjectPrefix = L_ReplyPrefix_Text
End If
strReportType = Right(srcMsg.Type, 3)
lSensitivity = 0
lSensitivity = srcMsg.Fields.Item(ActMsgPR_SENSITIVITY)
Select Case lSensitivity
Case 0
'Normal
bstrSensisitivity = ""
Case 1
'Personal
bstrSensisitivity = L_HeaderSensitivity_Text & " " & L_Personal_Text & vbCrLf
Case 2
'Private
bstrSensisitivity = L_HeaderSensitivity_Text & " " & L_Priv_Text & vbCrLf
Case 3
'Confidential
bstrSensisitivity = L_HeaderSensitivity_Text & " " & L_Confidential_Text & vbCrLf
End Select
lImportance = srcMsg.Importance
If lImportance = ActMsgHigh then
bstrImportance = L_HeaderImportance_Text & " " & L_High_Text & vbCrLf
ElseIf lImportance = ActMsgLow then
bstrImportance = L_HeaderImportance_Text & " " & L_Low_Text & vbCrLf
Else
bstrImportance = ""
End If
bstrConversation = srcMsg.Fields.Item(ActMsgPR_CONVERSATION_TOPIC)
newMsg.ConversationIndex = objOMSession.CreateConversationIndex(srcMsg.ConversationIndex)
newMsg.Sensitivity = srcMsg.Sensitivity
newMsg.Categories=srcMsg.Categories
newMsg.DeliveryReceipt = False
newMsg.ReadReceipt = False
If bstrResponseType <> "forward" then
newMsg.Importance = 1
End If
If bstrConversation <> "" then
bstrConversationDisplay = L_HeaderConversation_Text & " " & bstrConversation & vbCrLf
Else
bstrConversationDisplay = ""
End If
bstrMessageData = " " & vbCrLf & vbCrLf & "-----" & L_OriginalMessage_Text & "-----" & vbCrLf
bstrBodyTO = ""
bstrBodyCC = ""
If strReportType = "NDR" Then
' ActMsgPR_RECEIVED_BY_NAME
If srcMsg.Fields.Item(&H0044001F) <> "" then ' PR_RCVD_REPRESENTING_NAME
bstrBodyTO = L_HeaderTO_Text & " " & srcMsg.Fields.Item(&H0044001F) & vbCrLf
End If
Else
' ActMsgPR_DISPLAY_TO
If srcMsg.Fields.Item(ActMsgPR_DISPLAY_TO) <> "" then
bstrBodyTO = L_HeaderTO_Text & " " & srcMsg.Fields.Item(ActMsgPR_DISPLAY_TO) & vbCrLf
End If
' ActMsgPR_DISPLAY_CC
If srcMsg.Fields.Item(ActMsgPR_DISPLAY_CC) <> "" then '
bstrBodyCC = L_HeaderCC_Text & " " & srcMsg.Fields.Item(ActMsgPR_DISPLAY_CC) & vbCrLf
End If
End If
' ActMsgPR_SENT_REPRESENTING_NAME
If srcMsg.Fields.Item(ActMsgPR_SENT_REPRESENTING_NAME) <> "" Then
bstrBodyFROM = L_HeaderFrom_Text & " " & srcMsg.Fields.Item(ActMsgPR_SENT_REPRESENTING_NAME) & vbCrLf
Else
bstrBodyFROM = ""
End If
' ActMsgPR_NORMALIZED_SUBJECT
bstrSubjectData = bstrSubjectPrefix & srcMsg.Fields.Item(ActMsgPR_NORMALIZED_SUBJECT)
bstrBodySent = L_HeaderSENT_Text & " " & srcMsg.Fields.Item(ActMsgPR_CLIENT_SUBMIT_TIME) & vbCrLf
bstrMessageData = bstrMessageData & bstrBodyFrom & bstrBodyTo & bstrBodyCC
bstrMessageData = bstrMessageData & bstrBodySent
bstrSubject = srcMsg.Subject
If bstrSubject <> "" then
bstrSubject = L_HeaderSubject_Text & " " & bstrSubject & vbCrLf
End If
bstrMessageData = bstrMessageData & bstrSubject & bstrImportance & bstrSensisitivity
bstrMessageData = bstrMessageData & vbCrLf
' the original message has no text if it's an NDR
' otherwise, it has hacked text created by Kluane's read form
If strReportType <> "NDR" Then
' newMsg.Text = bstrMessageData
' newMsg.Text = newMsg.Text + srcMsg.Text
bstrMessageData = bstrMessageData & srcMsg.Text
newMsg.Text = bstrMessageData
Else
bstrRecipText = GetNDRBody(srcMsg, True)
newMsg.Text = bstrMessageData & bstrRecipText
End If
newMsg.Subject = bstrSubjectData
End Sub
%>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<script language='javascript'>
var holdMinutes=5;
var holdMs=60000 * holdMinutes; //5 min we could get the current session timeout if we felt like it?
function holdSession() {
setTimeout("self.location='commands.asp?command=holding'",holdMs);
}
<% if urlCommand="holding" then %>
parent.fLockForm = true;
setTimeout("self.location='commands.asp?command=holding'",holdMs);
<% else %>
parent.fLockForm = false;
<% end if %>
function statusAlert() {
<% If Not isResolved Then %>
DisplayNames();
<%Else%>
<% If bstrCommand="send" Then%>
parent.close();
<%ElseIf bstrCommand="bind" Then%>
parent.gotoForm(parent.iNextForm);
<%ElseIf bstrCommand="save" Then%>
top.status = "<%=L_MessageSaved_Message%>";
<% end if %>
<%End If%>
}
<%If Not isResolved Then %>
var _ANRWindow=null;
function DisplayNames() {
_ANRWindow = window.open("<%=bstrVirtRoot%>/forms/amunres.asp?obj=<%=bstrObj%>","anrWindow","width=400,height=300,scrollbars=1,resizable");
}
<%End If%>
function LaunchForm(szFormPath) {
openNewWindow("<%=bstrVirtRoot%>/forms/ipm/note/"+szFormPath + "?command=new&obj=<%=bstrNewObj%>",'newMessageWindow',640,500);
self.close();
}
</script>
<TITLE>Commands</TITLE>
<%=bstrBodyTag%>
</body>
</HTML>