Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Adding Doclink to richtext field, reopen document in edit mode with double clicking restriction.

Posted on 2006-10-26
11
Medium Priority
?
838 Views
Last Modified: 2013-12-18
dear Experts,

I would like to do the following.

Create a new document(b) .
Create doclink on a richtext field for document (b) on uidoc.
Close doc, open doc for doclink to appear immediately.
Set Document to edit mode.
Change field value.

My problem is : when i reopen the document after successfully creating the doclink, the system would not allow me to change to edit mode. Yes, i have scripts in POStOPEN and QUERYMODECHANGE to prevent double clicking edit. The message that prompts was the message i used to disable double clicking editing.

EditMode = uidoc.EditMode
                        
                        
                        uidoc.Close
                        
                        
                        Set rtitem5 = doc.GetFirstItem("link_0")
                        If ( rtitem5.Type = RICHTEXT ) Then
                              
                              Call rtitem5.AppendDocLink( newdoc , "Doclink" )
                              doc.Form = "f-requestform"
                              
                              Call doc.Save( False, True )
                        End If
                        
                        Set uidoc = workspace.EditDocument( EditMode , doc )
                        
                  End If
            End If
            
            Messagebox "This item has been mark as processed.", , _
            "Ittem Filled"      
            
            
            
            allowEdit = Cint(1)
            uidoc.EditMode = True
            
            Call uidoc.FieldSetText("status" , "Partial Processed")
0
Comment
Question by:Leepingtang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
11 Comments
 

Expert Comment

by:LordMacBee
ID: 17817697
if you have a script preventing edit mode then you cant change to edit mode. That restriction doesnt just prevent the user the go to edit mode but also any script doing so.
0
 

Author Comment

by:Leepingtang
ID: 17817785
But i have the same script that works on a button. Is this a constrain?
0
 

Expert Comment

by:LordMacBee
ID: 17817846
I can't quite see from your code what you are trying to achieve...
firstly, the messagebox doesnt seem to be in any way connected to the edit mode and thus is called every time. there are two 'end if' statements without the initial if statement.
secondly, it's hard to guess what else is going on in the document. Can you post the QuerySave / QueryModeChange scripts as well? Or is this code from those event handlers?

Maybee if you post the whole code...
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Leepingtang
ID: 17817966
Sorry LordMAcBee, the code that i have pasted is an abstract only.

let me explain myself again.

I have the following codes to stop editing by double clicking on the form. ( forces user to use the action button that enables the form to be in edit mode. )

Sub Postopen(Source As Notesuidocument)
      If source.EditMode And Not source.IsNewDoc Then
            allowEdit = True
            source.EditMode = False
            Messagebox "Please press the Edit button to edit.",64,"Edit"
      Else
            allowEdit = False
      End If
End Sub


Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
      If allowEdit Or (source.EditMode And Not allowEdit) Then
            allowEdit = False
      Else
            Messagebox "Please press the Edit button to edit.",64,"Edit"            
            continue = False
      End If
End Sub


On event of a click on a button, a new document will be created. I want to be able to create a doclink to this newly created document and make it visible right after the click. so i have to close uidoc and add the doclink on the background. Then reopen the document once again. My problem lies here. I want to re-open the document that i have closes in EDIT MODE so user can make further changes.



'doc is close here
uidoc.Close
                        
                        'add doclink from background
Set rtitem5 = doc.GetFirstItem("link_0")
                        If ( rtitem5.Type = RICHTEXT ) Then
                              
                              Call rtitem5.AppendDocLink( newdoc , "Doclink" )
                              doc.Form = "f-requestform"
                              doc.status = "Partial Processed"
                              doc.d0_status = "P"
                              Call doc.Save( False, True )
                        End If
                        
                        'reopen doc and set as uidoc
Set uidoc = workspace.EditDocument( False , doc )
                  End If
            End If
            
            Messagebox "This item has been mark as processed.", , _
            "Ittem Filled"      
             allowedit = True
                                 uidoc.Editmode = true

' My predefined message appears once the code is executed to the above line, forcing users to use the edit button for modification. I want to bypass that so that users do not have to click on the EDIT button again.
0
 
LVL 63

Accepted Solution

by:
SysExpert earned 80 total points
ID: 17819935
DO not use the uidoc front end, you need to get the doc handle and use backend procedure to reopen it

I hope this helps !
0
 

Author Comment

by:Leepingtang
ID: 17824938
I think  i know where you are coming from, will give it a try and let you know! Gracias mucho!!
0
 

Author Comment

by:Leepingtang
ID: 17830965
sysExpert, can you provide more details?
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 17842521
OK, apparently backend classes will not work for you since they bypass the UI and you want to reopen the doc for editing.

If that is th case, then I would simly add a hidden field with a flag that tells you that you have saved and are re-opening the doc.
If the flag is set then do Not prompt.

you already have

doc.d0_status = "P"

and you can check that to bypass the Edit prompt, or use another hidden field.

Make sure the default of the field is known and that you change it as needed.

I hope this helps !


0
 
LVL 18

Expert Comment

by:marilyng
ID: 17973043
In addition to trapping the doc.d0_Status="P" on the post open, querymodechange, and postmodechange,

change the line: Set uidoc = workspace.EditDocument( False , doc )
to:  Set uidoc = workspace.EditDocument( true , doc )


I found that when trying to track these, you need to set a status based on the button being pushed.  The Notes Mail file script library does this, actioninprogress = PUSH_SAVE

So, if you roll your query events into a script library and attach some constants to all events, then you can step through using a select case actioninprogress

Some Constants:
Const  SAVECONTINUE = 21
Const  SAVECLOSE = 20
Const  CLOSENOSAVE = 99
Const  SAVEREOPEN = 50

So, when you have an action button like: Save & Close
The first thing it does is set the actioninprogress field,  this way you know which button was pressed.  You default the button to SAVECONTINUE when the document opens in edit mode.

FIELD ActioninProgress:=50;
@if(@Command([FileSave]);@SetField("ActionInProgress";20);"")

So, the first FIELD sets the actioninprogress field to your SAVEREOPEN value, and the second one changes it so the user can close when they finish a second time.

The PostOpen, QueryModeChange, PostModeChange then can use either a combined script library or individual calls to check the value of actioninprogress:

Select Case ActioninProgress
 Case SAVEREOPEN
    do this
    do that
    do this
  Case SAVECLOSE
    Do something else
    Do another thing
   case Else
     etc.
end select

Also, when going from UI to backend, it helps to destroy the uidoc,
uidoc.close
set uidoc = nothing

But if you do this, and then change the ws.editdocument(true, doc)  it should work.  


The other nice thing about the actioninprogress field is that you can use hidewhens nicely.. actioninprogress!=50

See if this helps you.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question