An option for categorized views from the web
Okay, I'm starting a little something new tonight. Since this blog is a Domino database (thanks to BlogSphere), and since so much of my own code is built upon a foundation of ideas from other Domino developers, I've come to the conclusion that it's high time I start posting some tips of my own in this forum. I've occasionally sent one to SearchDomino, but it's becoming obvious that the real innovations are now taking place at OpenNTF and on the pages of blogs. Time will tell whether anything I produce will, in retrospect, have proven the least bit innovative, but I do feel a certain duty to at least offer an occasional seed to someone else's garden and see what they can manage to grow from it. Sadly, those of you that are here expecting one of my naive, politically charged rants will have to wait for another day... or settle for "reruns" in the archive.
I'd been planning on posting a sample database showing in action the concepts I outlined in the SearchDomino tip that spawned the most feedback, but I've decided that might be a worthwhile OpenNTF project. As it turns out, Chris Baumann has already started one for doing essentially what my tool is intended to do, although it doesn't appear to support a browser interface, and uses the older approach of creating temporary views with a modified $FormulaClass field in order to access design elements as NotesDocument instances.
Granted, by doing so it can support older versions of Notes (i.e. 4x/5x), but since IBM no longer does, at some point we as developers may need to put pressure on our employers/clients to keep current so that we can give them the utmost for their investment by using current techniques, instead of having to cripple our applications' power and our own development pace in order to allow them to support archaic binaries. To put things in perspective, 4.0 came out during my senior year. Of high school. My 10-year reunion is next spring. If companies are still using R4 - even 4.6, which, after all, is only 8 years old - let's face it, they're missing out. Those of you that have been developing in 6.5 for some or all of the last two years know what I mean. Features we used to spend hours or even weeks coding, and automation that simply wasn't possible 8 or 10 years ago, are now right-click menu options and checkboxes on a design element properties dialog box.
Anyway, enough babbling about that. I'll give more thought over the next few days as to whether I want to reanimate my DXL-based version control / code distribution tool (I abandoned it to fust unused when my boss bought TeamStudio... but a part of me has since yearned to bring it back to life). In the meantime, I thought some of you might find the following useful:
A long time ago I noticed that sections on forms / pages do not refresh the page as the twisties in categorized views do. Curious, I glanced at the page source to find that Domino auto-inserts span tags surrounding the content and a JavaScript function to show/hide the content (as well as the collapse/expand icons) when the twistie is clicked.
That gave me a whisper of an idea, and then I got distracted by something else and wandered off. But when I recently returned from my honeymoon and decided to post the pictures we'd taken online, it occurred to me that a photo album might be the perfect excuse for playing with writing my own custom web twisties.
The first step was stealing Domino's auto-generated JavaScript function and renaming it so that I could talk to it later without confusing any controlled access sections:
function _dViewCategoryExpand(sec) {
document.all["cSec"+sec].style.display = "none";
document.all["xSec"+sec].style.display = "";
}
function _dViewCategoryCollapse(sec) {
document.all["xSec"+sec].style.display = "none";
document.all["cSec"+sec].style.display = "";
}
Next, I added a span tag to the form that would contain my view:
<span ID="EmptyViewContent"></span>
Finally, I created a view to embed within the above span. The values of any standard sorting columns are irrelevant, but here's how I approached the categorized column:
strScriptSafeCategoryName := @Trim(@ReplaceSubstring(@URLEncode("Platform";ViewCategory);"'";"%92"));
"</span><br><span id=\"cSec" + strScriptSafeCategoryName + "\" style=\"position:relative; \"> <a onclick=\"return _dViewCategoryExpand('" + strScriptSafeCategoryName + "');\"><img src=\"/icons/expand.gif\" border=\"0\">" + ViewCategory + "</a></span> <span id=\"xSec" + strScriptSafeCategoryName + "\" CLASS=\"ViewCategory\" style=\"position:relative; display:none;\"> <a onclick=\"return _dViewCategoryCollapse('" + strScriptSafeCategoryName + "');\"><img src=\"/icons/collapse.gif\" border=\"0\">" + ViewCategory + "</a><br>"
If you'd like to see this in action, feel free to check out the following examples (but be patient on the thumbnails... my bandwidth's kinda wimpy at the moment):








Comments
Posted by Ben Langhinrichs At 14:22:49 On 09/12/2005 | - Website - |