Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Stop editors from sending a document to EditMode

Hi Experts,

I have a document that I don't want people to be able to edit by double clicking or going to actions/edit
But I do want it to goto edit only if they press a special action button.

The only problem is the action button has code and it is all in formula, and the QueryModeChange also has code already
but its all in script.  Is there a way I can stop the user from editing unless they press this Action button (in formula)

Thanks in advance... Joe.
0
jpirozzolo
Asked:
jpirozzolo
  • 5
  • 2
  • 2
1 Solution
 
ZvonkoSystems architectCommented:
You can not stop editing, but you can avoid changing the document :)

Add a field named SaveOptions and set it to "0"

Now your button should change this field to "1" before saving. Otherwise are people editing this document without button doing this in vain.

0
 
ArunkumarCommented:
Have an action button on view called as edit document.

Have this code:
@SetEnvironment( "EditAccess" ; "1");
@PostedCommand( [EditDocument] ; 1 )

In the QueryOpen Event have this script
-----------------
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
'    To check the document status:    
'    If the user opens the document in Read Mode , allow him to do so
'    If the user opens the document in Edit Mode without clicking the 'Change Name' Button, stop him
'    If the user clicks the 'Change Name' button then allow him to modify the contents
     
     Set Session = New NotesSession
     EditAccess = Session.GetEnvironmentString("EditAccess")
     If Mode = 1 And EditAccess <> "1" And (Not Isnewdoc) Then
          Continue = False
     End If
End Sub
------------

in the query modechange event have the following...

------------
Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
' The environment vairable EditAccess is set when the user clicks the Change Name button on the view Action Bar to 1, indicating that
' the user can edit the document to change the manager's info.  If the user did not use the Change Name button, do not allow them
' to edit the document since the agents would not run that make the changes to documents in other databases.
     
     Set Session = New NotesSession
     EditAccess = Session.GetEnvironmentString("EditAccess")
     If Not (Source.EditMode And EditAccess = "1" ) Then
          Continue = False
     End If
     
End Sub
-------------------
In query Close have this formula,

--------------------
ENVIRONMENT EditAccess := "0";
""
----------------

-Arun.
0
 
ArunkumarCommented:
Zvo-Bro !
This one is mine. And Joe will be definitely giving me 500 pts with EXcellent grading just wait and see...
:-)

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ZvonkoSystems architectCommented:
OK :)

But read first his requirements: no change in QueryModeChange section.
He use @formula and you propose LotusScript.

But if you mange to get the points, then it is ok :)

0
 
ArunkumarCommented:
Hee Hee Hee.... I am lucky here too...

The button of mine has formula and the mode change event has script.

It will be easy for him to implement my solution...

:-)
0
 
jpirozzoloAuthor Commented:
Thanks guys for the quick responce.
Looks like Arun gets the gold medel on this one (sorry Zvonko).. Perfect combo of Script and formula.

Anyway thanks again and have a great weekend.

Well done ... Joe :-D  
0
 
ArunkumarCommented:
FYKI: That code was stolen from none other than the #1.

:-)
Arun.
0
 
jpirozzoloAuthor Commented:
Oh yes!! so it was.

Well as CRAK says better stolen well than programmed badly :D
0
 
ArunkumarCommented:
oh yea!
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 5
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now