Friday, 30 May 2008

PromptForViewName

Function PromptForViewName( ) As String

Dim session As New NotesSession
Dim db As NotesDatabase
Dim viewsArray As Variant
Dim intSize As Integer
Dim i As Integer
Dim strViewName As String
Dim strDefaultName As String
Dim ws As New NotesUIWorkspace()

Set db = session.CurrentDatabase
viewsArray = db.Views

intSize = Ubound(viewsArray)
Redim strViewNamesArr(intSize) As String

Forall v In viewsArray
strViewNamesArr(i) = v.Name
If v.Name = "Contacts" Then
strDefaultName = "Contacts" ' if there is a contacts view, we will default to that
End If
i = i + 1

End Forall

'############################################
' Prompt for view name... default to contact if we have it
'############################################
If strDefaultName = "" Then
strDefaultName = strViewNamesArr(0)
End If

strViewName = ws.Prompt (PROMPT_OKCANCELLIST, _
"Select a View", _
"Select a view to use - (should have first column sorted.)", _
strDefaultName, strViewNamesArr)

If Isempty (strViewName) Then
strViewName = ""
End If

PromptForViewName = strViewName

End Function

Thursday, 22 May 2008

function MakeSafeForURL js

function MakeSafeForURL(strText) {
//eg given it's great+,
// returns it%20 great%2B
//return encodeURIComponent(strText);

strText = strText.replace(/'/g, "");
strText = strText.replace(/"/g, "");
strText = strText.replace(/\+/g, "");
strText = strText.replace(/&/g, "");
strText = strText.replace(/%/g, "");

return strText
}

Tuesday, 20 May 2008

Function



Function GetDbInfoFromReplicaID( strReplicaId As String, strServer As String )

Dim db As New NotesDatabase("","")
Dim blOpened As Boolean

blOpened = db.OpenByReplicaID( strServer, strReplicaId )
If blOpened = False Then
Error 1000, "The database is not found to open by replica id ("+ strReplicaID+") to get the information on the server ("+ strServer +")"
End If

GetDbInfoFromReplicaID = db.Title + "|" + db.FilePath + "|" + db.Server

End Function


Monday, 19 May 2008

Notes Designer Not Installed - maybe it is




A neat trick. If designer is not installed, but Lotus Notes is, try this trick. Create a text file in the notes directory. Call it designer.exe. Launch the notes client and you will see the desinger icon in the bookmarks bar.






( via Simon's Notes : Domino
Designer Not Installed? No Problem :-)