When I generated
my first few web pages using Oracle Designer 2.1.2. I thought that there
was not much flexibility to customize the presentation of the pages. Overtime
I found a number of techniques that provided me with the flexibility that
I required. In this article I show how to use the PL/SQL Package List preference
to give you a free hand to include any HTML and JavaScript in the modules
generated by Designer. To help the reader I also backup my words with pictures
of the results.
This was the first
challenge that I met. I needed modules to show 2 titles: the application
title and the module title.
Figure A shows an example
of the best I could get with the standard preferences values.
First, I needed an
application title on all my web pages. I achieved this by setting 2 of
the generator preferences for Web generation: standard header and standard
header on all pages. I did this using the Design Editor. Figure B illustrates
this tool.
I will use more
preferences in the continuation of this article. As preferences are organized
in a 2 level hierarchy, I made up a notation to help you locate the preferences
that I am setting. To describe what figure B illustrates I would write:
set Header and Footer à
Standard Header on all Pages = Yes; set Header and Footer à
Standard Header = htf.bold('<H1>Lab Application</H1>').
Removing the duplicate title turned out to be a little bit more tricky. There are 2 module properties that are used by Designer to construct titles: the Startup Page title and the Hyperlink Text. As I had both properties set to "Maintain Employees in Practice" I tried erasing text in the startup page title property. Well, to my astonishment, Designer kept generating duplicate titles for my Web page. So I tried erasing the Hyperlink text too. That worked: the startup title went away, but my cure had unacceptable secondary effects. The Hyperlink text is used by any link to this module, for example: menu items. Because I erased this text, the generated web page displayed the link to the users using the module name! Module names are never particularly user friendly….
So instead of removing useful text from the module properties, you need to set one of the startup page preferences: ‘Startup Page: Title Format’. The Designer online help recommends setting this preference to "." for no title to be generated. Unfortunately, the browser displays a dot that takes up a lot of vertical real estate on the web page.
In order to not display any title at all, you have to use a mechanism that solves a lot of other web problems: the PL/SQL Package List preference. You can get Designer to include any HTML or JavaScript code in the module that it generates by creating a package of functions that return varchar2. All you have to do is put the package name in the PL/SQL Package List preference and include the calls to your functions in the "right places" in the module definition. The "right places" are usually user text areas, titles, headers and footers.
So I set Text Handling
à
PL/SQL Package List = wfs_weblib, and Startup Pageà
Title Format = wfs_weblib.no_title. Wfs_weblib is my package. No_title
is a function that returns null. The code can be found in Listing A.
Figure C illustrates
the layout of the module when I generate it again. We now have an application
title -- Lab Application – and a module title – Maintain Employees in Practice.
There is a quick and easy way to get the exact presentation that you want without being an HTML expert: put the layout together in an HTML editor like Netscape. An HTML editor is an excellent environment to tune the color, sizing and positioning of the textual and graphical elements of your display.
Once this is done,
ask the editor to view the source of your page. To do this using Netscape,
select menu option Viewà
Page Source. Listing B shows an example of HTML code that I produced using
this technique:
The last trick
is to know where to put that HTML in the module definition. He it goes:
in the Design Editor, double click on the module. A dialog should appear
on the screen. The dialog title is "Edit Module <module name>". If you
do not get this dialog but see the property palette instead, select menu
option: Optionsà
Use Property Dialogs and double-click on the module again. There are five
tabs in the module dialog: Name, Titles, Files, User Text, Module Network.
Choose the User Text Tab, select text location Default Area and paste the
HTML code in the User Text field. Press the Finish button to save your
work.
Figure D illustrates
the first result I achieved when I generated my module. Not exactly what
I expected. But this is very easy to fix.
Hervé Deschamps is a Senior Principal Consultant with Oracle Corporation. He has had over five years of experience with Oracle Development Environments (Designer, Developer 2000 and their previous versions). He specialises in tending towards 100% Generation using Designer for both web and client server applications. You can reach him by e-mail at herve@iherve.com. He also maintains a web page full of articles, scripts, tips, techniques at: http://www.iherve.com.