For this example, we're going to use the following approach on the server side:
The "heavy lifting" here is in step 3 above. Fortunately, there is already an open source library, Jazzy (http://jazzy.sourceforge.net/), that can provide exactly this functionality for us. In fact, there are several libraries that will support JSON encoding as well (http://www.json.org/), so we really don't need to do a whole lot of work.
On the client side, we will do the following:
To hook all of this into TRIRIGA, we're going to use a Report Section to pull in content from the Document Manager.
Using Report Sections
Report Sections are very useful GUI components that allow you to pull in HTML-based content from Document Manager as a "template", populated with content from the current record. They are very similar to the Form Reports used in the Print Preview tab (or in the post-2.7 platform, the Reports tab). Basically, you first create an HTML document to serve as a template; you then add "replacement tokens" which TRIRIGA will populate with record data at runtime. For example:
When loaded in a Form Report (either through the Print Preview/Reports tab, or within a Report Section on a GUI), everything between the "%%" will be replaced with the corresponding field from the record. You can determine the correct field strings to use by selecting the GUI in the GUI Builder and clicking "Report Header"; after selecting the desired fields in the popup window and clicking "Export" you will be prompted to download a ".doc" file (which is actually an HTML file, not a Word Document). You can then use that as a basis for creating your HTML file, or just use the tokens within an HTML file built elsewhere.
This is itself quite useful, but more importantly we can use the Report Section to pull in arbitrary HTML content that we want to display within a GUI. This allows us to build mashups and other dynamic extensions.
Building The "Spell Checker" Section
In this example, we're going to leverage a few features of how GUIs work "under the hood":
Obviously, we don't want to have a big "Spell Checker" section on all of our GUIs, so when we add the Report Section we will stick it at the bottom of the GUI tab, uncheck the "Show Title Bar" setting, and specify a Height of 1. That's pretty much it; the HTML form is reusable, and should work with little or no modification on most GUIs.