Oracle Discoverer 4i Configuration Guide for Oracle9i Application Server
Release 4.1 for Windows NT

A87430-01

Library

Service

Contents

Index

Prev Next

5
Customizing Oracle Discoverer 4i Viewer

Oracle Discoverer 4i Viewer is easily customized to fit in with your Web site look and feel, to incorporate your companies logo or other artwork, or to build custom Discoverer applications for the Web.

This chapter covers the following areas:

5.1 Using Oracle Discoverer 4i Viewer for Customized Web Applications

5.1.1 Customize the general appearance

The appearance of Oracle Discoverer 4i Viewer can be customized by specifying HTML formatting attributes in a single customization file. Fonts, colors and graphics are all easily changed by anyone familiar with HTML formatting.

5.1.2 Customize the application

Oracle Discoverer 4i Viewer can be used to build complete custom Web applications or deliver data to other middle tier Web systems. It uses industry standard XML to represent data and application state, and the XSL stylesheet language to format the User Interface. Standard XSL tools can be used to customize the User Interface or to produce a complete embedded Business Intelligence application.

5.1.3 How the HTML is produced

All the HTML generated by Oracle Discoverer 4i Viewer is produced as a result of combining XML, which describes the information available, with XSL which defines how that information should be represented in HTML.

The XSL defines simple attributes, such as the fonts and colors to use, but it also defines the layout of each page, and the interactions with the user. By customizing the XSL, a specific Discoverer Application can be built and delivered on the Web.

Figure 5-1 Oracle Discoverer 4i Viewer HTML Generation using XSL/XML


5.1.4 Steps to Generate the HTML needed to build a specific Discoverer Application

5.1.4.1 Step 1 Browser sends URL

After login, let's assume a Discoverer Viewer user has asked for a list of workbooks that they are allowed to open in order to do some analysis of their business. The URL issued is:

http://myserver.mycompany.com/Discoverer4i/Viewer?us=video&db=Disco

The URL specifies the machine the servlets are installed on, and the username and database connection string to use. The password is not normally shown on the URL for security reasons.

5.1.4.2 Step 2 XML generation

The URL is processed by the Discoverer Servlet, and the Discoverer Application Server is instructed to check the security setting for this user and return details of the workbooks that this user is allowed to access. The security settings are held in the End User Layer tables in the database. After this information is returned from the server, the Servlet generates the following XML:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="example1.xsl"?>
<discoverer version="4.1.x.x" login_method="discoverer">
   <request source="http://myserver.mycompany.com/servlets/viewer">
      <command name="db">disco</command>
      <command name="us">VIDEO</command>
   </request>
   <account>
      <user>VIDEO</user>
      <database>disco</database>
      <eul default="true" name="VIDEO">
         <workbook name="Annual Sales Report" ref="Annual~20Sales~20Report">
            <description>Shows yearly and quarterly sales of products</
description>
         </workbook>
         <workbook name="Store and Band Analysis" 
ref="Store~20and~20Band~20Analysis">
            <description>Shows sales by Store, broken into sales bands</
description>
         </workbook>
         <workbook name="Video Sales Analysis" ref="Video~20Sales~20Analysis">
            <description>General purpose analysis of the Business </description>
         </workbook>
      </eul>
      <option name="qpw" enable="false">60</option>
      <option name="qrl" enable="false">10000</option>
      <option name="qtl" enable="false">1800</option>
      <option name="msa" enable="false">60</option>
      <option name="qif">250</option>
      <option name="qll">15</option>
      <option name="aq">true</option>
      <option name="nv">NULL</option>
      <option name="ftd">true</option>
      <option name="rpp">25</option>
   </account>
   <export name="xls" format="application.vnd.ms-excel">Microsoft Excel Workbook 
(*.xls)</export>
   <export name="htm" format="text.html">Hyper-Text Markup Language (*.htm)</
export>
   <export name="txt" format="text.plain">Text (Tab delimited) (*.txt)</export>
   <export name="csv" format="text.plain">CSV (Comma delimited) (*.csv)</export>
   <export name="prn" format="text.plain">Formatted Text (Space delimited) 
(*.prn)</export>
   <export name="dcs" format="text.plain">DCS (Express Format) (*.dcs)</export>
   <export name="dif" format="application.vnd.ms-excel">DIF (Data Interchange 
Format) (*.dif)</export>
   <export name="slk" format="application.vnd.ms-excel">SYLK (Symbolic Link) 
(*.slk)</export>
   <export name="wks" format="application.vnd.ms-excel">WKS (Lotus 1-2-3) 
(*.wks)</export>
</discoverer>


You can see information about three workbooks being returned - Store and Band Analysis, Video Sales Analysis and Annual Sales Report. Note there is NO information in the XML about how these workbooks names and descriptions should be displayed to the user, this is the function of the XSL file.

5.1.4.3 Step 3 Apply XSL

XSL is the industry standard stylesheet language defined by the World Wide Web Consortium. It allows a selection of elements from an XML file to be combined with an HTML template to generate HTML output for a Web Browser. The Oracle Discoverer 4i Viewer User Interface is entirely defined in XSL, which means that it can be customized or copied to define alternative User Interface styles using standard Web development tools such as HTML and XSL editors. The XSL and XML is combined in an XSL processor, and HTML is generated.

5.1.4.4 Step 4 Generate HTML

Given the XML above, the standard Oracle Discoverer 4i Viewer XSL configuration file would result in HTML being generated, which is then sent back to the browser in response to the initial URL. In Oracle Discoverer 4i Viewer, the generated HTML makes minimal demands on the browser or Internet device used. It also means that it is easy to integrate Oracle Discoverer 4i Viewer with other Web Applications or Portals.

5.2 Customization Examples

This section will help you carry out a customization of the Oracle Discoverer 4i Viewer user interface where you can either modify basic attributes such as fonts, colors and graphics or create your own look and feel with a custom user interface.

5.2.1 Files needed for customization

The files needed to carry out either a Quick or a Full customization can be found under the html/ directory shown below. These directories are created during the installation of Oracle Discoverer 4i Viewer in the root directory of the Web server.

disco4iv/  

 

 

disco4iv.jar 

 

 

html/ 

 

 

 

disco4iv.xml 

 

 

 

disco4iv.xsl 

 

 

 

errors.xsl 

 

 

 

functions.xsl 

 

 

 

gui_components.xsl 

 

 

 

page_layouts.xsl 

 

 

 

render_table.xsl 

 

 

 

 

scripts.xsl 

 

 

 

 

style.xsl 

 

 

 

viewer_config.xml 

 

 

 

 

demos/ 

Video Stores Demo 

 

 

 

help/ 

HTML help files 

 

 

 

images/ 

User inteface and help 

 

 

 

resources/ 

Message files in different languages 

5.2.2 Quick Customization

Many users want to be able to simply modify fonts and colors to fit in with their corporate standards, or to display the company logo to add branding. These global changes can be made in a single XSL stylesheet file `style.xsl'(found in the Servlet directory disco4iv/) that defines special `tags' for each style that can be modified.

You can also create a presentation template in the viewer_config.xml file to specify a set of pre-defined presentation options. These presentation options enable you to control what appears in the page header, worksheet area, and page footer. End-users can choose which presentation template to use on the Presentation Options page. A presentation template called "Corporate Look" is included in viewer_config.xml as an example.

Note that to modify style.xsl and viewer_config.xml, you must be able to access the XSL files on the server.

Many global style changes can be made by modifying style.xsl and viewer_config.xml, but the overall operation of the User Interface will remain unchanged. Another way of customizing Oracle Discoverer 4i Viewer is by using XSL, which allows a complete customized application to be made (for more information, refer to Section 5.2.3, "Full Customization").

5.2.2.1 Quick customization attributes

The style.xsl file contains the following customizable attributes:

The viewer_config.xml file enables you to specify settings for the different choices available on the Presentation Options page.

5.2.2.2 Quick customization steps

To complete a Quick customization, take the following steps:

  1. Open the style.xsl file in a text editor (the file is located in the Servlet directory \disco4iv\html).

  2. Edit text within the >angle brackets< for each variable you want to change.
    For further information, read the detailed comments inside the file itself.

  3. Save your changes to style.xsl and close the file.

  4. Open the viewer_config.xml file in a text editor (the file is located in in the Servlet directory \disco4iv\html).

  5. Copy the following section:

    		<look name="Corporate Look">
    <!-- Logo -->
    <component name="log" state="false"/> . . . <!-- "Show XML" Link -->
    <component name="xml" state="false"/>
    </look>
  6. Paste the copied section immediately before the </layout_templates> tag.

  7. Change "Corporate Look" to your preferred template name (note that the name you specify will be visible to users).

  8. Change the various component values to true or false as required.

  9. Save your changes to viewer_config.xml and close the file.

5.2.2.3 Example of editing the style.xsl file

Further comments on how to edit this file are included within the file itself.

To insert a logo

<xsl:variable name="logo_src"> </xsl:variable name>

is changed to

<xsl:variable name="logo_src"> http:www.mycompany.com/images/mylogo.gif </xsl:variable name>

To change the color of the text:

<xsl:variable name="text_color">#000000</xsl:variable>

is changed to add the appropriate color code.

5.2.3 Full Customization

This section provides information to help you create a fully customized user interface to the Oracle Discoverer 4i Viewer Servlet. Creating your own `look and feel' with a custom user interface.

It consists of the following topics:

5.2.3.1 Background

Before you start creating a custom interface to the Oracle Discoverer 4i Viewer Servlet, it is useful to understand how it works.

The following steps describe the flow of data that occurs when a request is made:

This model enables a clean separation between the application logic (handled by the Servlet) and the presentation logic (handled by the XSL files). It is therefore possible to completely change the appearance of the user interface by editing the XSL files.

Figure 5-2 illustrates the data flow in Oracle Discoverer 4i Viewer.

Figure 5-2 Oracle Discoverer 4i Viewer Data Flow


5.2.3.2 Prerequisites

To be able to create your own custom user interface for Oracle Discoverer 4i Viewer, you need the following prerequisites:

5.2.3.3 File Structure

The Servlet Configuration File specifies the name and location of the XSL file that should be applied to the XML generated by the Servlet. This XSL file imports further XSL files which together contain all the templates that are required for the presentation logic. An XML file is also used to supply additional configuration options. These files are described below.

5.2.3.3.1 disco4iv.xsl

This is the master XSL file. It performs the following functions:

5.2.3.3.2 page_layouts.xsl

This file contains the definitions for each type of page that can be displayed. Each definition consists of a series of GUI components (in the order that they should appear on the page).

The following page layouts have been defined:

5.2.3.3.3 gui_components.xsl

This file contains each of the GUI components (called by page_layouts.xsl) that are used to build a page. The following list provides a few examples of GUI components:

5.2.3.3.4 style.xsl

This file acts as a "stylesheet" by defining how certain text (such as headings) and graphics should appear. For more information, see the comments inside the file itself.

5.2.3.3.5 functions.xsl

This file contains a set of functions that perform common tasks. For example, building the href attribute when creating a hypertext link.

5.2.3.3.6 errors.xsl

This file interprets any errors, warnings or messages generated by the Discoverer Server and displays more user friendly versions.

5.2.3.3.7 scripts.xsl

This file contains JavaScript fragments for use by the JavaScript enhanced user interface. For more information, refer to Section 2.7, "Utilizing the Discoverer 4i Viewer JavaScript Enhanced User Interface").

5.2.3.3.8 render_table.xml

This file is used during the creation of tables and crosstabs. For more information, see the comments inside the file itself. Note that you will probably never need to edit this file.

5.2.3.3.9 viewer_config.xml

This file specifies:

5.2.3.4 Servlet Programming Interface

5.2.3.4.1 Receiving data from the Servlet

There are two methods that the Servlet can use to pass information to the XSL files:

5.2.3.4.2 Sending data to the Servlet

As mentioned above, the Servlet is driven by the commands it receives from the client (Web browser). These commands are sent using HTTP by calling the Servlet with parameters on the URL or by creating HTML forms that define the Servlet as the "action".

You can create your own "Presentation" commands by simply preceding it with an underscore (_) character. Any commands that begin with an underscore character are passed straight through to the XSL files as an XSL parameter. For example, specifying _filter=sales as a parameter on the URL results in the Servlet setting the XSL parameter "url_filter" to "sales". You could use this parameter to filter a list of workbooks.

5.2.3.5 Customizing Look and Feel - XML/XSL Example

XSL customization is best shown with an example. You can use the XML and XSL fragments below to experiment with customization in a Web Browser.

5.2.3.5.1 Step 1 - The XML file

The data is a standard XML file, similar to the example below:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="example1.xsl"?>
<discoverer4iv version="4.1.x.x" state="login"
url="http://myserver.mycompany.com/disco/disco4iv" login_method="disco_login"> <account nv="NULL" aq="confirm"> <user>video</user> <database>disco</database> <eul> <name>VIDEO</name> <workbook@name="Store and Band Analysis"> <description>Shows sales by Store, broken into sales bands</ description> </workbook> <workbook@name="Video Sales Analysis"> <description>General purpose analysis of the Business </ description> </workbook> <workbook@name="Annual Sales Report"> <description>Shows yearly and quarterly sales of products</ description> </workbook> </eul> </account> </discoverer4iv>

It starts by specifying the XML version. The second line specifies the XSL file to be applied to process the data, "example1.xsl" and the rest of the file is generated from the Oracle Discoverer 4i Viewer. The first two lines have been added here so you can type the text into a file using a text editor and then open it in a Web Browser to see the results visually as the XSL is changed. Save the file with the extension "xml" if you want to try this (note that this is only possible with Internet Explorer 5 or above).

5.2.3.5.2 Step 2 - The XSL file

The XSL file "example1.xsl" looks like this:

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
  <xsl:template match="/">
    <HTML>
      <BODY bgcolor="#FFFFFF" link="#663300" text="#000000">
        <b><i>Choose a Workbook :</i>	</b><P></P>
        <TABLE BORDER="2">
          <xsl:for-each select="/discoverer/account/eul/workbook">
            <TR>
              <TD width="242"><font face="Arial"><b><a href="link.htm">
                <xsl:value-of select="./@name"/></a></b></font>
              </TD>
              <TD>
                <xsl:value-of select="description"/>
              </TD>
            </TR>
          </xsl:for-each>
        </TABLE>
      </BODY>
    </HTML>
  </xsl:template>
</xsl:stylesheet>
5.2.3.5.3 Step 3 - XML+XSL = HTML

When the XML file is opened in a Web Browser (must be Internet Explorer 5 or above), it reads in the XSL stylesheet and generates HTML which looks like this:

Figure 5-3 List of workbooks using XML + XSL example


Examining the XSL file shows how the HTML is generated. Again the file starts by specifying the XML version, and the second line says that this file is a stylesheet. The HTML template starts with the <HTML> tag on line 4.

<BODY bgcolor="#FFFFFF" link="#663300" text="#000000">

This line defines the colors to be used.

<b><i>Choose a Workbook:</i></b><P></P>

This is just HTML, it sets a bold italic font and inserts the text "Choose a workbook"

<TABLE BORDER="2">

<xsl:for-each select="/discoverer/account/eul/workbook">

Now an HTML table is started, with a 2 line border. The next line is the first real XSL to appear - it means:

Go through the XML data file and for each workbook tag perform all the following steps until you reach the end tag: </xsl:for-each>

So for every workbook that appears in the XML file the following XSL is processed, and a row is inserted into the HTML table for every workbook found:


            <TR>
              <TD width="242"><font face="Arial"><b><a href="link.htm">
                <xsl:value-of select="@name"/></a></b></font>
              </TD>
              <TD>
                <xsl:value-of select="description"/>
              </TD>
            </TR>

<TR> starts a new row in the table, and <TD ... > defines the table data that is to be inserted for the first column. The width of the column is set to 242 pixels and the font is set to Arial. Next a hyperlink is defined that will go to the file "link.htm" when clicked. In fact in Discoverer 4i this link target is generated dynamically, but it is shown as a static link here for simplicity.

<b><a href="link.htm"><xsl:value-of select="@name"/></a></b></font>

This XSL line inserts the text from the XML file for the name attribute for each workbook element.

               <TD>
                <xsl:value-of select="description"/>
               </TD>

These lines define the second column in the HTML table and insert the text for the workbook description using the <description> element in the XML file. So each row in the HTML table will contain the workbook name, made into a link to click on, and the workbook description as text. Since there are three workbooks in the XML file, there will be three rows in the table.

Note that this example is not exactly how the Oracle Discoverer 4i Viewer shows the list of workbooks, it has been simplified here for clarity, but it illustrates how the XSL controls the appearance of the output. Also note that in Oracle Discoverer 4i Viewer, the XML and XSL are combined in the XSL processor on the middle tier, and not in the Web Browser.

5.2.3.5.4 Step 4 - Customize the XSL

We can modify the XSL file to appear as follows:

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
  <xsl:template match="/">
    <HTML>
      <BODY bgcolor="#FFFFFF" link="#663300" text="#000000">
        <b><i>Choose a Workbook :</i></b><P></P>
        <TABLE BORDER="0">
          <TR>
            <TD width="500" height="100" background="../../images/
disco_banner.gif">
              <font face="Arial"><b>Performance Reports</b></font>
            </TD>
          </TR>
        </TABLE>
        <TABLE border="0">              
          <xsl:for-each select="/discoverer/account/eul/workbook">
            <TR>
              <TD width="242">
                <a href="link.htm">
                  <img src="../../images/start1.gif">
                    <xsl:attribute name="alt">
                      <xsl:value-of select="description"/>
                    </xsl:attribute>
                  </img>
                </a>
              </TD>
              <TD>
                <font face="Arial">
                  <xsl:value-of select="@name"/>
                </font>
              </TD>
              <TD>
                <xsl:value-of select="description"/>
              </TD>
            </TR>
          </xsl:for-each>
        </TABLE>
      </BODY>
    </HTML>
  </xsl:template>
</xsl:stylesheet>

When this file is combined with the same XML, it appears as:

Figure 5-4 List of workbooks using the same XML with a modified XSL stylesheet:


Now the appearance of the User Interface is completely different, as it takes on a more graphical look and feel. Instead of text links there are graphical buttons for running the reports, each with a dynamic `tool tip' that pops up when you position the mouse over the button.

The XSL file is now different:


<TABLE BORDER="0">
          <TR>
            <TD width="500" height="100" background="../../images/
disco_banner.gif">
              <font face="Arial"><b>Performance Reports</b></font>
            </TD>
          </TR>
        </TABLE>

These lines create a table and insert a graphic and the heading "Performance Reports"

<TABLE BORDER="0">
          <xsl:for-each select="/discoverer/account/eul/workbook">
                <TR>

This starts the main table that the workbook names will be displayed in, as before, but now there is no border around the table and the rows are defined differently:


              <TD width="242">
                <a href="link.htm">
                  <img src="../../images/start1.gif">
                    <xsl:attribute name="alt">
                      <xsl:value-of select="description"/>
                    </xsl:attribute>
                  </img>
                </a>
              </TD>

The first table data column is defined as a hyperlink again, but this time with the image "start1.gif" as an image, rather than a text link. To get a "tooltip" to appear over an image the HTML "ALT" attribute is used.

Normally the ALT attribute is used with a simple text string:

<img src="start1.gif" alt="Tooltip text to appear when a mouse is over the 
image">

but since we want the tool tip to be dynamic we generate the ALT tag by getting the text from the <description> element in the XML file. The <xsl:attribute> tag is used to do this.

Finally:


             <TD>
               <font face="Arial">
               <xsl:value-of select="@name"/></font>
             </TD>

The second column in the table simply selects the name of the workbook to display, by using XSL to get it from the XML file as before.

5.2.4 Video Stores Demo - an example of an alternative user interface

The Video Stores demo is installed with Oracle Discoverer 4i Viewer and can be viewed following completion of a number of setup steps.

Once Oracle Discoverer 4i Viewer has been fully installed, you can configure your Web server to run the Video Stores demo.

The Video Stores demo illustrates how the Oracle Discoverer 4i Viewer user interface could be customized for an imaginary Video Store chain. You will be able to see the details which lie behind the user interface.

5.2.4.1 What is installed

During installation, the Video Stores demo directory demos\video, its sub directories and files are created. The demos\video directory is installed under the <iSUITES_HOME>\apache\apache\htdocs\disco4iv\html directory.

In the Video Stores demo directory demos\video the following files are installed:

The demos\video\images directory contains all the images used in the Video Stores user interface. This is where you would place any new images the user interface needs to use.

5.2.4.2 Set up steps

You need to carry out the following steps:

5.2.4.3 Set up Web Server

The Web server needs to be configured with the `Zone' name. You need to set up a new zone for the Video Stores Demo to specify the location of the \demos\video\disco4iv.xml (Video Stores Demo configuration file)

5.2.4.4 Run the Video Stores demo

Open a Web browser and enter the following URL:

The Video Stores demo will be displayed:

5.2.4.5 Modify the video.xsl file

The video.xsl file located in the <iSUITES_HOME>\apache\apache\htdocs\disco4iv\html\demos\video directory specifies the `look and feel' for the Video Stores Customization of Oracle Discoverer 4i Viewer.

For example, you can edit the video.xsl file to replace any of the images displayed, including the background. You can also specify the workbooks you want to display in the Demo.

The ability to alter almost everything displayed by editing the video.xsl file illustrates how you can create not only a look and feel for your organization, but also define unique views of your data.

5.2.5 Other customization examples

5.2.5.1 Logging on automatically

You can modify the page_layouts.xsl file to enable Discoverer Viewer users to log on automatically (i.e. bypassing the login screen) without exposing the password as a URL argument. Note that users must have a JavaScript-enabled browser for this mechanism to work.

5.2.5.1.1 Step 1: Add a new template to page_layouts.xsl

Add the following lines to the page_layouts.xsl file:

<xsl:template name="layout_auto_login"> 
<html>
<head><title>Auto Login</title></head>
<body>
<form method="post" name="autoLogin" action="{/discoverer/request/ @source}">
<!-- Specify the User Name in the value field below -->
<input type="hidden" name="us" value="username"/>
<!-- Specify the Password in the value field below -->
<input type="hidden" name="pw" value="password"/>
<!-- Specify the Database in the value field below -->
<input type="hidden" name="db" value="database"/>
<!-- Specify the Language Code in the value field below (en is English) -->
<input type="hidden" name="nlsl" value="en"/>
<!-- To show a list of Database Workbooks, leave the following two value fields set to "dwb" otherwise, set them to "swb" for Scheduled Workbooks. -->
<input type="hidden" name="in" value="dwb"/>
<input type="hidden" name="_in" value="dwb"/>
<!-- The following line requests the user is logged in using the default method (as set in viewer_config.xml) -->
<input type="hidden" name="lc" value="false"/>
</form>
<script language="JavaScript">
document.autoLogin.submit();
</script>
</body>
</html>
</xsl:template>
5.2.5.1.2 Step 2: Include username, password and database

Modify the layout_auto_login template to include the username, password and database information as indicated in the comments.

5.2.5.1.3 Step 3: Modify disco4iv.xsl

Search for the following text in disco4iv.xsl:

<xsl:call-template name="layout_connected"/>

Replace the above text with the following text:

<xsl:call-template name="layout_auto_login"/>

5.2.6 Customization Summary

XML and XSL provides a powerful customization environment for Oracle Discoverer 4i Viewer. Simple global formatting changes are made to a single style sheet file, while more sophisticated custom applications can be made by using completely alternative XSL processing. In this way Oracle Discoverer 4i Viewer provides the way to integrate Business Intelligence directly into other Web applications.


Prev Next
Oracle
Copyright © 2000 Oracle Corporation.

All Rights Reserved.

Library

Service

Contents

Index