If you've ever needed a way to allow developers access to create their own URL redirects from the Web, here's a quick and dirty solution.
I created a form that mirrors the mapping form in Domino Administrator. After authenticating, the developer has a drop down list of the servers in which they can create redirects. I use JavaScript to validate the fields and from an onClick event, I run an agent that creates a response doc to the server doc called "Mapping". I get a handle to the "WebConfigurations" view in the NAB and a handle to the server doc where I want to add the redirect.
In order for these changes to take effect, I created two program documents to stop and start HTTP overnight. Otherwise, the developer can contact me immediately to determine when I can stop/start HTTP.
Here are the parameters for the program documents:
Program name: nserver
Command line: -c "tell http quit"
Server to run on:
Comments: quits http task
Program name: nserver
Command line: -c "load http"
Server to run on:
Comments: starts http task
Remember to enable the program and select a time to run each document. I found setting them to run within a minute of each other works best.
Code
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim redirectDoc As NotesDocument
Dim webDoc As NotesDocument
Set webDoc = session.documentcontext
Set db = New NotesDatabase("","names.nsf")
Set view = db.GetView("WebConfigurations")
Set doc = view.GetDocumentByKey("")
Set redirectDoc = db.CreateDocument
Call redirectDoc.MakeResponse(doc)
redirectDoc.Form = "Mapping"
redirectDoc.ServerName = webDoc.ServerName(0)
redirectDoc.MappingType = "3" 'URL -> Redirection URL
redirectDoc.MapType = "Redirect"
redirectDoc.Type = "Mapping"
redirectDoc.RM_MapFrom = webDoc.MapFrom(0) 'incoming URL string
redirectDoc.RM_MapTo = webDoc.MapTo(0) 'redirection URL string
Call redirectDoc.Save(True,True)
End Sub