hypertext templates

52
www.bmc.com 1 © 1999 BMC SOFTWARE, INC. Hypertext Templates Customizing Visualizer Web Publishing Output v1.0 Perry A. Stupp Sr. Software Consultant

Upload: cachez

Post on 08-Jan-2016

62 views

Category:

Documents


4 download

DESCRIPTION

Hypertext Templates. Customizing Visualizer Web Publishing Output v1.0 Perry A. Stupp Sr. Software Consultant. Introduction. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Hypertext Templates

www.bmc.com

1© 1999 BMC SOFTWARE, INC.

Hypertext TemplatesCustomizing Visualizer Web Publishing Outputv1.0

Perry A. StuppSr. Software Consultant

Page 2: Hypertext Templates

2© 2001 BMC SOFTWARE, INC.

Introduction

Through the use of Hyptertext templates PATROL For Performance Management users can customize the output of their Visualizer Web Publishing efforts. This paper will explain how this process works and detail the steps required to address the most commonly requested changes to Visualizer’s output.

Page 3: Hypertext Templates

3© 2001 BMC SOFTWARE, INC.

Outline

1) Necessary HTML Background.1) Hypertext templates and the special <Visual/> variables2) Controlling the browser through Dynamic HTML3) Using VBScript and Javascript to modify output4) Customizing the output with HTML Frames

2) Understanding the HTT Processing Flow3) Generating the Web Publishing4) Sample Output5) Common Customization Requests6) Supporting the customizations7) Conclusion

Page 4: Hypertext Templates

4© 2001 BMC SOFTWARE, INC.

Fundamental HTML

This section outlines the background information required to understand how to customize your Visualizer web publishing efforts using HTML and Javascript.

Page 5: Hypertext Templates

5© 2001 BMC SOFTWARE, INC.

What are Hyptertext Templates?

Hypertext templates provide a code skeleton from which dynamic html pages can be derived.

Through a combination of copying code directly from the templates, performing variable substitution and Macro execution, the hyptertext templates produce html pages that contain dynamic content derived directly from the pages found within the Visualizer templates you are processing.

Page 6: Hypertext Templates

6© 2001 BMC SOFTWARE, INC.

Variable Substitution / Macro Execution

Special tags embedded within the Hyptertext templates are expanded during processing to provide access to the content found within the Visualizer templates. These tags are easily identified by their Visual prefix.

<Visual/Variable> Where Variable can be any of

nGpP - Number of Graphs per Page in the template.Scan=FILE.GRAPHIC - Replace the variable with the graphic file and

place a copy of the file in the output directory.Scan=FILE.HTT - Force the processing of the hyptertext template,

replacing the entry with the name of the resulting file.

Note - Replace with the notes for the project or page.ByPage - Process the BYPAGE Template.

Page 7: Hypertext Templates

7© 2001 BMC SOFTWARE, INC.

Variable Substitution / Macro Execution

PHdr - The Page Header (Numbered by default)Pnum - The page number the graph is onPage - Process the PERPAGE TemplateDate - The date the page was generated.

(Not the date of the published data!)Subl - The Text from the Graph’s SubtitleHead - The name of the projectnPNF - Export a copy of the graph in PNF FormatnPNG - Export a copy of the graph in PNG FormatnJPE - Export a copy of the graph in JPE FormatnJPG - Export a copy of the graph in JPG FormatGraph - Process the PERGRAPH Template?Tbl - Is this graph a table? Returns Yes or No.TREF - Execute the PERTABLE Template, replacing the

entry with the name of the resulting file.

Page 8: Hypertext Templates

8© 2001 BMC SOFTWARE, INC.

Variable Substitution / Macro Execution

Cols=? - Replacing the question mark with anything else will cause the output to be displayed in columns.

XinY=7 - Sets the Width of the Graph outputXinX=5 - Sets the Height of the Graph outputGREF - Execute the PERGRAPH Template, replacing

the entry with the name of the resulting file.Titl - The Graph’s TitlePxlX - The width of the graph In PixelsPxlY - The height of the graph In PixelsPFtr - The Graph’s FooterTabl - Create the table for the values in the graph.

Page 9: Hypertext Templates

9© 2001 BMC SOFTWARE, INC.

Dynamic HTML

Dynamic HTML can be used to create HTML documents that dynamically change their content and interact with the user. By using DHTML, authors can provide special effects on a Web page without relying on server-side programs.

Although there are a wide variety of objects available within DHTML model only the two used within the existing templates are discussed.

Document object – This object allows you to alter the properties of the document that you are displaying. The document.write() method allows you to write new content to the page as it is being rendered.

Navigator object – This object allows you to discover attributes about the browser that is displaying the page. This information can be used to identify the browser’s supported capabilities and provide custom results for the various browser types.

Page 10: Hypertext Templates

10© 2001 BMC SOFTWARE, INC.

VBScript and JavaScript

A programming language is required to change the content of the Object Model. Javascript provides the most extensive language support since VBScript is only available in Microsoft’s Internet Explorer. For this reason, the current implementation uses Javascript although, if you have an all Microsoft environment, you may want to consider using VBScript instead (if it is easier or provides additional benefits / capabilities).

Page 11: Hypertext Templates

11© 2001 BMC SOFTWARE, INC.

JavaScript

Although a full discussion of Javascript is beyond the scope of this presentation, a brief overview of some of the key operatives is appropriate.

To include Javascript in a web page, the code must be enclosed within the following tags:

<SCRIPT LANGUAGE=“JavaScript”>…</SCRIPT>

Page 12: Hypertext Templates

12© 2001 BMC SOFTWARE, INC.

JavaScript

Other operatives include variable declaration and conditional logic as illustrated below.

<SCRIPT LANGUAGE=“JavaScript”>var somevariable = 10if ( condition ) { code to executed if true …} else { code to execute if false …}</SCRIPT>

Page 13: Hypertext Templates

13© 2001 BMC SOFTWARE, INC.

Frames

Visualizer’s Web Publishing takes advantage of a modern browser’s ability to display content from multiple pages at one time. By splitting the screen into multiple partitions (or frames) it creates a functional user interface that allows both navigation and analysis at the same time.

Page 14: Hypertext Templates

14© 2001 BMC SOFTWARE, INC.

Frames

<frameset cols=“300,*”> <frame name=“lefty” src=“left.htm”> <frame name=“righty” src=“right.htm”><noframes>

Frames can be used to split a page into either columns or rows. Specifying the cols attribute splits the screen horizontally as illustrated. The frame tag is used to specify the name and source of the html for the various columns on the page.

Page 15: Hypertext Templates

15© 2001 BMC SOFTWARE, INC.

Frames

<frameset rows=“300,*”> <frame name=“top” src=“top.htm”> <frame name=“bot” src=“bottom.htm”><noframes>

Frames can also split a page into rows using the rows attribute.

Page 16: Hypertext Templates

16© 2001 BMC SOFTWARE, INC.

Frames

<frameset cols=“300,*”><frameset rows=“150,*”> <frame name=“topleft”> <frame name=“bottomleft”></frameset> <frame name=“rightside”><noframes>

Frames can be nested to provide a series of columns and rows as with Visualizer’s default web publishing format.

Page 17: Hypertext Templates

17© 2001 BMC SOFTWARE, INC.

FramesSome additional details about frames.

When splitting the frameset, you can specify the value in pixels or percentages.

<frameset cols="300,*"> <frameset rows=“25%,*">

The frame tag specifies the html source for the page (as specified by the src attribute). A name attribute can be also be applied allowing it to be referenced / altered by the DHTML object model. The ability to scroll within each of the pages is enabled by default, it can be explicitly included or excluded in each frame as appropriate.

<frame name="logo" src=“topleftpage.htm” scrolling="no">') <frame name="contents" src=“bottomleftpage.htm" base target="main">')

When you click a hyperlink on a page that's displayed in one frame, the page pointed to by that hyperlink usually opens in another frame called the target frame. The special target “_self” means replace the content in the current page with the page referenced by the hyperlink.

<frame name="main" src=“rightpage.htm" base target="_self">')

Page 18: Hypertext Templates

18© 2001 BMC SOFTWARE, INC.

Processing Flow

The Web Export processing flows through several templates before producing the final Web pages. Having a Visual representation of this flow makes it easier to understand when each step occurs and the output that it produces.

Page 19: Hypertext Templates

19© 2001 BMC SOFTWARE, INC.

Template processing flow and output

project.htt project1.htt

project2.htt

bypage.htt

perpage.httbygraph.htt

projectg1.htm …projectgN.htm

project1.jp? …projectN.jp?

projectt1.htm …projecttN.htm

pergraph.htt

project.htm

project1.htmproject2.htm

pertable.htt

Page 20: Hypertext Templates

20© 2001 BMC SOFTWARE, INC.

Processing Flow – A Closer Look

When the Web Publishing process is started the first template to be called is project.htt. A closer look at the execution of this one template helps to illustrate what happens throughout the entire process.

{HEADER SUBSTITION}

{FRAME GENERATION} {PROJECT1.HTT EXECUTION} {PROJECT2.HTT EXECUTION} {BMCLOGO.HTT EXECUTION}

{NO FRAMES SECTION} {BACKGROUND} {PROJECT NOTES} {PERPAGE EXECUTION} {END OF PAGE DETAILS}

The processing of the project template can be split into three main section. - The header section is simply some HTML that initializes the page and creates a title.-The frame generation section lays down the DHTML that selects the display type (thumbnails or page selection). This section also launches the execution of the project1 and project2 templates.-The no frames section is what is displayed if your browser does not support frames, this includes the creation of the page background and any notes that have been included in the project. This section launches the PERPAGE template and ends with some content closing off the HTML page.

Page 21: Hypertext Templates

21© 2001 BMC SOFTWARE, INC.

Processing Flow – A Closer Look

Taking a look at the results helps identify what happens during the processing phase.

Project.htt - Source

<HTML><HEAD><TITLE><Visual/Head></title></head>

<SCRIPT LANGUAGE="JavaScript">var GraphCount = <Visual/nGpP>document.write('<frameset cols="300,*">')document.write('<frameset rows="150,*">')… ‘<frame name="logo" src=<Visual/Scan=BMCCOLOR.HTT>’ …if (<Visual/nGpP> > 1) … '<frame name="contents" src="<Visual/Scan=PROJECT1.HTT>" …else … '<frame name="contents" src="<Visual/Scan=PROJECT2.HTT>" …document.write('</Frameset>')

Project.htm - Output

<HTML><HEAD><TITLE>PROJECT NAME SUBSTITUTED HERE</title></head>

<SCRIPT LANGUAGE=“JavaScript”var GraphCount = 3document.write('<frameset cols="300,*">')document.write('<frameset rows="150,*">')… '<frame name="logo" src=BMCCOLOR.HTM’ …if (3 > 1) … '<frame name="contents" src="PROJECT1.HTM" …else … '<frame name="contents" src="PROJECT2.HTM" …document.write('</Frameset>')

Page 22: Hypertext Templates

22© 2001 BMC SOFTWARE, INC.

Processing Flow – A Closer Look

What is most interesting about the execution of the project template is what happens to the <Visual/Page> variable. Unlike the <Visual/Scan=PROJECTN.HTT> call which forces the execution of the PROJECT templates and the creation of separate hypertext pages, this call to the perpage template results in the output of the execution being redirected back into the project html page.

Project.htt - Source

<Visual/Page>

Project.htm - Output

<SCRIPT Language="JavaScript">if (GraphCount > 1){document.write('<CENTER><H3>Page 1</h3></center>')document.write('<CENTER><table cols=3 width="66%" align=center>')}</SCRIPT>

<td><SCRIPT LANGUAGE="JavaScript">fname='sample2g4.htm'…

This repeats for each page in the template…

Page 23: Hypertext Templates

23© 2001 BMC SOFTWARE, INC.

Generating Web Publishing

This section covers some of the steps necessary to produce the Web Publishing output available from Visualizer.

Although a discussion on how to build effective templates is probably warranted it is beyond the scope of this presentation and should be addressed in a separate paper. As such, it is assumed that the user knows how to build at least a basic template for use with this effort.

Page 24: Hypertext Templates

24© 2001 BMC SOFTWARE, INC.

Generating Web Publishing

There are two ways to generate Web Publishing from your Visualizer Templates.

Export - Writes out the Web Pages onto the local machine.

Web Publish – Writes out the Web Pages onto the local machine temporarily and then transfers them (via http or ftp) to a Web Server to be published.

Page 25: Hypertext Templates

25© 2001 BMC SOFTWARE, INC.

Accessing the Publishing options

The Web Publishing option may be grayed out if you do not have the Microsoft Web Publishing Wizard installed. You can obtain a copy of this wizard from the Microsoft Web Site at:

http://windowsupdate.microsoft.com

Page 26: Hypertext Templates

26© 2001 BMC SOFTWARE, INC.

Accessing the Publishing options

Using Automator, you can create Web Publishing through the Graphics / Costing events.

Page 27: Hypertext Templates

27© 2001 BMC SOFTWARE, INC.

Accessing the Publishing options

You can also use a keystroke file to script the processing of the export which yields additional flexibility.

Page 28: Hypertext Templates

28© 2001 BMC SOFTWARE, INC.

Specifying an alternate path for HTT’s

By default, the publishing mechanism will look to the Visualizer installation directory for the HTT files. Through the use of keystroke files, you can override this location. At the risk of a minor increase in complexity, this provides the following benefits:

1) It permits different customization for different groups of nodes.

2) It ensures that the htt files are not overwritten when an upgrade is performed.

Page 29: Hypertext Templates

29© 2001 BMC SOFTWARE, INC.

Specifying an alternate path for HTT’s

To modify the location of the HTT files using keystrokes merely add the following line to your keystroke file;

{SetREPT} “c:\some path\…”

Note: If you choose to use the default BMC Logo’s then you will need to copy these files into this alternate path.

Page 30: Hypertext Templates

30© 2001 BMC SOFTWARE, INC.

Exporting Tables

If you would like to make the underlying values within the graphs available as tabular output, simply add a note for the project with the following text:

(see table)

Page 31: Hypertext Templates

31© 2001 BMC SOFTWARE, INC.

Exporting Tables

Now when you drill down into the individual graphs you will see an option to show the table associated with the underlying values.

Page 32: Hypertext Templates

32© 2001 BMC SOFTWARE, INC.

Exporting Tables

Drilling down into the “Show Table” link reveals the underlying values for the graphs. End-users can easily cut and paste these tables into other applications like Excel if they wish.

Page 33: Hypertext Templates

33© 2001 BMC SOFTWARE, INC.

Sample output

The output for Web Publishing will vary depending on the format of your template, largely due to the number of graphs within each page.

Page 34: Hypertext Templates

34© 2001 BMC SOFTWARE, INC.

How page layout affects the output

If you create your template with more than one graph per page then the frame on the left side of web the page will contain a list of available pages.

Page 35: Hypertext Templates

35© 2001 BMC SOFTWARE, INC.

Main Web Page – Multiple Graphs / page

Page 36: Hypertext Templates

36© 2001 BMC SOFTWARE, INC.

How page layout affects the output

If you create your template with only one graph per page then the frame on the left side of the web page will contain one thumbnail per page.

Page 37: Hypertext Templates

37© 2001 BMC SOFTWARE, INC.

Main Web Page – Single Graph / page

Page 38: Hypertext Templates

38© 2001 BMC SOFTWARE, INC.

How page layout affects the output

Looking at the html for the main page (project.htm), you can see the DHTML statements that are used to select the html page for the page / graphic selection pane (bottom left panel). If there are two or more graphs per page then the project1 html will be used, otherwise, the project2 html file will be displayed.

if ( 2 > 1)document.write('<frame name="contents" src="sample1.htm" base target="main">')

elsedocument.write('<frame name="contents" src="sample2.htm" base target="main">')

Page 39: Hypertext Templates

39© 2001 BMC SOFTWARE, INC.

If your Browser does not support frames

If your Web browser doesn’t support frames, then it is unlikely that it will support DHTML which is necessary to fully render the document. If it does support DHTML then you should see something like…

Page 40: Hypertext Templates

40© 2001 BMC SOFTWARE, INC.

Common Customization Requests

This section outlines some of the most commonly requested customizations to the Web Publishing output as well as the changes to the Hypertext templates required to achieve the desired results.

Page 41: Hypertext Templates

41© 2001 BMC SOFTWARE, INC.

Common Customization Requests

I have to scroll to see the entire graph, can I change the size so that it appears in the window?

In the pergraph.htt file add the following lines:

<Visual/Cols=?><Visual/XinX=7><Visual/XinY=5><td><SCRIPT LANGUAGE="JavaScript">

This will create graphs that are 7” x 5”, change the values as per your requirements.

Page 42: Hypertext Templates

42© 2001 BMC SOFTWARE, INC.

Common Customization Requests

How do I swap out the BMC Logo for my own?

In the bmccolor.htt file replace the name of the Scan file with your own logo:

<Img Src="<Visual/Scan=BMCLOGO.GIF>">

<Img Src="<Visual/Scan=MYLOGO.GIF>">

The same can be done for the wallpaper in the bmclogo.htt file.

Make sure that your logo file is in the directory specified by the {SetREPT} option in the keystroke file (if used) or else in the Visualizer installation directory.

Page 43: Hypertext Templates

43© 2001 BMC SOFTWARE, INC.

Common Customization Requests

My site doesn’t allow frames, can I produce web pages without them?

Although the content will display in browsers that don’t support frames, some companies don’t want (or allow) the use of frames on their web sites. To remove the frames, simply remove the lines highlighted in red below from the project.htt file.

<HTML><HEAD><TITLE><Visual/Head></title></head><SCRIPT LANGUAGE="JavaScript">var GraphCount = <Visual/nGpP>document.write('<frameset cols=“300,*">')document.write('<frameset rows="150,*">')document.write('<frame name="logo" src=<Visual/Scan=BMCCOLOR.HTT> scrolling="no">')if (<Visual/nGpP> > 1) document.write('<frame name="contents" src="<Visual/Scan=PROJECT1.HTT>" base target="main">')else document.write('<frame name="contents" src="<Visual/Scan=PROJECT2.HTT>" base target="main">')document.write('</Frameset>')document.write('<frame name="main" src="<Visual/Scan=BMCLOGO.HTT>" base target="_self">')document.write('</Frameset>')document.write('<Noframe>')</SCRIPT>

Page 44: Hypertext Templates

44© 2001 BMC SOFTWARE, INC.

Common Customization RequestsI prefer the thumbnail output format but my templates have more than one

graph in each page, can I change this?If you’re committed to a particular format for your output then you can simply

remove the conditional logic that controls the format selection. From the Project.htt file, simply remove the lines highlighted in Red.

<HTML><HEAD><TITLE><Visual/Head></title></head><SCRIPT LANGUAGE="JavaScript">var GraphCount = <Visual/nGpP>document.write('<frameset cols=“300,*">')document.write('<frameset rows="150,*">')document.write('<frame name="logo" src=<Visual/Scan=BMCCOLOR.HTT> scrolling="no">')if (<Visual/nGpP> > 1) document.write('<frame name="contents" src="<Visual/Scan=PROJECT1.HTT>" base target="main">')else document.write('<frame name="contents" src="<Visual/Scan=PROJECT2.HTT>" base target="main">')document.write('</Frameset>')

- Remember, by using the {SetREPT} option in a keystroke file, you do not need to commit to this format for all templates! - By keeping the PROJECT2.HTT line instead, you can force the use of pages even if you have only one graph per page.

Page 45: Hypertext Templates

45© 2001 BMC SOFTWARE, INC.

Common Customization Requests

Can I use Server Side Javascript or VBScript?

Provided the resulting pages are executed from a Web Server that supports scripting then you can, with a little creativity, include a limited amount server side code within your Web Publishing efforts. Over the course of the next few pages, an example of this process is illustrated for use on a IIS Server. Similar approaches can be used to provide the same functionality for JSP servers or CGI based Unix Servers.

Since the web pages produced through the publishing macros do not contain a .asp (or similar scripting) extension, they can not run server side code. Only by wrapping the existing code within an asp script can we actually achieve sever side scripting.

Remember, once this approach has been used, the pages will display only through a supported web server and will not work if executed directly through a browser on the local files.

Page 46: Hypertext Templates

46© 2001 BMC SOFTWARE, INC.

Common Customization Requests

Can I use Server Side Javascript or VBScript?

First we need to modify the project.htt file to add the following code (highlighted in red);

document.write('<frameset rows="150,*">')document.write('<frame name="logo" src=<Visual/Scan=BMCCOLOR.HTT> scrolling="no">')

<!-- Force the execution of the PROJECT TEMPLATES --><!-- <Visual/Scan=PROJECT1.HTT> --><!-- <Visual/Scan=PROJECT2.HTT> -->

<!– When using this approach it is easiest to simply select the format we want rather than using the if GraphCount logic -->document.write('<frame name="contents" src="<Visual/Scan=DYNCONT.ASP>" base target="main">')document.write('</Frameset>')

Page 47: Hypertext Templates

47© 2001 BMC SOFTWARE, INC.

Common Customization Requests

Can I use Server Side Javascript or VBScript?

Next, we need to create the dynamic content file (DYNCONT.ASP). Since there is no way to select an include file dynamically (at least not with ASP) we must know the name of the project file that we want to incorporate into our reporting from the dynamic content . As such, it becomes imperative that you use the keystroke file {SetREPT} option to ensure that the templates for this project are unique (since the project html filename that we must reference will be unique). The dynamic page might look something like this:

<!-- Execute some code, for example adding a date stamp to the page --><Body><H3>It is now <%=Now()%></H3><!-- Next, import the contents of our web publishing efforts --><!-- Unfortunately, this can not be defined dynamically so we must know the name of the project and the output format (project1 or project2) --><!-- #include file=“project21.htm” -->

Page 48: Hypertext Templates

48© 2001 BMC SOFTWARE, INC.

Common Customization Requests

The results of applying the customizations discussed.

Page 49: Hypertext Templates

49© 2001 BMC SOFTWARE, INC.

Common Customization Requests

Can I use Server Side Javascript or VBScript?

Unfortunately this means that server side code can only be run before or after the published html not throughout it.

Page 50: Hypertext Templates

50© 2001 BMC SOFTWARE, INC.

Supporting your customization effortsMy web publishing has broken should I call support?

As you have seen, using Hyptertext Templates to customize your Web Publishing requires knowledge of several web based technologies. The flexibility of DHTML and Javascript provide limitless opportunities to customize your solution but also ample opportunity to introduce bugs into the publishing process.

As such, the only truly “supportable” configuration is the default Hypertext Templates that ship with the product. If you choose to modify these files, then be prepared to troubleshoot and debug them when problems arise – Support will be unable to help you with this process and should not be contacted. Enhancement requests, however, should continue to be submitted through the standard support channel.

If you find that your Web Publishing is no longer working, please revert to a saved copy of your configuration or else replace your templates with the originals from the installation directory. If after restoring the original files, your publishing still does not work then you should contact support.

Should you require additional assistance with your customization, please feel free to contact the author of this paper who will, on a best effort basis, attempt to respond as quickly as possible to your questions / comments.

Page 51: Hypertext Templates

51© 2001 BMC SOFTWARE, INC.

Conclusion

This presentation highlights some of the ways that Visualizer output can be customized using hypertext templates. With a little bit of knowledge (about HTML, DHTML and javascript) and some creativity, it isn’t hard to create web pages that better suit your existing web environment or infrastructure requirements.

This document is intended to be a living document that will be updated periodically as relevant examples or case studies warrant inclusion.

Page 52: Hypertext Templates

52© 2001 BMC SOFTWARE, INC.

Contacting the Author

Please feel free to contact me if you have any questions or comments:

[email protected]