Manage Learn to apply best practices and optimize your operations.

Putting A Selected Document In Edit Mode From The View Applet

One of our clients wanted its' Domino application to work exactly the same in
both the Notes client and the web browser. This meant that the user had to be
able to put a selected document in a web view in edit mode without first having
to open it in read mode. The following code will do that for you.

The code uses several methods of the R5 View Applet API. Beware that this API
is unsupported, and its' methods and properties might change in the future. The
code is cross-browser, so it works in both Netscape and Internet Explorer.
Put the following JavaScript code in an action button:

// Create a regular expression to retrieve the hostname
// and database from the url
var expPattern = /(.+nsf)./;
var aMatch = location.href.match(expPattern);

if (aMatch != null) {
// Get a handle to the view applet
applView = document.applets.view;

if (applView != null) {
// Wait for the view applet to initialize
while (!applView.isActive()) {};

// Get the view UNID of the currently opened view
var sViewUNID = applView.getViewName();

// Get the document UNID of the currently selected document
var sDocUNID = applView.getCurrentDocument();

// Check if a document is selected by ensuring that the
// returned UNID is 32 characters long
if (sDocUNID.length() != 32) {
alert("No document selected. Please select a document to edit.");
} else {
// Construct the URL to edit the document
var sOpenURL = aMatch[1] + "/" + sViewUNID + "/" + sDocUNID +
"?EditDocument";
window.open(sOpenURL, "framContent");
}
}
}

Basically, what this code does is wait for the view applet to load, and then
use the getViewName() and getCurrentDocument() methods of the API to extract
the necessary data. With that information, the URL to edit the document is
constructed and the document is opened in edit mode (in above case, in the
'framContent' frame of the current frameset). The first part of the URL, being
the hostname and database, is extracted from the current pages' URL using a
regular expression (see the first lines of code).

Dig Deeper on Domino Resources - Part 4

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close