PermaLink Lotus Component Designer - enhancing the sample discussion component03/31/2007 08:16 AM
Lotus Component Designer
I needed to enhance the sample discussion component that ships with LCD 6 to have similar features as the discussion portlet that shipped with Workplace Services Express.  Many customers are upgrading to Portal 6 from WSE and one of the widely used features was Team spaces.   Users are able to create a team space for their teams/projects and WSE would create a new composite page with instances of these portlets.  The more popular portlets are the discussion, team calendar, and document manager portlets.
 
One of the features that the users liked and we needed to add were the locking of topics and their related threads.  They were able to check off the topic from the main view and click a "Lock Topic" button.  Lotus Component Designer provides the ability to add a checkbox on a view for the purpose of deleting documents.  There is a simple action provided to perform that task from a button or link.  I needed a way to collect what records were checked off in my Lock Topic button.

I posted the question to the LCD forum and Mark Wallace created a sample component for collecting the document IDs that were checked off.  He posted that sample to the Lotus Sandbox, here's a link to it.  The functions that he uses for the viewPanel are not in the LCD help.

Here's the code I generated for the Lock Thread button:

db=database;
var viewPanel = getComponent("viewPanel1");
var dataModel = viewPanel.getDataModel();
var docIdIter = dataModel.getSelectedIds();  //provides the a collection of docIds that are checked off

while (docIdIter.hasNext()) {  //iterate through the collection
        docId = docIdIter.next();
        print("<<< docId="+docId);
        doc=db.getDocumentById(docId);  //get the document
        if (doc!=null){
                doc.setStringValue("/schemaTopic/threadLocked","Locked");  //update the threadLocked field
                doc.save();
        }
}

Here's a screen shot of the enhanced portlet:
"discussion_lock_thread.JPG"

I added the "/schemaTopic/threadLocked" as a column in the view query.  Also, when the user opens the topic I hide the edit/reply links if the topic is locked.

Another enhancement I made was to allow a copy of the same portlet to be used on multiple portal pages but to simulate that the database was unique to the instance of the portlet.  This feature simulates the use of Team Spaces or composite applications.  LCD does support this feature on composite pages, but I wanted to provide this feature on a regular portal page.

I added a parameter called "instanceID" to the component that can be set per portlet instance.  Then in each view I use a filter to only show records for that instance.  This way the discussion portlet only needs to be rolled out once and each copy shares a single database.

Here's a screen shot of the filter.  I place the InstanceID in a session variable on the beforePageLoad event just for convenience.

"Discussion_instanceID_filter.JPG"

John

Technorati:
This page has been accessed 147 times. .
Comments :v

1. Rosa Isela11/16/2007 05:17:08 PM


Hi John

I need to filter a view by ForumTitle (component parameter), in order to have 2 instances of the portlet, each one with different ForumTitle, so each portlet will show the topics created on each portlet.

I added the element "forum" to the schemaTopic, then added the a colum to the view query vqTopicsForum.

I'm trying to place the "ForumTitle" parameter in a session variable on the beforePageLoad event (on the page "viewTopicsForum")
sessionScope.put("Forum", context.getParameter("ForumTitle"));
And then filter the view with
forum = "#{sessionScope.Forum}"
just as you did with "InstanceID", but it show an empty view because the session variable "Forum" is empty ("").

Where is the problem!??

Thanks




2. Rosa Isela11/20/2007 11:23:00 AM


OK I found the problem, it was on the event beforePageLoad, intead using directly the context:
sessionScope.put("Forum", context.getParameter("ForumTitle"));
I used:
sessionScope.put("Forum", getForumTitle());

Regards




3. John Mackey11/21/2007 09:47:54 AM


Hi Rosa,

Sorry for the delay in responding. I'm glad you found the solution. I thought I'd give you enough time to solve it on your own...

Regards,
John




Search
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
Calendar
No calendar found.
The BlogRoll