332 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Jobs | Twitter | Bookmarks | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Two critical HTTP problems in Domino 9...
Fri, Mar 29th 2013 309
Happy Pi Day present: Pi Calculator for XPages...
Thu, Mar 14th 2013 174
DOTS Deep Dive 4: I can schedule myself...
Thu, Feb 21st 2013 123
DOTS Deep Dive 3: Warning for Deadlocks
Thu, Feb 14th 2013 128
DOTS Deep Dive 2: Cancel me or I will crash your server...
Wed, Feb 13th 2013 126
DOTS Deep Dive 1: Art of Scheduling Tasklets
Mon, Feb 11th 2013 133
A rookie speaker was here...
Wed, Feb 6th 2013 137
Top 10
Authenticating Notes users for Web apps automatically...
Wed, May 11th 2011 326
A little story about an error with ID Vault...
Wed, Jan 12th 2011 320
Two critical HTTP problems in Domino 9...
Fri, Mar 29th 2013 309
Second Article is on The View: Custom Controls - Deep Dive into Parameterization
Thu, Nov 29th 2012 214
Five weeks of Yammer experience...
Fri, Jul 27th 2012 213
XPages Tip: A simple CC for prompting SSJS messages to UI...
Mon, May 2nd 2011 210
Fixed causeless server crashes: Some tips for admins
Tue, Aug 31st 2010 185
Still part of IBM Champions Program!
Wed, Dec 12th 2012 183
Happy Pi Day present: Pi Calculator for XPages...
Thu, Mar 14th 2013 174
6000 miles flight and I will speak at IBM Connect 2013...
Mon, Dec 10th 2012 170


Customizing Quickr for Domino 8.5.1 (part-2)
Serdar Basegmez    

My latest post was about Lotus Quickr for Domino customization. While designing Turkish Lotus User Group site, I have learned lot about this customization issue.

I said that it was poorly documented, whereas IBM released this handy presentation about the general concept of widget customization. I wish I had seen this before I have consumed hours to understand what's going on. Unlucky me :)

OK. I am posting my story about how I customized LUGTR Quickr site business card and footer (which I mentioned on my previous post) widgets.

About business card, don't raise your expectations, because I did not have time to do the essential part (getting additional data to the business card). I just try to explain how to place a photo on the business card and change the layout slightly. Remember, we don't have Lotus Connections Profiles. If we had, it would not be necessary to change anything, because it already provides enough customization.

First you should decide to change what. Is your change going to be available for whole Quickr implementation, or just for a customized theme. I did the business card issue for the whole site but the footer was just customized according to the custom theme...

Let's begin with the footer. Footer is a widget, named as "footer.js" placed under "qphtmlwidgetsmisc" directory (relative to "/data/domino/html" folder). You can see that widget names explains their path...

If you look at the widget script, you can see these lines in the postCreate function:

.... 
var xmldoc = this.getXmlDocFromString('<?xml version="1.0" encoding="utf-8" ?><entry></entry>');

this._xsl = (this.xslSource.length =0) ? this.getWidgetLocation() + "/footer.xsl" : this.xslSource;        

var _xslParams = new Array();
_xslParams['WIDGETID_PARAM'] = this.id;
_xslParams['TABLE_SUMMARY'] = window.q_LocaleUtils.getStringResource("FOOTER.SUMMARY");
_xslParams['IS_OFFLINE'] = window.q_BaseLoader.environment.isOffline;

var res = this.transformContent(xmldoc, this._xsl, _xslParams);
....


Don't look for functions like "this.getXmlDocFromString()" or "this.transformContent()" in this javascript file. They are inherited from "quickr.widgets._transformer" widget. What this script is doing is simple. It creates an XML DOM (empty one here), put some additional parameters and transform it to some HTML DOM object and place it inside the related div object.

<div dojoType="quickr.widgets.misc.footer"></div>


You can also see that the default XSL file (footer.xsl) is located under "htmlqphtmlwidgetsmisc" folder. It uses the default one if nothing defined under "xslSource" parameter. Here we see a problem. "xslSource" parameter is handy, because some widgets don't take any parameters from their declaration. In business card, we'll see how we will handle if it's the case.

Now, look at the XSL file. I will import some important parts here.

... 
<xsl:output method="html"  encoding="utf-8" />

<xsl:param name="WIDGETID_PARAM" select="'*DEFAULTWIDGETID*'" />
<xsl:param name="IS_OFFLINE" select="''" />
<xsl:param name="TABLE_SUMMARY" select="''" />
...
<div class="lotusFooter" id="lotusFooter">
        <table cellspacing="0" width="100%" summary="{$TABLE_SUMMARY}">
                <tr>
                        <th><div dojoType="quickr.widgets.misc.textlocalizer" key="FOOTER.LOTUSQUICKR"></div></th>
                        <th><div dojoType="quickr.widgets.misc.textlocalizer" key="BANNER.HELP"></div></th>
                        <xsl:choose>
                        <xsl:when test="$IS_OFFLINE = 'true'"></xsl:when>
                        <xsl:otherwise>
                        <th class="ConnectorSection"><div dojoType="quickr.widgets.misc.textlocalizer" key="FOOTER.CONNECTORS"></div></th>
                        </xsl:otherwise>
                        </xsl:choose>
...
<li><a href="http://lotusnotus.com/lotusnotus_en.nsf/dx/javascript:;" onclick="dijit.byId('{$WIDGETID_PARAM}').openQuickrInfoPage('0337C2FE18A2F9EB05257291006F0D04');"><div dojoType="quickr.widgets.misc.textlocalizer" key="FOOTER.ABOUT"></div></a></li>
...


The first part defines internal parameters to be used in transformation. We remember these from the js code which sets these parameters before transformation. You can see that "{$TABLE_SUMMARY}" notation provides us to use it at the HTML output. You place multilingual text with "textlocalizer" widget. The most important part, you can use selective output here. The link to download Quickr Connector plugin will not be printed if the user sees the page offline.

I copied this XSL file under my theme folder and changed as I wanted. Finally I changed widget declaration as the following:

<div dojoType="quickr.widgets.misc.footer" xslSource="/qphtml/skins/lugtheme/widgets/cFooter.xsl"></div>


I will not get into details here. It's just HTML. I changed the table to 3 column-layout and put sponsor links to the wider part (don't use styling on the XSL. The browser caches this file.) One thing you shoud be careful is to use XML notation in XSL file. Close all your tags (many designers don't close "< br >" tag, for instance)...

Let's get to the business card issue, which is a bit more complicated. This is the standard business card on QuickrD:

@@[CPEOPLE.MOREINFO]@@

Let's begin with the simple one: Changing the photo. Photo source is set automatically, by qpconfig.xml configuration. Here, I will open a discussion (which I am not the first) to question why Quickr has a different business card system than Sametime? Yep, it seems idiotic (and mysterious) that Quickr cannot take advantage of Sametime business cards. As you know, most general technique in Sametime is to store business card photos inside LDAP. I tried several alternative technique but they are not efficient.

Photos are coming from a URL request. There is a suggestion by Vincent Cailly on the wiki that designing a servlet to get photos directly from LDAP. I prefer not to do that because Java Servlet is a very resource-consuming task. I had my check-in application (thanks to Julian from YouAtNotes) which contains all avatars. I simply created an agent and modified qpconfig.xml:

... 
email = LCase(getURLParam(session.documentContext.query_string(0), "e="))
... /*** Get avatar url with some lookups ***/
if result(0)="" Then
        Print "["+default_avatar+"]"
Else
        Print "["+result(0)+"]"
End If


... 
<user_photo_source>
  <directory>
    <url>
      <![CDATA[ /registration.nsf/getavatar?OpenAgent&e={email} ]]>
    </url>
  </directory>
</user_photo_source>
...


That was the easy part :) Rough part is to modify the layout and include more details... Let's examine the business card widget (/qphtml/widgets/people/personcard.js):

... 
var xsl = this.getWidgetLocation() + "/personcard.xsl";        

// default: search for member name (in Contacts db)
this.generateXmlString = this.generateXmlString_Member;
var xmldoc = this.getXmlObject();
var xmlParams = new Array();
xmlParams['WIDGETID_PARAM'] = this.id;
xmlParams["GROUP_ROLE"] this.role;
var content = this.transformContent(xmldoc, xsl, xmlParams);

var bFound = (typeof content == "string" ? content.length > 0 : content.firstChild != null);
if (!bFound) {
        // Name not found (empty response), so force new search for name in directory.
        // We must supply the role in this case!
        this._xmlString = "";
        this.generateXmlString = this.generateXmlString_LDAP;
        xmldoc = this.getXmlObject(true);
        content = this.transformContent(xmldoc, xsl, xmlParams);
        this._xmlString = "";
}
...


There is a small trick here. In quickr, persons may be internal or external. The script first tries to get the internal member, if failed, it gets the external one.

We have two important problems in customization. The first problem is that it does not get a declarative parameter for XSL. So If we want to implement an alternative XSL to change its layout, we have two options. The first is to modify "personcard.xsl" file. You don't want to do this :) Because after each upgrade (even minor ones), you have to monitor these changes. What I did here is funny... I inherited this widget and created a new widget in my theme folder (/qphtml/skins/lugtheme/widgets/personcard.js). I also inherited the only function that calls XSL file:

dojo.provide("quickr.widgets.people.personcard"); 

dojo.provide("lugwidgets.personcard");
dojo.require("quickr.widgets.people._personcard");

dojo.declare("lugwidgets.personcard",  [quickr.widgets.people._personcard],
{
postCreate: function() {
try{

......... (the same stuff)...........

        //Customized here*****************
        var xsl = "/qphtml/skins/lugtheme/widgets/cpersoncard.xsl";        

......... (the same stuff)...........

  }catch(ee){
  }
}
})


I created the new XSL file in the custom widgets folder. In the customized XSL, I added the following part just after "Send Mail" button:

<li> 
<a href="http://lotusnotus.com/lotusnotus_en.nsf/dx/javascript:openProfile('{@ca:email}')">
  <img title="@@[CPEOPLE.MOREINFO]@@" alt="@@[CPEOPLE.MOREINFO]@@" src="http://lotusnotus.com/lotusnotus_en.nsf/dx//qphtml/skins/lugtheme/images/iconInfo16.png" />
                <span class="qkrPaddingLeft2px" dojoType="quickr.widgets.misc.textlocalizer" key="CPEOPLE.MOREINFO"></span>
</a>
</li>


Now we have to configure widget registry to replace the ordinary widget with our new widget. QuickrD has a declaration file named "/qphtml/widgets/resources/widgetRegistryConfig_ext.js". This can be used for widget additions and modifications. The documentation above explains it with great examples. My extensions are like that:

//*** Customized for LUGTheme 

{
    registerWidgets:
    [
                {
                        type: 'registerstrings',
                        id: 'lugtr',
                        path: '/qphtml/skins/lugtheme',
                        fileName: 'quickrstrings.js'
                },

                {
                        type: 'REGISTERMODULEPATH',
                        name: 'lugwidgets',
                        path: '/qphtml/skins/lugtheme/widgets'
        },
       
                {
                        type: 'globalreplace',
                        source: "quickr.widgets.people.personcard",
                        use: "lugwidgets.personcard"
                }
               
        ]
}


We also register our multinational strings at this point. Finally, here is what we get:

Image:Customizing Quickr for Domino 8.5.1 (part-2)

We mentioned about two problems. The second problem is that the xml data containing user information ("{@ca:email}") is coming from the atom engine of Quickr servlet. I could not find a way to change this. Here is the result of atom call:

<content type="application/xml"> 
        <ca:member
                ca:id="(some url)"
                ca:DN="CN=some name,O=some org"
                ca:type="user"
                ca:email="some email"
                ca:display-name="some name"
                ca:first-name="some firstname"
                ca:last-name="some surname"
                ca:phone-number="some phone"
                ca:description="some description"
                ca:role="some role - owner, reader, etc.">
        </ca:member>
</content>


What you can do is (and what I will) to extend the widget to get additional information (in JSON or XML format) from a domino agent and put this into XML object that will be transformed. When I do it, I'll blog. Meanwhile, I'd like to hear you if you have smarter solution.

What we learned...


Customizing Quickr is not a great issue for me anymore. The crucial part of customization is to be immune against version changes. Up to now, we would not lose anything we customized. Remember, extensions will be preserved during upgrades. We should only be careful if lab guys redesign the person card widget entirely, which seems more possible in major upgrades.

In addition, we keep all customized files together in the theme directory. That would help you to move your changes server to server. Only the widget extension file left out.

One last thing. Our business card customization will be valid for entire QuickrD installation. If you want to modify a widget for only specific theme, as told in wiki article, you can use selective modifications in the widget registry (in fact I didn't test it with 'globalreplace'):

{ 
        type: 'some type',
        condition: "some javascript condition",
        source: "some widget",
        use: "some widget"
}






---------------------
http://lotusnotus.com/lotusnotus_en.nsf/dx/customizing-quickr-for-domino-8.5.1-part-2.htm
Feb 23, 2011
81 hits



Recent Blog Posts
309


Two critical HTTP problems in Domino 9...
Fri, Mar 29th 2013 6:48a   Serdar Basegmez
After I upgraded my servers to Domino 9, I have found two problems affecting HTTP task. 1. Redirect TCP to SSL problem... My HTTP task stopped responding just after the upgrade. When I look into thread logs I saw that it was redirecting every requests to the same URL! After a couple of tests, I found that if you have "Redirect TCP to SSL" checked in your Internet Site document, it fails with infinite redirection problem. I posted the issue into the N/D 9.0 Social Edition forum and [read] Keywords: administration domino ibm ldd lotus notes traveler mobile profile server
174


Happy Pi Day present: Pi Calculator for XPages...
Thu, Mar 14th 2013 2:56a   Serdar Basegmez
Today is the "Pi Day"... Last week I was playing with Threads and Jobs project from OpenNTF. I needed a very long job to be run n the server-side. I have thought calculating pi digits would be a cool selection :) I found a Javascript-based Spigot algorithm by Stephen R. Schmitt and easily converted to Java (sorry about the code!). Notice that, on an average machine it calculates 10,000 digits in less than a minute. Now consider, ENIAC has calculated 2037 digits in 70 hours in 1949! [read] Keywords: xpages database development java javascript openntf server wiki
123


DOTS Deep Dive 4: I can schedule myself...
Thu, Feb 21st 2013 5:20a   Serdar Basegmez
Finally, we will be able to enable FeedMonster for CollaborationToday project. While doing final touches, I have been challenged by a question: "Can we schedule DOTS tasklets programmatically?" Actually, this is in the wish list for the next version of DOTS. But we can do some trick here. I didn't test this on Domino 9 but it should work. Here is the code: package org.openntf.news.playground.tasklets; import org.eclipse.core.runtime.CoreException; import org.eclipse.core [read] Keywords: domino ibm eclipse openntf profile xml
128


DOTS Deep Dive 3: Warning for Deadlocks
Thu, Feb 14th 2013 7:03a   Serdar Basegmez
Last time, I have blogged about the importance of the importantance of canceling tasklets... In most of the time, canceling a task is a 'choice' you have. You might want to stop the task for a reason. However, a very important problem is falling into deadlocks. If somehow your code falls into a deadlock or stuck situation, that would lock your DOTS container entirely. DOTS uses a basic mechanism for identifying scheduled tasklets that are stuck. Every tasklet starts its life with a pre [read] Keywords: ibm java openntf server
126


DOTS Deep Dive 2: Cancel me or I will crash your server...
Wed, Feb 13th 2013 3:53a   Serdar Basegmez
I just wanted to emphasize an important functionality within DOTS... One of our slides in the recent DOTS session in IBM Connect 2013, we have talked about the "monitor" argument in tasklets. It has two important uses. First of all, you might let DOTS container know about your progress. Second, it allows you to cancel your task in a less-disruptive manner. Let's dive into code here. Our tasklet is running every five seconds and wait 30 seconds each run: @RunEvery( every=5, [read] Keywords: domino ibm application java profile server
133


DOTS Deep Dive 1: Art of Scheduling Tasklets
Mon, Feb 11th 2013 4:02a   Serdar Basegmez
After a successful IBM Connect session, I started a series of posts, based on feedbacks I received from other developers. There was a little thing I didn't test before the session and this issue has been asked a couple of times: Possible conflicts between scheduled tasklets. Unfortunately, current implementation within DOTS is based on single threaded approach for tasklets. There are three different threads responsible in DOTS tasklet container for scheduled, manual and triggerred tasklet [read] Keywords: domino ibm sametime java profile




137


A rookie speaker was here...
Wed, Feb 6th 2013 7:06a   Serdar Basegmez
I was there, at IBM Connect 2013. My second Orlando visit was far more greater this time. A speaker badge combined to the IBM Champion ribbon, more experience and more fun! This year, my schedule was packed. I have planned lots of sessions and attended most of them. After last year's disappointment in BDD, I attended master classes on sunday and they were great! Two sessions were approaching development process in a different angle and they were especially exceptional. On sunday master [read] Keywords: domino ibm lotusphere notes application applications community development eclipse java openntf server skype
108


IBM Connect Session: BP207 - Meet the Java Application Server you already own...
Tue, Jan 22nd 2013 5:12a   Serdar Basegmez
Last year was my first Lotusphere. I had a great pleasure visiting labs and talking to developers from IBM. I have met to David Taieb and we were discussing about an idea (or a suggestion) about XPages. We are lacking a (distributed) back-end processing system for XPages. When you have to run a really long process in your application which could be a reporting, calculation or so forth, you don't have anything to keep users waiting with an hour glass. David sketched a diagram showing how S [read] Keywords: administration agent domino ibm lotusphere notes xpages application applications development java office openntf server
183


Still part of IBM Champions Program!
Wed, Dec 12th 2012 5:18a   Serdar Basegmez
In 2011, I have been honored to be recognized as IBM Champion for IBM Collaboration Solutions (formerly, Lotus Software). Yesterday, 2013 class has been announced by our precious community manager Joyce Davis and my title has been renewed for 2013. There are new champions on the list as well. But I am most delighted to see my dear friend, fellow founder of Turkish Lotus User Group and neighbour Ferhat Bulut (with the well-deserved nick name: bestcoder!). Ferhat is working for Akbank, o [read] Keywords: collaboration connections ibm lotus xpages blackberry community integration openntf
170


6000 miles flight and I will speak at IBM Connect 2013...
Mon, Dec 10th 2012 11:21a   Serdar Basegmez
Yes you heard right... One of two sessions I have submitted has been accepted. It will be a great excitement for me to speak at IBM Connect for the first time, and also honored to do this with my dear friend Bruce Elgort (and I might be the first speaker from Turkey... Not sure...). Meet the Java Application Server You Already Own - Domino "Java and in particular OSGi are now very important parts of the Notes/Domino app dev model. In this session you will learn about OSGi and how easy [read] Keywords: domino ibm notes xpages application applications community java server




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - Mobile Edition