|
|
|
|
|
|
|
|
|
|
Dynamically generated JavaScript libraries (continued)
Writing the script library dynamically also offers other opportunities:
- You can send compressed code to the browser, with all comment lines and extraneous white space removed. This means that code can be well documented with no performance loss. This will maximize its comprehensibility to developers, and minimize it for curious surfers.
- You can manage beta cycles more easily. Beta (or alpha) code can be stored in the library, and included in libraries only when a set parameter is passed to the Web agent.
- Usage of code could be recorded, for statistical and/or billing purposes, and
- Dynamically created JavaScript can be written inside the library.
Dynamic JavaScript inside dynamic libraries can be illustrated by the classic problem of browser detection. When the Domino server is creating the library, it knows what model of browser is being used, and exactly what that browser is capable of. Hence, a dynamic scripter could generate on-the-fly functions such as those that follow, which are already adapted to the client browser. First, here's an example of code returned to a Netscape Navigator 3.01 browser:
var is_xml = false;
var is_desc = 'Netscape Navigator 3.01';
function setanybackground(obj,color)
var targetObj=getObject(obj)
targetObj.bgColor=color }
|
The next example shows code returned to an Internet Explorer 5 browser:
var is_xml = true;
var is_desc = 'Internet Explorer 5';
function setanybackground(obj,color)
var targetObj=getObject(obj)
targetObj.backgroundColor=color }
|
These functions and variables are then available, just like human-created ones, for use by other scripts or HTML events on the Web page requesting the library. They will work perfectly for that page but are of no use to other developers -- they are also as small and fast as JavaScript functions can possibly be.
Since the scripts and sites are held as Notes documents, you could enable powerful version control procedures by building around them all the approval mechanisms and workflow that is standard fare for Notes developers. Add in to that the unbeatable power of Notes replication, and you can maintain multiple Web sites easily and securely, even from a dial-up portable.
Do it today To get you started on the concept, a fully working dynamic JavaScript generation system is ready for download and use now. It's called Domino Active Script Library, it's completely free to use and copy and can be found at http://www.rhizomatics.demon.co.uk/software/.
This library implements much of the potential described above, including auto detection of browsers, dynamic JavaScript code, the Netscape standard client sniffer variables, alpha and beta testing, browser and script language dependent scripts, code compression, and script security.
Packages of functions are contained in Script documents. Site documents describe the functions required by individual Web pages. Browser documents describe which browsers can handle which level of JavaScript. It's written for R4.6 and up. There is also support for storing LotusScript in the library.
[ Prev | Next ]
|
|
|
|
|
|
-- Advertisement --
2-Minute Tutorials
How do I...
- integrate MS Office or OpenOffice with Notes?
- create cross-tab reports and charts?
- print serial letters and mailing labels?
- create PDFs in Lotus Notes?
Check out the 2-minute tutorials here. |
-- Advertisement --
How good are your Notes Reports?
Integra for Notes provides high value reporting and data analysis from Lotus Notes databases using Microsoft Word, Excel and PDF files.
- Enhance traditional static reports with Excel data analysis, pivot tables, macros
- Report from any Lotus Notes databases without changes to database design
- Runs reports through a Lotus Notes client and a web browser
- Enables Report scheduling or distribution by e-mail, printing or storing in a Notes database
- Allows use of LotusScript for advanced data manipulation
Enables self service reporting capabilities to end-users.
Click for more info. |
|
|
|
|
|
|
|
|