I follow the steps in both the Admin help and the detailed steps in the LDD article on creating a company welcome page.
It says to set the default access to “Reader”. When I do this the test end user id gets the error: “You are not authorized to perform that operation” when opening the welcome page. After clicking OK on the prompt, everything’s fine.
When Default is Editor and above, no problem, when default is author, the prompt: “You cannot update or delete the document(s) since you are not listed as an allowable Author for this document” appears. Again they click KO on the prompt and everything’s fine.
I ran the debugger and a form called “(SetWPForLoc)” is being called and that form calls an “EditLayouts” script library (code below).
The line that generates the error is:
pnote.save True, True
and can be found about 3/4 of the way down in the “Set key As String” Property within the declarations section of the “EditLayouts” script library below.
In this case, pnote references a profile document called “CurrentLayout”.
any ideas?
TIA,
-MC
OPTIONS
Option Public
DECLARATIONS
Const LAYOUT_EDIT_DIALOG_TITLE_REGULAR = “Page Options”
Const LAYOUT_EDIT_DIALOG_TITLE_NEW = “New Page”
'DNT
Const CREATE_NEW_LAYOUT = “new”
Class LayoutSettings
session As NotesSession
db As NotesDatabase
note As NotesDocument
view As NotesView
Sub new( key As String)
Set session = New NotesSession
Set db = session.currentDatabase
Set view = db.getView( "(Layouts)")
If Len( key ) = 0 Or key = CREATE_NEW_LAYOUT Then
Set note = db.createDocument
note.replaceItemValue "Form", "LayoutSetting"
note.replaceItemValue "IsNewDoc", "1"
Else
Set note = db.getDocumentByUNID( key)
End If
End Sub
Property Get shouldBeDeleted As Integer
If doesLayoutExist Then
shouldBeDeleted = (note.getItemValue( "DeleteProfile")(0) = "1")
End If
End Property
Property Get key As String
If doesLayoutExist Then
key = note.universalID
End If
End Property
Property Get doesLayoutExist As Integer
If Not note Is Nothing Then doesLayoutExist = True
End Property
Function editWithDialog As Integer
If doesLayoutExist Then
Dim ws As New NotesUIWorkspace
Dim title As String
If note.isnewnote Then
title = LAYOUT_EDIT_DIALOG_TITLE_NEW
Else
title = LAYOUT_EDIT_DIALOG_TITLE_REGULAR
End If
If ws.dialogBox( "LayoutEditorDlg", True, True, True, False, False, False, title , note, True, True) Then
editWithDialog = True
Forall anitem In note.items
If Len(anitem.name) > 2 Then
If Lcase(Left$(anitem.name,3)) = "tmp" Then
anitem.remove
End If
End If
End Forall
End If
End If
End Function
Function save As Integer
If doesLayoutExist Then
If note.hasItem( "IsNewDoc") Then note.removeItem( "IsNewDoc")
save = note.save( True, True)
view.refresh
End If
End Function
Sub deleteDoc
If doesLayoutExist Then
note.remove( True)
End If
End Sub
End Class
Class CurrentLayout
session As NotesSession
db As NotesDatabase
view As NotesView
pnote As NotesDocument
Sub new
Set session = New NotesSession
Set db = session.currentDatabase
Set view = db.getView( "(Layouts)")
Set pnote = db.getProfileDocument( "CurrentLayout")
'init key
Me.key = Me.key
End Sub
Property Get key As String
'if the currentlocation is available, then get it from there
'otherwise get if from the local cache
Dim tempLayoutKey As String
tempLayoutKey = pnote.getItemValue( "$" & Me.locationIDFromINI())(0)
If Len(tempLayoutKey) = 0 Then
key = pnote.getItemValue( "CurrentLayoutKey")(0)
Else
key = tempLayoutKey
End If
End Property
Property Set key As String
pnote.replaceItemValue "$" & Me.locationIDFromINI(), key
pnote.replaceItemValue "CurrentLayoutKey", key
pnote.save True, True
End Property
Property Get currentLayout As LayoutSettings
Set currentLayout = New LayoutSettings( Me.key)
End Property
Property Set currentLayout As LayoutSettings
If currentLayout.doesLayoutExist Then
Me.key = currentLayout.key
Else
Call resetCurrentLayout()
End If
End Property
Sub resetCurrentLayout
Dim note As NotesDocument
Set note = view.getFirstDocument()
If note Is Nothing Then
Me.key = "defaultlayout"
Else
Me.key = note.getItemValue( "Key")(0)
End If
End Sub
Function locationIDFromINI As String
Dim rawLocationStr As String
Dim locationInfo As Variant
Dim strMyNAB As String
'Get the NAB from the INI Variable
strMyNAB = session.getEnvironmentString( "Names", True)
If strMyNAB = "" Then
'If it is empty we take the default name
strMyNAB = "names.nsf"
Elseif Instr(strMyNAB,",") > 0 Then
'if there is a comma inside there is more than one nab and we take only the first one
strMyNAB = Trim(Left(strMyNAB,Instr(strMyNAB,",")-1))
End If
Dim Locdb As New NotesDatabase("",strMyNAB)
Dim Locnote As NotesDocument
rawLocationStr = session.getEnvironmentString( "Location", True)
locationInfo = STRExplode( rawLocationStr, ",", False)
If Ubound( locationInfo) > 0 Then
locationIDFromINI = locationInfo(1)
End If
'get Current Location's name
iNum = Instr(rawLocationStr, ",")
currLoc = Left(rawLocationStr, iNum-1)
Set locview = Locdb.getview(Lcase("LocATionS")) 'DNT
Set locDoc = locview.getfirstdocument()
While Not locDoc Is Nothing
locationName = locDoc.getitemvalue("Name")
If locationName(0) = currLoc Then 'found the current location document
locationIDFromINI = Locdoc.UniversalID
Goto continueLocFromIni
End If
Set locDoc = locview.getnextdocument(locDoc)
Wend
continueLocFromIni:
End Function
End Class
STREXPLODE
Function STRExplode( Byval strValue As String, strDelimiter As String, bBlanks As Variant) As Variant
'** This function takes a string and converts it to an array, based on a delimiter
'** Parameters:
'**strValue- the string to explode
'**strDelimiter- the delimiter
'**bBlanks- a boolean value, pass true to have blanks placed in array when two delimiters have nothing between them
'** pass false to ignore the blanks
Dim strTemp As String
Dim strValues() As String
Dim iPlace As Integer
Dim idelimLen As Integer
Dim iValueCount As Integer
idelimLen = Len( strDelimiter)
iPlace = Instr( strValue, strDelimiter)
Do While iPlace <> 0
If (iPlace <> 1 Or bBlanks) Then
Redim Preserve strValues(iValueCount) As String
strValues(iValueCount) = Left( strValue, iPlace - 1)
iValueCount = iValueCount + 1
End If
strValue = Right( strValue, Len( strValue) - iPlace - idelimLen + 1)
iPlace = Instr( strValue, strDelimiter)
Loop
If Len( strValue ) <> 0 Or bBlanks Then
Redim Preserve strValues(iValueCount) As String
strValues(iValueCount) = strValue
Elseif iValueCount = 0 Then
Redim Preserve strValues(iValueCount) As String
End If
STRExplode = strValues
End Function