Most recent posts
-
SnTT: using the WebBrowser control to view attachments inline
If you've ever set a form to launch the first attachment upon document open, but wished (or received requests from users) that it wouldn't open a separate application window, there's another option. Nathan and I were experimenting with this, and here's what we came up with:
In the standard perweb.nsf there is a form called "WebBrowserForm", which contains an embedded control of class "Shell.Explorer.1" with its name set simply to "Browser". When you open a URL within Notes, you're essentially creating a new document using this form that, during the PostOpen, gets a handle on the browser control ( Set browserobject=uidoc.GetObject("Browser") ), and tells it to navigate to the web page ( browserobject.navigate doc.url(0) ). Although I've been unable to find a way to create this control using the Create > Object dialog, you can copy it from the original form into your own applications and take advantage of its ease of use.
The sample database is just a basic e-book reader. Its interface is a horizontal preview - a two frame collapsible frameset, with a table of contents view in the left frame and an empty preview frame on the right side. So, just like the standard mail Inbox, when a document is selected, if the preview frame is expanded, the document is loaded in preview mode. But here's where it gets a wee bit fancy.
The form's QueryOpen extracts whatever file is attached to the user's temp directory. The PostOpen gets a handle on the WebBrowser control, but instead of telling it to navigate to a URL, it navigates to the extracted file's path, which - if the filetype is one that I.E. can load inline - launches the file... inside Notes. So if the file is a PDF, for example, Adobe launches inside the preview pane instead of opening a separate application window just for itself. And, since the browser control is set to fill the window, the external application automatically scales to the preview pane. Imagine Nathan's Sesame Street demo, but a full-fledged Adobe Reader window off to the right instead of Big Bird.
This works not only for PDF's, but for text files, Office (if installed), and of course, good old HTML files. Even Quicktime movies and MP3's... AVI's and MPG's launch Media Player in a separate window. Basically, any file that, if clicked in a web page, would be loaded within the browser instead of triggering a download prompt or launching a separate app can be "previewed" in this manner. It's basically the standard attachment viewer on steroids. NOTE: viewer, not editor. If you open a Word doc, it'll be fully editable (assuming no constraints on the original file), but any changes you save are written back to the extracted copy in the temp folder, not to the copy attached to the Notes document. You'll probably want to make this abundantly clear to your users if you implement this approach in your own applications, particularly if they're now addicted to the standard in-place attachment editing capability.Permalink - posted on 7/09/2007 1:41:07 by Tim Tripcony
-
Flex yer Domino
A few weeks ago I played with Adobe Flex for a couple hours. I soon became distracted by other things and never got around to posting about the results. But I remembered tonight that I hadn't, and figured I might as well.
Flex, in case you haven't already seen it, is a framework for building Flash RIA's. You define the application's interface and behavior in an XML file, and it generates a SWF for you. Since it's intended to be for full-fledged applications, not "movies", it's quite data-centric. And it happens to be very easy to use. The official IDE is based on Eclipse, and costs $499... can't imagine being able to justify that expense any time soon. But the good news is they have a free SDK. So you can just write the XML in your favorite text editor, run the command line script that comes with the SDK, and you're done.
In very short order, I was able to write a basic but fully functioning contact manager. This example stores its data in a Domino database. Domino's ReadViewEntries URL command returns a format that doesn't play particularly nice with Flex, so the database contains a page with an embedded view allowing a much more friendly XML format. You can download the example database and source XML here.
Permalink - posted on 7/09/2007 1:37:58 by Tim Tripcony
-
SnTT: Client-side XSLT with Google AJAXSLT
Over the weekend, I was playing with client-side XSLT in JavaScript, and stumbled upon a great library: AJAXSLT, from "the Google". It allows you to easily apply a stylesheet to XML data that doesn't already include a stylesheet reference. I pulled the library (which consists of 5 .js files) into a Domino database, and extended my recent barebones Ajax library to perform a transform on remote XML using XSL that is also remote. In other words, it Ajaxes the XML, then Ajaxes the XSL, does the transform, and returns the result as a string. This example (which currently works in Firefox and Safari, but not I.E. or Opera... they seem to bomb on the nested Ajax call) shows a transform result being inserted into an empty div (on an otherwise blank HTML page). UPDATE: I made the example page a bit more interactive to make it clearer what's happening, and in what sequence. A button now triggers the load, and the XML/XSL are displayed in textareas as they're retrieved.
Why bother? Well, because the largest gap I currently see in the DXL API is an inability to specify a stylesheet path in the output. I'm assuming this was omitted because we can just pipeline a NotesDXLExporter directly to a NotesXSLTransformer... except the transformer in LotusScript is... well, crap. No offense, IBM, but passing it even the most pedestrian of XSL instructions causes it to bomb. Additionally, if we're pulling a ReadViewEntries via Ajax, why send it back to the server for transforming? This approach allows us to pull the XSL from the server as well and then let the client do the work of transforming. In this example, both the XML and the XSL are Page elements; the XML Page uses an embedded view to load the data from the database. The XSL is static, but could reference URL parameters, etc., to provide dynamic transformation options, such as sorting of the data.
You can download the sample database here.
Permalink - posted on 7/09/2007 1:35:35 by Tim Tripcony
-
Taking it out for a spin

Yoda approves of Domino Workspace. "Like this interface, I do."Permalink - posted on 3/09/2007 20:44:35 by Tim Tripcony