wissel.net

Usability - Productivity - Business - The web - Singapore & Twins

Listing custom fields and attachments in Lotus Connections


Lotus Connections 2.x allows users to specify custom fields to be added to any item. This option is very useful together with the entry template function. Once a set of additional fields has been defined, they can be reused to capture structured information into an activity. Currently these additional fields are visible with the entry, but can't be visualized in other ways, most notably a table (It is on the list for future versions). So when a developer has an itch, it needs scratching. Connections comes with multiple entry points: the webUI, a Sametime plug-in, a Notes plug-in and a ATOM/REST API. A quick check of the ATOM XML showed, that the custom fields are in the XML and would be retrieved when loading the ATOM url. Fields are encoded as snx:field inside a feed/entry element. They come as type text, name, attachment and url. 70 lines of XSLT would transform that into a table for me. I created 2 examples: one for the list of attachments in an activity and one with a table of custom field values. The stylesheet needs to be called by something (I just downloaded the ATOM feed using wget and the command line version of DXLMagic to do that). Enjoy. As usual: YMMV.The stylesheet:
< xsl: stylesheet xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" xmlns:xs=" http://www.w3.org/2001/XMLSchema" xmlns:f=" http://www.w3.org/2005/Atom" xmlns:app=" http://www.w3.org/2007/app" xmlns:snx=" http://www.ibm.com/xmlns/prod/sn" xmlns:os=" http://a9.com/-/spec/opensearch/1.1/" xmlns:xhtml=" http://www.w3.org/1999/xhtml" xmlns:thr=" http://purl.org/syndication/thread/1.0" exclude-result-prefixes=" xs" version=" 2.0">
    
    
< xsl: template match=" /">

        
< html>
            
< head>
                
< title> Activity entries with custom fields< /title>
                
< style type=" text/css">
                    html, body, td {font-family : Verdana, Arial, sans-serif; font-size : small }
                    th, td {
                        text-align : left;
                        border-right : 1px solid gray ;
                        border-bottom : 1px solid gray ;
                    }
</ style>
            
</ head>
            
< body>
                
< table>
                    
< xsl: apply-templates select=" //f:entry[snx:field[@type='text']][1]" mode=" header" />
                    
< tbody>
                        
< xsl: apply-templates select=" //f:entry" />
                    
</ tbody>

                
</ table>
            
</ body>
        
</ html>

    
</ xsl: template>

    
< xsl: template match=" f:entry" />

    
<!--  We presume we have one text field there -->
    
< xsl: template match=" f:entry[snx:field[@type='text']]">
        
< tr>
            
< td>
                
< xsl: element name=" a">
                    
< xsl: attribute name=" href">
                        
< xsl: value-of select=" f:link[@rel='self']/@href" />
                    
</ xsl: attribute>
                
< xsl: value-of select=" f:title" />
                
</ xsl: element>
            
</ td>
            
< xsl: apply-templates select=" snx:field" />
        
</ tr>
    
</ xsl: template>
    
    
< xsl: template match=" snx:field[@type='text']">
        
< td>
            
< xsl: value-of select=" f:summary" />
        
</ td>
    
</ xsl: template>
    
    
< xsl: template match=" snx:field[@type='person']">
        
< td>
            
< xsl: value-of select=" f:name" />
            (
< xsl: value-of select=" f:email" /> )
        
</ td>
    
</ xsl: template>

    
< xsl: template match=" f:entry[snx:field[@type='file']]" mode=" header" />
    
< xsl: template match=" snx:field[@type='file']" mode=" header" />

    
< xsl: template match=" f:entry[snx:field]" mode=" header">
        
< thead>
            
< tr>
                
< th> Title</ th>
                
< xsl: apply-templates select=" snx:field" mode=" #current" />
            
</ tr>
        
</ thead>
    
</ xsl: template>

    
< xsl: template match=" snx:field" mode=" header">
        
< th>
            
< xsl: value-of select=" @name" />
        
</ th>
    
</ xsl: template>

</ xsl: stylesheet>
Download the samples.

Posted by on 22 October 2009 | Comments (0) | categories: IBM IBM - Lotus

Comments

  1. No comments yet, be the first to comment