SNTT: Using OpenNTF Xpages Wiki with multiple domains

I have been working on a public facing OpenNtf Xpages Wiki for our Delivery Toolkit suite of products and wanted the Wiki to work with multiple domains e.g. if a user arrived via www.focul.net or www.deliverytoolkit.com then the wiki links would remain consistent.

The current wiki code ( 0.6 ) causes the internal wiki links to resolve to the domain which is configured as the host name on the server document.

Image:SNTT: Using OpenNTF Xpages Wiki with multiple domains
Looking at the code in the xpWikiStyle SSJS library the links are absolute. Changing the following line produces relative urls which will honour the domain

url=@LeftBack(database.getHttpURL(),”/”)+facesContext.getExternalContext().getRequestContextPath();

to

to url=””+facesContext.getExternalContext().getRequestContextPath();

so http://www.deliverytoolkit.com/Public/FDT/FDTWiki.nsf/home.xsp and
http://www.focul.net/Public/FDT/FDTWiki.nsf/home.xsp both work.

Using facesContext.getExternalContext().getRequest().getHeader(“Host”) to get the domain should also work if a computed domain is required

The project entry is here

Update  11th March 2010
You need to make similar changes tot he edit button on the prtContent custom control i.e. the wiki page

SNTT: Examples of accessing data on Xpages

There are several ways of getting at the data on an Xpage. I wanted to understand this better so I have created this example which gives examples of

getComponent( “element name”).getValue();
getComp onent(“element name”).getSubmittedValue()
currentDocument.getItemValueString(“back end field name / data source name”)

The key learning for me has been that the getSubmittedValue method will only work if the “Do not validate or update data” property is set. If it is not set then the value returned is null even though the name would suggest that it returns the “submitted value”.

Image:SNTT: Examples of accessing data on Xpages

This means that in the case of a document which is not new you may need to test for both the existing value and the submitted value if you are using a two stage drop down as described by Tim Clark. The code I have used in a recent project is :

// the submitted value is not available
// until on onchange event has occurred
var keyvar : String;
var combo4SV = getComponent(“comboBox4”).getSubmittedValue();
var combo4 = getComponent(“comboBox4”).getValue();
if(combo4SV === null){keyvar = combo4} else {keyvar = combo4SV};
@DbLookup(@DbName(), “vpeepsbyorgname”, keyvar, 2)

There is also a similar example listed under “Combining getValue and getSubmittedValue” in the Redbooks Wiki: Building Domino Web Applications using Domino 8

I have also found the following links useful :

You at Notes Wiki
Embedding Contextual Data for Client-Side Logic in XPages
Paul Hannan

xpage_field_values.nsf

SNTT : Adding Google Analytics to the OpenNTF Xpages Wiki template

I have been working on a public facing OpenNtf Xpages Wiki for our Delivery Toolkit suite of products and I wanted to add Google Analytics.

It turned out to be straight forward once I had read a blog by  Thomas Adrian  who’s Xpages based blog really looks the business – try out the search functionality.

Step 1 – copy the Analytics code from Google

Image:SNTT : Adding Google Analytics to the OpenNTF Xpages Wiki template

Step 2 – disable the design inheritance for the wiki using application properties

Image:SNTT : Adding Google Analytics to the OpenNTF Xpages Wiki template

Step 3 – open the prtBanner Custom Control

Image:SNTT : Adding Google Analytics to the OpenNTF Xpages Wiki template

Step 4 – add an Output Script control to the Custom Control

Activate the Custom Controls Panel

Image:SNTT : Adding Google Analytics to the OpenNTF Xpages Wiki template

Position your curson in the top left corner of the prtBanner and click

Image:SNTT : Adding Google Analytics to the OpenNTF Xpages Wiki template

Select the “Output Script” Custom control from the “Other” Custom Controls menu

Image:SNTT : Adding Google Analytics to the OpenNTF Xpages Wiki template
Image:SNTT : Adding Google Analytics to the OpenNTF Xpages Wiki template

Switch to “Source” and you will see the Output Script represented by<xp:scriptBlock id=“scriptBlock1”></xp:scriptBlock>.
You can move this to the top of the other custom controls as shown below.

Image:SNTT : Adding Google Analytics to the OpenNTF Xpages Wiki template

Now paste your Google Analytics Script between the Script Block markers so that it looks like this

Image:SNTT : Adding Google Analytics to the OpenNTF Xpages Wiki template

Save the Custom Control