Subscribe via Feed

Referencing Server-Based Images in XPages

Paul Withers, May 10, 2010 12:15:48 PM

Some time ago Jo Grant posted on the Notes & Domino Application Development Wiki a helpful and effective bit of server-side javascript code to manipulate the XSPUrl class to reference view icon images in XPages.

After using that method to reference images in the oneuiv2 folder on the server, I remembered that themes reference oneuiv2 css and javascript files, but don't have to manipulate the XSPUrl class. Instead they set the href attribute to:

/.ibmxspres/domino/oneuiv2/goldTheme/goldTheme.css

So I could reference iconConfirmation16.png in my Program Files\IBM\Lotus\Domino\data\domino\html\oneuiv2\images folder with the following code:

"/.ibmxspres/domino/oneuiv2/images/iconConfirmation16.png"

NB The html subfolder must be omitted from the path, if you include that, it'll fail.

If you want to reference images for the oneui or webstandard themes, in \domino\java\xsp folder and subfolders, you need to use "/.ibmxspres/global". So this will give you the calendar date picker image used beside date fields with the oneui theme:

"/.ibmxspres/global/theme/common/images/iconDatePicker.gif"

Action button icons and view icons are slightly easier to reference. There is no special method to access the icons subfolder, you just need "/ibmxspres/domino/icons", e.g. "/.ibmxspres/domino/icons/vwicn101.gif".

And if you've got already got a column set to display view icons, the following server-side javascript will work:

"/.ibmxspres/domino/icons/vwicn" + @Right("00"+@Text(myDoc.getColumnValue("Status")),3) + ".gif"

NB The icon is a number, so not necessarily three digits. The @Right code forces to three digits prefixed with the relevant number of zeros to create the right image name.

Also, from looking at the oneuiv2 themes you should be able to access the dojo folders with the url "/.ibmxspres/dojoroot/". I haven't tried this, but again, because it works in themes, it should work in image urls.

These urls will allow you to use any of server-based images quickly and easily with minimal typing.



2 responses to Referencing Server-Based Images in XPages

iota, November 25, 2010 7:56 AM

To get images in Notes and server side I use this :

if(@ClientType()=="Notes"){
return "/.ibmxspres/icons/vwicn" + @Right("00"+@Text(viewEntry.getColumnValue("$0")),3) + ".gif";
}else{
return "/.ibmxspres/domino/icons/vwicn" + @Right("00"+@Text(viewEntry.getColumnValue("$0")),3) + ".gif";
}


chinmay, October 5, 2010 10:55 AM

Does this work on Notes Client too? I created image control and specify

/.ibmxspres/domino/icons/actn010.gif as the URL. The XPage shows proper images in browser but not in Notes Client.