Prevent edit mode

Hi All,

How to prevent a form, edit mode by double clicking in Notes Client

Thanks in advance,

Kamal

Subject: Prevent edit mode

On querymode change set the editflag to false.

Subject: DON’T FORGET QUERYOPEN! — Prevent edit mode

If you do one without the other you are leaving a big hole. The QueryModeChange happens if they open the document then change to edit mode, but what if they open it directly into edit mode from a view. In this case the QMC is not executed. That’s why you need to code the QOpen too.

Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)

Dim doc As NotesDocument

Set doc = Source.Document



If Mode Then  ' if trying to enter edit mode

	Continue = CheckEdit( doc )  ' function in Utility to check [Investigator] role and sStatus="Complete"

	If Not Continue Then Exit Sub

End If

End Sub

Sub Querymodechange(Source As Notesuidocument, Continue As Variant)

Dim doc As NotesDocument

Set doc = source.Document



If Not source.EditMode Then  ' if trying to enter edit mode

	Continue = CheckEdit( doc )  ' function in Utility to check [Investigator] role, sStatus="Complete", unassigned, ...

	If Not Continue Then Exit Sub	

End If

End Sub

Subject: p.s.

The previous code could be simplified some unless you are going to do something more. The something more could be role-based checking using code like the following:

Function IsAdminRole As Integer

’ Return true if user is a member of [Admin] role

IsAdminRole = False

Const NotesMacro$ = "@UserRoles"

result = Evaluate(NotesMacro$)

Forall x In result  ' check if the user has the role 

	If x = "[Admin]" Then IsAdminRole = True

End Forall

End Function

Function StopNonAdmins As Integer

’ this function stops processing immediately if user is not a member of [Admin] role?

'-----------------------------------------------------------------------------

’ MsgBox parameters – can be used where %Include “lsconst.lss” is not allowed

Const MB_OK = 0                 ' OK Button only

Const MB_IconStop = 16          ' Critical message

Const MB_IconExclamation = 48   ' Warning message

'-----------------------------------------------------------------------------

If Not IsAdminRole Then

	

	Answer% = Msgbox( "Only Administrators may use this agent.", MB_OK + MB_IconExclamation, "Access Denied" )

	continue = False

	End ' stop now

	

End If

End Function

Subject: Prevent edit mode

This is asked frequently - if you really want to prevent the document from being edited, you MUST make proper use of the ACL and Authors fields.

Any other changes that prevent the document from being put into edit mode are cosmetic at best.

Subject: RE: Prevent edit mode

Well … more than cosmetic. Certainly using the true security features of Notes is more secure, but few users are going to be able to break through application coding features using debug mode or other methods.

Subject: One more way

Declare a global variable as integer. Initialize it to your situation as False or True. Then in the corresponding events or actions, set this global variable to True or False accordingly and based on this value set the ‘editmode’ or ‘continue’ to false or true.

Subject: Prevent edit mode

On querymode change set the uidoc.editmode=False

Subject: RE: Prevent edit mode

continue = False