% Response.Expires = 0 %>
<% REM Directories Page add/edit pop-up %>
<%
L_ENTER_DIRECTORY_NAME_TEXT = "Please enter a directory name."
L_ENTER_ALIAS_NAME_TEXT = "Please enter an alias for this Directory."
L_DIRECTORY_ALREADY_EXISTS_TEXT = "A directory already exists for this service. Do you want to replace it?"
L_PATH_SYNTAX_INCORRECT_TEXT = "The Path syntax is incorrect."
L_HELP_TEXT = "Help"
L_EDIT_DIRECTORY_ON_TEXT = "Edit Directory on"
L_ADD_DIRECTORY_ON_TEXT = "Add Directory on"
L_ALIAS_TEXT = "Alias:"
L_PATH_TEXT = "Path:"
L_OK_TEXT = "OK"
L_CANCEL_TEXT = "Cancel"
%>
<% REM Get variables %>
<% REM svr = Server name %>
<% REM a = Action to be performed by server-side code (new/add,edit/save) %>
<% REM DirVirtualName = Virtual Directory being edited %>
<% REM DirHome = Whether a home directory already exists for service %>
<% svr = Session("svr") %>
<% a = Request("a") %>
<% DirVirtualName = Request("DirVirtualName") %>
<% DirHome = Request("DirHome") %>
<% VRootIndex = Request("index") %>
<% REM Include _cnst file to force logon by anonymous users (if access denied, body of file ignored) %>
<% if (cont = true) then %>
<% On Error Resume Next %>
<% Set admin = Server.CreateObject("Smtpadm.Admin.1") %>
<% if (Err <> 0) then %>
<% end if %>
<% On Error Resume Next %>
<% admin.server = svr %>
<% if (Err <> 0) then %>
<% end if %>
<% On Error Resume Next %>
<% Set VServer = admin.VirtualServerAdmin %>
<% if (Err <> 0) then %>
<% end if %>
<% REM Set Server %>
<% On Error Resume Next %>
<% VServer.Server = svr %>
<% if (Err <> 0) then %>
<% end if %>
<% REM Set Service Instance %>
<% On Error Resume Next %>
<% VServer.ServiceInstance = Session("ServiceInstance") %>
<% if (Err <> 0) then %>
<% end if %>
<% On Error Resume Next %>
<% set Vroots = admin.VirtualDirectoryAdmin %>
<% if (Err <> 0) then %>
<% end if %>
<% REM Set Server %>
<% On Error Resume Next %>
<% Vroots.Server = svr %>
<% if (Err <> 0) then %>
<% end if %>
<% REM Set Service Instance %>
<% On Error Resume Next %>
<% Vroots.ServiceInstance = Session("ServiceInstance") %>
<% if (Err <> 0) then %>
<% end if %>
<% REM Enumerate Virtual directories %>
<% On Error Resume Next %>
<% Vroots.Enumerate %>
<% if (Err <> 0) then %>
<% end if %>
<% if (a = "edit") then %>
Edit Directory Properties
<% elseif (a = "new") then %>
Add Directory
<% end if %>
<% if ((a = "add") OR (a = "save")) then %>
<% DirDirectory = Cstr(Request("newDirectory")) %>
<% DirDirectory = Replace(DirDirectory,"%5C","\") %>
<% DirDirectory = Replace(DirDirectory,"%3A",":") %>
<% DirVirtualName = Request("txtVirtualName") %>
<% originalDirRoot = Request("txtOriginalDirRoot") %>
<% if (a = "add") then %>
<% On Error Resume Next %>
<% set thisVroot = Server.CreateObject("Smtpadm.VirtualDirectory") %>
<% if (Err <> 0) then %>
<% end if %>
<% thisVroot.VirtualName = DirVirtualName %>
<% thisVroot.Directory = DirDirectory %>
<% On Error Resume Next %>
<% thisVroot.server = svr %>
<% if (Err <> 0) then %>
<% end if %>
<% On Error Resume Next %>
<% thisVroot.ServiceInstance = Session("ServiceInstance") %>
<% if (Err <> 0) then %>
<% end if %>
<% On Error Resume Next %>
<% REM Vroots.Create(thisVroot) %>
<% thisVroot.Create %>
<% if (Err <> 0) then %>
<% end if %>
<% elseif (a = "save") then %>
<% if (originalDirRoot <> DirRoot) then %>
<% REM Create a new virtual root to copy new values into %>
<% On Error Resume Next %>
<% set thisVroot = Server.CreateObject("Smtpadm.VirtualDirectory") %>
<% if (Err <> 0) then %>
<% end if %>
<% On Error Resume Next %>
<% thisVroot.server = svr %>
<% if (Err <> 0) then %>
<% end if %>
<% On Error Resume Next %>
<% thisVroot.ServiceInstance = Session("ServiceInstance") %>
<% if (Err <> 0) then %>
<% end if %>
<% else %>
<% REM Get pointer to existing virtual root directory %>
<% On Error Resume Next %>
<% set thisVroot = Vroots.GetNth(Cint(VRootIndex)) %>
<% if (Err <> 0) then %>
<% end if %>
<% end if %>
<% thisVroot.VirtualName = DirVirtualName %>
<% thisVroot.Directory = DirDirectory %>
<% if (originalDirRoot <> DirVirtualName) then %>
<% On Error Resume Next %>
<% REM Vroots.AddDispatch(thisVroot) %>
<% thisVroot.Set %>
<% if (Err <> 0) then %>
<% else %>
<% Vroots.GetNth(Cint(vRootIndex)) %>
<% thisVroot = Vroots %>
<% thisVroot.Delete %>
<% end if %>
<% else %>
<% On Error Resume Next %>
<% REM Vroots.SetDispatch VRootIndex, thisVroot %>
<% thisVroot.Set %>
<% if (Err <> 0) then %>
<% end if %>
<% end if %>
<% end if %>
<% end if %>
<% if (a = "new") then %>
<% On Error Resume Next %>
<% set thisVroot = Server.CreateObject("Smtpadm.VirtualDirectory") %>
<% if (Err <> 0) then %>
<% end if %>
<% On Error Resume Next %>
<% thisVroot.server = svr %>
<% if (Err <> 0) then %>
<% end if %>
<% On Error Resume Next %>
<% thisVroot.ServiceInstance = Session("ServiceInstance") %>
<% if (Err <> 0) then %>
<% end if %>
<% thisVroot.Directory = "" %>
<% thisVroot.VirtualName = "" %>
<% elseif (a = "edit") then %>
<% REM Get a pointer to the VirtualDirectory Object we are editing %>
<% On Error Resume Next %>
<% Vroots.GetNth(VRootIndex) %>
<% set thisVroot = Vroots %>
<% if (Err <> 0) then %>
<% end if %>
<% end if %>
<% end if %>