3
votes

In one of my XPages application (for Client, XPiNC) I have a link to "Edit" an attachment of this document. I use the technology described in this blog article to get the attachment edited.

In that scenario I have three windows interacting:

  1. The XPage (XPiNC) containing the document where the link is clicked
  2. The Notes Document (called by notes:// URL) containing the attachment
  3. The application window containing the launched attachment (e.G. MS Word).

I managed to let the notes document (2) wait for the application (3) to finish and upload the modified attachment.

Now I need the XPage to wait for the backend change to occur and then to reload the XSP Document from the backend document to prohibit save conflicts.

I think the easiest way would be to pull out the attachments to attachment documents that are responses to the current document, but this is a rather old application that has large amounts of data in many many databases, and it is not feasible to convert all of these existing documents for that.

Now I search for the second best way to do it.

So again the question: How can I make the XPage "wait" for a backend change to occur and then reload the current page.

Second: How do I best "visualize" to the user, that something is running in the backend (Spinner, fade out, etc.).

The servers are 9.0.1FP2, the Clients unfortunately are 8.5.3 (cannot be updated at the moment).

Here is the Code, that I use in my "Open" Link:

<xp:link escape="true" text="Edit" id="attachmentEdit">
  <xp:eventHandler event="onclick"
    submit="true" refreshMode="partial" refreshId="tableAttachment">
      <xp:this.action><![CDATA[#{javascript:var strAttachmentName:String = docs.toString(); 
        var strReplid = database.getReplicaID(); 
        var strUnid = document1.getDocument().getUniversalID();

        var strServer = @Name( "[CN]" , database.getServer() );
        var strUrl:String = "notes://" + strServer + "/"+strReplid+"/(ShowAttachment)?OpenForm"; 
        session.setEnvironmentVar("InfothekCurrentAction","EDIT~" + strUnid + "~" + strAttachmentName); 
        view.postScript('window.location.href="'+strUrl+'"');}]]>
      </xp:this.action>
    </xp:eventHandler>
  </xp:link>
2

2 Answers

0
votes

I am using an xagent for that. Thats what i do:

1) I am setting the background of a div to a moving css gradient.

2) Set the src of the div to an xagent that is doing some things in the backend

3) The xagent is calling some csjs after its loaded(in your case, you could call a button to refresh the page)

0
votes

Take a look at this proof-of-concept demo: http://dontpanic82.blogspot.sk/2010/01/xpages-custom-control-that-can-help.html

Simple CSJS chcecks for updated property of the document. In case it was modified (attachment saved), you can show pop up or just reload the XPage.