dominoGuru.com

Your Development & Design Resource

Personal Address Book + 1 Domino Agent = Read-Only WAP UI for Mobile Devices

I was contacted by Keith the other day asking me for a downloadable example from my WML-enabling a Personal Address Book - It's in the cards.... article.

Instead of going the multi-Design Element route (as the original article called for a View Design Element and a Form Design Element), I thought that I would take a second to simplify the approach and instead deliver the same functionality with a single Agent Design Element.

The Agent - named mobile - can be added to any Lotus Notes Personal Address Book Template-based NotesDatabase, have that NotesDatabase setup with an appropriately configured Access Control List, put in on a Domino HTTP-enabled Server, and simply point your mobile devices to NotesDatabase/mobile.

The Agent itself is very simple - by design - and can allow for customization via tweaking to meet the needs of the particular customer:

Sub Initialize

 Dim s As New NotesSession
 Dim db As NotesDatabase
 Dim col As NotesDocumentCollection
 Dim doc As NotesDocument
 Dim markup_options As String
 Dim markup_cards As String
 
 Set db = s.CurrentDatabase
 Set col = db.AllDocuments
 Call col.FTSearch(|[form] = "Person"|, 0)
 
 Print |Content-type: text/vnd.wap.wml|
 
 If (col.Count > 0) Then
  
  Set doc = col.GetFirstDocument
  
  Do Until (doc Is Nothing)
   markup_options = markup_options + |<option value="| + Join(doc.GetItemValue("fullname"), "") + |"><onevent type="onpick"><go href="#card_| + Cstr(doc.UniversalID) + |" /></onevent>| + Join(doc.GetItemValue("fullname"), "") + |</option>|
   markup_cards = markup_cards + |<card id="card_| + Cstr(doc.UniversalID) + |" title="Contact Info"><p><b>| + Join(doc.GetItemValue("fullname"), "") + |</b><br />| + Join(doc.GetItemValue("mailaddress"), "") + |<br />| + Join(doc.GetItemValue("officephonenumber"), "") + |</p></card>|
     Set doc = col.GetNextDocument(doc)
  Loop
  
  Print |<?xml version="1.0"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">|
  Print |<wml><card id="card1" title="| + Cstr(db.Title) + |"><p><select name="name">| + markup_options + |</select></p></card>| + markup_cards + |</wml>|
  
 Else
  
  Print |<?xml version="1.0"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">|
  Print |<wml><card id="card1" title="| + Cstr(db.Title) + |"><p><b>Unable to load Contacts</b></p><p>There appears to be an issue with this address book. Please contact support.</p></card></wml>|
  
 End If
 
End Sub

Pretty simple stuff here, which renders the following WML markup:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>

<card id="card1" title="Example WAP NAB">
<p>
<option value="Chris Toohey">
<onevent type="onpick">
<go href="#card_3CEDB7D07E5327D98525760200117ECA" />
</onevent>Chris Toohey</option>
</select>
</p>
</card>

<card id="card_3CEDB7D07E5327D98525760200117ECA" title="Contact Info">
<p>
<b>Chris Toohey</b><br />
ctoohey@dominoguru.com<br />
610.417.1700</p>
</card>

</wml>

So feel free to take the above LotusScript-based Agent Design Element code and use it to add a mobile device WAP UI to any Group Address Books and such that you might have lying around. Also, feel free to point your mobile device WAP-friendly browser to check-out the online demo that I've setup.

(Note: I wrote this in an Agent and leveraged things like FTSearch from within the mobile Agent. I do this so you can easily pinpoint what's going on and apply any required modifications.)

Now, for a killer solution: combine this with Showtime and deliver via Channel Push - for example - as many icon-laden WAP-enabled Personal Address Books that your customer teams require.

So, to review:

To implement this solution, you can simply create a new Agent Design Element named mobile, past in my code, and point any WAP-friendly mobile device to /mobile.


About the author: Chris Toohey

Thought Leadership, Web & Mobile Application Development, Solutions Integration, Technical Writing & Mentoring

A published developer and webmaster of dominoGuru.com, Chris Toohey specializes in platform application development, solutions integration, and evangelism of platform capabilities and best practices.



More from dominoGuru.com


dominoGuru.com is powered by IBM Notes Domino XPages & hosted by Prominic.NET

Contact Us

Use our Contact / Feedback form or one of these email addresses:

Creative Commons License

Except where otherwise noted, dominoGuru.com by Chris Toohey is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.