About This Code
Brief Description:
Add html via template system to a notes-only DB
Category:
Design Elements, HTML, Lotusscript
Last Modified:
16 Sep 2007
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
This is a simple template system, to add webrendering to any 'notes only' database.
The DB is a small projekt to add a upload to our webpage and notes-net (put Files into notesDB, give URL to someone outside or doclink to someone inside -> we have a 15MB limit for Mail :-)), that part is in german and not yet fully tested (as is the rest of the DB) :-)
This DB has stolen code from:
* OpenLog -> Error Logging
* Michel Van der Meiren (blog.lotusnotes.be) and Jake Howlett(http://www.codestore.net) -> WebSession class and some other ideas
* Michael Woehrer (http://sw-guide.de/lotus-notes-domino/document-library/) -> with his DocLib DB I learned LotusScript and domino programming :-) and this DB still has some elements around from that DB.
Thanks a lot :-)
Any feedback, bugreports, ideas more than welcome: jasc@gmx.net
Usage / Example
Just add the following design elements:
Script libraries: jasc::TemplateSystem, jasc::Vector and OpenLogFunctions
Form: Template
View: ($LookupTemplateByName)
Agent: (wqo-launch)
Additionally, you may want the Template View (for adding and looking at the templates) and ErrorLog View and the LogEvent Form (For the error Log).
For each form you want to display in web, you need to add a field (for example "HTML") which is the *only* visible field in web. You may add a hidden field named 'TemplateName', which can compute a template name. If not present, 'Form' is used to find the template. Also you need to execute the Agent in the WebQueryOpen event.
For each template, you need to add a doc of type template. You need to fill out at least the 'basic' page and add the html template. You can specify tags, which are replace by the content of a field, by the html'ified content of a field or by the result of evaluating a @Formula (specifed in the template). Tags are then inserted in the html template surounded with '<!--$' and '$-->'. If you add a '<!--$Debug$-->' it will be replaced by a paragraph, which states how long it took to compute the WQO Agent. Also, every error (String as given by 'logError()' of OpenLogFunction will be added there.
Examples: the "FilesFolder" form only uses the simple field replace and computes all the tag values in hidden ComputedForDisplay fields on the webenabled form. The ViewTemplateDefault and NavigatorTemplate form have a computed 'TemplateName' field and use two different templates (one for authenticated users, one for rest/anonymous). The anonymous is just a plain html file ('not allowed') and the other uses two @Formula to compute the name and the FileFolder Listing.
How it works: Basicly it's just a search&replace :-) Just look into the jasc::TemplateSystem lib and the 'Template' class.
Code Attachments