home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 March
/
CHIPCD_3_98.iso
/
software
/
testsoft
/
exchange
/
webdata
/
usa
/
inbox
/
commands.asp
next >
Wrap
Text File
|
1997-08-25
|
11KB
|
259 lines
<% response.buffer = true %>
<!--#include file="../constant.inc"-->
<!--#include file="../lib/getrend.inc"-->
<!--#include file="../lib/session.inc"-->
<!--#include file="../lib/pageutil.inc"-->
<!--#include file="../lib/jsroot.inc"-->
<%
'<!--Microsoft Outlook Web Access-->
'<!--viewer commands.asp
'<!--Copyright (c) Microsoft Corporation 1993-1997. All rights reserved.-->
On Error Resume Next
var objFolder
'constants - params for doLoadEvent()
iParamError = -1
iParamNone = 0
iParamGotoFolder = 1
iParamCalendarView = 2
iParamCreatedFolder = 3
iParamDeletedFolder = 4
iParamCheckMessages = 5
iParamUpdateView = 6
iParamDeletedMarkedMessages = 7
bstrParamErrMsg = ""
urlCommand = lcase(Request.QueryString("command"))
urlAction = Lcase(Request.QueryString("action"))
If urlCommand = "" and urlAction = "" then 'If both of these values are nothing then we were posted to
urlAction = lcase(Request.Form("action"))
urlCommand = lcase(Request.Form("command"))
urlObj = Request.Form("obj")
urlStore = Request.Form("store")
Else
urlObj = Request.QueryString("obj")
urlStore = Request.QueryString("store")
End If
iLoadCommand = iParamNone 'default to do nothing
If urlStore="" Then
iStore=1
Else
iStore=cint(urlStore)
End if
'always validate the session
fTimedOut = false
if Not CheckSession3("1","newwindow",urlStore) Then
fTimedOut = true
urlAction = ""
urlCommand = ""
end if
nAccess=-1 'full permissions default
If urlAction<>"" THEN 'performing some action on the current folder obj
iLoadCommand=iParamNone
'TODO: we are assuming the session still has the current folder here
'we must be passed in obj and store (need to check???)
If urlAction <> "newfolder" Then 'Initpage is not needed when creating new folder
InitPage iStore 'resets Session(CURRENT_FOLDER)
End If
Set objFolder = Session(CURRENT_FOLDER)
If IsSpecialFolder(objFolder.ID) Then
fIsSpecialFolder = true
Else
fIsSpecialFolder = false
End If
If urlAction="newfolder" Then '*** CREATE A NEW FOLDER
Set objFolders = Session(CURRENT_HIERARCHY)
Set objNewFolder = objFolders.Add(Request.Form("folderName"))
If Err.Number<>0 Then
iLoadCommand = iParamError
bstrParamErrMsg = L_errFailCreateFolder_ErrorMessage
Else
iLoadCommand = iParamCreatedFolder
End If
ElseIf urlAction="deletefolder" Then '*** DELETE CURRENT FOLDER
If fSpecialFolder<>false Then
iLoadCommand = iParamError
bstrParamErrMsg = L_errFailDeleteFolder_ErrorMessage
Else
OpenAllStores
bstrParentFolderID = objFolder.FolderID
DeleteItem objFolder
If Err.Number <> 0 Then
iLoadCommand = iParamError
if Err.Number = -2147219964 then
bstrParamErrMsg = L_errFailDeleteFolder_ErrorMessage + "\n" + L_errDeletedItemExists_ErrorMessage
else
bstrParamErrMsg = L_errFailDeleteFolder_ErrorMessage
end if
Else
iLoadCommand = iParamDeletedFolder
End If
End If
ElseIf urlAction="deleteallmessages" Then '*** DELETE ALL MESSAGES IN DELETED ITEMS FOLDER
If (Session(bstrAuthenticated)) Then
objOMSession.getDefaultFolder(ActMsgDefaultFolderDeletedItems).Messages.Delete
objOMSession.getDefaultFolder(ActMsgDefaultFolderDeletedItems).Folders.Delete
Else
iLoadCommand = iParamError
bstrParamErrMsg = L_errFailDeleteMessage_ErrorMessage
End If
ElseIf urlAction="deletemarkedmessages" Then '*** DELETE ALL CHECKED MESSAGES
DeleteItems
If Err.Number <> 0 Then
iLoadCommand = iParamError
bstrParamErrMsg = L_errFailDeleteMessage_ErrorMessage
Else
iLoadCommand = iParamDeletedMarkedMessages
End If
End If
ELSE
SELECT CASE urlCommand
CASE "newfolder" '*** GOTO ANOTHER FOLDER
set objFolder = nothing
'not passed a store then open folder and get it
if urlStore="" Then
Set objFolder = OpenFolder(urlObj)
If objFolder is Nothing then
iStore = -1 'error state - folder doesn't exist or something
iLoadCommand = iParamError
bstrParamErrMsg = L_errFolderNotReplicated_ErrorMessage
Else
If objFolder.StoreID = Session(bstrPublicStoreID) Then
iStore = 1
Else
iStore = 0
End If
End if
end if
If iStore > -1 Then 'we have a store!
InitPage iStore
If Err.Number=424 And iStore=1 Then 'folder not available error
iStore = -1 'error state - folder doesn't exist or something
iLoadCommand = iParamError
bstrParamErrMsg = L_errFolderNotReplicated_ErrorMessage
Else
iLoadCommand = iParamGotoFolder
Set objFolder = Session(CURRENT_FOLDER)
If IsSpecialFolder(objFolder.ID) Then
fIsSpecialFolder = true
Else
fIsSpecialFolder = false
End If
bstrFolderID = objFolder.ID
bstrFolderType = objFolder.Fields.Item(ActMsgPR_CONTAINER_CLASS).Value
If bstrFolderType="IPF.Appointment" Then
iLoadCommand=iParamCalendarView
ElseIf iStore <> PRIVATE_AUTHENTICATED Then
'check for permission (this is 0 if 'none' or 'not available')
'err.clear
nAccess = objFolder.Fields.Item(ActMsgPR_ACCESS)
'If Err.Number <> 0 Then nAccess=0
End If
End if
Else 'no store no obj...TopOfIF for anon?
iLoadCommand = iParamGotoFolder
iStore = 1
InitPage 1
bstrFolderID = ""
End If
CASE "checkmessages"
InitPage cint(urlStore) 'resets Session(CURRENT_FOLDER)
Set objFolder = Session(CURRENT_FOLDER)
bstrFolderID = objFolder.ID
iLoadCommand = iParamCheckMessages
CASE "updateview"
InitPage cint(urlStore) 'resets Session(CURRENT_FOLDER)
iLoadCommand = iParamUpdateView
END SELECT
END IF
%>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<script language='javascript'>
<% IF NOT fTimedOut THEN 'drop thru if timed out%>
<% If iLoadCommand = iParamGotoFolder Then %>
<% if nAccess=0 Then %>
alert("Insufficient permissions to folder");
<% else %>
parent.fIsSpecialFolder = eval(<%=fIsSpecialFolder%>);
parent.szCurFolderID = "<%=bstrFolderID%>";
<%If iStore=1 Then %>
parent.szCurPubFID="<%=bstrFolderID%>";
parent.iCurCompose=1;
<%ElseIf iStore=0 Then%>
parent.szCurPvtFID="<%=bstrFolderID%>";
parent.iCurCompose=0;
<%End If%>
if (parent.peer_fr != null) parent.peer_fr.location = "<%=bstrVirtRoot%>/inbox/peerfldr.asp?obj=<%=bstrFolderID%>&store=<%=iStore%>";
if (parent.title_fr!=null) {
if (parent.fIsAnon) parent.title_fr.location = "<%=bstrVirtRoot%>/inbox/titlea.asp?compidx="+parent.iCurCompose;
else parent.title_fr.location = "<%=bstrVirtRoot%>/inbox/title.asp?compidx="+parent.iCurCompose+"&store=<%=iStore%>";
}
if (parent.msg_fr!=null) parent.msg_fr.location = "<%=bstrVirtRoot%>/inbox/messages.asp?obj=<%=bstrFolderID%>&store=<%=iStore%>";
<% end if %>
<% ElseIf iLoadCommand = iParamCheckMessages Then %>
if (parent.peer_fr != null) parent.peer_fr.location = "<%=bstrVirtRoot%>/inbox/peerfldr.asp?obj=<%=bstrFolderID%>&store=<%=iStore%>";
if (parent.title_fr!=null) {
if (parent.fIsAnon) parent.title_fr.location = "<%=bstrVirtRoot%>/inbox/titlea.asp?compidx="+parent.iCurCompose;
else parent.title_fr.location = "<%=bstrVirtRoot%>/inbox/title.asp?compidx="+parent.iCurCompose+"&store=<%=iStore%>";
}
if (parent.msg_fr!=null) parent.msg_fr.location = "<%=bstrVirtRoot%>/inbox/messages.asp?obj=<%=bstrFolderID%>&store=<%=iStore%>";
<% ElseIf iLoadCommand = iParamDeletedMarkedMessages Then %>
self.location = "<%=bstrVirtRoot%>/inbox/commands.asp?command=checkmessages&obj="+parent.szCurFolderID+"&store="+parent.iCurStore;
<% ElseIf iLoadCommand = iParamCalendarView Then %>
parent.parent.RefreshNavbar(2);
<% ElseIf iLoadCommand = iParamCreatedFolder Then %>
if (parent.peer_fr != null) parent.peer_fr.location = "<%=bstrVirtRoot%>/inbox/peerfldr.asp?obj=<%=urlObj%>&store=<%=iStore%>";
<% ElseIf iLoadCommand = iParamDeletedFolder Then 'current folder gone so redirect commands to parent folder %>
window.location = "<%=bstrVirtRoot%>/inbox/commands.asp?command=newfolder&obj=<%=bstrParentFolderID%>&store=<%=iStore%>";
<% ElseIf iLoadCommand = iParamUpdateView Then %>
if (parent.title_fr!=null) {
if (parent.fIsAnon) parent.title_fr.location = "<%=bstrVirtRoot%>/inbox/titlea.asp?page=1&view=<%=Request.Querystring("view")%>";
else parent.title_fr.location = "<%=bstrVirtRoot%>/inbox/title.asp?page=1&view=<%=Request.Querystring("view")%>&compidx="+parent.iCurCompose;
}
if (parent.msg_fr!=null) parent.msg_fr.location = "<%=bstrVirtRoot%>/inbox/messages.asp?obj=<%=urlObj%>&page=1&view=<%=Request.Querystring("view")%>&compidx="+parent.iCurCompose+"&store=<%=iStore%>";
<% ElseIf iLoadCommand = iParamError Then %>
alert("<%=bstrParamErrMsg%>");
<% End If %>
<% END IF 'fTimedOut%>
</script>
<body>
<FORM name="commandform" ACTION="commands.asp" METHOD="POST" target="command_fr">
<input type="hidden" name="action" value="newfolder">
<input type="hidden" name="foldername" value="">
<input type="hidden" name="obj" value="">
<input type="hidden" name="store" value="">
</Form>
</body>
</HTML>