Sean Cull

Show Summary Only

SNTT : Adding a redirect message to a HTTPS login when the url is changing

Focul Developer  28 February 2013 19:21:58

If there is a better way to do this then please tell me :-)

iNotes users have previously logged into a Domino server called inotes.acme.com. They always used HTTPS. The new domian for the server is email.biggeracme.com

So when users hit https://inotes.acme.com we want to give them a message and a hyper link saying "in future please use http://email@biggeracme.com"

Now if they were using http as opposed to https you could use a domino internet sites redirect rule that took users to a page with this message.

But because they are using the HTTPS protocol and there is only a single IP address for the server redirects do not work in this way.

Domino, as far as I understand, latches onto the first SSL enabled internet site document that it finds.

So... being a developer I hacked the Domino Web Access Redirect login form so that it uses a different sub form depending on the url

Users going to https://inotes.acme.com get this

Image:SNTT : Adding a redirect message to a HTTPS login when the url is changing

Whereas users going to https://email.biggeracme.com get this

Image:SNTT : Adding a redirect message to a HTTPS login when the url is changing


The trick was to add an extra field to the DWALoginForm form in iwaredir.nsf as shown below. This uses the cgi variables and captures the domain name.
So when the domain name contains inotes.acme.com the subform "message" is presented otherwise the standard subform is presented.

Image:SNTT : Adding a redirect message to a HTTPS login when the url is changing

 Admin Tips  Lotus  Show-n-Tell Thursday 


SNTT : Pulling Notes data into Excel via http / XML

Sean Cull  5 September 2011 22:51:45

Just a very quick tip to show how you can dynamically pull your latest Notes / Domino data into an Excel Spreadsheet.
Note that this method will only work for domino applications which do not require authentication

Basic Idea


In Excel go to Data and click on the Data and then "From Web" options

Image:SNTT : Pulling Notes data into Excel via http / XML

Next paste in the URL of your Domino XML feed ( more on that later )

Accept all of the options and your data will be added in a nicely formatted table.
The table is also given a name so that when you reference it from pivot charts etc.. the chart will always contain all of the data from the XML feed.

Creating the XML Feed

Continue Reading "SNTT : Pulling Notes data into Excel via http / XML" »

 Lotus  MS Office  Show-n-Tell Thursday 


SNTT : Using Active Directory to authenticate web users

Sean Cull  10 March 2011 21:24:59

Introduction



This article describes how you can use Active Directory via LDAP and Directory Assistance to authenticate your web users. This is particularly useful in our case where we have an XPages based application running in on a black boxed  appliance in a MS shop.
The example uses a Windows Server 2008 R2 for AD and Domino 8.5.2 running on Linux. The scheme is simple enough but I struggled to piece the bits together so I thought a write up would be useful.

Useful tools



I found that the Apache Directory Studio was really useful. This allows you to explore the Active Directory LDAP feed and get a feel for its structure.

Continue Reading "SNTT : Using Active Directory to authenticate web users" »

 Admin Tips  Appliance  Dev Tips  Show-n-Tell Thursday  Active Directory  LDAP  Lotus 


SNTT : Adding embedded Video to the Openntf Domino Wiki Template

Sean Cull  28 October 2010 20:03:41

I use the Domino Wiki template from OpenNTF for most of the projects that I work on. It has its quirks but it is none the less very useful.

We are launching a new XPages product and I wanted the relevant wiki to be a bit more engaging so I added a .swf ( Adobe Shock Wave ) feature that displays the video as an embedded object.
I guess this doesn't work for iPads ??

Anyhow, it is very simple to do and the end result is a form that looks like this

Image:SNTT : Adding embedded Video to the Openntf Domino Wiki Template

and a wiki  page that looks like this (click here )


Image:SNTT : Adding embedded Video to the Openntf Domino Wiki Template

Step 1 : Add a new field to the underlying Notes form CONTENT NOTES



Image:SNTT : Adding embedded Video to the Openntf Domino Wiki Template

Step 2 : Add a computed field to the Custom Control prtContent



This field displays the html code for the video if the field above is populated.

Image:SNTT : Adding embedded Video to the Openntf Domino Wiki Template

The value of the field is calculated as shown below. The field is set to display as HTML ( see attached file also )


part6 = document1.getValue("swffilename_tx");
atturl = facesContext.getExternalContext().getRequest().getRequestURL().toString() + "/$file/"+part6;
"<object width='550' height='400'><param name='movie' value='"+ atturl +"'><embed src='"+atturl+"' width='550' height='400'></embed></object>"

The visibility of the filed is calculated as

if(document1.isEditable()){return(false)};
var check1 =  document1.getValue("swffilename_tx");
if (check1 =="" || check1 == null){return(false)}else{return(true)}

I'm not proud, any advice on coding gratefully received.


Step 3: Add a field to the XPages so that it can be edited in the browser



Image:SNTT : Adding embedded Video to the Openntf Domino Wiki Template

This is mapped to the field on the form in step 1. Also note that if you copy the the source for the row above the cells are hidden for some reason.

Thats it !

To use it attach a SWF file and enter the file name into the new field.

The result is like this => http://www.deliverytoolkit.com/Public/FDT/moc/mocwiki.nsf/dx/Overview_Screencast

I have attached the XPage source below. I would attach the whole database but it has been badly hacked about in other ways.

Sean








 Dev Tips  Lotus  Open Source  Show-n-Tell Thursday  Wiki Template 


SNTT : Modifying an Xpage resource file via DXL without a temporary file

Sean Cull  23 September 2010

In Xpages resource files can be used to store settings. This is a great way of increasing the configurability of your application ( labels, keyword choices etc )  without having to carry the overhead of frequent look-ups to Notes configuration documents. This approach is a core part of the Steve Castledines OpenNTF Xpages Framework and has also been recommended by Matt White.

This article describes how to create a resource file via DXL using a stream so that an intermediate file on the hard drive is not needed. The code incorporates other code from Julian Robichaux for managing the Base64 encoding.

Entering the configuration


The application has a series of configuration documents. As each is saved in the UI it calls a back end LotusScript agent which creates a file resource. The Xpage application pulls the settings directly from this file resource rather than from the documents themselves.
The system does not attempt to update the file resource but creates a new one from scratch by cycling though the view and adding information for each record.

Image:SNTT : Modifying an Xpage resource file via DXL without a temporary file

The structure of the file resource


Image:SNTT : Modifying an Xpage resource file via DXL without a temporary file

Retrieving the settings


The settings can be retrieved using the code below, note that you also need to include the file as a resource bundle

Image:SNTT : Modifying an Xpage resource file via DXL without a temporary file

Image:SNTT : Modifying an Xpage resource file via DXL without a temporary file

The code to create the resource file


Image:SNTT : Modifying an Xpage resource file via DXL without a temporary file

The crux to creating the file resource is that it is in base64 so you will need to use some code originally developed by Julian Robichaux and published on OpenNTF
I have attached the whole script library at the end of the article. The entry point called by the agent is Sub s_CreateFileResourceFromView_6_01

Image:SNTT : Modifying an Xpage resource file via DXL without a temporary file


I have posted the code as an attachment. Apologies for not including a demo database but I would need to strip the functionality out of a commercial system. The attached code has plenty of commenting .

This article has also been posted on the IBM Developers Wiki

 Dev Tips  Lotus  Show-n-Tell Thursday  XPages 


Receiving POP3 mail into a Linux Domino server using getmail and sendmail

Sean Cull  26 July 2010 07:42:55

I have a need to receive mail from a POP3 account into a domino server running on Centos 5.5 as an appliance.  

Some time ago on windows I used the Chimeras Email Forwarding System which worked very well but this was a Linux server.

The scheme I came up with uses a combination of  Getmail version 4 and Sendmail.

Getmail is a Linux utility which will poll different types of mail accounts and then pass those messages on. It has an option to pipe the messages to an external mail delivery agent such as Sendmail. Sendmail can then send them on to the Domino server as SMTP on the localhost address.

These notes are for a Centos 5.5 installation with the Webmin web based management console

Install and configure Getmail



Create a new user called mailer or similar and a password. This is because Getmail will not call Sendmail if it is run as root.

As Root download Getmail

see http://pyropus.ca/software/getmail/documentation.html#installing

$ cd /tmp/
$ wget http://pyropus.ca/software/getmail/old-versions/getmail-4.20.0.tar.gz
$ tar xzf getmail-version.tar.gz
$ rpm -ihv getmail-version-release.noarch.rpm
$ cd getmail-version
$ python setup.py build


I then used Winscp to create the configuration file /home/mailer/.getmail/getmailrc


In this case the receiving account on the Domino server will be the Administrator account. Getmail has lots of other options

[retriever]
type = SimplePOP3Retriever
server = acme.com
username = peter pan
password =

[destination]
type = MDA_external
path = /usr/sbin/sendmail
arguments = ("-i","-bm", "administrator@localhost")

[options]
verbose = 0
read_all = false
delete = false
message_log = ~/.getmail/log

[default]

Configure Sendmail



Sendmail and Domino cannot normally run on the same box because they both need to bind to port 25. In this scenario Sendmail does not need to listen to port 25 so it can be configured to listen on port 26 ( or any other unused port ). I used the Webmin client to make this change under Servers > Sendmail > Network Ports


Image:Receiving POP3 mail into a Linux Domino server using getmail and sendmail


Testing the System



Log in as mailer

enter getmail -v
The -v gives a verbose output so that you can see what is happening.


Scheduling the getmail task



I used webmin to set up the cron job running as the mailer user


System > Scheduled Cron Jobs


Image:Receiving POP3 mail into a Linux Domino server using getmail and sendmail

Other things to remember



You may need to set Sendmail up to start on bootup

You may need to allow pop3 mail through your firewall


As usual all feedback on better schemes welcomed !

Sean


 Admin Tips  Appliance  Linux  Lotus  Show-n-Tell Thursday 


SNTT : Installing Traveler on an old 32 bit server is so much easier with linux than windows server 2008

Sean Cull  10 June 2010 08:00:00

Image:SNTT : Installing Traveler on an old 32 bit server is so much easier with linux than windows server 2008

Note 1 : Notes 8.5.2  is beta and there are no guarantees that the features described here will be in the final product that IBM ships.

Note 2 : The description below is for a development server and may or may not be suitable for production depending on your circumstances.

Having moved to Amazon EC2 I I recently decommissioned an old Dell Poweredge 650 server and decided to put it to good use to test 8.5.2 CD5. This server has no DVD drive, is 32 bit and cannot boot from USB.

My original plan had been to get some more experience of Server 2008 R2 but I ended up going down the Linux route as it was much simpler. Continue Reading "SNTT : Installing Traveler on an old 32 bit server is so much easier with linux than windows server 2008" »

 Admin Tips  Lotus  Show-n-Tell Thursday  traveler 


SNTT : Accessing a Notes Server with a notes client via Port 22

Sean Cull  13 May 2010 07:00:00

You can get to a Notes server from a Notes client via port 22 if you use the tunnelling feature in Putty.
Useful if you are looking at an appliance type deployment for browser apps.
Note that you will need a connection document listing the ip address as localhost as you cannot type localhost directly into the server name in the File >> Open >> Lotus Notes Application window as you can ( sometimes ) with an IP address.

Image:SNTT : Accessing a Notes Server with a notes client via Port 22

 Admin Tips  Appliance  Amazon EC2  Lotus  Show-n-Tell Thursday 


SNTT: Creating a persistent EC2 Domino Instance with EBS boot volumes

Sean Cull  1 April 2010 07:00:00

Image:SNTT: Creating a persistent EC2 Domino Instance with EBS boot volumes

update : there is now also an official IBM Domino AMI and a wiki article although I think it will take some work to make it persistent.

After reading Michael Brown's excellent article about setting up an "Ephemeral" Domino server on EC2 I decided to look at using EC2 a bit harder. This blog is now running on EC2 and I have been very very impressed with the functionality that this service provides. I would obviously like to test the system more but early indications are that it has good potential for VSMB and SAAS Domino offerings.

When you follow Michael's guide you get a Domino server which uses the "Ephemeral" disk which is automatically deleted when the the instance is terminated. An alternative approach is to build the system using the Amazon Elastic Block Storage ( EBS ) system for storage. These EBS volumes have the potential ( note the word potential ) to remain intact after the instance is terminated. This means that should the instance fail your data will remain intact. It also means that you can take advantage of options to use "spot pricing" and to resize your server.

This article will take you through a method to set up such a server using Ubuntu 8.04. I am not an expert in Linux or EC2 so I would appreciate your comments on any improvements that I could make to the scheme. You should also note that as yet there is no licence for Domino on EC2 but the licences for DB2 usage suggest that a small EC2 instance is 50 PVU points. Ed Brill has posted of a forthcoming licence but this is intended for "Development and Proof of Concept" usage.

Michael covers setting up the Amazon account, it is really straight forward. The console is a great example what can be achieved with CSS.

Image:SNTT: Creating a persistent EC2 Domino Instance with EBS boot volumes
Continue Reading "SNTT: Creating a persistent EC2 Domino Instance with EBS boot volumes" »

 Admin Tips  Open Source  Show-n-Tell Thursday  Ubuntu  Lotus  Amazon EC2 


SNTT : XPages onclick Ghosts in the machine

Sean Cull  18 March 2010 10:18:13

For some time I have been convinced that there is ghost code in my Xpages applications. Being new to Xpages I often rework my approach to things and it seems as though my old code was still running  even though it had definitely been changed !

Another part of this phenomenon is that I have been convinced that onclick events in links have been firing on page load. This usually happened in the early hours adding to my belief that it was a ghost !

Well Keth Strickland made a post a few days ago that made me think it might not be just me. He described how if you edit the onclick property of a link in the "All Properties" tab the code would fire on page load.

Investigating further I found that the problem was two fold. Keith is right, it does fire but it is also possible to end up with two sets of code for the on-click event as the screen cast below shows.

1) Add some code to the on-click of a link via the events tab
2) save the document
3) reopen the document and you see the same code in the all properties tab for the link
4) modify the code via the events tab ( in this case change "2" to "x" )
5) save and close the document
6) re-open the document and you have two different sets of code, one of which also happens to run on page load

I had to make a screen cast to prove I wasn't mad.
Continue Reading "SNTT : XPages onclick Ghosts in the machine" »

 8.5.1  Dev Tips  Show-n-Tell Thursday  XPages  Lotus 


SNTT: Examples of accessing data on Xpages

Sean Cull  25 February 2010 07:30:00

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 :
Continue Reading "SNTT: Examples of accessing data on Xpages" »

 8.5.1  Dev Tips  Lotus  Show-n-Tell Thursday  XPages 


SNTT: Using OpenNTF Xpages Wiki with multiple domains

Sean Cull  25 February 2010 07:30:00

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

 8.5.1  Admin Tips  Dev Tips  Lotus  Show-n-Tell Thursday  Wiki Template  XPages 


SNTT : Adding Google Analytics to the OpenNTF Xpages Wiki template

Sean Cull  11 February 2010 08:00:00

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 Continue Reading "SNTT : Adding Google Analytics to the OpenNTF Xpages Wiki template" »

 2nd hand tips  Admin Tips  Dev Tips  Lotus  Show-n-Tell Thursday  Wiki Template  XPages 


Application Debug Mode

Sean Cull  19 November 2009 07:00:00

A while back someone asked what was my best tip for Lotus Notes development - this is it - it is used in every single application I have developed in at least the last 5 years and it was passed on to me by my cousin ( thanks Martin )!

Most Notes forms will have hidden fields on them and those fields are really useful when it comes to understanding what is going on in an application. You can access the values in three ways :

1) use the document properties
2) change the "hide when" properties
3) - my tip - programmatically change the "hide when" properties

I used to hide the individual fields but a better way is to change the "hide when" attribute of a section rather than the individual fields ( thanks Ewan ). The hide when is linked to a notes.ini / environmental setting but you could also use a profile document.

Image:Application Debug Mode

Image:Application Debug Mode
Continue Reading "Application Debug Mode" »

 2nd hand tips  Dev Tips  Lotus  Show-n-Tell Thursday 


Fusion Charts tips ( including xPages )

Sean Cull  20 July 2009 08:00:00

During a recent Proof of Concept with XPages I was struggling to get fusion charts to work with Xpages so I thought I should write down what I learned. To be honest there is really only one tip that is specific to Xpages but the Fusion Charts bits was useful learning for me.

Fusion Charts is a flash based system that lets you easily create charts, dashboards etc... There is a free version and a paid for version. There are also several other competitors to this and I would be interested to hear how others have found them.

Image:Fusion Charts tips ( including xPages )

There is a demo database here, this can also be downloaded. Xpages it requires 8.5x to run. The help in the Fusion download is also excellent.
Continue Reading "Fusion Charts tips ( including xPages )" »

 8.5  Dev Tips  Lotus  Show-n-Tell Thursday  XPages 


SNTT : Button to check if your users are fowarding mail to external email accounts

Sean Cull  11 December 2008 18:28:53

Users forwarding automatically forwarding emails to external accounts can cause both security and reliability issues. I have seen instances where an email was automatically sent to an external account which sent back an error bounce message ... which got sent to the same account ... which sent back another bounce message ... and so on.

There are two main ways that users will do this.

The first
is to modify the mail forwarding address in their person record ( Can your users edit this setting ? Should they be able to edit this setting ? ). You can find these affected records by searching the people view in the NAB / Domino Directory using a search string such as the one shown below - this is a cruse search looking  for the existence of the "@" symbol in the mailaddress field. Note that you can save this as a shared search for future use.

Image:SNTT : Button to check if your users are fowarding mail to external email accounts

The second
method that users use to forward mail to external accounts is to use the mail rules in their mail files. These can be disabled in the server configuration record but they are genuinely useful things to have in many cases.

I have written code for a button which will scan everyones mail rules ( assuming the user has access to their mail files ) and return a report of mail rules containing the symbols "@" and "." in the same forwarding address. This is a fairly crude search string but it is effective in most cases - feel free to improve upon it.

Clicking on the button will produce a report such as the one below which is emailed to your Notes account.

Image:SNTT : Button to check if your users are fowarding mail to external email accounts
Continue Reading "SNTT : Button to check if your users are fowarding mail to external email accounts" »

 Admin Tips  Download  Show-n-Tell Thursday  Lotus 


SNTT - Short agent to change the run on server for scheduled agents

Sean Cull  4 December 2008 18:00:00

I use this administration agent in my databases to quickly change the "run on" server for all f the scheduled agents when I deploy a template to a new server.

The other approach I use is to have the agent "run on all servers" but to then have each agent check for a configuration document in the database which then lists which servers it is allowed to run on. If the current server is not in the configuration document then the agent exits.

Sub Initialize
        Dim session As New NotesSession
        Dim ws As New notesuiworkspace
        Dim db As NotesDatabase
        Set db = session.CurrentDatabase
        Dim askme As Variant
       
        askme = ws.Prompt (PROMPT_OKCANCELEDIT, _
        "Suggested Server", _
        " You must use the format CN=...." ,db.server)
        If Not Isempty (askme) Then
                Forall a In db.Agents
                        If Not a.servername = "" And Not a.servername = "*" Then
                                If a.servername = askme Then
                                        Print a.name + " already set to run on chosen server"
                                Else
                                        Print "changing " + a.name + " from " + a.servername + " to " + askme
                                        a.servername = askme
                                        Call a.save
                                End If
                        End If
                End Forall                
        End If
        End Sub


change_server.lss

 Dev Tips  Show-n-Tell Thursday 


SNTT: Stopping users from opening the wrong replica

Sean Cull  22 October 2008 22:00:00

One of the great strengths of notes is that users can access the same information on different servers or on local replicas. It can also be a real problem.

I have frequently had calls from people along the lines of
"I added some information and I can see it but my colleague can't".


One of our clients recently wanted to deploy replicas of their business critical applications to a different server to improve robustness. Without taking any special steps this actually reduces robustness and user satisfaction because over a period of time users end up using different replicas from each other and sometimes are using a slow server ( a branch office in South Africa on broadband was often a culprit ) without realising this.

The dynamics of how Notes chooses which server to open next often puzzles me but I was once told that it was to do with the alphabetical order of the servers because of the order of the databases in catalog.nsf - and once the top icon is for a distant server users will always use that server.

Anyhow, the code that follows may help. In this particular case the business applications are only used on one site so access to any off-site server should only be required if the on-site server cannot be accessed, his makes it easy - in other projects I have used a rule whereby the application should be accessed on the same server as the persons mail file

There are 3 design elements :

1) an action that creates a profile document listing the name of the preferred server - this is manually triggered when the system is set up

2) some script in the database initialize script which compares the preferred server lists above with the actual server

3) a subform which pops up to alert the user if looks as though they are using the wrong server.


Essentially the code does the following :

checks to see if the person has access to the database
gets the preferred server name from the profile document and compares this with the actual server name.

if the actual server != the preferred server then the system checks to see if the preferred server can be opened.
if the preferred server can be opened then the user is advised as shown in the screen shots below otherwise the user is allowed to open the requested server

I wasn't able to write code to actually switch to the new database so instead it closes the database and brings the correct icon to the top on the workspace. i have not tried this in a "workspaceless" environment.


Image:SNTT: Stopping users from opening the wrong replica

Image:SNTT: Stopping users from opening the wrong replica


You may think that the steps required to access the "wrong" server are a bit OTT but remember that this pop up only gets triggered when the "preferred" server is available.

Continue Reading "SNTT: Stopping users from opening the wrong replica" »

 Admin Tips  Dev Tips  Show-n-Tell Thursday  Download  Lotus 


SNTT - Visual Directory - thumbnails in the domino directory

Sean Cull  2 October 2008 23:06:02


Image:SNTT - Visual Directory - thumbnails in the domino directory

Last year one of our clients asked us to help create a directory of staff with thumbnail images, profiles and contact details. After bouncing it about we agreed that using the Domino directory would make sense as much of the information was already there.

I am always wary of messing with the directory but in this case it was a relatively small directory ( < 200 people ) and we set out to add design elements rather than modify existing design elements. The scheme that we came up with is shown in the images above - essentially the system converts thumbnail images ( 80px x 80px ) into image resources and then displays these image resources in the view.

I doubt that this approach will  scale to very large organisations but I have used it on a version of Jake Howletts test directory with 2,000 names and it works fine.

Before launching into the technical description I would like to thank the following people whose code is included in some way :
  • Our client who paid for some of this work and kindly agreed for it to be open sourced - it was a win - win because we obviously didn't charge them for the open source code that we used.
  • Ewan Arthur, a colleague from FoCul,  who worked with me on the code
  • Julian Robichaux -  http://www.openntf.org/Projects/codebin/codebin.nsf/0/DF779ACFF30EB48886257118004D35B5
  • Lou Capizzoli on Openntf.org  http://www.openntf.org/Projects/codebin/codebin.nsf/0/DF779ACFF30EB48886257118004D35B5
  • Charles Robinson  http://www.cubert.net  ( the my documents folder code )
  • Rocky Oliver / Andre Guiard  http://www.lotusgeek.com/SapphireOak/LotusGeekBlog.nsf/D6Plinks/ROLR-6MBMQJ        

The Scheme


A new form was used to display the persons profile. This form has an action button allowing a jpg file to be uploaded and stored in a rich text field called UserPhoto.

A background agent ( which needs unrestricted privileges ) takes the newly attached jpg files, downloads this to the hard drive on the server and then creates an image resource using DXL using code from Lou and Julian. The name of the image resource is the document unique id of the person record. The jpg file is deleted from the hard drive once the image resource has been created

A new view displays the person records and the image resources associated with each person record. The view has a form formula which forces the new profile form to be used when a document is opened from this view. The form has a form field to make sure that the default form for that record is always the original Domino Directory person form,

In the examples attached below I have left the default domino directory views in place but it is a simple matter to change the default opening view ( edit the Mainframeset ) to be the new one with the images

Note that the forms and code shown here are simplified from the production system but the key concepts still work.

The Design Elements


The only change to the existing elements of the Domino directory is the default view for the mainframeset frameset, everything else uses new design elements. These are :

Forms
:

.FoCul\PersonProfile

Views
:

Focul\01. Profiles\By Name)

Script Library
:

.FoCul_Image_Resource_Handling_6_01

Scheduled Agent
:

.FoCul\Update Image Resources ( note that this needs to be set up for your named server )
note that the agent contains a selection rule so that it only runs on records needing to be processed

Other agents
:

.FoCul\Set images for all people - populates all records with test images stored in c:\temp\images  ( may not be MAC friendly )

(.FoCul Remove Profile)

The Downloads


There are four downloads :


Very Small : The script library at the heart of the system

.FoCul_Image_Resource_Handling_6_01.lss

Small : A database with just the required additional design elements ( 0.5 Mb )

designelementsonly.zip

Medium : A full Domino Directory (8.0.2 ) with the original and the new design elements and 10 records ( 3 Mb )

somerecords.zip

Large : The 2000 record Domino Directory with test images ( 40 Mb  )

fakenameswimages.zip

Areas for Improvement


The system probably won't work on MAC or Linux ( clients and servers ) without some simple changes to the file paths construction

Some code is needed to remove the resource images when a thumbnail or person record is removed

Unashamed Plug


Ewan and I would be very happy to help anyone who wants commercial support to implement this type of system ( or any other system ) via FoCul Ltd. We are based in the UK and have a particularly strong record in developing applications for the Manufacturing sector.

 Admin Tips  Dev Tips  Download  Show-n-Tell Thursday  Lotus 


Finding which documents have been deleted from a database with a script solution

Sean Cull  29 May 2008 08:16:35


Update


Notes 8.5 now has an extra column in the user activity pop up which shows deletions

I seem to have lost the comments somehow but several people recommended Ytrias (free ) tool over Notes Peek. I have tried it now and it is very good




I recently had a call from a customer to say that their application had stopped working. It turned out that a number of configuration documents had been inadvertently deleted when the user tried to archive off old documents - but which ones ?

One frustrating feature of Notes is that unless you code something special it is very difficult to find out who has deleted documents and when ( I now generally use a soft delete mechanism so that most users  cannot hard delete documents )

1) The first quick check is to look in the application properties - user activity and see if anyone has "written" a large number of documents.

Image:Finding which documents have been deleted from a database with a script solution


2) I then use a script to compare the documents in the "live" copy with the documents in a local replica or backup. This takes each document in the backup and tries to find the corresponding document in the live copy. If no matching document is found ( or just a deletion stub ) it puts that document in a folder so that I can copy it back to the live system ( note that the doc unid will change )

3) If I need to do further analysis to see when the document was deleted ( and indirectly by who using the logs ) I can now use the doc unid and NotesPeek to examine the deletion stub - I find that the search facility doesn't always work so I tend to dump it to a text pad and search there

Image:Finding which documents have been deleted from a database with a script solution



This is the LotusScript code for step 2
( also attached as an LSS )

'check for deletions on the server:

Option Public
Option Declare ' because Rocky says you must


Sub Initialize

'check for deletions on the server:
' Sean Cull, www.seancull.co.uk


' This agent compares two replicas and highlights documents that are in one
' replica but not the other. These documents are added to folders $4091_Deleted_Documents
', $missingdocuments or $zerolengthdocs for later examination

' the code is particularly usefull for finding what has been deleted from a replica

Dim ws As New notesuiworkspace
Dim session As New NotesSession
Dim thisdb As notesdatabase
Dim otherdb As notesdatabase
Dim coll As notesdocumentcollection
Dim thisdoc As notesdocument
Dim otherdoc As NotesDocument
Dim number_docs As Long
Dim var As Variant
Dim unidvar As String
Dim Error_4091_flag As Boolean

On Error Goto printerror        
On Error 4091 Goto error_4091
' error 4091 occurs when you use getdocumentbyunid on a deletion stub
' the error message is invalid universalid
' there are some support documents which also suggest that you sometimes do manage
' to get a handle on a stub so you also need to check if doc.size = 0

Set thisdb = session.CurrentDatabase
Set coll = thisdb.AllDocuments

number_docs = coll.count

Print "There are " & Cstr(number_docs) & " Documents to process"

'variant = notesUIWorkspace.Prompt( type%, title$, prompt$ [, default ] [, values ] )
'PROMPT_CHOOSEDATABASE (13)
'variant(0) = server
'variant(1) = path
'variant(2) = title

var = WS.Prompt( 13, "Choose the second database", "")

Set otherdb = Session.GetDatabase( var(0), var(1), False )
If Not otherdb.IsOpen Then
       Msgbox "Could not open the second database"
       Exit Sub
End If


Set thisdoc = coll.GetFirstDocument
Do Until thisdoc Is Nothing
       number_docs  =         number_docs  - 1
       Print         number_docs ' this slows things down but I find it useful
       unidvar = thisdoc.UniversalID
       error_4091_flag = False
       Set otherdoc = otherdb.GetDocumentByUNID(unidvar)
       If error_4091_flag Then ' a deletion stub
               Call thisdoc.putinfolder("$4091_Deleted_Documents",True)                                                
       Else
               If otherdoc Is Nothing Then
               ' a missing document as opposed to a deleted one
                       Call thisdoc.putinfolder("$Missing_Documents",True)                        
               Else
                       ' there is a document but we need to check if it is a zero length stub
                       If otherdoc.size = 0 Then Call thisdoc.putinfolder("$Zerolengthdocs",True)                        
               End If                        
       End If
       Set thisdoc = coll.GetNextDocument(thisdoc)
Loop

Exit Sub

Error_4091 :
error_4091_flag = True        
Resume Next

PrintError:

If (Err() <> 0) Then
       Messagebox( "Error" & Str(Err) & ": " & Error$)
End If

Exit Sub

End Sub

 Admin Tips  Show-n-Tell Thursday  Lotus 


Displaying all of your Image Resources in a view easily

Sean Cull  19 May 2008 09:22:43

an extension to Martin's database

Image:Displaying all of your Image Resources in a view easily










Image Resources can now ( version 6 ? ) be displayed in views. This has quite a few possibilities including showing thumbnails in the corporate directory which I will post later but for now I have posted this example which builds on an icon database by Martin Vereecken.

I have added an agent called "Create documents for Image Resources" which will cycle through the design elements and create a Notes Document for each of the image resources - this then allows them to be displayed in the view. I have also added two views for this purpose, the first is a flat view and the second a twistied view where the categorisation is based on the image resource name

The code is in the .lss file at the end and I have also added a copy of Martins database with the agent added.

 Dev Tips  Download  Show-n-Tell Thursday  Lotus