<%
L_EventType8_Text = "anything changes"
L_EventType0_Text = "a new document is created"
L_EventType1_Text = "a document is modified"
L_EventType2_Text = "a document is deleted"
L_EventType3_Text = "a document is moved"
L_EventType7_Text = "a discussion item is inserted or deleted"
L_Anonymous_Text = "Anonymous"
OWSEVTCOL_NONE = 0
OWSEVTCOL_EVTID = 5
OWSAA_SMTPCONTACTEMAIL = 9
OWSAA_SMTPADMINEMAIL = 10
OWSAA_ISADMIN = 14
CMD_INITIAL = 0
CMD_CONFIRMED = 1
CMD_CANCELED = 2
SUCCESS = 0
FOUND = 1
ERR_ACCESSDENIED = -1
ERR_NOTFOUND = -2
ERR_UNKNOWN = -3
E_ACCESSDENIED = 70
On Error Resume Next
szEventID = Request.QueryString("EventID")
fConfirmedVal = Request.Form("CONFIRMED")
fCanceledVal = Request.Form("CANCELED")
iCmd = CMD_INITIAL
iRet = ERR_NOTFOUND
if ((IsEmpty(fCanceledVal) <> True) and (fCanceledVal = "true")) then
iCmd = CMD_CANCELED
end if
if ((IsEmpty(fConfirmedVal) <> True) and (fConfirmedVal = "true")) then
iCmd = CMD_CONFIRMED
end if
if (iCmd <> CMD_CANCELED) then
if IsEmpty(Session("MiscApis")) then
Set Session("MiscApis") = Server.CreateObject("OWS.MiscApis.1")
end if
if((IsEmpty(szEventID) <> True) and (szEventID <> "")) then
Set Subscriptions = Session("MiscApis").EnumEvtSubs(szEventID, OWSEVTCOL_EVTID, 0, 0)
if (Subscriptions.EOF = False) then
Set tgtsub = Subscriptions.Item()
if (tgtsub.EventID = szEventID) then
iRet = FOUND
end if
end if
end if
if (iRet = FOUND and iCmd = CMD_CONFIRMED) then
Subscriptions.Delete(szEventID)
if Err.Number <> 0 then
if (Err.Number = E_ACCESSDENIED) then
iRet = ERR_ACCESSDENIED
else
iRet = ERR_UNKNOWN
End if
Err.Clear
else
iRet = SUCCESS
end if
end if
if (iRet = FOUND) then
strUserDomain = Request.ServerVariables("LOGON_USER")
strUser = Right(strUserDomain,(len(strUserDomain)-instr(strUserDomain,"\")))
if (StrComp(strUser, tgtsub.Owner, 1) <> 0) then
if ((strUser <> "") Or (StrComp(tgtsub.Owner, L_Anonymous_Text, 1) <> 0)) then
if (Session("MiscApis").GetAttribute(OWSAA_ISADMIN) = 0) then
iRet = ERR_ACCESSDENIED
end if
end if
end if
end if
if (iCmd = CMD_INITIAL And iRet = FOUND) then
OWS_CT_NONE = 0
OWS_CT_AUTHORCONTAINS = 8
OWS_CT_FILE = OWS_CT_NONE
OWS_CT_FOLDER = 16
lEvtType = tgtsub.EventType
if (lEvtType = "8") then
szEvtType = L_EventType8_Text
elseif (lEvtType = "0") then
szEvtType = L_EventType0_Text
elseif (lEvtType = "1") then
szEvtType = L_EventType1_Text
elseif (lEvtType = "2") then
szEvtType = L_EventType2_Text
elseif (lEvtType = "3") then
szEvtType = L_EventType3_Text
elseif (lEvtType = "7") then
szEvtType = L_EventType7_Text
else
szEvtType = ""
end if
%>
Delete Subscription
<%
lCriteria = tgtsub.Criteria
if ((lCriteria And OWS_CT_FOLDER) = 0) then
%>
This document: |
<% Response.Write(tgtsub.ScopeUrl) %> |
<%
else
%>
Documents in folder: |
<% Response.Write(tgtsub.ScopeUrl) %> |
<%
if (lCriteria And OWS_CT_AUTHOREQUALS) then
%>
Where 'modified by' contains:": |
<% Response.Write(tgtsub.SavedBy) %> |
<%
end if
end if
%>
Notify me when: |
<% Response.Write(szEvtType) %> |
Send to: |
<% Response.Write(tgtsub.SMTP) %> |
Owned by: |
<% Response.Write(tgtsub.Owner) %> |
<%
elseif (iRet = SUCCESS) then
%>
Delete Subscription
Successfully deleted the subscription.
Click here to view your subscriptions.
<%
elseif (iRet = ERR_ACCESSDENIED) then
bstrEmail = Session("MiscApis").GetAttribute(OWSAA_SMTPCONTACTEMAIL)
if IsEmpty(bstrEmail) then
bstrEmail = Session("MiscApis").GetAttribute(OWSAA_SMTPADMINEMAIL)
end if
%>
Delete Subscription
Error: Access is denied.
This subscription was created by <%=tgtsub.Owner %>. Only <%=tgtsub.Owner %> or an administrator is allowed to delete this subscription.
<% if IsEmpty(bstrEmail) = False then
%>
Please contact <%=bstrEmail%> for further assistance.
<%
end if
%>
<%
elseif (iRet = ERR_NOTFOUND) then
%>
Delete Subscription
The subscription could not be found.
Click here to view your subscriptions.
<%
else
%>
Delete Subscription
The subscription could not be deleted due to an unknown error.
Click here to view your subscriptions.
<%
end if
else
%>
Delete Subscription
The request to delete the subscription has been canceled.
Click here to view your subscriptions.
<%
end if
%>