Articles
PermaLink XPages - Undocumented Feature that will help you build Plug-n-Play Custom Controls05/07/2009 07:06 AM
Domino 8.5
When building Custom Controls for XPages, the ultimate goal is to make the Custom Control plug-n-play.  You want to be able to drop the custom control on any XPage and have it interact with the XPage seamlessly.

Being a Design Partner, I have been working with XPages since the pre-beta versions.  Prior to that I was Design Partner for the Lotus Component Designer.  So to come across a new feature is exciting....  

I recently wanted to make a custom control completely independent of the XPage it was on (see this custom control).  Yet I still needed to grab some values from the datasource for the XPage the control is placed on.  The issue is that the XPage datasource name is set by the developer and I could not see a way to determine the datasource name without requiring the end developer to place additional code on their XPage to support my custom control.

Looking through the Request Scope variables on the page at runtime, I found that there is a variable present on every XPage called currentDocument.  Sure enough, it was of NotesXSPDocument type and was set to the current document for the XPage.  So I could now have access to any data on the document I needed without knowing the datasource name.  

For example, if I wanted to find out what the Form name for the document opened in the XPage that my custom control was on, I could use the following code:
theForm=currentDocument.getForm();

or to get the backend NotesDocument and determine the Document unique ID:

doc=currentDocument.getDocument();
docUNID=doc.getUniversalID();


I checked with the XPages Chief Architect, Phil Riand, and this object will be supported in future releases and will be documented.  So it is safe to use this feature in your applications.

Enjoy....

-John

Technorati:
(5)

PermaLink XPages Multi Attachments Custom Control - on OpenNTF.org05/06/2009 06:10 AM
Domino 8.5
I updated my sample Multi Attachment custom control to now accept configuration parameters so it is easier to reuse the control in different applications.  The updated application can be downloaded from OpenNTF.org by clicking here.  

I decided to make the control easy to drag and drop onto any XPage after speaking with Niklas Heidloff from IBM.  He was filling me in on all the changes coming soon to OpenNTF.org and I felt it was important to contribute to the efforts that are underway.  

About the Multi Attachment Custom Control
This custom control uses a central attachment repository db for all the attachments for your application.  It allows the user to add as many attachments to a document as they want by clicking the "Add New Upload" button .  Each attachment is a separate document in the attachment repository and is linked back to the document using the document's universalID.  The custom control uses a repeat control to repeat a description and download control for each attachment.

The parameters I added allow you to specify the location and name of the repository database as well as control the various features of the file download control.  The repository contains a single view and form.  You can place that view and form into any database to create the repository.

Here's a screen shot of the custom control being used on an XPage that tracks Project information:

Image:John's Blog - XPages Multi Attachments Custom Control - on OpenNTF.org

Here's a screen shot showing the parameters:

Image:John's Blog - XPages Multi Attachments Custom Control - on OpenNTF.org

Descriptions of the available parameters
Parameter Description Type
fileUploadDbName The db name that will store the attachments.  Include the full path from the Notes data directory. string
hideIfNoAttachments Controls the visibility of the download control if there are no attachments boolean
showCreatedDate Controls the visibility of the column for Creation date boolean
showModifiedDate Controls the visibility of the column for Modified date boolean
showSize Controls the visibility of the column for Attachment size boolean
showType Controls the visibility of the column for Attachment tyope boolean



You can download the control here: http://www.openntf.org/Projects/pmt.nsf/ProjectLookup/XPages%20Multi%20Attachment%20Custom%20Control.

You can read more about how the control was built by clicking here: http://www.jmackey.net/groupwareinc/johnblog/johnblog.nsf/d6plinks/GROC-7G3GF7

Please feel free to contact me if you have any issues or questions.....

-John

Technorati:
(4)

PermaLink XPages and 8.5 Discussion Template - a Fix for the File Download Control04/28/2009 07:49 AM
Domino 8.5
Many people have been asking for my help with a problem with the 8.5 Discussion template's File Download control.  The reason is that I have an example of a Custom Control for storing file attachments in a central database which uses the File Download control and has the same issue.

The issue with the File Download control in XPages is that it does not launch Microsoft attachments properly when using Internet Explorer.  The secondary issue is that it throws an exception if your database is in a subdirectory.  You can read the details here in the 8.5 Discussion forum.  

Last week Irina Kojevnikova posted a solution to the problem.  Her solution overrides the File Download control's HREF for each attachment.  

Here is a description of the solution:

On the All Properties tab for the File Download control, there is a property fileNameHrefValue which is computable.

Image:John's Blog - XPages and 8.5 Discussion Template - a Fix for the File Download Control


The JavaScript for the value computes the url for each attachment by referencing the current row using the data->var property value rowData.  As the control loops through the attachments, we can get the name of each attachment by using rowData.getName(). Now we can use the filename to build a new url for each attachment.

Image:John's Blog - XPages and 8.5 Discussion Template - a Fix for the File Download Control


The data var property is set on the All properties tab under the data section.
Image:John's Blog - XPages and 8.5 Discussion Template - a Fix for the File Download Control

The end result is a url similar to: http://localhost/TestDiscussion.nsf/0/A8364817576EF43F852575A30043E76D/%24FILE/JohnExcel.xls

One issue I could not completely resolve was that if the user attaches files and the document has not been saved yet, the new url will not work since it is using the universalID.  Most likely the person that uploads a file will not try and launch it immediately, though they might want to delete it.  So I replaced the href with "#" if it is a new document so there will not be an error message if the user clicks on the file...it will do nothing.  If anyone has a suggestion on a different approach, please let me know.

I updated the discussion8.ntf template with the fix and you can download that here: discussion8.ntf.  You will need to sign the database with a production id for use on your server, or sign the 3 custom controls I updated: mainTopic, response, and viewTopic.  I also updated my Custom Control for storing file attachments in a central database with the fix.

Thank you to Irina for putting together a solution!  Also, a special thanks to Richard Cotrim who spent some time this weekend testing the solution.

-John
Technorati:
(2)

PermaLink XPages/Domino 8.5 - Extending the Dojo Rich Text Editor Toolbar04/06/2009 07:04 AM
Domino 8.5
A number of folks, including myself, have been looking to extend the XPages/Domino 8.5 Dojo Rich Text Editor toolbar.  The Dojo Editor toolbar usually has other features available such as the create link or insert image.  The issue in adding the additional plugins is that Domino 8.5 has it's own flavor of the Dojo Editor.

Steve Leland has just published a Wiki article describing how to extend the "ibm.domino.widget.layout.DominoRichText class" to add in some additional features to the toolbar.  

He points out that the plugins for the following are shipped with Designer and Domino Server but are not implemented:
  • formatBlock - assigns css defined formats
  • createLink - constructs an anchor tag with a user supplied URL
  • insertImage - constructs an image tag with a user supplied URL

In this article Steve show's how to extend the Editor for both XPages and the Domino classic web server.  

Here's a snippet from the article describing how to extend the toolbar for XPages:

XPages
Let's create a JavaScript class in data\domino\js\dojo-1.1.1\test\widget\layout\TestRichText.js to encapsulate the LinkDialog dependency - using the dojo.require() statement.   Here's the file contents:

/* ******************************************************************/
/*                                                                                                                      */
/* Sample Rich Text Toolbar extension                                                                      */
/*                                                                        &a mp;am p;nbs p;                                             */
/* ******************************************************************/
dojo.provide("test.widget.layout.TestRichText");

dojo.require("ibm.domino.widget.layout.DominoRichText");
dojo.require("dijit._editor.plugins.LinkDialog");
dojo.declare("test.widget.layout.TestRichText", ibm.domino.widget.layout.DominoRichText, {
    constructor: function() {
        if(dojo.isArray(this.extraPlugins)) {
            this.extraPlugins.push("|", "formatBlock", "createLink","insertImage", "|");
        } else {
            this.extraPlugins = [ "formatBlock", "createLink", "insertImage","|" ];
        }
    }//,
}
);


Save that to the TestRichText.js file.

Now we need to have the XPage which uses our rich text control instruct Dojo runtime to load our class into the browser - with a dojo.requires('test.widget.layout.TestRichText') statement.  This is done using our XPage's Properties tab, and selecting 'All Properties'.  We are interested in the 'resources' property - clicking on the plus image lets us identify our resource as a Dojo Module, and we give it our class as a value:

Image:John's Blog - XPages/Domino 8.5 - Extending the Dojo Rich Text Editor Toolbar

Then we need to put a rich text control on our XPage, exactly as if it were an ordinary rich text control, and on its Properties tab, select 'All Properties' and set the dojoType with a value of our class:
Image:John's Blog - XPages/Domino 8.5 - Extending the Dojo Rich Text Editor Toolbar

Here is the link to the full article: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/04022009010354PMWEBMZZ.htm

Nice work Steve!

-John
Technorati:
(1)

PermaLink Two New Notes and Domino 8.5 Courses for Developers and Administrators 03/16/2009 08:10 AM
Domino 8.5
The folks over at TLCC, The Learning Continuum Company,  have just released two new distance learning courses.  They are:
  • Notes and Domino 8.5 Application Development Update
  • Notes Domino 8.5 System Administration Update
In addition, there will be a full XPages course available in April.

I have had the opportunity to review the 8.5 application development update course.  It's packed with content, demonstrations, and hands on examples covering all the new features of Domino Designer on Eclipse.  This includes XPages, DOJO rich text editor, and the use of CSS and Themes, the new Java and LotusScript programming interfaces, as well as what's new in Composite Applications.

The 8.5 system administration update course covers the Domino Configuration Tuner, Domino Attachment and Object Services (DAOS), Dynamic Policies, and the new ID Vault....to name a few of the topics.

If you want to update your skills, or are looking to take your certification update exams, #951 or #956, then take a look at the the TLCC site for more details and cost info: http://www.tlcc.com/admin/tlccsite.nsf/pages/dom85courses

-John

Technorati:
(1)

PermaLink Using XPages to Integrate Between Notes Applications with Relational Databases - Wiki article03/02/2009 03:15 PM
Domino 8.5
Jo Grant and Craig Wolpert from the IBM ISV Development Enablement team, have published a new Wiki article titled Using XPages to Integrate Between Notes Applications with Relational Databases.  These guys are on a roll over there and have produced 10 great Wiki examples over the last 2 weeks.  (I believe they have secretively developed an XPage vitamin they are taking that allows them to work around the clock....but I can't prove it...)

In this example they show how you can use connectivity to a MySQL database to:

1 - Create a Repeat based view of our data
2 - Create a form to view a single record
3 - Use that form to update the data

Here's a snippet from the article:

You can easily direct XPage elements to surface data from different Notes applications. It turns out not to be much harder to surface data from different back end data sources with XPages.
The key to integrating different data technologies is by binding them together with Javascript. Almost any XPage control that surfaces data has the option to surface that data from a Javascript source. So any data repository you can get to from Javascript can be used by XPages.


Relational databases (RDB) are a very widely used technology for storing data. Many relational databases are accessible through Java Database Connectivity (JDBC). And this Java interface can be called from Javascript. This is our key to surfacing RDB data in an XPage. For our example here we will show connectivity to the MySQL relational database.


Here's a link to the article: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/xpage_integration_rdb.htm

Great article and nice work guys!

John
Technorati:
(0)

PermaLink Lead Manager XPage Sample on OpenNTF.org02/23/2009 09:10 AM
Domino 8.5
There was a new article posted today in the Lotus Domino Designer Wiki titled Lead Manager XPage Sample Overview authored by Jo Grant and Craig Wolpert.  The corresponding sample application is distributed on OpenNTF.org.

This application is a great way to learn XPages. It's an example of taking a Notes client application and providing a modern web interface by using XPages.  The application itself consists of 4 databases.

Here is a screen shot of the 4 databases in the Notes client:
Image:John's Blog - Lead Manager XPage Sample on OpenNTF.org


And here is a screen shot of the application with the new XPage design:
Image:John's Blog - Lead Manager XPage Sample on OpenNTF.org

The full link to the article: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/lead_manager_x_overview.htm

and the sample download can be found here: http://www.openntf.org/Projects/pmt.nsf/ProjectLookup/Lead%20Manager%20X

John
Technorati:
(1)

PermaLink Great series of articles published - Using existing business logic in an XPage: Java, LS, and Web Services02/20/2009 01:29 PM
Domino 8.5
There is a really interesting series of articles posted today over in the Lotus Designer Wiki.  The 4 articles were published today by Jo Grant and Craig Wolpert from IBM.

The series is titled:  Using existing business logic in an Xpage.  It discusses how you can use your existing business logic that is in Lotusscript, Java, or Web Services from within your new XPage applications.  I've heard many people ask questions and voice concerns around this topic, so I think this series will be a great help to those folks who want to go forward with XPages without having to rewrite lots of code for their applications.

The 1st article is an overview containing links to the other 3 articles.  Here's the direct link:
- http://www-10.lotus.com/ldd/ddwiki.nsf/dx/reuse_business_logic_xpage.htm

Thanks Jo and Craig for your hard work....I look forward to reading the series and working with the techniques this weekend!

John
Technorati:
(0)

Search
Hire the Experts
Need help on your XPages projects?

Talk to the experts! Read more...
XPage Examples
By Category
My Links
Downloads
Monthly Archive
Powered by
Blogsphere
Lotus Domino ND7 RSS News Feed RSS Comments Feed Geo URL netcraft RSS Validator Lotus Geek Chris. A. Brandlehner OpenNTF BlogSphere