Showtime
My Blackberry Enterprise Server Push Utility for the Lotus Notes Client, allows you to create Jobs for individual Channel, Message, and Browser Content Pushes, as well as allows you to delete Pushed Channel Icons from defined recipient devices.
Contact Information
Blogger, podcaster, writer, and geek Chris Toohey covers topics from application development to the latest must-have-gadgets.
Latest Updates
Products & Applications
Time Tracker
The idea is simple. At the start of your day - upon completion of your first task - create an entry highlighting what you did and whether you feel it was an efficient or inefficient use of your time. Based on several requests, you can also select the priority, apply categories, or even align your time against a project.
For Lotus Notes Client v8.0 and above, you can use the Time Tracker Widget to make this process even easier!
Zephyr
My Configuration-based Rich Text Mail Merge and Emailing Utility, Zephyr allows you to create rich, data-driven emails to support automated workflow - all via Microsoft Word Mail Merge-like architecture. Dear <firstname> allows you to personalize each email message not only to the individual recipient, but also to the individual application workflow event!
xCopy
xCopy is a simple configurable xCopy client for the Lotus Notes client. By creating and defining xCopy Profiles, you can batch process your file backup or remote upload jobs. With the addition of the xCopy sidebar widget, you can easily kick-off these jobs, and modify both the xCopy Profiles and xCopy itself.
Community & Resources
Lotus Technical Information & Education Community
The Lotus Technical Information & Education community is comprised of IBM, business partner, and customer subject matter experts who use product wikis, published articles, white papers, community blogs and the latest in social media to build and share high quality technical content.
OpenNTF.org - Open Source Community for Lotus Notes Domino
OpenNTF is devoted to enabling groups of individuals all over the world to collaborate on IBM Lotus Notes/Domino applications and release them as open source.
developerWorks Lotus : Wikis
Share your deployment experiences and best practices in our wikis and help IBM to create scenarios for successful deployments. Contribute to the community by collaborating on shared content and leverage the shared knowledge from that community.
NotesDocument READ and UPDATE with AJAX calls to Domino Agents (or Simple Inline View Editing over the web) - Build, Demo, and Download
09/22/2009 10:30:03 AM by Chris Toohey
Building off of my example from yesterday, I thought that I would show you how we can quickly and easily create READ and UPDATE functions for NotesDocuments via calls to our (modified) HTTP Request Consumer Domino Agents. And, to spice things up, I thought I'd do it all via AJAX.
Build Synopsis
That's the end-goal - a simple NotesData table that will allow us to change the Status of a given NotesDocument.
To get to that goal, I'll take the Agent Design Elements from yesterday - creating one for the READ and another for the UPDATE function. But first I need to ready the Page Design Element that acts as the Default Launch Object for the NotesDatabase, which will act as the display for our NotesData table.
Phase One: index.html Page Design Element
The index.html Page Design Element - just like with yesterday's example - is extremely simple by design: I want to focus your attention to the functional capabilities of having your Web Applications (Domino or non-Domino technologies-based) interacting with the HTTP Request Consumer Agents.
We'll focus on the HTML Form Element and the JavaScript functions, as the rest of the HTML markup is either descriptive/introduction or my Paypal Donation stuff.
The HTML Form Element contains the following markup:
<form action="#" name="moddocs" id="moddocs" method="GET">
<div id="viewbody"> </div>
<script>getdocs(document.getElementById("viewbody"));</script>
</form>
The JavaScript functions - there are two - are:
var http = false;
if(navigator.appName == "Microsoft Internet Explorer") {
http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
http = new XMLHttpRequest();
}
function getdocs(target) {
http.open("GET", "getdocs.agent?open", true);
http.onreadystatechange=function() {
if(http.readyState == 4) {
target.innerHTML = http.responseText;
}
}
http.send(null);
}
function moddoc(val, UNID) {
http.open("GET", "status.agent?open&status=" + val + "&UNID=" + UNID, true);
http.onreadystatechange=function() {
if(http.readyState == 4) {
getdocs(document.getElementById("viewbody"));
}
}
http.send(null);
}
getdocs() simply grabs getdocs.agent Agent Design Element-generated markup and sets the innerHTML of the passed-thru HTML Object (via an AJAX call). moddoc() passes two values to the status.agent Agent Design Element: the new value of the status NotesItem and the target NotesDocument UNID (again, via AJAX). When it's complete, it runs another AJAX call to getdocs() to refresh the NotesData table.
All I need to do from here is make sure that my NotesData table has the markup it needs that wires into the moddoc(). Pretty simple, as via the getdocs() function I have absolute control over what's returned to the Web Browser Client.
Phase Two: HTTP Request Consumer Agents
The getdocs() and moddoc() simply require a modification to their respective Initialize subroutines to both deliver and update our NotesDocuments.
getdocs.agent Agent Design Element - Initialize
status.agent Agent Design Element - Initialize
... and that's it. The getdocs.agent Agent Design Element generates the markup that we need: the onchange event of each SELECT HTML Element passes the newly-selected value and the target NotesDocument Unique ID to the moddoc() JavaScript function, which calls our status.agent Agent Design Element. This processes the request - using the submitted UNID and status parameter values to find the target NotesDocument and update said NotesDocument status NotesItem respectively.
After that, we simply "refresh" the UI via another AJAX call... and we're done.
Online Demo, Example Download, and Closing Remarks
Again, for those of you who prefer an online demo complete with downloadable example, I've got you covered.
The code written in this series is - how should I put this - not ideal. In a "best practices" scenario here, you'd want to return something like JSON, and parse that JSON return locally. This code is about as simplified and straight forward as it gets - I didn't do anything that would subtract from the goal of this article: getting you to understand just what you can do with an HTTP Request Consumer Agent Design Element.
Hopefully, this is a simple enough showcase that you'll start delving into this practice yourself - regardless of your comfort level with LotusScript, JavaScript, HTML Method calls, and AJAX. It's really powerful stuff here, and your web applications will definitely benefit from the overall approach.
Notice I said web applications - which is the second time in this article that I haven't prefixed Domino as normal. I use this approach with Flash-based Banner Ads, simple HTML Forms hosted on IIS and Apache, and countless other scenarios. It's ultimately no different than using Google Web Services or any other SaaS or Cloud service. I take that back actually - using this approach, you can quickly and near-immediately bring Lotus Notes Client-only applications onto the Web and Mobile Browser Clients: simply point the target NotesDatabase to a different NotesDatabase, Domino Server, etc. and you have yourself a very powerful NotesData proxy on your hands...






Your Javascript Ajax calling code is a bit errm... rigid, Chris.
For one thing, Microsoft's non-standard name that they use instead of XHTMLHttpRequest is slightly different in each version of IE.
And what if Microsoft broke down and actually started to properly support XHTMLHttpRequest in a future version of IE? Your code would still use their proprietary version.
Most implementations I've seen get around this by trying to create a proper XHMTLHttpRequest object. If that fails, then you assume it's IE and then try the Microsoft way. Here's one function I downloaded earlier:
And here's how you might create an object from that function and then call it:// function to create an XMLHttpClient in a cross-browser manner // Lovingly downloaded from http://e-articles.info/e/a/title/Cross-Browser-XMLHttpRequest/ function initXMLHttpClient() { var xmlhttp; try { // Mozilla / Safari / IE7 xmlhttp = new XMLHttpRequest(); } catch (e) { // IE var XMLHTTP_IDS = new Array( 'MSXML2.XMLHTTP.6.0', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP' ); var success = false; for (var i=0;i < XMLHTTP_IDS.length && !success; i++) { try { xmlhttp = new ActiveXObject(XMLHTTP_IDS[i]); success = true; } catch (e) {} } if (!success) { throw new Error('Unable to create XMLHttpRequest.'); } } return xmlhttp; }var requestObj = initXMLHttpClient(); requestObj.onreadystatechange = function() { // Do your processing of the data retrieval } // trigger the object's call requestObj.open('GET', 'http://yourserver.com/yourservice', true); requestObj.send(null)Cheers,
- Mike
Oops! That didn't really work out, did it!
Never mind; you can look at the original version at:
http://e-articles.info/e/a/title/Cross-Browser-XMLHttpRequest/
@Mike:
Thanks for the beefier AJAX code! I try to keep the examples on here as simple as possible - since many of the techniques that I talk about are confusing enough, I try to keep the script that's not the primary focus of the given article as simplified as possible.
I'm always looking for cleaner, faster, and ultimately better ways of doing things, so this JavaScript will absolutely come in handy!
You're welcome, Chris.
FYI, I'm currently working on a post for my own blog where I try to decipher class-based inheritance in JavaScript, and how it compares to Classes in LotusScript.
It's a bit tricky: JavaScript doesn't even have classes!